4 Replies Latest reply on Feb 27, 2003 3:07 PM by adrian.brock

    Unable to lookup session bean from servlet

      Hi All,

      My JBoss installation: JBoss-3.0.0_Tomcat-4.0.3.
      -------------------------

      I'm looking up a stateless sessionbean from my servlet.

      My deployment structure is, i have a EAR file in which i have my WAR and JAR files.


      When i lookup my EJBHome i get a the following exception
      --------------------------------------------------------

      1. java.lang.reflect.InvocationTargetException:

      2. java.rmi.MarshalException: error marshalling arguments; nested exception is:

      3 java.net.SocketException: Connection aborted by peer: socket write error
      4. java.net.SocketException: Connection aborted by peer:
      socket write error
      at java.net.SocketOutputStream.socketWrite(Native Method)
      at java.net.SocketOutputStream.write(SocketOutputStream.java:96)
      at java.io.BufferedOutputStream.write(BufferedOutputStream.java:112)
      at java.io.ObjectOutputStream.drain(ObjectOutputStream.java:1463)
      at java.io.ObjectOutputStream.setBlockData(ObjectOutputStream.java:1486)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:407)
      at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:268)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:106)
      at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:128)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:73)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76)
      at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:185)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy490.create(Unknown Source)
      at java.lang.reflect.Method.invoke(Native Method)




      Greatly appreciate your help.


      Anitha
      (SE)-IIMS-New Zealand.

        • 1. Re: Unable to lookup session bean from servlet

          This says the client closed the connection for some
          reason.

          Why are you sending jndi requests over JRMP?
          Check for jndi.properties or any properties
          you pass to the intial context that includes
          provider.url

          You might also try 3.0.6

          Regards,
          Adrian

          • 2. Re: Unable to lookup session bean from servlet

            Thanks Adrian,

            I'am creating the InitialContext with the following properties in my servlet to look up a session bean.

            java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory

            java.naming.provider.url=localhost:1099

            java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces


            If i do not include provider url in my InitialContext properties i get the following exception.

            (Pls Note: my JBoss installation is JBoss-3.0.0_Tomcat-4.0.3)

            The Exception is :

            1.javax.naming.CommunicationException: Receive timed out.

            2. Root exception is java.io.InterruptedIOException: Receive timed out
            at java.net.PlainDatagramSocketImpl.receive(Native Method)
            at java.net.DatagramSocket.receive(DatagramSocket.java:392)
            at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:919)
            at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1009)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:436)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:429)


            Greatly appreciate your help

            Anitha
            (SE)-IIMS-New Zealand.

            • 3. Re: Unable to lookup session bean from servlet

              Thanks Adrian,

              I'am creating the InitialContext with the following properties in my servlet to look up a session bean.

              java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory

              java.naming.provider.url=localhost:1099

              java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces


              If i do not include provider url in my InitialContext properties i get the following exception.

              (Pls Note: my JBoss installation is JBoss-3.0.0_Tomcat-4.0.3)

              The Exception is :

              1.javax.naming.CommunicationException: Receive timed out.

              2. Root exception is java.io.InterruptedIOException: Receive timed out
              at java.net.PlainDatagramSocketImpl.receive(Native Method)
              at java.net.DatagramSocket.receive(DatagramSocket.java:392)
              at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:919)
              at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1009)
              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:436)
              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:429)


              Greatly appreciate your help

              Anitha
              (SE)-IIMS-New Zealand.

              • 4. Re: Unable to lookup session bean from servlet

                Use new InitialContext() with no properties.
                The properties should come from a jndi.properties
                which on the same server will use inVM local lookups
                rather than RMI.

                Your method should still work but it is way less
                efficient, I don't why it is timing out?

                Regards,
                Adrian