2 Replies Latest reply on Apr 21, 2002 9:53 AM by Richard Grantham

    Unable to find a session bean in a servlet

    Richard Grantham Newbie

      Apologies if this is the wrong group to post to but this is an issue that's only affecting a servlet.

      I am trying to locate a session bean I have written in deployed in a servlet yet I receive this exception when lookup(...) is called:

      13:33:27,469 ERROR [Default] javax.naming.CommunicationException. Root exception is
      13:33:27,491 ERROR [Default] java.io.InvalidClassException: java.lang.ObjectMissing no-arg constructor for class
      13:33:27,493 ERROR [Default] at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1350)
      13:33:27,494 ERROR [Default] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
      13:33:27,495 ERROR [Default] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
      13:33:27,497 ERROR [Default] at java.rmi.MarshalledObject.get(MarshalledObject.java:138)
      13:33:27,519 ERROR [Default] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:369)
      13:33:27,520 ERROR [Default] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:349)
      13:33:27,521 ERROR [Default] at javax.naming.InitialContext.lookup(InitialContext.java:350)
      13:33:27,523 ERROR [Default] at MainServlet.getAdministratorSession(MainServlet.java:137)

      Cut down, of course.

      My question is why is this happening? A test client works and can find the session bean quite happily with no problems and they both use the same code to do this. The servlet is having no problems locating an entity bean just this session bean.

      Cheers.

      Rilux

        • 1. Re: Unable to find a session bean in a servlet
          Adrian Brock Master

          Quite a few people have reported this or a similar
          problem.

          I think this has been fixed in latest CVS, but I'm
          going to test this for myself this weekend.

          Regards,
          Adrian

          • 2. Re: Unable to find a session bean in a servlet
            Richard Grantham Newbie

            OK, well I seem to have fixed this without getting anything from CVS. Here is my setup and how I solved it.

            I have the EJB .jar file and the servlet .war file deployed separately - to together in a .ear file. Consequenly I have a lib directory in the .war file containing a jar file with the interfaces I was using. On an unrelated problem with a different class I was trying to use a 'find' method I had written. I was getting exceptions when trying to execute this method and was being told it didn't exist.

            Well, obviously probably, the jar in WEB-INF/lib was out of date. I couldn't be arsed to make a new one so I just copied the EJB jar file into that directory and packaged it all up.

            When I deployed the web application and EJB's not only had was the 'find' method working but the session bean also worked and I was a slightly happier camper.

            Rilux