问题:我在Glassfish上运行JAX-RS Web应用程序,使用Intellij IDEA开发。 服务器工作正常,直到我添加了对Enunciate的支持。我添加的那一刻" enunciate:docs enunciate:assemble"在Make和Deploy Artifact步骤之前运行的maven目标,一切都崩溃了。在每次重新部署时,我都会收到以下错误。即使在取消了明确的maven目标之后,我仍然得到它们......
问题:这到底是什么原因,因为我甚至不使用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 :(得分:0)
显然现在已经修复了。我不知道究竟是做了什么,因为有时改变什么也没做,有时它确实做到了。例如:我已经添加了enunciate:在enunciate:docs之后汇编目标,重新部署并且没有任何改变。只有在服务器重新启动后才会在工件中包含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汇编步骤有关。