javaeetutorial
  1. javaeetutorial
  2. JAVAEETUTORIAL-250

54.5 The jobs Concurrency Example missing info and won't run

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Works as designed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: examples
    • Labels:
      None
    • Environment:

      JavaEE 7.0.21, glassfish-4.0.1-b03

      Description

      I followed the tutorial http://docs.oracle.com/javaee/7/tutorial/doc/concurrency-utilities005.htm#CIHCGGEG (54.5 The jobs Concurrency Example) and there is a configuration options missing.

      • I had to set glassfish.home.prefix property in docs/javaee-tutorial/examples/pom.xml and nowhere does the Tutorial or that documentation say to do this

      And then once fixed I couldn't get to work in Netbeans or through Maven as discussed. The reasons are:

      • Firstly was due to an empty beans.xml file - /docs/javaee-tutorial/examples/concurrency/jobs/src/main/webapp/WEB-INF/beans.xml
      • Second was an error I could not work out without becoming more familiar with the code which I don't have time to do now (when all I want to do is see the examples working as described). The error is as below.

      I'm looking forward to seeing this working!

      Cheers,

      Brooke

      2013-09-23 10:47:01 .390+1000 [SEVERE] - WebModule[/jobs]StandardWrapper.Throwable
      java.lang.IllegalStateException: Error when configuring to use the EJB interceptor binding API. JAX-RS EJB integration can not be supported.
      at org.glassfish.jersey.gf.ejb.EjbComponentProvider.registerEjbInterceptor(EjbComponentProvider.java:167)
      at org.glassfish.jersey.gf.ejb.EjbComponentProvider.bind(EjbComponentProvider.java:199)
      ...
      Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.glassfish.jersey.gf.ejb.EjbComponentProvider.registerEjbInterceptor(EjbComponentProvider.java:162)
      ... 92 more
      Caused by: java.lang.NullPointerException
      at com.sun.ejb.containers.InternalInterceptorBindingImpl.registerInterceptor(InternalInterceptorBindingImpl.java:97)
      ... 97 more
      2013-09-23 10:47:01 .391+1000 [SEVERE] - WebModule[/jobs]Servlet /jobs threw load() exception
      java.lang.NullPointerException
      at com.sun.ejb.containers.InternalInterceptorBindingImpl.registerInterceptor(InternalInterceptorBindingImpl.java:97)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      ...
      2013-09-23 10:47:01 .391+1000 [SEVERE] - Startup of context /jobs failed due to previous errors]]
      2013-09-23 10:47:01 .395+1000 [SEVERE] - ContainerBase.addChild: start:
      org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.NullPointerException
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:5954)
      at com.sun.enterprise.web.WebModule.start(WebModule.java:691)
      ...
      Caused by: org.apache.catalina.LifecycleException: java.lang.NullPointerException
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5712)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:5946)
      ... 72 more
      Caused by: java.lang.NullPointerException
      at com.sun.ejb.containers.InternalInterceptorBindingImpl.registerInterceptor(InternalInterceptorBindingImpl.java:97)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.glassfish.jersey.gf.ejb.EjbComponentProvider.registerEjbInterceptor(EjbComponentProvider.java:162)
      at org.glassfish.jersey.gf.ejb.EjbComponentProvider.bind(EjbComponentProvider.java:199)
      at org.glassfish.jersey.server.ApplicationHandler.bindWithComponentProvider(ApplicationHandler.java:845)
      at org.glassfish.jersey.server.ApplicationHandler.bindProvidersAndResources(ApplicationHandler.java:775)
      at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:396)
      at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:161)
      at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:286)
      at org.glassfish.jersey.internal.Errors$2.call(Errors.java:289)
      at org.glassfish.jersey.internal.Errors$2.call(Errors.java:286)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
      at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:283)
      at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:298)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349)
      at javax.servlet.GenericServlet.init(GenericServlet.java:244)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1382)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5704)
      ... 73 more
      2013-09-23 10:47:01 .396+1000 [WARNING] - java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.NullPointerException
      java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.NullPointerException
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1044)
      ...
      2013-09-23 10:47:01 .396+1000 [SEVERE] - Exception while invoking class com.sun.enterprise.web.WebApplication start method
      java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.NullPointerException
      at com.sun.enterprise.web.WebApplication.start(WebApplication.java:168)
      at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
      ...
      2013-09-23 10:47:01 .397+1000 [SEVERE] - Exception during lifecycle processing
      java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.NullPointerException
      at com.sun.enterprise.web.WebApplication.start(WebApplication.java:168)
      ...
      2013-09-23 10:47:01 .397+1000 [SEVERE] - Exception while loading the app]]
      2013-09-23 10:47:01 .403+1000 [SEVERE] - Undeployment failed for context /jobs]]
      2013-09-23 10:47:01 .418+1000 [SEVERE] - Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.NullPointerException]]

        Activity

        Hide
        jendrock added a comment -

        Several issues are raised here.

        We explicitly tell users what environment is optimal for running the tutorial. This is explained here: http://docs.oracle.com/javaee/7/tutorial/doc/usingexamples001.htm#GEXAB.

        If you download and install the Java EE 7 SDK, you get the correct environment and the tutorial example tree in one installation. Furthermore, you also get access to Update Tool, a mechanism for ensuring that you always have the most up-to-date tutorial sources installed. If you do not follow these directions, the tutorial will not work out-of-the-box, as you discovered.

        The non-zero byte-length beans.xml file was an issue that we recognized as a problem the first day that we shipped the tutorial. I noted this as a problem in the Java EE 7 SDK Release Notes (http://www.oracle.com/technetwork/java/javaee/documentation/javaee7sdk-readme-1957703.html), which are available on the SDK download page. You have 2 options for this problem - delete the beans.xml file or update the tutorial package and get a "patched" tutorial where this shortcoming has been addressed. This is why we encourage folks to use the environment that we promote.

        I believe that your final problem is due to the fact that you installed the Web Profile, not the Full Profile version of GlassFish Server. Again, we explicitly say that we support only the Full Profile version.

        If you start the application server and then create and configure the 2 managed executor services that are described in http://docs.oracle.com/javaee/7/tutorial/doc/concurrency-utilities005.htm#sthref2912 before you try to run the jobs example, I am sure that you will find that it works as advertised. I just tried it again, after updating my tutorial installation to package 7.0.3-1, and it works as described.

        Show
        jendrock added a comment - Several issues are raised here. We explicitly tell users what environment is optimal for running the tutorial. This is explained here: http://docs.oracle.com/javaee/7/tutorial/doc/usingexamples001.htm#GEXAB . If you download and install the Java EE 7 SDK, you get the correct environment and the tutorial example tree in one installation. Furthermore, you also get access to Update Tool, a mechanism for ensuring that you always have the most up-to-date tutorial sources installed. If you do not follow these directions, the tutorial will not work out-of-the-box, as you discovered. The non-zero byte-length beans.xml file was an issue that we recognized as a problem the first day that we shipped the tutorial. I noted this as a problem in the Java EE 7 SDK Release Notes ( http://www.oracle.com/technetwork/java/javaee/documentation/javaee7sdk-readme-1957703.html ), which are available on the SDK download page. You have 2 options for this problem - delete the beans.xml file or update the tutorial package and get a "patched" tutorial where this shortcoming has been addressed. This is why we encourage folks to use the environment that we promote. I believe that your final problem is due to the fact that you installed the Web Profile, not the Full Profile version of GlassFish Server. Again, we explicitly say that we support only the Full Profile version. If you start the application server and then create and configure the 2 managed executor services that are described in http://docs.oracle.com/javaee/7/tutorial/doc/concurrency-utilities005.htm#sthref2912 before you try to run the jobs example, I am sure that you will find that it works as advertised. I just tried it again, after updating my tutorial installation to package 7.0.3-1, and it works as described.
        Hide
        jendrock added a comment -

        I believe that the issues that were noted caused the example to not run. Once the issues that were identified were resolved, the app should run as expected, and it does!

        Show
        jendrock added a comment - I believe that the issues that were noted caused the example to not run. Once the issues that were identified were resolved, the app should run as expected, and it does!

          People

          • Assignee:
            Unassigned
            Reporter:
            HankCa
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: