4 Replies Latest reply on Sep 9, 2008 4:03 PM by Celinio Fernandes

    java.lang.NullPointerException with EJB 3 stateless web ser

    Celinio Fernandes Novice

      Hi,
      I get an error while deploying a Stateless session bean defined as a web service on JBoss 5 CR1.
      It seems to be a problem of version of JRE since it works with JRE 5 but does not work with JRE 6.
      I am using Eclipse 3.4

      My interface looks like this :
      @WebService
      @SOAPBinding(style = Style.RPC)
      public interface Test extends Remote {
      ...
      }

      My bean looks like this :

      @Stateless
      @WebService(endpointInterface ="Test")
      @Remote(Test.class)
      public class TestBean {
      ...
      }

      It deploys with jre 1.5 but it fails miserably using jre 1.6. Here is the stack trace (the web services are developped inside the VenteEnLigneEJB project, with Eclipse 3.4):

      2:18:19,835 ERROR [AbstractKernelController] Error installing to Real: name=vfszip:/D:/EJB3/jboss-5.0.0.CR1/server/default/deploy/VenteEnLigne.ear state=PreReal mode=Manual requiredState=Real
      org.jboss.deployers.spi.DeploymentException: Error during deploy: vfszip:/D:/DeveloppementEJB3/jboss-5.0.0.CR1/server/default/deploy/VenteEnLigne.ear/VenteEnLigneEJB.jar
       at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
       at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:180)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:970)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1023)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:911)
       at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1392)
       at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:784)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:912)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:834)
       at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:672)
       at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:455)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:594)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:541)
       at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:257)
       at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:135)
       at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:409)
       at org.jboss.Main.boot(Main.java:209)
       at org.jboss.Main$1.run(Main.java:544)
       at java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.NullPointerException
       at org.jboss.wsf.common.KernelAwareSPIFactory.getKernelProvidedSPI(KernelAwareSPIFactory.java:40)
       at org.jboss.wsf.framework.DefaultWSFRuntimeLocator.locateRuntime(DefaultWSFRuntimeLocator.java:36)
       at org.jboss.wsf.container.jboss50.deployer.AbstractDeployerHook.getWsfRuntime(AbstractDeployerHook.java:59)
       at org.jboss.wsf.container.jboss50.deployer.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:86)
       at org.jboss.wsf.container.jboss50.deployer.AbstractDeployerHookEJB.deploy(AbstractDeployerHookEJB.java:43)
       at org.jboss.wsf.container.jboss50.deployer.AbstractWebServiceDeployer.internalDeploy(AbstractWebServiceDeployer.java:62)
       at org.jboss.wsf.container.jboss50.deployer.WebServiceDeployerEJB.internalDeploy(WebServiceDeployerEJB.java:95)
       at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
       at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:174)
       ... 18 more
      22:18:19,899 INFO [NativeServerConfig] JBoss Web Services - Stack Native Core
      22:18:19,899 INFO [NativeServerConfig] 3.0.2.GA
      


      And the version of java that i use :

      22:17:15,871 INFO [CopyMechanism] VFS temp dir: D:\EJB3\jboss-5.0.0.CR1\server\default\tmp
      22:17:15,885 INFO [ZipEntryContext] VFS force nested jars copy-mode is enabled.
      22:17:16,787 INFO [ServerInfo] Java version: 1.6.0_07,Sun Microsystems Inc.
      22:17:16,787 INFO [ServerInfo] Java VM: Java HotSpot(TM) Client VM 10.0-b23,Sun Microsystems Inc.
      22:17:16,787 INFO [ServerInfo] OS-System: Windows Vista 6.0,x86
      



      If i comment out the annotations @Webservice on the class AND the interface, it deploys correctly, no error.

      Does anyone know what is wrong here ?

      Thanks

        • 1. Re:  java.lang.NullPointerException with EJB 3 stateless web
          jaikiran pai Master

           

          "longbeach" wrote:

          It deploys with jre 1.5 but it fails miserably using jre 1.6.


          I don't know how you got this working on jre 1.5. I tried out a simple example in my application:

          package org.myapp.webservice;
          
          import javax.jws.WebService;
          import javax.jws.soap.SOAPBinding;
          import javax.jws.soap.SOAPBinding.Style;
          
          @WebService
          @SOAPBinding(style = Style.RPC)
          public interface AppService {
          
           void sayHello(String user);
          
          }
          



          package org.myapp.webservice;
          
          import javax.jws.WebService;
          
          @WebService (endpointInterface="org.myapp.webservice.AppService")
          public class AppServiceImpl implements AppService {
          
           public void sayHello(String user) {
           System.out.println("Hello " + user);
          
           }
          
          
          }
          


          Packaged this in a EAR file and placed it in deploy folder of JBoss-5 CR1 with JDK 1.5

          13:54:30,148 INFO [ServerInfo] Java version: 1.5.0_10,Sun Microsystems Inc.
          13:54:30,257 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 1.5.0_10-b03,Sun Microsystems Inc.
          13:54:30,257 INFO [ServerInfo] OS-System: Windows 2003 5.2,x86
          


          Started JBoss. But the startup failed with the same exception as what you see:
          13:55:52,195 ERROR [AbstractKernelController] Error installing to Real: name=vfsfile:/D:/jboss-5.0.0.CR1/server/jaikiran/deploy/ZEJB3Persistence.ear/ state=PreReal mode=Manual requiredState=Real
          org.jboss.deployers.spi.DeploymentException: Error during deploy: vfsfile:/D:/jboss-5.0.0.CR1/server/jaikiran/deploy/ZEJB3Persistence.ear/myapp_ejb3.jar/
           at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
           at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:180)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:970)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1023)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:911)
           at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
           at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1392)
           at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:784)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:912)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:834)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:672)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:455)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:594)
           at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:541)
           at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:257)
           at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:135)
           at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:409)
           at org.jboss.Main.boot(Main.java:209)
           at org.jboss.Main$1.run(Main.java:544)
           at java.lang.Thread.run(Thread.java:595)
          Caused by: java.lang.NullPointerException
           at org.jboss.wsf.common.KernelAwareSPIFactory.getKernelProvidedSPI(KernelAwareSPIFactory.java:40)
           at org.jboss.wsf.framework.DefaultWSFRuntimeLocator.locateRuntime(DefaultWSFRuntimeLocator.java:36)
           at org.jboss.wsf.container.jboss50.deployer.AbstractDeployerHook.getWsfRuntime(AbstractDeployerHook.java:59)
           at org.jboss.wsf.container.jboss50.deployer.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:86)
           at org.jboss.wsf.container.jboss50.deployer.AbstractDeployerHookEJB.deploy(AbstractDeployerHookEJB.java:43)
           at org.jboss.wsf.container.jboss50.deployer.AbstractWebServiceDeployer.internalDeploy(AbstractWebServiceDeployer.java:62)
           at org.jboss.wsf.container.jboss50.deployer.WebServiceDeployerEJB.internalDeploy(WebServiceDeployerEJB.java:95)
           at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
           at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:174)
           ... 18 more
          13:55:52,305 INFO [NativeServerConfig] JBoss Web Services - Stack Native Core
          13:55:52,305 INFO [NativeServerConfig] 3.0.2.GA
          


          Going by the logs, this looks like deployment ordering issue in CR1.

          As a workaround, i stopped JBoss. Removed the EAR from the deploy folder of JBoss. Then started JBoss (without the EAR file). Once the server had started successfully, i copied the EAR containing this webservice to the deploy folder. The hot deployer picked up the deployment and successfully deployed the applicaiton.

          • 2. Re:  java.lang.NullPointerException with EJB 3 stateless web
            jaikiran pai Master

             

            "jaikiran" wrote:

            As a workaround, i stopped JBoss. Removed the EAR from the deploy folder of JBoss. Then started JBoss (without the EAR file). Once the server had started successfully, i copied the EAR containing this webservice to the deploy folder. The hot deployer picked up the deployment and successfully deployed the applicaiton.


            Another workaround is to create a folder named "deploy.last" in %JBOSS_HOME%/server/default/deploy and place your application in that folder and start JBoss.

            • 3. Re:  java.lang.NullPointerException with EJB 3 stateless web
              jaikiran pai Master

              Just found this JIRA https://jira.jboss.org/jira/browse/JBWS-2246 which talks about a SAR deployment failure. Seems applicable to EAR deployment too.

              • 4. Re:  java.lang.NullPointerException with EJB 3 stateless web
                Celinio Fernandes Novice

                hi,
                i tried what you did, using JRE 1.6

                I removed the ear, started JBoss 5, then i copied the ear file and the deployment works.
                Thanks. That seems to help.

                I have not tested it yet though. Hope there is no problem.