简体   繁体   中英

NoClassDefFoundError: com/sun/jersey/spi/spring/container/SpringComponentProviderFactory

Problem : I have a JAX-RS Web Application running on Glassfish, developed using Intellij IDEA. The server was working fine until I added support for Enunciate. The moment I added "enunciate:docs enunciate:assemble" maven goal to be run before Make and Deploy Artifact steps, all hell broke loose. On every re-deploy, I get the below errors. Even after removing the enunciate maven goals, I still get them...

Question : What the hell causes this, because I don't even use Spring (SpringComponentProviderFactory) ?

Edit : This is still not fixed. Any other ideas ?

Artifact project:war exploded: java.io.IOException: com.sun.enterprise.admin.remote.RemoteFailureException: Error occurred during deployment: Exception while loading the app : CDI deployment failure:WELD-001408 Unsatisfied dependencies for type [Ref<ContainerRequest>] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject org.glassfish.jersey.server.internal.routing.UriRoutingContext(Ref<ContainerRequest>, ProcessingProviders)]. Please see server.log for more details.

At the same time, in the server logs I get:

[2014-04-15T20:31:29.252+0300] [glassfish 4.0] [WARNING] [AS-DEPLOYMENT-00011] [javax.enterprise.system.tools.deployment.dol] [tid: _ThreadID=35 _ThreadName=admin-listener(4)] [timeMillis: 1397583089252] [levelValue: 900] [[
  Error in annotation processing: {0}.
java.lang.NoClassDefFoundError: com/sun/jersey/spi/spring/container/SpringComponentProviderFactory
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:1183)
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1728)
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1611)
    at com.sun.enterprise.deployment.annotation.impl.ModuleScanner.getElements(ModuleScanner.java:297)
    at com.sun.enterprise.deployment.archivist.Archivist.processAnnotations(Archivist.java:585)
    at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:462)
    at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:446)
    at org.glassfish.web.deployment.archivist.WebArchivist.postAnnotationProcess(WebArchivist.java:338)
    at org.glassfish.web.deployment.archivist.WebArchivist.postAnnotationProcess(WebArchivist.java:91)
    at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:420)
    at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:396)
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:271)
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:280)
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:241)
    at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:161)
    at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:198)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:222)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:96)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:878)
[2014-04-15T20:31:30.214+0300] [glassfish 4.0] [WARNING] [] [javax.enterprise.web.util] [tid: _ThreadID=35 _ThreadName=admin-listener(4)] [timeMillis: 1397583090214] [levelValue: 900] [[
  The web application [unknown] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.]]

[2014-04-15T20:31:30.215+0300] [glassfish 4.0] [WARNING] [] [javax.enterprise.web.util] [tid: _ThreadID=35 _ThreadName=admin-listener(4)] [timeMillis: 1397583090215] [levelValue: 900] [[
  The web application [unknown] registered the JDBC driver [com.mysql.fabric.jdbc.FabricMySQLDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.]]

[2014-04-15T20:31:31.947+0300] [glassfish 4.0] [WARNING] [] [org.glassfish.weld.BeanDeploymentArchiveImpl] [tid: _ThreadID=35 _ThreadName=admin-listener(4)] [timeMillis: 1397583091947] [levelValue: 900] [[
  AS-CDI-005]]

[2014-04-15T20:31:36.583+0300] [glassfish 4.0] [WARNING] [] [org.jboss.weld.interceptor.util.InterceptionTypeRegistry] [tid: _ThreadID=35 _ThreadName=admin-listener(4)] [timeMillis: 1397583096583] [levelValue: 900] [[
  Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled]]

[2014-04-15T20:31:36.584+0300] [glassfish 4.0] [WARNING] [] [org.jboss.weld.interceptor.util.InterceptionTypeRegistry] [tid: _ThreadID=35 _ThreadName=admin-listener(4)] [timeMillis: 1397583096584] [levelValue: 900] [[
  Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled]]

[2014-04-15T20:31:37.341+0300] [glassfish 4.0] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=35 _ThreadName=admin-listener(4)] [timeMillis: 1397583097341] [levelValue: 1000] [[
  Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: CDI deployment failure:WELD-001408 Unsatisfied dependencies for type [Ref<ContainerRequest>] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject org.glassfish.jersey.server.internal.routing.UriRoutingContext(Ref<ContainerRequest>, ProcessingProviders)]
    at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:225)
    at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)

Apparently this is fixed now. I have no idea what actually did it, because sometimes a change did nothing, sometimes it did. Ex: I've added enunciate:assemble goal after enunciate:docs, redeployed and nothing changed. Only after a server restart did it include the docs folder in the artifact. I can't understand the reasoning behind this, because a server restart has nothing to do with a build step, but whatever...

Anyhow, from all the changes/configs I've tried, I would pay attention to these especially, from pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<packaging>war</packaging>

   <dependencies>
        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-servlet</artifactId>
            <version>2.4.1</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.codehaus.enunciate</groupId>
            <artifactId>enunciate-rt</artifactId>
            <version>1.28</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

</project>

LE: I am pretty sure it's partially because of <scope>provided</scope> Just be sure to not compile it like I initially did. The other reason I think has to do with the maven assemble steps like described above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM