Applet/Servlet --java.io.InvalidClassException

I'm trying to get an Applet to send data to a servlet and vice versa but I come upon this error:
java.io.InvalidClassException: javax.swing.AbstractButton; Local class not compatible:
stream classdesc serialVersionUID=-937921345538462020
local class serialVersionUID=7577615732708390153I know the client version is 1.4.1 and the server is 1.3. However, It is not fair to ask every client to make sure they have 1.3, or to have to upgrade the server to 1.4.1.
Isn't there a way to make them compatible? I heard about the serialVer program that comes with JAVA but I don't know how to use it to solve my problem.
Thanks

1. You should not try to send serialized Swing objects between different Java versions. Almost every of them has the following notice in their JavaDoc:
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing.
In 1.4 you may use XML-based persistence (see XMLEncoder).
2. SerialVer is a good program, but even if you mark two classes as compatible (by assigning an explicit serialVersionUID), they should indeed be compatible. Look for specs on serialization available within the JDK Documentation bundle.
3. Core JDK classes (java.util, java.lang), as far as I remember, are compatible and can be read / written by different JDKs.
4. If you would pass your own classes through serialization from 1.3 to 1.4 or back, you probably should provide some explicit serialVersionUID for them. The reason is that 1.4 in some cases may calculate a different value than 1.3, for the same class. Look around for a list of changes between that versions.

Similar Messages

  • Java.io.InvalidClassException:local class incompatible?

    hello everyone:
    I deploy a J2EE application called A in a weblogic domain called A, it can run correctly;
    then I deploy another J2EE application called B, which is a new edition of A, in another weblogic domain called B, it can also run correctly;
    The two domains use the same server. I don't know whether this will cause problems like this.
    But the previous A can't run correctly and throw exceptions as follows in Java Console:
    java.io.InvalidClassException: com.longzhou.oa.docnet.dto.abstractdto.DnBaseRole; local class incompatible: stream classdesc serialVersionUID = 1264764439065723117, local class serialVersionUID = -6834466395328850197
         at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
         at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
         at java.io.ObjectInputStream.readClassDesc(Unknown Source)
         at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
         at java.io.ObjectInputStream.readClassDesc(Unknown Source)
         at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
         at java.io.ObjectInputStream.readObject0(Unknown Source)
         at java.io.ObjectInputStream.readArray(Unknown Source)
         at java.io.ObjectInputStream.readObject0(Unknown Source)
         at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
         at java.io.ObjectInputStream.readSerialData(Unknown Source)
         at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
         at java.io.ObjectInputStream.readObject0(Unknown Source)
         at java.io.ObjectInputStream.readObject(Unknown Source)
         at com.longzhou.oa.applet.util.EjbLocator.getInputStream(EjbLocator.java:18)
         at com.longzhou.oa.applet.DnIO.getDnAllByID(DnIO.java:63)
         at com.longzhou.oa.applet.DnIO.loadGraph(DnIO.java:33)
         at org.enhydra.jawe.DnDefine.loadDn(Unknown Source:185)
         at org.enhydra.jawe.AbstractEditor.<init>(Unknown Source:130)
         at org.enhydra.jawe.PackageEditor.<init>(PackageEditor.java:60)
         at org.enhydra.jawe.JaWE.init(JaWE.java:195)
         at org.enhydra.jawe.DnApplet.jbInit(DnApplet.java:67)
         at org.enhydra.jawe.DnApplet.init(DnApplet.java:54)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    java.lang.NullPointerException
         at com.longzhou.oa.applet.DnIO.getDnFromDto(DnIO.java:731)
         at com.longzhou.oa.applet.DnIO.loadGraph(DnIO.java:34)
         at org.enhydra.jawe.DnDefine.loadDn(Unknown Source:185)
         at org.enhydra.jawe.AbstractEditor.<init>(Unknown Source:130)
         at org.enhydra.jawe.PackageEditor.<init>(PackageEditor.java:60)
         at org.enhydra.jawe.JaWE.init(JaWE.java:195)
         at org.enhydra.jawe.DnApplet.jbInit(DnApplet.java:67)
         at org.enhydra.jawe.DnApplet.init(DnApplet.java:54)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.lang.Object
         at java.io.ObjectInputStream.readObject0(Unknown Source)
         at java.io.ObjectInputStream.readObject(Unknown Source)
         at com.longzhou.oa.applet.util.EjbLocator.getInputStream(EjbLocator.java:18)
         at com.longzhou.oa.applet.InitModel.initEmpGroupList(InitModel.java:353)
         at org.enhydra.jawe.DnDefine._$1(Unknown Source:241)
         at org.enhydra.jawe.DnDefine.loadDn(Unknown Source:186)
         at org.enhydra.jawe.AbstractEditor.<init>(Unknown Source:130)
         at org.enhydra.jawe.PackageEditor.<init>(PackageEditor.java:60)
         at org.enhydra.jawe.JaWE.init(JaWE.java:195)
         at org.enhydra.jawe.DnApplet.jbInit(DnApplet.java:67)
         at org.enhydra.jawe.DnApplet.init(DnApplet.java:54)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.NotSerializableException: java.lang.Object
         at java.io.ObjectOutputStream.writeObject0(Unknown Source)
         at java.io.ObjectOutputStream.writeObject(Unknown Source)
         at com.longzhou.oa.util.EgovServlet.service(EgovServlet.java:332)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1072)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6981)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3892)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2766)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
         at java.lang.Thread.startThreadFromVM(Unknown Source)
    java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.lang.Object
         at java.io.ObjectInputStream.readObject0(Unknown Source)
         at java.io.ObjectInputStream.readObject(Unknown Source)
         at com.longzhou.oa.applet.util.EjbLocator.getInputStream(EjbLocator.java:18)
         at com.longzhou.oa.applet.InitModel.initSysRoleList(InitModel.java:371)
         at org.enhydra.jawe.DnDefine._$1(Unknown Source:242)
         at org.enhydra.jawe.DnDefine.loadDn(Unknown Source:186)
         at org.enhydra.jawe.AbstractEditor.<init>(Unknown Source:130)
         at org.enhydra.jawe.PackageEditor.<init>(PackageEditor.java:60)
         at org.enhydra.jawe.JaWE.init(JaWE.java:195)
         at org.enhydra.jawe.DnApplet.jbInit(DnApplet.java:67)
         at org.enhydra.jawe.DnApplet.init(DnApplet.java:54)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.NotSerializableException: java.lang.Object
         at java.io.ObjectOutputStream.writeObject0(Unknown Source)
         at java.io.ObjectOutputStream.writeObject(Unknown Source)
         at com.longzhou.oa.util.EgovServlet.service(EgovServlet.java:332)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1072)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6981)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3892)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2766)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
         at java.lang.Thread.startThreadFromVM(Unknown Source)
    Can anyone tell me the reason? Thanks

    "local class incompatible" error is due to the retrieving of serialized object, which might be dumping from memory to somewhere like database, file etc., that is of different edition of the class. Maybe an object A of AClass was stored in a database and lately the AClass changed to a new edition, let's call it A'Class, and they have something different, especially the serialVersionUID field. When the object A is retrieved from the database, which should be compatible with A'Class (be ware of that A'Class and AClass has the same name but of different edition), unfortunately, they don't, the error mentioned above occurs.
    So, I guess that although the app A and B uses different domain, if they uses the same database to store and retrieve something (here may refers to objects) of different edition and are run one after another, the compatible issues are going to occur.
    Separating app A from B as much as possible is not a good solution, but you could have a try.
    Hoping helpful, good luck!

  • Applet Servlet communication compiles but does not communicate

    Hi,
    I have a applet which has a button named A. By clicking the button, the applet passes the letter A to the servlet. The servlet in turn accesses an Oracle database and retrieves the name corresponding to letter A from a table (name is Andy in the present case). The servlet interacts with the databse via a simple stored procedure and uses its output parameter to display the name Andy back in the applet.
    Both the applet and servlet codes have compiled fine(servlet code compiled with -classpath option to servlet jar using a TOMCAT). However, on clicking button A in the applet, I do not get the name Andy.
    Any help/suggestion in resolution of this is highly appreciated. Thanks in advance.
    HTML CODE:
    <html>
    <center>
    <applet code = "NameApplet.class" width = "600" height = "400">
    </applet>
    </center>
    </html>
    STORED PROCEDURE CODE:
    procedure get_letter_description(
    ac_letter IN CHAR,
    as_letter_description OUT VARCHAR2) IS
    BEGIN
    SELECT letter_description INTO as_letter_description FROM letter WHERE letter =
    ac_letter;
    EXCEPTION
    WHEN no_data_found THEN as_letter_description := 'No description available';
    END get_letter_description;
    APPLET CODE:
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.util.*;
    import java.io.*;
    import java.net.*;
    public class NameApplet extends Applet implements ActionListener
    private TextField text;
    private Button button1;
    private String webServerStr = null;
    private String hostName = "localhost";
         private int port = 8080;
    private String servletPath = "/examples/servlet/NameServlet?letter=";
    private String letter;
    public void init()
         button1 = new Button("A");
    button1.addActionListener(this);
    add(button1);
              text = new TextField(20);
         add(text);
    // get the host name and port of the applet's web server
              URL hostURL = getCodeBase();
         hostName = hostURL.getHost();
    port = hostURL.getPort();
              webServerStr = "http://" + hostName + ":" + port + servletPath;
    public void actionPerformed(ActionEvent e)
         if (e.getSource() == button1)
         letter = "" + 'A';
    private String getName(String letter){
    String name = "" ;
    try {
              URL u = new URL(webServerStr + letter);
              Object content = u.getContent();
    name = content.toString();
         } catch (Exception e) {
         System.err.println("Error in getting name");
    return name;
    SERVLET CODE:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import java.util.Properties;
    public class NameAppletServlet extends HttpServlet {
    private static Connection conn = null;
    private static final char DEFAULT_CHAR = 'A';
    private static final char MIN_CHAR = 'A';
    private static final char MAX_CHAR = 'G';
    private static final String PROCEDURE_CALL
    = "{call get_letter_description(?, ?)}";
    protected void doGet( HttpServletRequest request,
    HttpServletResponse response )
    throws ServletException, IOException
    handleHttpRequest(request, response);
    protected void doPost( HttpServletRequest request,
    HttpServletResponse response )
    throws ServletException, IOException
    handleHttpRequest(request, response);
    protected void handleHttpRequest( HttpServletRequest request,
    HttpServletResponse response )
    throws ServletException, IOException
    String phrase = null;
    char letter = getLetter(request, DEFAULT_CHAR);
    if (letter >= MIN_CHAR && letter <= MAX_CHAR) {
    try {
    name = getName(conn, letter);
    } catch (SQLException se) {
    String msg = "Unable to retrieve name from database.";
    name = msg;
    } else {
    String msg = "Invalid letter '" + letter + "' requested.";
    //throw new ServletException(msg);
    phrase = msg;
    response.setContentType("text/plain");
    PrintWriter out = response.getWriter();
    out.println(name);
    private String getName(Connection conn, char letter)
    throws SQLException
    CallableStatement cstmt = conn.prepareCall(PROCEDURE_CALL);
    cstmt.setString(1, String.valueOf(letter));
    cstmt.registerOutParameter(2, Types.VARCHAR);
    cstmt.execute();
    String name = cstmt.getString(2);
    cstmt.close();
    return name;
    private char getLetter(HttpServletRequest request, char defaultLetter) {
    char letter = defaultLetter;
    String letterString = request.getParameter("letter");
    if (letterString!=null) {
    letter = letterString.charAt(0);
    return letter;
    public void init(ServletConfig conf) throws ServletException {
    super.init(conf);
    String dbPropertyFile = getInitParameter("db.property.file");
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    conn = DriverManager.getConnection(
    "jdbc:oracle:thin:myserver:1521:CDD",
    "scott",
    "tiger");
    } catch (IOException ioe) {
    throw new ServletException(
    "Unable to init ReinforcementServlet: " + ioe.toString());
    } catch (ClassNotFoundException cnfe) {
    throw new ServletException(
    "Unable to init ReinforcementServlet. Could not find driver: "
    + cnfe.toString());
    } catch (SQLException se) {
    throw new ServletException(
    "Unable to init ReinforcementServlet. Error establishing"
    + " database connection: " + se.toString());
    }

    Hi,
    I am not able to understand by which method you are doing Applet-Servlet commuincation.
    If you want to use Object Serialization method, plz.get the details from following URL.
    http://www.j-nine.com/pubs/applet2servlet/
    Ajay

  • Asynchronous applet-servlet communication

    Hi all,
    I am trying to implement asynchronous applet-servlet communication and need your help. Anything would help(I tried with synchronous applet-servlet communication but doesn't solve my problem).
    Thanks,

    http://java.sun.com/docs/books/tutorial/networking/index.html
    You can open a socket connection. Bother the client and the server
    can have separate threads for reading and writing and that you gives you
    asynchronous communication. Later, if you think the server is generating
    too many threads and not scaling, you can use features of .java.nio to
    make it more scalable:
    java.nio.channels

  • Is there a good advanced review on applet-servlet communication

    I am working on a web application and unfortunately experiencing a lot of trouble trying to use an applet as front end which interacts with a couple of servlets running on Tomcat. I need to get data from one servlet and send data to another.
    There is a lot of messages posted in this and other forums about how to do this, but none of them got a response pointing to a useful advanced reference on this subject. I have reviewed some of the references given, but couldn't find a thorough detailed advanced reference on applet-servlet communication. For this I mean an exhaustive explanation of the mechanism of communication and when and when is neccesary to use each of the multiple configuration possibilities regarding content-type, message-length, request-method, connection settings, and so on.
    Would anybody be so kind to show me the right direction? As I read the (literally) hundreds of messages posted on this topic, I see this info as widely useful. Most of the topic tracks ends on void or with painful no-way sentences, and maybe many people is avoiding Java technology on web application because of this problem (development delays can abort a project).

    This sample chapter in Java developers' guide to Servlets and Jsp focuses on Applet-Servlet communication, is a pretty good one, and is free :
    http://www.javaranch.com/bunkhouse/samps/2809ch12.pdf
    As to an exhaustive & complete guide that covers absolutely everything, I may be wrong but I doubt you'll find anything like that...unless there is a book somewhere dedicated to the subject.

  • Java.io.InvalidClassException

    Hello,
    I have tomcat running the JSP files for an online application. The error messages I am getting when I try to open a particular jsp file (summary_detail.jsp) is written in the log file of the application, and is as follows:
    ERR summary_detail.jsp: java.io.InvalidClassException: com.icwjsp.summary.java.DataSubObjectItem; Local class not compatible: stream classdesc serialVersionUID=-8981327278361376304 local class serialVersionUID=-4077089632444832393
    CALLSTACK com.inqmy.services.rmi_p4.P4RuntimeException: java.io.InvalidClassException: com.icwjsp.summary.java.DataSubObjectItem; Local class not compatible: stream classdesc serialVersionUID=-8981327278361376304 local class serialVersionUID=-4077089632444832393
         at com.icwapi.apiobjects.MedicalOverview_Stub.getData(MedicalOverview_Stub.java:375)
         at com.icwapi.apiobjects.MedicalOverviewKey.getData(MedicalOverviewKey.java:10)
         at summary.main.health.summary_detail_1._jspService(summary_detail_1.java:190)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java)
         at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574)
         at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
         at org.apache.tomcat.core.Handler.service(Handler.java:235)
         at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
         at org.apache.tomcat.modules.server.Ajp13Interceptor.processConnection(Ajp13Interceptor.java:341)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
         at java.lang.Thread.run(Thread.java:484)
    Any help on what could be leading to the problem (o.k. local class not compatible), or even better still, any pointers to what I could do to fix the problem, would be very much appreciated!
    Thank you,

    Thanks for answering, no it wasn't!
    I was sure it was, cos I have it running on my local machine, but there was a cache that I needed to clear.
    Cheers!

  • Applet-servlet communication, object serialization, problem

    hi,
    I encountered a problem with tomcat 5.5. Grazing the whole web i didn't find any solution (some guys are having the same problem but they also got no useful hint up to now). The problem is as follows:
    I try to build an applet-servlet communication using serialized objects. In my test scenario i write a serialized standard java object (e.g. a String object) onto the ObjectOutputStream of the applet/test-application (it doesn't matters wheter to use the first or the latter one for test cases) and the doPost method of the servlet reads the object from the ObjectInputStream. That works fine. But if i use customized objects (which should also work fine) the same code produces an classnotfound exception. When i try to read and cast the object:
    TestMessage e = (TestMessage)objin.readObject();
    java.lang.ClassNotFoundException: TestMessage
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    ...That seems strange to me, because if i instantiate an object of the same customized class (TestMessage) in the servlet code, the webappclassloader doesn't have any problems loading and handling the class and the code works fine!
    The class is located in the web-inf/classes directory of the application. I've already tried to put the class (with and without the package structure) into the common/classes and server/classes directory, but the exception stays the same (I've also tried to build a jar and put it in the appropriate lib directories).
    I've also tried to catch a Throwable object in order to get information on the cause. But i get a "null" value (the docu says, that this will may be caused by an unknown error).
    I've also inspected the log files intensively. But they gave me no hint. Until now I've spend a lot of time on searching and messing around but i always get this classnotfound exception.
    I hope this is the right place to post this problem and i hope that there is anyone out there who can give me some hint on solving this problem.
    Kindly regards,
    Daniel

    hi, thanks for the reply,
    all my classes are in the web-inf/classes of the web-app and have an appropriate package structure. thus the TestMessage class is inside a package.
    i tried some names for the testclass but it didn't matter. the exception stays the same. I also tried to put the jar in the common/lib but the problem stays.
    Well the problem with loaded classes: As i mentioned in the post above i can instantiate an object of TestMessage in the code without any problems (so the classloader of my webapp should know the class!!)
    only when reading from the objectinputstream the classloader doesn't seem to know the class?? maybe theres a parent classloader resposible for that and doesn't know the class?
    strange behaviour...
    p.s. sending the same object from the servlet to the client works well
    regards
    daniel
    Message was edited by:
    theazazel

  • Applet-Servlet or RMI - which is better

    We are in the process of developing a swing-applet based system that requires regular interaction with multiple databases residing on more than one database server.
    The options available before us, as we evaluate are:
    a. Use "signed" applets ( as this is going to be essentially an intra-net application) and use JDBC connection to connect to more than one database ( which reside on servers other than the web server).
    b. Use applet - servlet communication - basically, the servlet would establish connection to the databases, directly or through EJB, retrieve necessary database information and pass on the objects to the applet - the front end GUI would be controlled by the applet.
    c. Use RMI
    We would like to have your perspective of the three options, with your experience in this line.
    The questions that come to us are:
    a. If the system is essentially an intra-net application, is it okay to design with "signed" applet mechanism - how far is this method common in the market and acceptable to the clients? Is it true that the signed applet would be able to establish connection to various "identified servers" that are allowed permissions in the security file?
    b. Between applet-servlet and RMI, which is a better method? What should be the factors that need to be considered? Is RMI being widely used or should we be thinking in terms of EJB, eventhough the current project is purely a Java based solution.
    Your input is highly appreciated - thanking in advance for any suggestions and inputs that you may provide.
    Thanks
    Dixie

    Dixie,
    1) IMHO signed applets are not widely used, but you can use
    ordinary applets, which are accessing other resources through
    redirector servlet on server side - I mean ordinary applets
    are prohibited to establish connect to other than it's own server.
    So you will be forced to have special servlet on your server,
    which have access to other resources on other servers - this is a
    way how to avoid applets limitation.
    2) RMI is a heavy solution, because all parameters/objects should
    be serialized over net and if network connection is unreliable
    working with system will be just a nighmare.
    3) If you think that your network connection is unreliable, you can use HTTP protocol between client and server instead of RMI. In this case
    you will have following benefits:
    i) You can still use all of powerness of thick client
    ii) Network unreliability will be defeated
    iii) Sometime if you would like to port your application to a thin
    client it will be done much more easier than in case of RMI
    4) If you would like to use thin client your only problem will
    be poorness of UI - if you can go with it - go ahead! Otherwise
    use thick client with RMI or HTTP depending on quality of network.
    Paul

  • Applet/Servlet communication - StreamCorruptedException

    Hi, I'm having a problem when I try to connect to a servlet. I am using applet/servlet communication. The problem only occurs when I have lauched a crystal report via http in a new window.
    After the report is launched if I try to hit my servlet I get the following error:
    java.io.CorruptedStreamException: invalid stream header
    Not all crystal reports I launch cause this behavior but I can see nothing in the url I use to launch the report that is out of place or different than other reports.
    APPLET-SERVLET CONNECTION
    try {
    StringBuffer path = new StringBuffer();
    path.append(ip);
    path.append("servlet/DatabaseServlet?");
    path.append("option=getRecords&query=").append(URLEncoder.encode(query,"UTF-8"));
    URL url = new URL(path.toString());
    URLConnection servletConnection = url.openConnection();
    servletConnection.setUseCaches(false);
    servletConnection.setDoInput(true);
    servletConnection.setDoOutput(true);
    servletConnection.setRequestProperty("Content-Type", "application/x-java-serialized-object");
    ObjectInputStream inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
    rc = (RecordCollection) inputFromServlet.readObject();
    inputFromServlet.close();
    } catch (Exception e) {
    e.printStackTrace();
    SERVLET CODE
    Forwards to doPost
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    System.out.println("session id: " + request.getSession().getId());
    this.doPost(request, response);
    LAUNCHING REPORT FROM APPLET
    try {
    String launchURL = host + directory + report + "?promptOnRefresh=0"+ "&" +
    authentication + "&" + key + "&" + startPeriods + "&" + reportYears + "&" + reportTitle + "&" endPeriods "&" + locations + "&" + reportPeriod + "&" + fiscalWeek + "&" + fiscalYear + "&" +time;
    context.showDocument(new URL(launchURL), "_blank");
    } catch (Exception ex) {
    ex.printStackTrace();
    SAMPLE URL THAT CAUSES PROBLEM
    http://localhost:113/Reports/OpenToBuy_3.class?promptOnRefresh=0&user0=rpuser&password0=er34sw1&[email protected]=rpuser&[email protected]=er34sw1&user0@sub2=rpuser&[email protected]=er34sw1&promptex-key="L","L1","ALL"&promptex-start="1"&promptex-years="2004","2004"&promptex-title="Report Title"&promptex-end="1"&promptex-locs="01","03","04","05"&promptex-period="Feb 2004 [04-01]"&promptex-cw="1"&promptex-cy="2004"&promptex-time=-2-52728"
    Everything works fine until I launch this report then I can no longer get data from my servlet. I thought the URL lenght for the report might be the problem but I lauch a report with a URL longer than the problem one and there I don't get the errors after. When I try to connect to the servlet the println statement in the doGet method of my servlet doesn't get printed so it's not even making it inside that method in the servlet.
    Anyone have any idea what could be causing this? Anyone have any ideas what would be causing this? I'm really stumped.

    I've seen this problem before. Because your accessing a complete URL (ie http://<host>:<port>/xxx), you are actually creating a new session. Whenever the applet opens a connection to a servlet it is running on it's own session not the same as the JSP. This is rather obvious since the Page and Applet are separate entities.
    Try sending authentication with the url. I think the syntax is:
    username:password@http://localhost/xxx
    However I'm not sure how well this might work for Tomcat. As for Java it may try and throw a MalformedURLException I would have to test it first - it's been a long time since I used this technique!
    Wish I could be more help,
    Anthony

  • Big Problem in Applet-Servlet Communication-(Help)

    I wrote an method to send serialized objects from Applet to Servlet,
    the method is as following:
    private ObjectInputStream postObjects (URL servlet, Serializable objs[], String sessionID) throws Exception {
    ObjectInputStream in = null;
    ObjectOutputStream out = null;
    try{
    URLConnection con = servlet.openConnection();
    con.setDoInput(true);
    con.setDoOutput(true);
    con.setUseCaches(false);
    con.setRequestProperty("Content-Type","application/x-java-serialized-object");
    con.setAllowUserInteraction(false);
    con.setRequestProperty("Cookie", sessionID);
    out = new ObjectOutputStream(con.getOutputStream());
    int numObjects = objs.length;
    for(int x = 0; x < numObjects; x++){
    out.writeObject(objs[x]);
    out.flush();
    out.close();
    in = new ObjectInputStream(con.getInputStream());
    }catch(Exception e){
    e.printStackTrace(System.err);
    throw e;
    }finally{
    return in;
    when I call this method, I got the following error message in Applet console,
    my platform is Salaris 5.8 + iPlanet 6.0.
    java.io.EOFException
         at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2150)
         at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2619)
         at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:726)
         at java.io.ObjectInputStream.<init>(ObjectInputStream.java:251)
         at com.shinewave.lms.core.client.ServletProxy.postObjects(ServletProxy.java:255)
         at com.shinewave.lms.core.client.ServletProxy.doInitialize(ServletProxy.java:76)
         at com.shinewave.lms.core.client.APIAdapterApplet.LMSInitialize(APIAdapterApplet.java:60)
    java.lang.NullPointerException
         at com.shinewave.lms.core.client.ServletProxy.doInitialize(ServletProxy.java:77)
         at com.shinewave.lms.core.client.APIAdapterApplet.LMSInitialize(APIAdapterApplet.java:60)
    java.lang.NullPointerException
         at com.shinewave.lms.core.client.ServletProxy.doInitialize(ServletProxy.java:82)
         at com.shinewave.lms.core.client.APIAdapterApplet.LMSInitialize(APIAdapterApplet.java:60)
    Please help me to solve this problem, thank you very much.

    Hi..
    Sorry abt this. But I was hoping if u could help out on this..
    I am trying to implement a applet to servlet communication...
    wherin the servlet would read data from the database... and send it back to the applet which gets displayed on the applet...
    But the problem is that the applet is not able to establish a connection with the servlet..
    I am also using another supportive class whose object is basically passed from the servlet to the applet..
    could u help me..
    below is the piece of code...
    APPLET:
    import java.net.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    public class TestApplet extends JApplet implements ActionListener
         JButton btnLoad;
         JTextField tfEmpno, tfFname, tfLname, tfSalary;
         URL url;
    private String webServerStr = null;
    private String hostName = "sandy";
    private int port = 8085;
    private String servletPath = "/jdbcTest.DBDetailsServlet";     
    public TestApplet()
         super();
    // suppress Warning Message
    getRootPane().putClientProperty"defeatSystemEventQueueCheck",Boolean.TRUE);
         public void actionPerformed(ActionEvent ae)
              if(btnLoad.getText().equals("Load"))
                   if(loadData())
                        btnLoad.setText("Save");
              else
                   btnLoad.setText("Load");
    //               saveData();
         public void init()
              setBackground(Color.pink);
              tfEmpno = new JTextField(10);
              tfFname = new JTextField(10);
              tfLname = new JTextField(10);
              tfSalary= new JTextField(10);
              JPanel panel = new JPanel();
              panel.setLayout(new FlowLayout());
              panel.add(tfEmpno);
              panel.add(tfFname);
              panel.add(tfLname);
              panel.add(tfSalary);
              getContentPane().add(panel, BorderLayout.CENTER);
              JPanel bottom = new JPanel(new FlowLayout());
              btnLoad = new JButton("Load");
              btnLoad.addActionListener(this);
              bottom.add(btnLoad);
              getContentPane().add(bottom, BorderLayout.SOUTH);
         public boolean loadData()
              try
         System.out.println("Web Server host name: " + hostName);
         webServerStr = "http://" + hostName + ":" + port + servletPath;
         System.out.println("Web String full = " + webServerStr);
                   String servletGET = webServerStr + "?"
         + URLEncoder.encode("UserOption") + "="
         + URLEncoder.encode("AppletDisplay");     
    //               url = new URL(getCodeBase(),"http://sandy:8080/servlet/jdbcTest.DBDetailsServlet");
                   System.out.println("Complete Servlet Url => " + servletGET);
                   url = new URL(servletGET);
                   URLConnection con = url.openConnection();
                   con.setUseCaches(false); // Turn off caching.
                   InputStream in = con.getInputStream();
                   System.out.println("\nsuccess ....... con.getInputStream() ");
                   ObjectInputStream ois = new ObjectInputStream(in);
                   System.out.println("\nsuccess ....... new ObjectInputStream(in) ");
                   Object object = ois.readObject();
                   System.out.println("\nGot the object from servlet...");
                   if(object != null)
                        System.out.println("\nObject NOT null ...");
                        ArrayList result = (ArrayList) object;
                        jdbcTest.EmployeeValue empval = (jdbcTest.EmployeeValue) result.get(0);
                        tfEmpno.setText(""+empval.getEmp_no());
                        tfFname.setText(empval.getFname());
                        tfLname.setText(empval.getLname());
                        tfSalary.setText(""+empval.getSalary());
                        System.out.println("\nObject processed " + result);
                        repaint();
                   return true;
              catch(Exception e)
                   e.printStackTrace();
                   System.out.println("\n\n loadData()=> E X C E P T I O N : " + e + "\n");
                   return false;               
         public void saveData()
              //yet to be implemented..
    SERVLEt:
    package jdbcTest;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class DBDetailsServlet extends HttpServlet
         public void doGet(HttpServletRequest req,HttpServletResponse res )throws ServletException, IOException
              System.out.println("\nInside the doGet()\n");
              ArrayList results = getDetails();
              ObjectOutputStream oos = new ObjectOutputStream(res.getOutputStream());
              oos.writeObject(results);
         public void doPost(HttpServletRequest req,HttpServletResponse res )throws ServletException, IOException
              System.out.println("\nInside the doPost()\n");
              doGet(req,res);
         public ArrayList getDetails()
              try
                   System.out.println("\nServlet : inside GetDetails...");
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   java.sql.Connection con = java.sql.DriverManager.getConnection("jdbc:odbc:SandyDSN","","");
                   java.sql.Statement stmt = con.createStatement();
                   System.out.println("\n Statement created..");
                   java.sql.ResultSet rs = stmt.executeQuery("SELECT * FROM EMP WHERE EMP_NO = 222");
                   System.out.println("\n Query Executed...");
                   ArrayList results = new ArrayList();
                   while(rs.next())
                        EmployeeValue empval = new EmployeeValue();
                        empval.setEmp_no(rs.getLong("EMP_NO"));
                        empval.setFname(rs.getString("FNAME"));
                        empval.setLname(rs.getString("LNAME"));
                        empval.setSalary(rs.getLong("SALARY"));
                        results.add(empval);
                   System.out.println("\n Resultset Obtained...");
                   stmt.close();
                   con.close();
                   return results;
              catch(Exception e)
                   System.out.println("Error while retreiving details....." + e);
                   return null;
         public boolean saveDetails(EmployeeValue empval)
              try
                   return true;
              catch(Exception e)
                   System.out.println("Error while updating details....." + e);
                   return false;
    The utility class EMployeeValue is as below:
    package jdbcTest;
    import java.io.*;
    class EmployeeValue implements Serializable
         private long emp_no;
         private String fname;
         private String lname;
         private long salary;
         public EmployeeValue()
              super();
         public EmployeeValue(long eno, String fn, String ln,long sal)
              super();
              setEmp_no(eno);
              setFname(fn);
              setLname(ln);
              setSalary(sal);
         public long getEmp_no()
              return emp_no;
         public java.lang.String getFname()
              return fname;
         public java.lang.String getLname()
              return lname;
         public long getSalary()
              return salary;
         public void setEmp_no(long newEmp_no)
              emp_no = newEmp_no;
         public void setFname(java.lang.String newFname)
              fname = newFname;
         public void setLname(java.lang.String newLname)
              lname = newLname;
         public void setSalary(long newSalary)
              salary = newSalary;

  • Java.io.InvalidClassException: org.jboss.proxy.Interceptor...

    Hi there,
    I'm working on a JSP running on a Tomcat server 4.0.1. Such JSP calls a Servlet, which tries to recover an EJB:
         public CommunityEJB getCommunityEJB() throws UnexpectedException
              CommunityEJB lRet = null;
              CommunityEJBHome lhome = null;
              Context jndiContext = null;
              try
                   lhome = (CommunityEJBHome) ServiceLocator.getInstance().getEJBHome(JNDINames.EJB_COMMUNITY);
                   lRet = lhome.create();
              catch (Exception e)
                   UnexpectedException ue = new UnexpectedException(e);
                   logger.throwing(CLASS_NAME, "getCommunityEJB", ue);
                   throw ue;
              return lRet;
    The EJB is recovered though JNDI, running on JBoss 3.2.1. Tomcat server and JBoss are running separately (Tomcat I'm using is not the embedded in JBoss).
    The code above throws the next exception:
    tuamo.core.exception.UnexpectedException: javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.proxy.Interceptor; local class incompatible: stream classdesc serialVersionUID = 4358098404672505200, local class serialVersionUID = 8774269974037850782]
    Can anybody help me with this?
    Thanks!!

    The EJB client jar is out of sync with the EJB server jars. In simple words, you might have recompiled any or all of the following and either only redeployed it on the server or dropped it in the client classpath depending on where did you make the changes.
    home interface
    remote interface
    types being passed over the methods in these interfaces (parameters, return values, etc.)
    I'm not quite sure what you mean by recovering an EJB? Typically its called looking it up.

  • Communication between Applets & Servlets

    How do you communicate in between Applets & Servlets ?

    http://forum.java.sun.com/thread.jsp?forum=45&thread=525518&start=0&range=15#2519429

  • Applet+servlet+standards

    Hi there,
    I am relatively new at java and i was asking myself one question :
    let's say i have an applet that "post" to a servlet to validate login and password against a database (so far it works well), what is the mean by wich (if the login password combination is good), i go to the next stage e.g. open a new applet-servlet combination ?
    I used to program with vbscript in .asp page (i know.....), and in that language there was the instruction redirect that allowed to redirect to another page when the results were being considered "valid", but i'm not sure that it is te way to do it in the applet-servlet world ...
    Any hints, tricks,approach, are welcome......
    thank you to all

    The servlet API includes a method to redirect a client to a new webpage. For example:
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
        // do validation
        // redirect client
        response.sendRedirect(redirectURL);
    }

  • Netscape problem with applet servlet communication

    Netscape always seems to get in the way when you use applets, right?
    I have a nice set of code from a book that shows how to do applet->servlet stuff.
    But although I'm doing this all in the privacy of my own localhost Netscape immediately put a spanner in the works with a security exception and wouldn't let the servlet respond.
    Anyone know what to do here.
    The answer is to use Internet Explorer, possibly, but I'm in linux, and I can't get Opera to work with java yet.
    Anyone got any ideas? Thanks.

    I encountered a security exception with Netscape in Linux when attempting applet-servlet stuff but that's prpbably because I haven't got the plugin for that yet...in fact I don't know if a plugin is available for sure...let me know if you do. As a matter of fact I plan on using the HTMLConverter this weekend to find out if it'll download a plugin.
    The applet-servlet thing runs fine in IE and Netscape on my Windows box as long as the plugins are there and I use the appropriate plugin tags in the HTML
    Post what you find out,
    Brad

  • Could not deserialize session data, java.io.InvalidClassException

    Whenever I click on logout link from Liferay(Which deployed as application on Weblogic 10.3),It shows below Exception in the console however i am able to logout sucessfully.
    Could not deserialize session data.
    java.io.InvalidClassException: org.hibernate.proxy.pojo.javassist.SerializableProxy; local class incompatible: stream classdesc serialVersionUID = 1180036893511205383, local class serialVersionUID = -2265249369383210104 at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:560)
    It seems to be Classpath polluted with different hibernate jars.But still not able to figure it out.Below is the jar files which i have in classpath.
    hibernate-annotations.jar
    hibernate-commons-annotations.jar
    hibernate-core.jar
    hibernate3.jar
    Application Server: Weblogic 10.3
    Any Help would be much appreciated.

    Sounds like you have two different versions of a class in the two applications.
              If you change a class implementation and recompile - the updated class gets a new UID. Looks like maybe one app has a jar with the older class and the other app has a jar with the new class.

Maybe you are looking for

  • Consolidating Music Files into Itunes - File Name Invalid/Too Long!

    When trying to consolidate music files into my library, I get an error message stating "Failed, The file name was invalid or too long." ???? I have tons of songs and don't know which file name is invalid or too long???

  • Strange issue with Notes For Approval field

    Hi All, Scenario one: While creating the shopping cart , in step3 screen there appers s a label Notes For Approval but the inputfield next to it was disabled and the creator can not enter any remarks in it. Login as approver , click on Approval link,

  • WEP key for Cisco 2100

    Hi I am having a lot of trouble trying to set a WEP, or any other key. When I am visiting 192.168.100.1 there is no option for log in or anything, only observe. The pages 192.168.0.1, 192.168.1.1 & 192.168.2.1 also time out every time. When I ping, t

  • Does there be any change in the dimensions of the project when published in a web browser ?

    Hello all. I am facing a problem with the dimensions of my project. I need my published project in the web browser must fit in the window without any scrolling. I started my project with the dimensions 1024*540. when I tested it at the initial stage

  • Counter output cards

    I am currently using PCI 6259 which has 2 counter outputs. Are there any counter cards that I can add to get 5-8 additional counter output? All the ones I see on NI and Measurement Computing website have maximum of two outputs. Solved! Go to Solution