8 Replies Latest reply on Sep 20, 2002 7:42 AM by Sascha

    Problem with running ejb

    Sascha Newbie

      Hi,

      I've written a session bean cart. The cart has an addItem method, which has a parameter Item. Deployment is ok, but when I run my testclient and call the methode addItem, then I will get the following output in JBuilder 6 EE:

      C:\Programme\JBuilder6\jdk1.3.1\bin\javaw -classpath "U:\sbenkart\sandkasten\WebOrderSystem\classes;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\crimson.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\bin\run.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\bin\shutdown.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\concurrent.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\getopt.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\jaxp.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\jboss-boot.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\jboss-common.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\jboss-jmx.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\jboss-system.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\log4j-boot.jar;C:\Programme\j2sdkee1.3.1\lib\j2ee.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\concurrent.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\gnu-regexp.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jaas.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jacorb.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jboss-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jboss-common-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jbossha-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jboss-iiop-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jboss-j2ee.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jboss-jsr77.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jbossmq-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jbossmqha.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jboss-net-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jbosssx-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jboss-system-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jcert.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jmx-connector-client-factory.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jmx-ejb-connector-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jmx-rmi-connector-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jnet.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jnp-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jsse.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\log4j.jar;C:\Programme\JBuilder6\jdk1.3.1\demo\jfc\Java2D\Java2Demo.jar;C:\Programme\JBuilder6\jdk1.3.1\jre\lib\i18n.jar;C:\Programme\JBuilder6\jdk1.3.1\jre\lib\jaws.jar;C:\Programme\JBuilder6\jdk1.3.1\jre\lib\rt.jar;C:\Programme\JBuilder6\jdk1.3.1\jre\lib\sunrsasign.jar;C:\Programme\JBuilder6\jdk1.3.1\lib\dt.jar;C:\Programme\JBuilder6\jdk1.3.1\lib\htmlconverter.jar;C:\Programme\JBuilder6\jdk1.3.1\lib\tools.jar" -Duser.dir=C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\bin -Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserFactoryImpl -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.crimson.jaxp.DocumentBuilderFactoryImpl de.sam.webordersystem.shoppingcart.ShoppingCartTestClient1
      -- Initializing bean access.

      -- Succeeded initializing bean access.

      -- Execution time: 1442 ms.

      -- Calling create()

      -- Succeeded: create()

      -- Execution time: 571 ms.

      -- Return value from create(): ShoppingCart:1032431133887.

      -- Set ShoppingCardID to 10

      -- ShoppingCardID is 10 now!

      -- Add items to basket

      Error message: RemoteException occurred in server thread; nested exception is:
      java.rmi.ServerException: null
      Embedded Exception
      null; nested exception is:
      javax.ejb.EJBException: nested exception is: java.lang.NullPointerExceptionjava.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      java.rmi.ServerException: null
      Embedded Exception
      null; nested exception is:
      javax.ejb.EJBException: nested exception is: java.lang.NullPointerException

      java.rmi.ServerException: null
      Embedded Exception
      null; nested exception is:
      javax.ejb.EJBException: nested exception is: java.lang.NullPointerException

      javax.ejb.EJBException: nested exception is: java.lang.NullPointerException



      java.lang.NullPointerException

      <<no stack trace available>>

      javax.ejb.EJBException: nested exception is: java.lang.NullPointerException

      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)

      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)

      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)

      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.StatefulSessionInterceptor.invoke(StatefulSessionInterceptor.java:117)

      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)

      at $Proxy1.addItem(Unknown Source)

      at de.sam.webordersystem.shoppingcart.ShoppingCartTestClient1.testBasket(ShoppingCartTestClient1.java:442)

      at de.sam.webordersystem.shoppingcart.ShoppingCartTestClient1.(ShoppingCartTestClient1.java:56)

      at de.sam.webordersystem.shoppingcart.ShoppingCartTestClient1.main(ShoppingCartTestClient1.java:486)

      I really don't know what's the problem. I think JBoss cannot find the Item class. But JBoss doesn't throws an error in his dos box. So maybe a problem of the client? The Item class is in the same package as the Cart Bean.
      Any ideas?

        • 1. Re: Problem with running ejb
          Adrian Brock Master

          Try wrapping your addItem method with

          try
          {
          ...
          }
          catch (Exception e)
          {
          e.printStackTrace();
          throw e;
          }

          Regards,
          Adrian

          • 2. Re: Problem with running ejb
            Sascha Newbie

            To put the addItem method into a try-catch-construct doesn't helps. The problem is, that I can't call the addItem method. If I put it into the try-catch-construct I only catch the Exception, but nothing more. I don't know why JBoss is not able to find the Item class. In the error output I found a line "at $Proxy1.addItem(Unknown Source)". So I think JBoss is not able to find the Item class. The methos signature is "addItem(Item item)". The Item class is in the jar file togehter with the cart bean. I put all this in to the deploy directory. Then I put the Item class into the lib directory. But nothing happens. The Item is not a bean, it's a Java class. Borland has a similar example in the examples files of Bolrand Enterprise Server.

            • 3. Re: Problem with running ejb
              Adrian Brock Master

              addItem(Unknown Class) is a red herring,
              it is a dynamic proxy in front of your bean.

              I suggested adding the try/catch so you can see where
              the NPE is thrown.

              Regards,
              Adrian

              • 4. Re: Problem with running ejb
                Mikael Eriksson Novice

                The log you have given is the client log.

                If you look in the server log its probably easier
                to find the cause of the exception.

                Regards

                • 5. Re: Problem with running ejb
                  Sascha Newbie

                  Now I have put the addItem call in the client into a try-catch-structure. The error is now:

                  C:\Programme\JBuilder6\jdk1.3.1\bin\javaw -classpath "U:\sbenkart\sandkasten\WebOrderSystem\classes;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\crimson.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\bin\run.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\bin\shutdown.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\concurrent.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\getopt.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\jaxp.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\jboss-boot.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\jboss-common.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\jboss-jmx.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\jboss-system.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\lib\log4j-boot.jar;C:\Programme\j2sdkee1.3.1\lib\j2ee.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\concurrent.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\gnu-regexp.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jaas.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jacorb.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jboss-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jboss-common-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jbossha-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jboss-iiop-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jboss-j2ee.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jboss-jsr77.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jbossmq-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jbossmqha.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jboss-net-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jbosssx-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jboss-system-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jcert.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jmx-connector-client-factory.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jmx-ejb-connector-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jmx-rmi-connector-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jnet.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jnp-client.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\jsse.jar;C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\client\log4j.jar;C:\Programme\JBuilder6\jdk1.3.1\demo\jfc\Java2D\Java2Demo.jar;C:\Programme\JBuilder6\jdk1.3.1\jre\lib\i18n.jar;C:\Programme\JBuilder6\jdk1.3.1\jre\lib\jaws.jar;C:\Programme\JBuilder6\jdk1.3.1\jre\lib\rt.jar;C:\Programme\JBuilder6\jdk1.3.1\jre\lib\sunrsasign.jar;C:\Programme\JBuilder6\jdk1.3.1\lib\dt.jar;C:\Programme\JBuilder6\jdk1.3.1\lib\htmlconverter.jar;C:\Programme\JBuilder6\jdk1.3.1\lib\tools.jar" -Duser.dir=C:\Programme\JBuilder6\jboss-3.0.0_tomcat-4.0.3\bin -Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserFactoryImpl -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.crimson.jaxp.DocumentBuilderFactoryImpl de.sam.webordersystem.shoppingcart.ShoppingCartTestClient1
                  -- Initializing bean access.

                  -- Succeeded initializing bean access.

                  -- Execution time: 1442 ms.

                  -- Calling create()

                  -- Succeeded: create()

                  -- Execution time: 801 ms.

                  -- Return value from create(): ShoppingCart:1032516732986.

                  -- Set ShoppingCardID to 10

                  -- ShoppingCardID is 10 now!

                  -- Add items to basket

                  java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
                  java.rmi.ServerException: null
                  Embedded Exception
                  null; nested exception is:
                  javax.ejb.EJBException: nested exception is: java.lang.NullPointerException

                  java.rmi.ServerException: null
                  Embedded Exception
                  null; nested exception is:
                  javax.ejb.EJBException: nested exception is: java.lang.NullPointerException

                  javax.ejb.EJBException: nested exception is: java.lang.NullPointerExceptionError message: RemoteException occurred in server thread; nested exception is:
                  java.rmi.ServerException: null
                  Embedded Exception
                  null; nested exception is:
                  javax.ejb.EJBException: nested exception is: java.lang.NullPointerException



                  java.lang.NullPointerException

                  <<no stack trace available>>

                  javax.ejb.EJBException: nested exception is: java.lang.NullPointerException

                  at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)

                  at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)

                  at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)

                  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.StatefulSessionInterceptor.invoke(StatefulSessionInterceptor.java:117)

                  at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)

                  at $Proxy1.addItem(Unknown Source)

                  at de.sam.webordersystem.shoppingcart.ShoppingCartTestClient1.testBasket(ShoppingCartTestClient1.java:442)

                  at de.sam.webordersystem.shoppingcart.ShoppingCartTestClient1.(ShoppingCartTestClient1.java:56)

                  at de.sam.webordersystem.shoppingcart.ShoppingCartTestClient1.main(ShoppingCartTestClient1.java:486)


                  I had a look at the server log file. But this file is empty.

                  • 6. Re: Problem with running ejb
                    Sascha Newbie

                    Now I have tested a new addItem() method. This method has no parameters. It's not a problem to call this method.

                    The ShoppingCart bean uses the Item class. Item class is not a bean. My test client creates an new Item item and put it to the basket while calling addItem(item). If I put an ouput at the first line of addItem(Item item), nothing will be displayed. This means, that the method can't ba called from the client.

                    • 7. Re: Problem with running ejb
                      Sascha Newbie

                      Addition: the item I send to addItem is not null.

                      • 8. Re: Problem with running ejb
                        Sascha Newbie

                        I've zipped my JBuilder 6 project. Maybe it is esier to help me.