0

I am trying to deploy a web application (.war) to glassfish v4. The same application works on jetty (via maven-jetty-plugin).

The application uses jersey 2.7, eclipselink 2.5.0 and servlet 3.0 specifications.

When I try to deploy from the admin console I get the following in the error log (excerpt, orginal message is over 300 lines, full version at http://pastebin.com/UTNt5EHM)

2014-05-21T17:43:55.650+0200] [glassfish 4.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=34 _ThreadName=admin-listener(3)] [timeMillis: 1400687035650] [levelValue: 1000] [[
  Exception while loading the app : CDI deployment failure:Exception List with 4 exceptions:
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Configuration] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public org.glassfish.jersey.message.filtering.SecurityServerScopeProvider(Configuration, ServiceLocator)]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:403)
[...]
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Configuration] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public org.glassfish.jersey.message.filtering.CommonScopeProvider(Configuration, ServiceLocator)]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:403)
[...]
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [EntityGraphProvider] with qualifiers [@Default] at injection point [[BackedAnnotatedField] @Inject private org.glassfish.jersey.message.filtering.EntityInspectorImpl.graphProvider]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:403)
[...]
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Configuration] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public org.glassfish.jersey.message.filtering.ServerScopeProvider(Configuration, ServiceLocator)]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:403)
[...]

The war file contains the following:

  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2014-05-21 17:49   META-INF/
      131  2014-05-21 17:49   META-INF/MANIFEST.MF
        0  2014-05-20 21:26   WEB-INF/
        0  2014-05-20 21:26   WEB-INF/lib/
        0  2014-05-20 21:26   WEB-INF/classes/
        0  2014-05-20 21:26   WEB-INF/classes/de/
        0  2014-05-20 21:26   WEB-INF/classes/de/sitl/
        0  2014-05-20 21:26   WEB-INF/classes/de/sitl/dev/
        0  2014-05-20 21:26   WEB-INF/classes/de/sitl/dev/games/
        0  2014-05-20 21:26   WEB-INF/classes/de/sitl/dev/games/game00/
        0  2014-05-20 21:26   WEB-INF/classes/META-INF/
      780  2014-05-20 18:25   WEB-INF/web.xml
   962808  2014-05-15 19:01   WEB-INF/lib/jersey-guava-2.7.jar
    15988  2014-05-19 14:53   WEB-INF/lib/jetty-continuation-9.1.1.v20140108.jar
   111466  2014-05-19 20:35   WEB-INF/lib/jetty-webapp-9.1.1.v20140108.jar
    67151  2014-05-15 19:01   WEB-INF/lib/hk2-utils-2.2.0.jar
   333974  2014-05-19 14:53   WEB-INF/lib/jetty-util-9.1.1.v20140108.jar
    26366  2014-05-15 19:01   WEB-INF/lib/javax.annotation-api-1.2.jar
    68682  2014-05-16 17:59   WEB-INF/lib/jersey-entity-filtering-2.7.jar
    15714  2014-05-15 19:01   WEB-INF/lib/jersey-container-servlet-2.7.jar
   103252  2014-05-19 14:53   WEB-INF/lib/jetty-http-9.1.1.v20140108.jar
   100227  2014-05-19 14:53   WEB-INF/lib/jetty-io-9.1.1.v20140108.jar
   399677  2014-05-19 14:53   WEB-INF/lib/jetty-server-9.1.1.v20140108.jar
    25110  2014-05-19 17:46   WEB-INF/lib/jersey-container-jetty-http-2.7.jar
   112758  2014-05-15 19:01   WEB-INF/lib/javax.ws.rs-api-2.0.jar
     5596  2014-05-21 17:34   WEB-INF/lib/game00-service-core-rest-0.0.1-SNAPSHOT.jar
   714195  2014-05-15 19:01   WEB-INF/lib/javassist-3.18.1-GA.jar
     7724  2014-05-21 17:34   WEB-INF/lib/game00-model-core-api-0.0.1-SNAPSHOT.jar
    95887  2014-05-19 20:35   WEB-INF/lib/jetty-security-9.1.1.v20140108.jar
   110637  2014-05-19 20:35   WEB-INF/lib/jetty-servlet-9.1.1.v20140108.jar
   708636  2014-05-15 19:01   WEB-INF/lib/jersey-common-2.7.jar
  2838580  2014-05-15 18:58   WEB-INF/lib/derby-10.10.2.0.jar
   142439  2014-05-15 19:01   WEB-INF/lib/hk2-api-2.2.0.jar
     5968  2014-05-15 19:01   WEB-INF/lib/javax.inject-2.2.0.jar
    95806  2014-05-19 22:31   WEB-INF/lib/javax.servlet-api-3.1.0.jar
   171588  2014-05-15 19:01   WEB-INF/lib/hk2-locator-2.2.0.jar
    53866  2014-05-15 19:01   WEB-INF/lib/jersey-container-servlet-core-2.7.jar
    63777  2014-05-15 19:01   WEB-INF/lib/validation-api-1.1.0.Final.jar
     7897  2014-05-21 17:34   WEB-INF/lib/game00-model-core-jpa-0.0.1-SNAPSHOT.jar
  4977121  2014-05-16 17:59   WEB-INF/lib/org.eclipse.persistence.core-2.5.0.jar
   488045  2014-05-16 17:59   WEB-INF/lib/org.eclipse.persistence.moxy-2.5.0.jar
    24874  2014-05-16 17:59   WEB-INF/lib/jersey-media-moxy-2.7.jar
   923051  2014-05-15 19:01   WEB-INF/lib/jersey-server-2.7.jar
   271208  2014-05-16 17:59   WEB-INF/lib/org.eclipse.persistence.asm-2.5.0.jar
     8842  2014-05-21 17:34   WEB-INF/lib/game00-model-core-jaxb-0.0.1-SNAPSHOT.jar
    41763  2014-05-19 20:35   WEB-INF/lib/jetty-xml-9.1.1.v20140108.jar
   162126  2014-05-15 18:58   WEB-INF/lib/javax.persistence-2.1.0.jar
    20235  2014-05-15 19:01   WEB-INF/lib/osgi-resource-locator-1.0.1.jar
     6926  2014-05-19 20:35   WEB-INF/lib/jersey-container-jetty-servlet-2.7.jar
    21007  2014-05-15 18:58   WEB-INF/lib/commonj.sdo-2.1.1.jar
     7322  2014-05-21 17:34   WEB-INF/lib/game00-build-tools-0.0.1-SNAPSHOT.jar
  8318722  2014-05-20 19:47   WEB-INF/lib/eclipselink-2.5.0.jar
    14867  2014-05-15 19:01   WEB-INF/lib/aopalliance-repackaged-2.2.0.jar
   151688  2014-05-15 19:01   WEB-INF/lib/jersey-client-2.7.jar
   189645  2014-05-16 17:59   WEB-INF/lib/org.eclipse.persistence.antlr-2.5.0.jar
     1005  2014-05-21 17:49   WEB-INF/classes/de/sitl/dev/games/game00/RestApplication$1.class
      925  2014-05-21 17:49   WEB-INF/classes/de/sitl/dev/games/game00/RestApplication.class
     1458  2014-05-20 21:26   WEB-INF/classes/META-INF/persistence.xml
       60  2014-05-20 21:26   WEB-INF/classes/META-INF/load.sql
      194  2014-05-18 17:50   test.xhtml
     7266  2014-05-21 17:37   META-INF/maven/de.sitl.dev.games.game00/game00-webapp/pom.xml
      132  2014-05-21 17:49   META-INF/maven/de.sitl.dev.games.game00/game00-webapp/pom.properties
---------                     -------
 23005162                     62 files

The web.xml file contains:

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
    version="3.1">       

    <servlet>
        <servlet-name>de.sitl.dev.games.game00.RestApplication</servlet-name>
    </servlet>

    <servlet-mapping>
        <servlet-name>de.sitl.dev.games.game00.RestApplication</servlet-name>
        <url-pattern>/webapp/*</url-pattern>
    </servlet-mapping>

</web-app>

The persistence.xml contains:

<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
    version="2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">

    <persistence-unit name="WebappPersistenceUnit"
        transaction-type="RESOURCE_LOCAL">

        <class>de.sitl.dev.games.game00.model.core.jpa.ConcreteUnitData</class>
        <class>de.sitl.dev.games.game00.model.core.jpa.SkillData</class>

        <properties>
            <!-- JDBC settings -->
            <property name="javax.persistence.jdbc.driver"
                value="org.apache.derby.jdbc.EmbeddedDriver" />
            <property name="javax.persistence.jdbc.url"
                value="jdbc:derby:memory:CoreDB;create=true" />
            <property name="javax.persistence.jdbc.user" value="" />
            <property name="javax.persistence.jdbc.password"
                value="" />

            <!-- Schema settings -->
            <property
                name="javax.persistence.schema-generation.database.action"
                value="create" />
            <property
                name="javax.persistence.schema-generation.create-source"
                value="metadata" />
            <property
                name="javax.persistence.sql-load-script-source"
                value="META-INF/load.sql" />
        </properties>

    </persistence-unit>
</persistence>

I have currently no idea what this means, none of the classes mentioned is part of my code. It feels like something is missing on the classpath, however I was unser the assumption (from jersey manual) that jersey is included in glassfish v4.

Fabian
  • 363
  • 2
  • 6
  • Do you own the beans which you are trying to inject or are they from a 3rd party library? – jgitter May 21 '14 at 16:14
  • The classes mentioned in the error are all third party. I am injecting only one bean. That worked on jetty. – Fabian May 21 '14 at 17:24

1 Answers1

0

Looks like Jersey is already provided by the container so there is no need to bundle it with your application. Likely this is the cause of your problem. You may want to read the glassfish documentation more closely.

Here is a link to a bug issue for someone who had the same error you did. It was eventually closed as user-error / packaging issue, but the comments may help you.

https://java.net/jira/browse/JERSEY-1941

jgitter
  • 3,396
  • 1
  • 19
  • 26