Servlet throws IOException when browser is "stopped"
Hello,
I have a servlet running on the Sun ONE Web server 6.1 that throws this error message: "java.io.IOException: WEB8004: Error flushing the output stream".
Through my testing, it seems as if this is caused by the user pressing the stop button before the output can be completely commited to the client. Strangely enough the error seems to thrown when IE is the browser but not when Firefox is. My guess is that what is happening is the client connection is closed when stop is pressed in IE and the server cannot write to the client anymore so the error is thrown.
I was wondering if anyone has any insight into how to prevent this from getting thrown. I realize that this error is not a major thing and probably doesn't need to be worried about, but it is quite annoying because webmaster gets emailed anytime an exception is thrown so cutting down on pointless exceptions is something we like to do :)
Thanks in advance.
You could also try hitting the browser's refresh button many times as quickly as possible; it should also give similar errors. Or keep Control-R (reload) pressed down and let the keyboard's auto-repeat do its work.
When the browser is in the process of fetching a page and decides it isn't interested in the page after all, it closes the TCP/IP connection to the server. The server will get an IOException. Nothing you can do about that. Write a catch block that ignores IOException when flushing a web page. Or maybe log "error sending page, the user probably hit the reload button", without the stack trace, into an audit log.
Similar Messages
-
DOMparser throws IOException when encounters Hungarian Characters
Hoi!
I wrote a piece of code that extracts some
information from an XML document into a vector of Java classes, using the oracle.xml.parser.v2.DOMParser.
And it worked. Or seemed to work...
But when I put some articles in the XML file
in Hungarian, the parser threw IOException.
If I remplace the Hungarian characters to
English "equivalents" a -> a etc., it works.
I don't know. If XML is made up of Unicode characters, what's the problem with it?
(The hex code of a was E1 in my text editor,
as I'm using Win NT :(. )
can I modify the xml prolog somehow?
I'd rather not write a conversion program
from a text file to another.
Any ideas?
and here's the code:
DOMParser theParser = new DOMParser();
XMLStreamToParse = XMLes.class.getResourceAsStream(xmlDocPath);
theParser.setValidationMode(false);
try{
theParser.parse( XMLStreamToParse );
//this throws IOException
nullWhat are you using as your test client?The test client is WebStone 1.0. WebStone always downloads the whole response, and reports the size of the response in bytes. From this I can see that when the IO exception occurs, webstone is unable to read the whole response, as it reports a smaller size.
So, I do not think the problem is that the client has prematurely aborted its download. WebStone doesn't work that way. I think something has gone awry on the server side, and this worries me. -
Socket I/P stream's read fails to throw IOException when connection is lost
Hi,
Socket.getInputStream().readShort() blocks till it reads from the server. It throws an IOException if the connection is lost before calling the method. But it is not throwing an IOException if the connection is lost after blocking.
That is....
// If the connection is lost before calling, it is throwing an IOException.
short s = mySocket.getInputStream().readShort();
// But, while it is blocked and if I shutdown the server, it's never throwing
// an IOException and it stays blocked.How should I get around this problem?
Thank you!It's true; a timeout is really the best way.
One approach I thought about using, where I was in control of the protocol, was to periodically send a "nop" type operation to the socket; a message that doesn't do anything. Obviously not all applications have this liberty, either because you aren't in control of the protocol, or because you want to keep your application single threaded. It's also kind of hackish, and not as good as the timeout mechanism in most respects.
You also have to be a little careful about what you define as a "connection failure". If, for example, you set up a TCP/IP socket without a timeout, and then physically disconnect the ethernet cable, the connection will in fact stay up. If you come back an hour later and plug in the cable again, the connection will still be there and will pass traffic again. -
IOException when sendRedirect() in servlet
I write 2 servlets when I try to sendRedirect() to call from one servlet to the second servlet it work but make HANDLER THREAD PROBLEM:
java.io.IOException:socket Closed
I will thank any one for help my.
talDon't forget that the sendRedirect() method doesn't call an URL from a servlet but ask the browser (client) to call this URL.
It is equals to get the HTTP 302 (found) return with a location that has value of your URL.
So do u have your exception in the first or the second servlet ?
If the exception is raised in the first servlet, please show us the code of this servlet
Jean -
my problem is my iphone 4s is connected to wi-fi with full signal(3 bars) strength but freezes when browsing and says
"Cannot Open Page"
"Safari could not open page because the server stopped responding"
I already reset the iphone to its factory settings and erase all contents but still the browsing speed freezes or not searching at all. Sometimes it will work and fast but then the problem uccors every now and then. Iv'e been using iphone 4 for two years and I still have it and works fine compared to this IPHONE 4S.Settings → scroll down to Safari → in Safari settings, I selected both Clear History and Clear Cookies and Data.
IF that does not work -
Restart or reset your iPhone, iPad, or iPod touch - Apple Support
Finally - if problem still present -
Go to Settings>General>Reset
Reset the network settings - you will need to add the password of your home WiFi in your phone once more
The device should turn itself off & back on then go into Settings>Wifi and join your network -
How do I stop receiving Mail alerts on the iPad?
e.g. When browsing in Safari I will be interrupted by a 'ping' sound and a Mail alert box every time a new email comes in to my Inbox. This is irritating. How do I stop this? To see if I have new Mail I just prefer to go to Mail and my Inbox at convenient intervals.
Thank you.The same way you'd change any notifications: Settings>Notifications>Mail. Change it to "Banner" or "None".
-
When I start play memories (4.0.01) "Browser has stopped working" appears in a popup overlaying the
PlayMemories Home. Popup also requests you close the program, making this version of PlayMemories
unuseable! Prior versions worked. I am running a current version of Windows 7 ultimate.Hi jkrad4130,
The My Pictures folder is the defautl folder where the software gets all the files from so you can view and edit them. If you want to add other folders containing your media files from earlier imports, just click on File, Add folders and select the folder you want the software to manage. I would also suggest backing up your files to another device, if you have any.
If my post answers your question, please mark it as "Accept as Solution". Thanks_Mitch -
Screen Goes Black and Hangs when browsing by Artist, Album, Song, etc.
I'm having a fairly huge issue with Front Row:
I can play video files (although their is a moment of hangtime between selecting a video and the video actually playing) and music files (if I choose the "Shuffle Songs" option), however, when I choose to browse my music by artists, albums, songs, genres, etc. my screen goes black and stays that way until I hit CMD+Q over and over until it finally quits. Furthermore, when I do play music via "Shuffle Songs" and quit out of Front Row, the music continues to play in the background and cannot be stopped, paused, etc.
Is there anyone out there who can help me fix this? I love Front Row and use it all the time and it would be a shame not to be able to anymore..
Thanks in advance,
CoreyI have a similar problem. When browsing music the screen goes to black or just freezes on whatever was beeing displayed for maybe 30 seconds to a minute before continuing. It happens quite often. I am running the latest version of Front Row on a brand new Mac Mini. I have a very large iTunes music folder (about 830 gigabytes of uncompressed AIFF files) running on an external FW800 drive. I tried repairing permissions and a number of Front Row and a few iTunes files appear in the list. However, when I run repair permissions again, the same files are still listed so obviously if they need to be repaired, it's not happening. I tried repairing the volume (no problems found) and repairing permissions from the Install disc but the result was identical.
-
On Windows 7 HttpURLConnection.openConnection() throws IOException
Hi Team,
In our application we have a to create httpURLCOnnection (url.openConnection())which works fine on Windows XP but throws IOException on Windows7. Does anybody know which settings need to be enabled on windows 7 to resolve this issue?
Any response would be appreciated. Thanks in Advance.Hello Team,
I have a specific exception which I get when trying to open a url on Windows 7 with IIS authentication enabled. We get exception when trying to get response code of HTTP Connection
java.io.IOException: Authentication failure
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
Same code works find on windows XP. Do I need to do any specific settings on Windows7 to work this?
Thanks in Advance. -
Launching Browser from Java when Browser URL is very long
Hi,
I am trying to launch a browser from Java.
I am doing the following.
String command = "cmd" + "/c" + "start" + " browserURL";
Process p = Runtime.getRuntime()exec(command);
Note: My browserURL is very long.
Now the browser is invoked. But the URL shown is incomplete and hence
browser is unable to open the required application.
Can someone help me in this.
One way is to increase the buffer size on the command prompt?
Is there any java command for this?
Is there any other way to solve this issue.
Thanks,
ARthis is my second time posting this, take note of it. I can't remember where i got it from, but credits go to the person that wrote it. It has helped me out thousands of times!!!
to use, compile, then call from your program:
org.newio.utils.BrowserLauncher.openURL("your url here")dfwtc
package org.newio.utils;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.*;
public class BrowserLauncher
private static int jvm;
private static Object browser;
private static boolean loadedWithoutErrors;
private static Class mrjFileUtilsClass;
private static Class mrjOSTypeClass;
private static Class macOSErrorClass;
private static Class aeDescClass;
private static Constructor aeTargetConstructor;
private static Constructor appleEventConstructor;
private static Constructor aeDescConstructor;
private static Method findFolder;
private static Method getFileType;
private static Method makeOSType;
private static Method putParameter;
private static Method sendNoReply;
private static Object kSystemFolderType;
private static Integer keyDirectObject;
private static Integer kAutoGenerateReturnID;
private static Integer kAnyTransactionID;
private static final int MRJ_2_0 = 0;
private static final int MRJ_2_1 = 1;
private static final int WINDOWS_NT = 2;
private static final int WINDOWS_9x = 3;
private static final int OTHER = -1;
private static final String FINDER_TYPE = "FNDR";
private static final String FINDER_CREATOR = "MACS";
private static final String GURL_EVENT = "GURL";
private static final String FIRST_WINDOWS_PARAMETER = "/c";
private static final String SECOND_WINDOWS_PARAMETER = "start";
private static final String NETSCAPE_OPEN_PARAMETER_START = " -remote 'openURL(";
private static final String NETSCAPE_OPEN_PARAMETER_END = ")'";
private static String errorMessage;
private BrowserLauncher()
private static boolean loadClasses()
switch(jvm)
default:
break;
case 0: // '\0'
try
Class aeTargetClass = Class.forName("com.apple.MacOS.AETarget");
macOSErrorClass = Class.forName("com.apple.MacOS.MacOSError");
Class osUtilsClass = Class.forName("com.apple.MacOS.OSUtils");
Class appleEventClass = Class.forName("com.apple.MacOS.AppleEvent");
Class aeClass = Class.forName("com.apple.MacOS.ae");
aeDescClass = Class.forName("com.apple.MacOS.AEDesc");
aeTargetConstructor = aeTargetClass.getDeclaredConstructor(new Class[] {
Integer.TYPE
appleEventConstructor = appleEventClass.getDeclaredConstructor(new Class[] {
Integer.TYPE, Integer.TYPE, aeTargetClass, Integer.TYPE, Integer.TYPE
aeDescConstructor = aeDescClass.getDeclaredConstructor(new Class[] {
java.lang.String.class
makeOSType = osUtilsClass.getDeclaredMethod("makeOSType", new Class[] {
java.lang.String.class
putParameter = appleEventClass.getDeclaredMethod("putParameter", new Class[] {
Integer.TYPE, aeDescClass
sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply", new Class[0]);
Field keyDirectObjectField = aeClass.getDeclaredField("keyDirectObject");
keyDirectObject = (Integer)keyDirectObjectField.get(null);
Field autoGenerateReturnIDField = appleEventClass.getDeclaredField("kAutoGenerateReturnID");
kAutoGenerateReturnID = (Integer)autoGenerateReturnIDField.get(null);
Field anyTransactionIDField = appleEventClass.getDeclaredField("kAnyTransactionID");
kAnyTransactionID = (Integer)anyTransactionIDField.get(null);
break;
catch(ClassNotFoundException cnfe)
errorMessage = cnfe.getMessage();
return false;
catch(NoSuchMethodException nsme)
errorMessage = nsme.getMessage();
return false;
catch(NoSuchFieldException nsfe)
errorMessage = nsfe.getMessage();
return false;
catch(IllegalAccessException iae)
errorMessage = iae.getMessage();
return false;
case 1: // '\001'
try
mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");
mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType");
Field systemFolderField = mrjFileUtilsClass.getDeclaredField("kSystemFolderType");
kSystemFolderType = systemFolderField.get(null);
findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder", new Class[] {
mrjOSTypeClass
getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType", new Class[] {
java.io.File.class
break;
catch(ClassNotFoundException cnfe)
errorMessage = cnfe.getMessage();
return false;
catch(NoSuchFieldException nsfe)
errorMessage = nsfe.getMessage();
return false;
catch(NoSuchMethodException nsme)
errorMessage = nsme.getMessage();
return false;
catch(SecurityException se)
errorMessage = se.getMessage();
return false;
catch(IllegalAccessException iae)
errorMessage = iae.getMessage();
return false;
return true;
private static Object locateBrowser()
if(browser != null)
return browser;
switch(jvm)
case 0: // '\0'
try
Integer finderCreatorCode = (Integer)makeOSType.invoke(null, new Object[] {
"MACS"
Object aeTarget = aeTargetConstructor.newInstance(new Object[] {
finderCreatorCode
Integer gurlType = (Integer)makeOSType.invoke(null, new Object[] {
"GURL"
Object appleEvent = appleEventConstructor.newInstance(new Object[] {
gurlType, gurlType, aeTarget, kAutoGenerateReturnID, kAnyTransactionID
return appleEvent;
catch(IllegalAccessException iae)
browser = null;
errorMessage = iae.getMessage();
return browser;
catch(InstantiationException ie)
browser = null;
errorMessage = ie.getMessage();
return browser;
catch(InvocationTargetException ite)
browser = null;
errorMessage = ite.getMessage();
return browser;
case 1: // '\001'
File systemFolder;
try
systemFolder = (File)findFolder.invoke(null, new Object[] {
kSystemFolderType
catch(IllegalArgumentException iare)
browser = null;
errorMessage = iare.getMessage();
return browser;
catch(IllegalAccessException iae)
browser = null;
errorMessage = iae.getMessage();
return browser;
catch(InvocationTargetException ite)
browser = null;
errorMessage = ite.getTargetException().getClass() + ": " + ite.getTargetException().getMessage();
return browser;
String systemFolderFiles[] = systemFolder.list();
for(int i = 0; i < systemFolderFiles.length; i++)
try
File file = new File(systemFolder, systemFolderFiles);
if(file.isFile())
Object fileType = getFileType.invoke(null, new Object[] {
file
if("FNDR".equals(fileType.toString()))
browser = file.toString();
return browser;
catch(IllegalArgumentException iare)
browser = browser;
errorMessage = iare.getMessage();
return null;
catch(IllegalAccessException iae)
browser = null;
errorMessage = iae.getMessage();
return browser;
catch(InvocationTargetException ite)
browser = null;
errorMessage = ite.getTargetException().getClass() + ": " + ite.getTargetException().getMessage();
return browser;
browser = null;
break;
case 2: // '\002'
browser = "cmd.exe";
break;
case 3: // '\003'
browser = "command.com";
break;
case -1:
default:
browser = "netscape";
break;
return browser;
public static void openURL(String url)
throws IOException
if(!loadedWithoutErrors)
throw new IOException("Exception in finding browser: " + errorMessage);
Object browser = locateBrowser();
if(browser == null)
throw new IOException("Unable to locate browser: " + errorMessage);
switch(jvm)
case 0: // '\0'
Object aeDesc = null;
try
try
aeDesc = aeDescConstructor.newInstance(new Object[] {
url
putParameter.invoke(browser, new Object[] {
keyDirectObject, aeDesc
sendNoReply.invoke(browser, new Object[0]);
catch(InvocationTargetException ite)
throw new IOException("InvocationTargetException while creating AEDesc: " + ite.getMessage());
catch(IllegalAccessException iae)
throw new IOException("IllegalAccessException while building AppleEvent: " + iae.getMessage());
catch(InstantiationException ie)
throw new IOException("InstantiationException while creating AEDesc: " + ie.getMessage());
break;
finally
aeDesc = null;
browser = null;
case 1: // '\001'
Runtime.getRuntime().exec(new String[] {
(String)browser, url
break;
case 2: // '\002'
case 3: // '\003'
Runtime.getRuntime().exec(new String[] {
(String)browser, "/c", "start", url
break;
case -1:
Process process = Runtime.getRuntime().exec((String)browser + " -remote 'openURL(" + url + ")'");
try
int exitCode = process.waitFor();
if(exitCode != 0)
Runtime.getRuntime().exec(new String[] {
(String)browser, url
catch(InterruptedException ie)
throw new IOException("InterruptedException while launching browser: " + ie.getMessage());
break;
default:
Runtime.getRuntime().exec(new String[] {
(String)browser, url
break;
static
loadedWithoutErrors = true;
String osName = System.getProperty("os.name");
if("Mac OS".equals(osName))
String mrjVersion = System.getProperty("mrj.version");
String majorMRJVersion = mrjVersion.substring(0, 3);
try
double version = Double.valueOf(majorMRJVersion).doubleValue();
if(version == 2D)
jvm = 0;
} else
if(version >= 2.1000000000000001D)
jvm = 1;
} else
loadedWithoutErrors = false;
errorMessage = "Unsupported MRJ version: " + version;
catch(NumberFormatException numberformatexception)
loadedWithoutErrors = false;
errorMessage = "Invalid MRJ version: " + mrjVersion;
} else
if(osName.startsWith("Windows"))
if(osName.indexOf("9") != -1)
jvm = 3;
} else
jvm = 2;
} else
jvm = -1;
if(loadedWithoutErrors)
loadedWithoutErrors = loadClasses();
suck my balls -
Satelitte P200-1BA - Internet browser activity stops
Hello,
I have a big problem with internet activity on WLAN connection.
Configuration:
Comp: Satelitte P200-1BA .
System: Vista Home Premium OEM with SP1 and last upgrades.
Internet Browsers: Mozilla Firefox, IE, Safari.
Router: FRITZ Box 7050.
Communicators: Skype, Gadu-gadu
Problem description:
After system booting - WLAN internet connection start automaticaly in next step commumicators are starting.
When I open any of my internet browsers - I can work with this browser only 5-20 min. After this time my browser activity stops.
I can't use any other browser - web pages are not loading. But - commmunicator Gadu-Gadu - still works properly.
I can start & stop communicator activity many time - and communicator still is OK.
But not browser - browser is hanging up.
I have to system reboot - this is the only way I can using again my browser and see any www pages.
I know that:
- i've tested dns - writtening IP in adres field in browser - does'nt work
- there are different ports 80-browsers, 8080(?) communicator - maybe vista blocks any ports?
- in command mode - adres pinging - without problems
- in command mode ipconfig /renew - without effects
- different toshiba - with windows XP - works properly and correctly
- mail program (outlook) is working properly
- after vista reinstallation - problem is back
Please, help.Hi
You are using the WLan but did you notice the same using the LAN?
According to your posting the chat applications like gadu-gadu and Skype are automatically loading in the OS background.
In your case I would test if the IE and other internet browsers would hang without usig and loading gadu gadu and Skype.
Furthermore if this issue appears only using the WLan then you should update the WLan driver and should also check if the BIOS is up to date.
Sorry for this frugal proposal but as you probably know, its not really easy to say what causes this strange issue
Greets -
Java Does Not Throw Exception When Writing To Read-Only Files
I have noticed that when I try to write to a read-only file in a window environment, Java does not throw an IOExcpetion, it just dosn't write to the file.
I am writing an FTP server and here is the code:
public static long copyStream(InputStream in, OutputStream out)throws IOException
IOException exception = null;
long copied = 0;
try
byte buffer[] = new byte[1024];
int read;
while((read = in.read(buffer)) != -1)
out.write(buffer, 0, read);
copied += read;
catch(IOException e)
//ensures that the streams are closed.
exception = e;
try
in.close();//ensures output stream gets closed, even if there is an
//excption here.
catch(IOException e){exception = e;}
out.close();//try to close output.
if(exception != null)
//exception is not null, an exception has occured.
//rethrow exception.
throw exception;
return copied;//all ok, return bytes copied.
}Is this a bug in JAVA VM? Is so, how should I report it?I have noticed that when I try to write to a read-only file in a window environment,
Java does not throw an IOExcpetion, it just dosn't write to the file.C:\source\java\Markov>attrib readonly.out
A R C:\source\java\Markov\readonly.out
�C:\source\java\Markov>java b
java.io.FileNotFoundException: readonly.out (Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at b.main(b.java:5)
import java.io.*;
public class b {
public static void main(String[] args) {
try {
OutputStream os = new FileOutputStream ( "readonly.out");
catch (Exception e) {
e.printStackTrace();
} -
APPHANGB1 when browsing the web, or just keeping it open. Happens once in a 5 minutes, and it freezes for 30 seconds. I found many people who have this problem too ....
Odds are only someone that develops apps for iOS would have access to whatever this is and, even then, this information may still not be available.
I would do a backup of your phone & then erase it and restore from the backup to see if the odd behavior goes away. If so, something went funny with your update the first time around. If not, there's something in your backup that's making the phone throw a fit.
I resolved my battery issues (more or less) by disabling the "set date/time automatically" setting. I haven't re-enabled it yet but my battery life has been much better with it off.
~Lyssa -
UNFORTUNATELY BROWSER HAS STOPPED
When I try to open just ONE site (a VA site) I get the above message . "unfortunately Browser has stopped"..... All the other sites I go to this does not happen, It is just with this site. My girl friends Iphone allows me to go to the site and I go to the site on my computer. But this this one site will not open up on my Droid Razr!!!! Any ideas?
Thank you very much.
ScottYou try a Different Browser: Dolphin HD, Chrome, F.F., Etc See if one of them works Scott.. i know on mine when i visit the Motorola Site it always want me to Convert back to Mobile..
-
"safari web browser has stopped working" ... help?
So a number of months ago (5, I believe) Safari Web Browser crashed and I tried opening it and a message popped up that said:
+Microsoft Windows:+
+Safari Web Browser has stopped working+
+A problem caused the problem to stop working correctly. Windows will close the program and notify you if a solution is available.+
Now up until the crash, I was extremely satisfied with Safari and it was my default internet browser. After I kept seeing this message when trying to start Safari, I decided to uninstall it and reinstall it, then tried repairing it several times. It kept showing the same message for a while so I decided to give up for a few months, so I tried again and the same thing happened. Once again I gave up and today I tried again when I updated my iTunes and that same message popped up and Safari didn't work.
So I decided to post here to see if someone can help me figure out and fix the problem since I prefer that browser to most and never had any problems with it until I froze it and it crashed that number of months ago.
Thanks and your help is greatly appreciated.Hi,
I'm afraid I'm not familiar with Vista, but in XP the Safari preferences etc. are stored in this location:
C:\Documents and Settings\YourUsername\Application Data\Apple Computer\Safari\
If you know where the equivalent Vista location is, rename the Safari directory to be Safari_backup and then retry launching the application to see if one of the files in there is corrupt and causing Safari to crash.
If it does work after doing that, try moving the files one by one back from the Safari_backup directory to the newly created Safari directory, restarting Safari each time, until you find the problematic one.
Maybe you are looking for
-
Itunes used to work fine, but now crashes everytime I plug my iphone in. It gets partway through the sync, then quits with no error message. If I stop the syncying, itunes is fine. If i then select my iphone in the lefthand column, iTunes crashes.
-
I am in flash 9 and creating a basic hyperlink on one of my text layers. I converted the text to a button and then went to the actions panel and entered the following code: on(release) getURL(" http://www.google.com", "_blank"); I keep getting an err
-
I just imported my library of photos into Lightroom and now I'm on a mission to correct the sins of the past. One of those sins is that the keywords embedded into the photos themselves are in some cases Helter Skelter. In other words, I'm not compl
-
I have looked on bottom where SN is, etc. and there is nothing more than the WRT54G label....no version. The other forums said there was a version after that above the serial number, but I cannot find it. Can someone help me please? I figure I need
-
Dimensional Modeling on SAP Hana
Hello, I am a newbie on SAP hana, so need help from experts / gurus. Imagine the following Scenario ---> Oracle ERP is the source System and we want to build a Analytic Solution on Hana. Also assume that tables can be replicated into SAP Hana Questio