Servlet cannot receive message from applet after sent message to applet

In my Applet-Servlet communication, my servlet can not receive message from the applet after the servlet sent message to the applet. It will throw java.io.EOFException: Expecting code
Can someone tell me what is wrong?
==============
This is relevant code on applet side:
String inMsg = "";
try {
_owner.textArea.append("run start...please wait......\n");
String location = "http://111.111.11.111:8080/mdo/servlet/BLServlet";
URL servletURL = new URL(location);
URLConnection servletConnection = servletURL.openConnection();
     _owner.textArea.append("URL = "+location+"\n");
servletConnection.setDoOutput(true);
servletConnection.setDoInput(true);
servletConnection.setUseCaches(false);
servletConnection.setDefaultUseCaches(false);
servletConnection.setRequestProperty("Content-Type", "application/octet-stream");
_owner.textArea.append("servlet connection: \n  "+servletConnection.toString()+"\n");
outputToServlet = new ObjectOutputStream(servletConnection.getOutputStream());
_owner.textArea.append("output to servelt:  "+outputToServlet.toString()+"\n");
_owner.textArea.append("Send msg: Register\n");
outputToServlet.writeObject("Register");
_owner.textArea.append("Sent. \n");
outputToServlet.flush();
_owner.textArea.append("Flush. \n");
try {
Thread.sleep(3000);
} catch (InterruptedException exc) {
_owner.textArea.append("Cannot Sleep.\n");
return;
inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
_owner.textArea.append("input from servlet:   "+inputFromServlet.toString()+"\n");
Object inMessage = new Object();
inMessage = (Object) inputFromServlet.readObject();
inMsg = inMessage.toString();
_owner.textArea.append("Receive: "+inMsg+"\n");
_owner.textArea.append("output-to-servelt:  "+outputToServlet.toString()+"\n");
_owner.textArea.append("input-from-servlet: "+inputFromServlet.toString()+"\n");
_owner.textArea.append("Send msg: Hello\n");
outputToServlet.writeObject("Hello");
_owner.textArea.append("Sent. \n");
outputToServlet.flush();
_owner.textArea.append("Flush. \n");
try {
Thread.sleep(3000);
} catch (InterruptedException exc) {
_owner.textArea.append("Cannot Sleep.\n");
return;
_owner.textArea.append("output-to-servelt:  "+outputToServlet.toString()+"\n");
_owner.textArea.append("input-from-servlet: "+inputFromServlet.toString()+"\n");
inMessage = new Object();
inMessage = (Object) inputFromServlet.readObject();
inMsg = inMessage.toString();
_owner.textArea.append("Receive: "+inMsg+"\n");
_owner.textArea.append("End of run\n");
} catch (Exception e) {
_owner.textArea.append("Exception:  "+e.toString()+"\n");
Code on Servlet side:
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String inMsg;
try {
textArea.append("start of main\n");
inputFromApplet = new ObjectInputStream(request.getInputStream());
inMsg = (String) inputFromApplet.readObject();
textArea.append(" - BLServlet - from Applet: "+inMsg+"\n");
if (inMsg.equals("Register")) {
outMsg = "Register Accept";
} else {
outMsg = "MISTAKE2";
textArea.append("output message: "+outMsg+"\n");
outputToApplet = new ObjectOutputStream(response.getOutputStream());
textArea.append("object output stream: "+outputToApplet.toString()+"\n");
outputToApplet.writeObject(outMsg);
outputToApplet.flush();
try {
Thread.sleep(3000);
} catch (InterruptedException exc) {
return;
inMsg = (String) inputFromApplet.readObject();//Throw java.io.EOFException: Expecting code
textArea.append(" - BLServlet - from Applet: "+inMsg+"\n");
inputFromApplet.close();
if (inMsg.equals("Hello")) {
outMsg = "Hello! How are you!";
else {
outMsg = "MISTAKE3";
textArea.append("output message: "+outMsg+"\n");
outputToApplet.writeObject(outMsg);
outputToApplet.flush();
} catch (Exception exc) {
textArea.append("Exception: "+exc.toString()+"\n");
return;
} // end of try/catch
} // end of doPost method

I have the same problem. I'm trying to send an ImageIcon through an ObjectOutputStream from an Applet to a Servlet. Here is my code:
URL url = new URL(getCodeBase(),"/License/SnapshotServlet");
URLConnection con = url.openConnection();
con.setDoOutput(true);
con.setUseCaches(false);
con.setRequestProperty("Content-Type", "application/x-java-serialized-object");
OutputStream os = con.getOutputStream();
BufferedOutputStream bos = new BufferedOutputStream(os);
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(icon);
oos.flush();
oos.close();
Here is my error:
[5/6/02 17:41:31:312 CDT] 7f8b8205 SystemOut     U service() called
java.io.EOFException
at java.io.DataInputStream.readFully(DataInputStream.java:168)
at java.io.ObjectInputStream.readFully(ObjectInputStream.java:2076)
at java.io.ObjectInputStream.inputArray(ObjectInputStream.java:1085)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:380)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:242)
at javax.swing.ImageIcon.readObject(ImageIcon.java:373)
at java.lang.reflect.Method.invoke(Native Method)
at java.io.ObjectInputStream.invokeObjectReader(ObjectInputStream.java:2219)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1416)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:392)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:242)
at dps.license.webcam.SnapshotServlet.doPost(SnapshotServlet.java:39)
at dps.license.webcam.SnapshotServlet.service(SnapshotServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:827)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:167)
at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:297)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:110)
at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:472)
at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:1012)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:913)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:523)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:282)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:112)
at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:91)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:184)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:106)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:125)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:315)
at com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.java:60)[5/6/02 17:41:31:859 CDT] 7f8b8205 SystemOut     U saving image...
[5/6/02 17:41:31:859 CDT] 7f8b8205 SystemOut     U ERROR: Image is null!
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:323)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:252)
at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122)
Does anyone have any idea what is going on here?

Similar Messages

  • I cannot receive texts from one contact after updating to the iOS7 system - why?

    I cannot receive texts from one contact after updating to the iOS7 system - why?

    amyhs, thanks for those details. This is certainly quite odd that this has been going on so long and we definitely want to get to the bottom of this. Now, you stated that you have reached out to technical support and spoke with a tier two technical support representative. At this time, what actions or troubleshooting steps were taken? Are you aware if a ticket with our network technicians was ever created? As well, have you ever previously had an iPhone and are you aware if the users that are unable to message you are using iMessage?
    AdamG_VZW
    Follow us on Twitter @VZWSupport
    If my response answered your question please click the "Correct Answer" button under my response. This ensures others can benefit from our conversation. Thanks in advance for your help with this!!

  • I recently bought a Samsung Galaxy s5 and cannot receive iMessages from iphones, I have deleted my apple id, turned off imessage, turned off spam messages on my android device, wasted 35 minutes on the phone to Apple's 'Support' has anyone got any tips?

    I recently bought a Samsung Galaxy s5 and cannot receive iMessages from iphones, I have deleted my apple id, turned off imessage, turned off spam messages on my android device, wasted 35 minutes on the phone to Apple's 'Support' has anyone got any tips?

    Hi,
    Do you mean you are not getting SMS text messages now ?
    If so start here
    Follow the Account management options until you are offered and email contact.
    Explain the issue via email as only someone in Support can now remove your iPhone Number from iMessages if it has not "de-registered" itself correctly.
    8:28 pm      Wednesday; May 7, 2014
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • HT201269 how do i unregister my iphone? I have the galaxy s4 now and cannot receive texts from iphone users.

    How do i unregister my old Iphone, i no longer have it in my possesion. I now have the galaxy s4 and cannot receive texts from iphone users

    Hello AnnH2
    If you have access you your old iPhone, just sign out of Messages. If you do not have access to it, then change your Apple ID password.
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    Unlink a phone number
    To remove a phone number from an Apple ID, sign out of FaceTime and Messages on your iPhone:
    Settings > Messages > Send & Receive. Tap your Apple ID, then tap Sign Out.
    Settings > FaceTime. Tap your Apple ID, then tap Sign Out.
    This should remove your phone number from other devices using the same Apple ID with FaceTime and Messages. If the phone number is still available on other devices after you sign out of FaceTime and iMessage on the iPhone, you may need to sign out of iMessage and FaceTime on all your devices, then sign in to FaceTime and Messages again on devices you want to use.
    Note: If you no longer have access to the iPhone that is using the number you want to remove, reset your Apple ID password.
    Regards,
    -Norm G.

  • Cannot Receive Text from One Person

    I cannot receive texts from 1 person who is also a Verizon Customer, both of us have iPhone 4S phones.  I receive his messages on my iPad, but not my iPhone.   All other texting seems to be working with other contacts.  I could receive his texts/iMessages 12 hours ago without a problem.  Any suggestions?  I have rebooted my phone.  He can receive my texts.
    Thanks.

    I'm having a similar problem. I can receive texts from this one person but he cannot receive mine. I can also not call him but he can call me. He uses A T&T but does not have this problem when texting other verizon users. I have an Iphone 4S and he has an Iphone 5. This has been happening for 3 days. I have tried resetting the networks, restarting my phone,  and checking blocked contacts. Nothing is helping with the issue.

  • Cannot receive text from specific person....

    I can receive texts from my husbands iPhone 4S, but he cannot receive texts from me using an iPhone 4S.... I have already done a "hard reboot" and it still doesn't work. Any suggestions to help me out?

    Are the messages green (SMS) or blue (iMessage)?  If SMS, probably a carrier problem.  If iMessage, probably an iMessage configuration problem on his account, be sure you are addressing the message to the iMessage phone number or email address configured in the settings on his device.

  • Traded in my iPhone for a different brand of phone. I had no idea that I had to sign out of iMessage before doing this. Now, my old phone is gone and my new phone cannot receive texts from people who have iphones and had me as a contact before. They try t

    Traded in my iPhone for a different brand of phone. I had no idea that I had to sign out of iMessage before doing this. Now, my old phone is gone and my new phone cannot receive texts from people who have iphones and had me as a contact before. They try to send an iMessage and I have no way to receive an iMessgae now. On some server somwhere my AppleID still tells people they should send me iMessages. What is the solution to this issue? Deleting my AppleID would work to solve this issue, but I cannot ever delete the ID? What can Apple do for this?

    If you did not erase your apps and data before getting rid of your old phone, try using Find My Phone and erasing everything remotely. See if this works.

  • My phone cannot receive file from pc using bluetoo...

    I got problem with my phone that cannot receiving file from my pc via bluetooth,
    but there's no any trouble if i send or receiveing file from other mobile phone,
    someone please explain and give me the solution

    I'm using nokia 5530 XM

  • I cannot receive text from anyone that is not on an iPhone...

    i cannot receive text from anyone that is not on an iPhone...

    sorry i just edited.  i can receive text from other carriers, other phones, but cannot receive from iphones. 
    i rececently switched to a 5 AND added one for my daughter on her own number but same apple id. i dont have her phone nearby to see what she may have possibly changed.

  • I cannot receive mail and I get a message saying cannot get mail,username or password is incorrect.

    I cannot receive and send mail. A message appears with username or password incorrect. I have checked these and they are correct.

    Delete the account, do a Reset [Hold the Home and Sleep/Wake buttons down together for 10 seconds or so (until the Apple logo appears) and then release. When the screen goes blank power On again in the normal way.] It is absolutely/appsolutely safe! And then renter the username etc.

  • Cannot receive fax from one telephone number

    I cannot receive faxes from one specific party, connects and then says it fails to receive.

    Hi,
    Please check the sender to see is it a silence number ? or using any filter ?
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • Gnome-Bluetooth cannot receive files from Nokia Lumia 810

    To whom it may concern,
    I opened a  bug report stating that I cannot receive files from my Nokia Lumia 810 using gnome-bluetooth. According to Nokia, it should be able to (and they claimed they tested it themselves during my phone call with them). The bug report is FS#33348. I'd appreciate if anyone could assist me on this problem.

    jainkkunal wrote:
    This link has been deleted could you please post the solution here Thanks in anticipation
    Hi and Welcome to the Forums!
    See this KB:
    KB05409 Transfer a file using Bluetooth technology between two BlackBerry smartphones
    Substitute, in the KB, the appropriate instructions for your other device in place of the KB section for the sending device. Do not skip the "Receive Using BT" step on the receiving BB...nothing will transfer if you do.
    Good luck and let us know!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • I cannot receive audio from several of my internet music sites such as XM Radio online since switching to Firefox 4 Beta 1 - Help

    I cannot receive audio from several of my internet music sites such as XM Radio online since switching to Firefox 4 Beta 1 - Help
    == URL of affected sites ==
    http://www.xmradio.com/player/listen/playerShell.action

    I should have explained further. The game opens in a new window over to the upper left of my screen, leaving the original page underneath. I tried minimizing it so that I could get to my toolbar and did the View > Zoom > Reset. This has no effect. The lower portion of the game is still not showing. Using other browsers the window or frame of the game is much larger, therefore everything shows.

  • HT4528 I had an iphone 4. I traded it in for a samsung galaxy note 3. Since swapping phones, I cannot receive text from any iphone. What can I do to fix the problem.

    I had an iphone 4. I traded it in for a samsung galaxy note 3. Since swapping phones, I cannot receive text from any iphone. What can I do to fix the problem.

    Contact Apple support to deactivate iMessage. https://www.apple.com/support/appleid/contact/

  • Cannot receive ObjectMessage from a Tomcat-Servlet - MessageFormatException

    Hi,
    I have a strange problem....
    I wrote a (very simple) class Nummer, that has a long attribute and a String attribute. The class also implements Serializable....Then I sent this Object as an Objectmessage from one JMS-client to another one.....Everything worked perfectly....
    (I use OpenJMS0.7.6.1)
    ...then I tried to sent this class as an ObjectMessage to a Servlet that runs under Tomcat4.1.30......the Servlet successfully receives the ObjectMessage, but when it tries to get the object off the body it throws a MessageFormatException...!!!! Why is this?? I mean, it indicates that there are problems with Serialisation, but if i do not use servlets there are no problems at all....
    ....maybe this could help you: The Servlet does not throw an Exception, when the ObjectMessage contains a standard JAVA Object like java.util.Date for example....
    ....of course, the servlet "knows" the object I try to send as I have put it in a jar and added the jar to the build path...
    I would be very glad, if anybody out there can give me a hint...
    THANKS....
    **************************Here is some code*******************************/
    //this is how the servlet tries to receive the object
         if (m instanceof ObjectMessage){
                        Nummer n = (Nummer) ((ObjectMessage)m).getObject();
                        System.out.println("Nummer: "+n.getNr());
                        System.out.println("Zahl: "+n.getZahl());
    //this is how the ObjectMessage is sent to the Servlet
    ObjectMessage message = session.createObjectMessage();
              message.setObject((Nummer) new Nummer(30, "Drei�ig"));
              //message.setObject(hash);
              message.setStringProperty("sourceID",JMSExpert.ID);
              message.setStringProperty("targetID",targetID);
              this.sender.send(message);
    The class Nummer contains only the long and the String property and the constructor...and the setter/getter...There's no toString(), toHashCode and whatever...

    ...I finally found it out by myself....for some reason it was not enough to just add the jar to the build path in Eclipse ("Add external jar")....when I also copied the jar to TOMCATHOME/Common/lib it wrked well....so i am satisfied fr the moment even though I suppose that it is not very "professional" to put everything in commons/lib .....but putting it in Shared/lib was not enough ....does anybody have a better idea??...

Maybe you are looking for

  • I just downloaded an app to my desktop but it will not sync to my iPad

    I have done this many times before and it worked fine. But today two apps I downloaded to my mac desktop and they show up in my list of apps on the desktop. But after I sync the iPad to my desktop it just goes throught he procedure of backing up and

  • Arrowheads made using Stroke panel break when backsaved as an EPS?

    Hello~! So I've noticed some fundamental differences between the features that WERE available under the "Add Arrowheads" feature, and the ability to add arrowheads that is now included in the Stroke panel. Insofar as I understand, there was not a way

  • How to get count for missing month

    I created a view as follows: CREATE OR REPLACE FORCE VIEW "Vinfection1" ("MONTH", "COUNT") AS select "MONTH","COUNT" from ( select to_char(s.pdate,'Mon-yyyy') as month, count(*) as count from surproc s, diagnosis_surproc d where s.surprocid = d.surpr

  • SFTP Connector issue

    I have a couple of questions about the SFTP connector: Firstly I have been trying to get the SFTP connector to work but so far have had no luck. Having set up the connector and set all the package settings all of my requests fail with an HTTP 400 res

  • How do I compress an audio file?

    Hello, This is definitely an overloaded home page, but I am doing what I am told. I am working on making some of the images smaller for speed. http://www.peterspunch.com/ My problem is that the audio works fine on my computer on Safari, but gets cut