8 Replies Latest reply on Jul 22, 2011 7:45 PM by abhi0123

    JAX-WS service with EJB endpoint would not deploy

    abhi0123

      Simple JAX-WS service with EJB endpoint fails to deploy. The AS7 does not seem to handle Web Services well at all. This is the 3rd problem that I found. Service deploys just fine in other Java EE 6 compliant servers.

       

      MovieServiceEJB.java


      {code}

      @Stateless

      @WebService

      @SOAPBinding(style = Style.DOCUMENT, parameterStyle = ParameterStyle.WRAPPED, use = Use.LITERAL)

      public interface MovieServiceEJB {

       

          @WebMethod(operationName = "getMovies")

          public OrderedAssembly<Movie> getMovieSet(

              @WebParam(name = "inputDirpath") String path) throws IOException;

      }

      {code}

       

      MovieServiceEJBImpl.java

       

      {code}

      @Stateless

      @WebService(name = "movieservice", serviceName = "movieServiceEjb", targetNamespace = "http://name.app.abhi/movieservice/ejb", endpointInterface = "name.app.abhi.movieservice.ejb.service.MovieServiceEJB")

      public class MovieServiceEJBImpl implements MovieServiceEJB {

          private MovieServiceImpl movieService = new MovieServiceImpl();

       

          @Override

          public OrderedAssembly<Movie> getMovieSet(String path) throws IOException {

          SortedSet<Movie> movieSet = movieService.getMovieSet(path);

          return new OrderedAssembly<Movie>(movieSet,

              new MovieComparator<Movie>());

          }

      }

      {code}

       

       

      {code}

      08:14:19,275 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.subunit."movie-service-ear-1.0-SNAPSHOT.ear"."movie-service-ejb-1.0-SNAPSHOT.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."movie-service-ear-1.0-SNAPSHOT.ear"."movie-service-ejb-1.0-SNAPSHOT.jar".INSTALL: Failed to process phase INSTALL of subdeployment "movie-service-ejb-1.0-SNAPSHOT.jar" of deployment "movie-service-ear-1.0-SNAPSHOT.ear"

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)

          at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]

          at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]

      Caused by: java.lang.RuntimeException: java.lang.InstantiationException: name.app.abhi.movieservice.ejb.service.MovieServiceEJB

          at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.newInstance(NonSpringBusHolder.java:170)

          at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.configure(NonSpringBusHolder.java:93)

          at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:109)

          at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:132)

          at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.internalDeploy(AspectDeploymentProcessor.java:78)

          at org.jboss.as.webservices.deployers.TCCLDeploymentProcessor.deploy(TCCLDeploymentProcessor.java:42)

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)

          ... 5 more

      Caused by: java.lang.InstantiationException: name.app.abhi.movieservice.ejb.service.MovieServiceEJB

          at java.lang.Class.newInstance0(Class.java:340) [:1.6.0_26]

          at java.lang.Class.newInstance(Class.java:308) [:1.6.0_26]

          at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.newInstance(NonSpringBusHolder.java:166)

          ... 11 more

      {code}

       

        • 1. Re: JAX-WS service with EJB endpoint would not deploy
          jaikiran

          Caused by: java.lang.InstantiationException: name.app.abhi.movieservice.ejb.service.MovieServiceEJB

          It looks like it's trying to instantiate a interface instead of the bean implementation. Can you attach the application?

          • 2. Re: JAX-WS service with EJB endpoint would not deploy
            jaikiran

            Never mind, found the problem in your code:

             

            @Stateless
            @WebService
            @SOAPBinding(style = Style.DOCUMENT, parameterStyle = ParameterStyle.WRAPPED, use = Use.LITERAL)
            public interface MovieServiceEJB {

            You shouldn't add @Stateless on a interface. I'll add a JIRA to log a WARN for that and not pick it up as a session bean.

            • 3. Re: JAX-WS service with EJB endpoint would not deploy
              abhi0123

              jaikiran pai wrote:

               

              You shouldn't add @Stateless on a interface.

              I do not agree that @Stateless shouldn't be applied to an interface. The annotation target allows for interfaces and there is nothing in the spec preventing that. On the contrary, there are available examples which annotate similarly. JBoss AS should not warn the user against doing that. It may just ignore the annotation if present on an interface.

              Nevertheless, I'll try that after I get off work today.

              • 4. Re: JAX-WS service with EJB endpoint would not deploy
                jaikiran

                abhi0123 wrote:

                 

                jaikiran pai wrote:

                 

                You shouldn't add @Stateless on a interface.

                I do not agree that @Stateless shouldn't be applied to an interface. The annotation target allows for interfaces and there is nothing in the spec preventing that. On the contrary, there are available examples which annotate similarly. JBoss AS should not warn the user against doing that.

                EJB3.1 spec, section 4.9.2 has the rules. Which examples show the use of @Stateless on an interface?

                • 5. Re: JAX-WS service with EJB endpoint would not deploy
                  abhi0123

                  jaikiran pai wrote:

                   

                  EJB3.1 spec, section 4.9.2 has the rules.

                  I have attached the "JSR-000318 Enterprise JavaBeans 3.1 Maintenance Release specification". Section 4.9.7 is the "Session Bean's Business Interface". I do not see anything preventing a @Stateless annotation on the Business Interface.

                   

                  I am not trying to be confrontational or anything; I just think one of us is missing to see something.

                   

                  jaikiran pai wrote:

                   

                  Which examples show the use of @Stateless on an interface?

                  I will find and post the examples. Most probably they were from a book.

                  • 6. Re: JAX-WS service with EJB endpoint would not deploy
                    jaikiran

                    abhi0123 wrote:

                     

                    jaikiran pai wrote:

                     

                    EJB3.1 spec, section 4.9.2 has the rules.

                    I have attached the "JSR-000318 Enterprise JavaBeans 3.1 Maintenance Release specification". Section 4.9.7 is the "Session Bean's Business Interface". I do not see anything preventing a @Stateless annotation on the Business Interface.

                     

                    The point you are missing is the presence of a @Stateless annotation on a interface shouldn't make that interface a EJB bean class.

                     

                    To make it more clear, see section 4.3.1 which says:

                     

                    The Stateful and Singleton and Stateless annotations are component-defining annotations and are applied to the bean class.

                    Furthermore, section 4.9.2 has the complete set of rules applicable for the session bean class.

                    • 7. Re: JAX-WS service with EJB endpoint would not deploy
                      jaikiran

                      abhi0123 wrote:

                       

                      I am not trying to be confrontational or anything;

                      No worries, I understand 

                      • 8. Re: JAX-WS service with EJB endpoint would not deploy
                        abhi0123

                        Removing @Stateless from over interface worked. The service got successfully deployed.