我使用JAX-RS web app
构建了Intellij IDEA
。我正在使用Glassfish
作为服务器。不幸的是,在对类进行一些更改,然后运行应用程序(Shift + F10)并调用资源(即使是未更改的资源)之后,我得到以下错误。如果我在运行它之前重建项目,我不会得到以下错误。
问题:我们可以直接运行项目,而不需要在每次该小变化后重建它吗?
[2014-11-24T15:33:23.772+0100] [glassfish 4.1] [WARNING] [] [javax.enterprise.system.container.web.com.sun.web.security] [tid: _ThreadID=29 _ThreadName=http-listener-1(4)] [timeMillis: 1416839603772] [levelValue: 900] [[
Context path from ServletContext: differs from path from bundle: /]]
[2014-11-24T15:33:23.952+0100] [glassfish 4.1] [INFO] [] [com.sun.jersey.api.core.servlet.WebAppResourceConfig] [tid: _ThreadID=29 _ThreadName=http-listener-1(4)] [timeMillis: 1416839603952] [levelValue: 800] [[
Scanning for root resource and provider classes in the Web app resource paths:
/WEB-INF/lib
/WEB-INF/classes]]
[2014-11-24T15:33:26.359+0100] [glassfish 4.1] [INFO] [] [com.sun.jersey.api.core.ScanningResourceConfig] [tid: _ThreadID=29 _ThreadName=http-listener-1(4)] [timeMillis: 1416839606359] [levelValue: 800] [[
Root resource classes found:
class com.project.resource.TransactionsResource
class com.project.resource.InvitesResource
class com.project.resource.UsersResource]]
[2014-11-24T15:33:26.360+0100] [glassfish 4.1] [INFO] [] [com.sun.jersey.api.core.ScanningResourceConfig] [tid: _ThreadID=29 _ThreadName=http-listener-1(4)] [timeMillis: 1416839606360] [levelValue: 800] [[
Provider classes found:
class org.codehaus.jackson.jaxrs.JsonParseExceptionMapper
class org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider
class org.codehaus.jackson.jaxrs.JsonMappingExceptionMapper
class org.codehaus.enunciate.modules.jersey.EnunciateJAXBContextResolver
class org.codehaus.jackson.jaxrs.JacksonJsonProvider]]
[2014-11-24T15:33:26.528+0100] [glassfish 4.1] [INFO] [] [com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer] [tid: _ThreadID=29 _ThreadName=http-listener-1(4)] [timeMillis: 1416839606528] [levelValue: 800] [[
CDI support is enabled]]
[2014-11-24T15:33:26.540+0100] [glassfish 4.1] [INFO] [] [org.codehaus.enunciate.modules.jersey.EnunciateJerseyServletContainer] [tid: _ThreadID=29 _ThreadName=http-listener-1(4)] [timeMillis: 1416839606540] [levelValue: 800] [[
org.codehaus.enunciate.modules.amf.JAXRSProvider not found.]]
[2014-11-24T15:33:26.561+0100] [glassfish 4.1] [INFO] [] [org.codehaus.enunciate.modules.jersey.EnunciateJerseyServletContainer] [tid: _ThreadID=29 _ThreadName=http-listener-1(4)] [timeMillis: 1416839606561] [levelValue: 800] [[
Unable to load the spring component provider factory. Using the jersey default...]]
[2014-11-24T15:33:26.569+0100] [glassfish 4.1] [INFO] [] [com.sun.jersey.server.impl.application.WebApplicationImpl] [tid: _ThreadID=29 _ThreadName=http-listener-1(4)] [timeMillis: 1416839606569] [levelValue: 800] [[
Initiating Jersey application, version 'Jersey: 1.11 12/09/2011 10:27 AM']]
[2014-11-24T15:33:29.576+0100] [glassfish 4.1] [SEVERE] [] [com.sun.jersey.spi.inject.Errors] [tid: _ThreadID=29 _ThreadName=http-listener-1(4)] [timeMillis: 1416839609576] [levelValue: 1000] [[
The following errors and warnings have been detected with resource and/or provider classes:
SEVERE: No injectable for parameter DiscoveredParameter(@javax.ws.rs.core.Context(),interface javax.ws.rs.core.Configuration,null,false)]]
[2014-11-24T15:33:29.579+0100] [glassfish 4.1] [SEVERE] [] [javax.enterprise.web] [tid: _ThreadID=29 _ThreadName=http-listener-1(4)] [timeMillis: 1416839609579] [levelValue: 1000] [[
WebModule[]StandardWrapper.Throwable
com.sun.jersey.spi.inject.Errors$ErrorMessagesException
at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170)
at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:771)
at org.codehaus.enunciate.modules.jersey.EnunciateJerseyServletContainer.initiate(EnunciateJerseyServletContainer.java:131)
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:318)
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:609)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1212)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:237)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
]]
[2014-11-24T15:33:29.580+0100] [glassfish 4.1] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=29 _ThreadName=http-listener-1(4)] [timeMillis: 1416839609580] [levelValue: 900] [[
StandardWrapperValve[jersey]: Allocate exception for servlet jersey
com.sun.jersey.spi.inject.Errors$ErrorMessagesException
at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170)
at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:771)
at org.codehaus.enunciate.modules.jersey.EnunciateJerseyServletContainer.initiate(EnunciateJerseyServletContainer.java:131)
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:318)
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:609)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1212)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:237)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
答案 0 :(得分:0)
显然,如果我在运行它之前重建项目,一切都很好。这个问题的任何永久解决方案?
编辑:Freaking想出来了。 Enunciate插件在组装时搞砸了。只需在enunciate:docs
工件之前使用Building
。另外,在pom.xml
中使用以下enunciate配置。这将生成文档到项目的webapp文件夹中,从而直接在Web应用程序的公用文件夹中包含enunciate docs。构建工件的下一个maven步骤将负责webapp和现在包含的enunciate docs。
<project>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-plugin</artifactId>
<version>1.29</version>
<executions>
<execution>
<goals>
<goal>docs</goal>
</goals>
</execution>
</executions>
<configuration>
<docsDir>${project.basedir}/src/main/webapp/docs</docsDir>
<configFile>enunciate.xml</configFile>
<enunciateArtifactId/>
<moduleName/>
</configuration>
</plugin>
</build>
</project>