1 2 Previous Next 15 Replies Latest reply on Jan 10, 2002 9:37 AM by Adrian Brock

    home.create()

    oli306 Newbie

      I have the following problem :

      I have a session EJB that performs calls to data sources, something very common.
      If I call my EJB from a standalone application, it works fine.
      But if I include the EJB call in a servlet, I get an error :

      Starting service Tomcat-Apache
      Apache Tomcat/4.0
      Got context in ms 250
      Got reference to pricing in ms 953
      Got reference to bean's home interface in ms 828
      java.io.InvalidClassException: java.lang.ObjectMissing no-arg constructor for class
      java.io.InvalidClassException: java.lang.ObjectMissing no-arg constructor for class
      at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1350)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
      at java.rmi.MarshalledObject.get(MarshalledObject.java:138)
      at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:258)
      at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:182)
      at $Proxy0.create(Unknown Source)
      at ../.. my servlet : home.create();



      anybody have an idea ?

        • 1. Re: home.create()
          Adrian Brock Master

          Read the javadocs for java.io.Serializable.

          Your request is being marshalled between the web container and the ejb container which requires that
          the classes be serializable.

          Don't worry about the bean or home classes look at the
          parameters.

          Regards,
          Adrian

          • 2. Re: home.create()
            oli306 Newbie

            hi adrian,

            I've checked all the classes I use for parameters. All of them are serializable and have a no-arg constructor.



            • 3. Re: home.create()
              Adrian Brock Master

              In that case it must the class returned by
              home.create()
              This is one of those annoying java things.

              Anybody can claim

              implements Serializable

              in their class definition but you don't know it's
              not true until it falls over at runtime.

              Regards,
              Adrian

              • 4. Re: home.create()
                oli306 Newbie

                If it's a serialization problem, why don't I get this error from my standalone app ?

                • 5. Re: home.create()
                  Adrian Brock Master

                  What do you mean by standalone app.

                  Is it in the same VM or are you running a separate
                  client?

                  servlet to j2ee should be the same as
                  client to j2ee except servlet to j2ee can be optimized
                  if the web container runs in the same VM.
                  But the marshalling means you are running
                  non-optimized.

                  Regards,
                  Adrian

                  • 6. Re: home.create()
                    oli306 Newbie

                    I run a separate client with exactly the same code as the servlet for the ejb calls.
                    That's why I don't understand I get an error in one case only.







                    • 7. Re: home.create()
                      Adrian Brock Master

                      Do you have something configured differently,

                      e.g. You are using transactions or security in the
                      servlets but not in the client app?
                      It might be that this part isn't serializable?

                      Regards,
                      Adrian

                      • 8. Re: home.create()
                        oli306 Newbie

                        well, there's no special configuration with tomcat and I don't use transactions or security apis.
                        The only thing I'm sure about is that this problem comes from the arguments.For my tests, if I hardcode the parameters and remove the arguments, I get a successfull response.
                        I have now to understand why in a servlet it throws an exception and why it works fine from my command line app.
                        I'll try to go deeply in the tomcat configuration files to be sure there's not a special configuration I had not seen.
                        First of all, I will try with a new install of tomcat.
                        I will let you know if I find something that may help other guys.

                        Thanks a lot for your help Adrian.



                        • 9. Re: home.create()
                          Benjamin Hille Newbie

                          Have you tried with Jetty ? I had nightmares with Tomcat because of the classloader and swaped to Jetty and everything is fine now.
                          Benjamin

                          • 10. Re: home.create()
                            oli306 Newbie

                            maybe I should install jboss and tomcat from the bundle zip file available here.

                            Because I'm using a Tomcat instance installed far before jboss.

                            I'd prefer to continue using tomcat instead of switching to jetty because I have a lot of stuff in production running under tomcat.


                            • 11. Re: home.create()
                              Andreas Schouten Newbie

                              Hi Oli,

                              we used Tomcat and Jboss in two different VM's without problems.
                              Have You double checked, that the jBoss client classes and Your ejb classes in tomcat classpath /lib directory? And the version of the classes the same as under jBoss?

                              • 12. Re: home.create()
                                oli306 Newbie

                                yes, the classpath are corrects.

                                I have more details : if I refresh the servlet page in my browser, I get another error message for the second call :

                                java.lang.NoClassDefFoundError
                                at java.io.ObjectInputStream.allocateNewObject(Native Method)
                                at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1347)
                                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
                                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
                                at java.rmi.MarshalledObject.get(MarshalledObject.java:138)
                                at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:258)
                                at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:182)
                                at $Proxy0.create(Unknown Source)
                                at ...... my code : home.create();


                                But the first message is always this one at the top of this forum page

                                • 13. Re: home.create()
                                  Adrian Brock Master

                                  Perhaps you could try to reproduce this is a small
                                  test application and post the code.

                                  If it works for us, you know it's your configuration.

                                  If it doesn't work for us, we should be able to tell
                                  you why.

                                  You haven't mentioned which versions of JBoss and
                                  Tomcat you are using?

                                  Regards,
                                  Adrian

                                  • 14. Re: home.create()
                                    oli306 Newbie

                                    I use jboss2.4.3 and tomcat 4.0.

                                    I don't know how to send you my servlet code since I use many external apis like SAP access.

                                    I have a test application on command line. it works fine.



                                    regards,
                                    olivier



                                    1 2 Previous Next