7 Replies Latest reply on Apr 5, 2002 9:56 AM by Kenneth Roper

    Error deploying simple EJB

    Tony Piazza Newbie

      I am trying to deploy the simple HelloWorld.jar as described in Ed Roman's Mastering EJB book. When I launch JBoss I get the following:

      [INFO,AutoDeployer] Auto deploy of file:/C:/Server/jboss/deploy/HelloWorld.jar
      [INFO,J2eeDeployer] Deploy J2EE application: file:/C:/Server/jboss/deploy/HelloWorld.jar
      [INFO,J2eeDeployer] Create application HelloWorld.jar
      [INFO,J2eeDeployer] install EJB module HelloWorld.jar
      [INFO,ContainerFactory] Deploying:file:/C:/Server/jboss/tmp/deploy/Default/HelloWorld.jar
      [INFO,ContainerFactory] Deploying Hello
      [ERROR,ContainerFactory] DeploymentError
      java.lang.NoSuchMethodException
      at java.lang.Class.getMethod0(Native Method)
      at java.lang.Class.getMethod(Unknown Source)
      at org.jboss.ejb.StatelessSessionContainer.setUpBeanMappingImpl(StatelessSessionContainer.java:422)
      at org.jboss.ejb.StatelessSessionContainer.setupBeanMapping(StatelessSessionContainer.java:456)
      at org.jboss.ejb.StatelessSessionContainer.init(StatelessSessionContainer.java:155)
      at org.jboss.ejb.Application.init(Application.java:202)
      at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:372)
      at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:306)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.deployment.J2eeDeployer.startModules(J2eeDeployer.java:487)
      at org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:459)
      at org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:190)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.deployment.AutoDeployer.deploy(AutoDeployer.java:395)
      at org.jboss.deployment.AutoDeployer.run(AutoDeployer.java:233)
      at org.jboss.deployment.AutoDeployer.startService(AutoDeployer.java:371)
      at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:103)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(ConfigurationService.java:967)
      at $Proxy0.start(Unknown Source)
      at org.jboss.util.ServiceControl.start(ServiceControl.java:79)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.Main.(Main.java:208)
      at org.jboss.Main$1.run(Main.java:110)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.jboss.Main.main(Main.java:106)
      [ERROR,J2eeDeployer] Starting HelloWorld.jar failed!
      [ERROR,Default] java.lang.NullPointerException
      [ERROR,Default] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.stop(JRMPContainerInvoker.java:318)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.ejb.StatelessSessionContainer.stop(StatelessSessionContainer.java:220)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.ejb.Application.stop(Application.java:231)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:400)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:306)
      [ERROR,Default]
      [ERROR,Default] at java.lang.reflect.Method.invoke(Native Method)
      [ERROR,Default]
      [ERROR,Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [ERROR,Default]
      [ERROR,Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.deployment.J2eeDeployer.startModules(J2eeDeployer.java:487)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:459)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:190)
      [ERROR,Default]
      [ERROR,Default] at java.lang.reflect.Method.invoke(Native Method)
      [ERROR,Default]
      [ERROR,Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [ERROR,Default]
      [ERROR,Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.deployment.AutoDeployer.deploy(AutoDeployer.java:395)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.deployment.AutoDeployer.run(AutoDeployer.java:233)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.deployment.AutoDeployer.startService(AutoDeployer.java:371)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:103)
      [ERROR,Default]
      [ERROR,Default] at java.lang.reflect.Method.invoke(Native Method)
      [ERROR,Default]
      [ERROR,Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [ERROR,Default]
      [ERROR,Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(ConfigurationService.java:9
      7)
      [ERROR,Default]
      [ERROR,Default] at $Proxy0.start(Unknown Source)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.util.ServiceControl.start(ServiceControl.java:79)
      [ERROR,Default]
      [ERROR,Default] at java.lang.reflect.Method.invoke(Native Method)
      [ERROR,Default]
      [ERROR,Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [ERROR,Default]
      [ERROR,Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.Main.(Main.java:208)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.Main$1.run(Main.java:110)
      [ERROR,Default]
      [ERROR,Default] at java.security.AccessController.doPrivileged(Native Method)
      [ERROR,Default]
      [ERROR,Default] at org.jboss.Main.main(Main.java:106)
      [ERROR,Default]
      [INFO,J2eeDeployer] Module HelloWorld.jar is not running
      [INFO,J2eeDeployer] Destroying application HelloWorld.jar
      [ERROR,AutoDeployer] DeploymentInfo failed:file:/C:/Server/jboss/deploy/HelloWorld.jar
      org.jboss.deployment.J2eeDeploymentException: Error while starting HelloWorld.jar: null, Cause: java.lang.NullPointerEx
      eption
      at org.jboss.deployment.J2eeDeployer.startModules(J2eeDeployer.java:530)
      at org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:459)
      at org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:190)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.deployment.AutoDeployer.deploy(AutoDeployer.java:395)
      at org.jboss.deployment.AutoDeployer.run(AutoDeployer.java:233)
      at org.jboss.deployment.AutoDeployer.startService(AutoDeployer.java:371)
      at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:103)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(ConfigurationService.java:967)
      at $Proxy0.start(Unknown Source)
      at org.jboss.util.ServiceControl.start(ServiceControl.java:79)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.Main.(Main.java:208)
      at org.jboss.Main$1.run(Main.java:110)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.jboss.Main.main(Main.java:106)

      I am having difficulty determining what is wrong. It would be great if I could learn how to read the stack trace and figure out what went wrong.

      Any help you can give me would be greatly appreciated!

        • 1. Re: Error deploying simple EJB
          Adrian Brock Master

          Hi,

          The NoSuchMethodException doesn't report the name of the
          missing method :-(

          Your problem is that you have a method declared in your
          remote interface that your bean class does not implement.

          If you can't spot it, try posting the code.

          Regards,
          Adrian

          • 2. Re: Error deploying simple EJB
            Tony Piazza Newbie

            Adrian,

            You were exactly right! Thanks much for your assistance. My next question is how did you figure that out from the information I gave you?

            Tony

            • 3. Re: Error deploying simple EJB
              Tony Piazza Newbie

              Now I am having trouble doing a lookup on the initial context. Here is my code:

              Properties props = System.getProperties();

              props.setProperty( "java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory" );
              props.setProperty( "java.naming.provider.url", "localhost:1099" );
              props.setProperty( "java.naming.factory.url.pkgs", "org.jboss.naming" );

              Context ctx = new InitialContext( props );

              Object obj = ctx.lookup( "HelloHome" );

              When I run this I get the following output:

              javax.naming.NameNotFoundException: HelloHome not bound
              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.jnp.server.NamingServer_Stub.lookup(Unknown Source)
              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:349)
              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:333)
              at javax.naming.InitialContext.lookup(InitialContext.java:350)
              at examples.HelloClient.main(HelloClient.java:29)
              Exception in thread "main"

              I am using a default JBoss/Catalina configuration. Any ideas as to what is causing the problem? Thanks again.

              Tony

              • 4. Re: Error deploying simple EJB
                Adrian Brock Master

                Is the <ejb-name> of the bean HelloHome?

                Have you changed the <jndi-name> using jboss.xml?

                Regards,
                Adrian

                • 5. Re: Error deploying simple EJB
                  Tony Piazza Newbie

                  Adrian,

                  To answer your questions:

                  >Is the <ejb-name> of the bean HelloHome?

                  The <ejb-name> is Hello.

                  >Have you changed the <jndi-name> using jboss.xml?

                  I do not have a jboss.xml file.

                  I have attached my jar file for you to look at. Thanks for your help!

                  Tony

                  • 6. Re: Error deploying simple EJB
                    Alice Newbie

                    ctx.lookup("Hello");

                    you should "lookup" for <ejb-name> value (unless u override it by some other name using jndi-name in jboss.xml)

                    • 7. Re: Error deploying simple EJB
                      Kenneth Roper Newbie

                      Aaaarrrrggghh! This was horrible to debug!

                      I got the same error, it was indeed because my remote EJB interface declared methods not implemented by the bean, but try debugging this when you have 30 EJBs with 2 - 8 methods each, and it is not obvious which EJBs have been modified! With no automatic tools, I had to manually read all the source files and compare the remote to bean classes ... two hours later I can finally deploy my jar again.

                      It would be really nice to put a bit of error handling in the JBoss code to print out the faulty bean, or the method name.