2014-04-15 77 views
0

問題:我有一個使用Intellij IDEA開發的Glassfish上運行的JAX-RS Web應用程序。 服務器工作正常,直到我添加了對Enunciate的支持。當我添加「闡明:docs enunciate:彙集」Maven目標在Make和Deploy Artifact步驟之前運行時,所有地獄都會崩潰。在每次重新部署時,我都會遇到以下錯誤。即使刪除了闡述maven的目標,我仍然得到它們...NoClassDefFoundError:com/sun/jersey/spi/spring/container/SpringComponentProviderFactory

問題:究竟是什麼原因造成這種情況,因爲我甚至不使用Spring(SpringComponentProviderFactory)?

編輯:這仍然沒有修復。任何其他想法?

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. 

同時,在服務器日誌中我得到:

[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) 

回答

0

顯然,這已經得到解決。我不知道實際上做了什麼,因爲有時一個變化什麼都沒做,有時候變成了。例如:我已經在闡明:docs之後添加了闡述:彙總目標,重新部署並且沒有任何更改。只有在服務器重新啓動後,它纔會包含工件中的文檔文件夾。我無法理解這背後的原因,因爲服務器重新啓動與構建步驟無關,但無論如何...

無論如何,從我試過的所有更改/配置中,我會注意這些特別是,從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:我敢肯定這是部分因爲<scope>provided</scope>只要確保不編譯它像我最初一樣。我認爲的另一個原因與如上所述的maven組裝步驟有關。

+0

我有同樣的問題。我增加了'提供的',讓Maven認爲它提供了,然後刪除它,這樣它會下載我的依賴項。 – taco