glassfish
  1. glassfish
  2. GLASSFISH-16937

Having REST services in separate WARs in a single EAR prints classloading warnings

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.1
    • Fix Version/s: 4.1
    • Component/s: web_container
    • Labels:
      None
    • Environment:

      Windows Server 2008

      Description

      Warnings show up when an EAR is deployed, containing more than one WAR archove with REST web services. Looks like GlassFish/Jersey tries to load all the REST service classes for each of the WARs being deployed, and then shows classloader warnings:

      WEB9052: Unable to load class <classname>, reason: java.lang.ClassNotFoundException: <classname>

      I did a minimal project which produces an EAR with this structure:

      ear-1.0.ear

      • META-INF/
      `- application.xml
      • war-1-1.0.war
       
      • classes/
        `- test/war1/Service1.class
      `- WEB-INF/
      `- web.xml
      `- war-2-1.0.war
      • classes/
      `- test/war2/Service2.class
      `- WEB-INF/
      `- web.xml

      (See the attached maven project).

      test.war1.Service1 and test.war2.Service2 are POJOs with class-level @Path annotation and method-level @GET or @POST annotations.
      The application.xml DD is generated by maven-ear-plugin and only contains the two webmodules and their contextroots.
      Both web.xml only contain a display name and the Jersey ServletContainer loaded on startup.

      When deploying to GlassFish 3.1 on Windows Server 2008, the log contains the following entries:

      [#|2011-07-01T10:45:59.159+0200|WARNING|glassfish3.1|javax.enterprise.system.container.web.org.glassfish.web.loader|_ThreadID=183;_ThreadName=Thread-1;|WEB9052: Unable to load class test.war2.Service2, reason: java.lang.ClassNotFoundException: test.war2.Service2|#]

      [#|2011-07-01T10:45:59.187+0200|INFO|glassfish3.1|com.sun.jersey.api.core.WebAppResourceConfig|_ThreadID=23;_ThreadName=Thread-1;|Scanning for root resource and provider classes in the Web app resource paths:
      /WEB-INF/lib
      /WEB-INF/classes|#]

      [#|2011-07-01T10:45:59.187+0200|INFO|glassfish3.1|com.sun.jersey.api.core.ScanningResourceConfig|_ThreadID=23;_ThreadName=Thread-1;|Root resource classes found:
      class test.war1.Service1|#]

      [#|2011-07-01T10:45:59.187+0200|INFO|glassfish3.1|com.sun.jersey.api.core.ScanningResourceConfig|_ThreadID=23;_ThreadName=Thread-1;|No provider classes found.|#]

      [#|2011-07-01T10:45:59.187+0200|INFO|glassfish3.1|com.sun.jersey.server.impl.application.WebApplicationImpl|_ThreadID=23;_ThreadName=Thread-1;|Initiating Jersey application, version 'Jersey: 1.5 01/14/2011 12:36 PM'|#]

      [#|2011-07-01T10:45:59.354+0200|INFO|glassfish3.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=183;_ThreadName=Thread-1;|WEB0671: Loading application ear-1.0#war-1-1.0.war at [/war1]|#]

      [#|2011-07-01T10:45:59.368+0200|WARNING|glassfish3.1|javax.enterprise.system.container.web.org.glassfish.web.loader|_ThreadID=183;_ThreadName=Thread-1;|WEB9052: Unable to load class test.war1.Service1, reason: java.lang.ClassNotFoundException: test.war1.Service1|#]

      [#|2011-07-01T10:45:59.382+0200|INFO|glassfish3.1|com.sun.jersey.api.core.WebAppResourceConfig|_ThreadID=23;_ThreadName=Thread-1;|Scanning for root resource and provider classes in the Web app resource paths:
      /WEB-INF/lib
      /WEB-INF/classes|#]

      [#|2011-07-01T10:45:59.382+0200|INFO|glassfish3.1|com.sun.jersey.api.core.ScanningResourceConfig|_ThreadID=23;_ThreadName=Thread-1;|Root resource classes found:
      class test.war2.Service2|#]

      [#|2011-07-01T10:45:59.382+0200|INFO|glassfish3.1|com.sun.jersey.api.core.ScanningResourceConfig|_ThreadID=23;_ThreadName=Thread-1;|No provider classes found.|#]

      [#|2011-07-01T10:45:59.382+0200|INFO|glassfish3.1|com.sun.jersey.server.impl.application.WebApplicationImpl|_ThreadID=23;_ThreadName=Thread-1;|Initiating Jersey application, version 'Jersey: 1.5 01/14/2011 12:36 PM'|#]

      [#|2011-07-01T10:45:59.521+0200|INFO|glassfish3.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=183;_ThreadName=Thread-1;|WEB0671: Loading application ear-1.0#war-2-1.0.war at [/war2]|#]

      [#|2011-07-01T10:45:59.535+0200|INFO|glassfish3.1|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=183;_ThreadName=Thread-1;|ear-1.0 was successfully deployed in 543 milliseconds.|#]

      So this looks like Glassfish tries to load both services for each WAR module. When loading war-1, it cannot load test.war2.Service2, and while loading war-2, it cannot load test.war1.Service1...
      Although, the application is correctly deployed and all the services do work !!

      I guess this is a tiny bug, and could be fixed within a handful of lines. I could try to fix it, if someone could point me to the right module producing this warning.

        Activity

        Hide
        Philipp91 added a comment -

        This issue should be prioritized higher. It may be a minor problem for people who's logs get flooded by these messages, but it is a major problem for people who can't use the REST services, which they deployed. The classes are not available, NoClassDefFound exceptions occur as follow-ups and the REST service is not available.

        I use a simple JAR included in WEB-INF/lib.

        Show
        Philipp91 added a comment - This issue should be prioritized higher. It may be a minor problem for people who's logs get flooded by these messages, but it is a major problem for people who can't use the REST services, which they deployed. The classes are not available, NoClassDefFound exceptions occur as follow-ups and the REST service is not available. I use a simple JAR included in WEB-INF/lib.
        Hide
        obfischer added a comment -

        Is there a chance to get this fixed in the near future? Our monitoring reports all log messages with a log level above INFO. It is very annoying to warnings for a non-existent problem.

        Show
        obfischer added a comment - Is there a chance to get this fixed in the near future? Our monitoring reports all log messages with a log level above INFO. It is very annoying to warnings for a non-existent problem.
        Hide
        Daniel added a comment -

        The web.xml for GF4 should use org.glassfish.jersey.servlet.ServletContainer API instead.

        Show
        Daniel added a comment - The web.xml for GF4 should use org.glassfish.jersey.servlet.ServletContainer API instead.
        Hide
        Shing Wai Chan added a comment -

        The given test case may need to update for GlassFish 4.

        Show
        Shing Wai Chan added a comment - The given test case may need to update for GlassFish 4.
        Hide
        andrey.v.markelov added a comment -

        I have got the same trouble. Are you going to fix that?

        Show
        andrey.v.markelov added a comment - I have got the same trouble. Are you going to fix that?

          People

          • Assignee:
            Daniel
            Reporter:
            mmuller
          • Votes:
            11 Vote for this issue
            Watchers:
            15 Start watching this issue

            Dates

            • Created:
              Updated: