我创建了一个在本地实现REST服务的应用程序:
Eclipse Indigo Jersey 2.4 Tomcat 7.0.47
使用Eclipse在本地运行时,服务工作正常,但在部署我的WAR文件时,尝试对其中一个服务URL执行GET时会出现以下异常:
HTTP Status 500 - Servlet.init() for servlet com.app.rest.MyResourceConfig threw exception
type Exception report
message Servlet.init() for servlet com.app.rest.MyResourceConfig threw exception
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet.init() for servlet com.app.rest.MyResourceConfig threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
java.lang.Thread.run(Thread.java:662)
root cause
java.lang.IllegalStateException: The resource configuration is not modifiable in this context.
org.glassfish.jersey.server.ResourceConfig$ImmutableState.register(ResourceConfig.java:270)
org.glassfish.jersey.server.ResourceConfig$ImmutableState.register(ResourceConfig.java:218)
org.glassfish.jersey.server.ResourceConfig.register(ResourceConfig.java:448)
org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:300)
org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167)
org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349)
javax.servlet.GenericServlet.init(GenericServlet.java:160)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Jenkins(Hudson)远程API来使用freeStyleProject的XML响应.
研究关于詹金斯在树中的查询参数文件和这里我一直在试图用它来提高响应时间,以获得XML响应.但Jenkins似乎无法使用此URL生成作业的节点downstreamProject和构建的action/parameter:
http:// localhost/job/MyJob/api/xml?depth = 2&tree = name,description,builds [ action [parameter [name,value] ] number,url,timestamp,result],healthReport [score,description],downstreamProject [名称,网址]
我只是得到这个响应XML:
<freeStyleProject>
<description>Description</description>
<name>MyJob</name>
<build>
<number>2</number>
<result>SUCCESS</result>
<timestamp>1325784290000</timestamp>
<url>http://localhost/job/MyJob/2/</url>
</build>
<build>
<number>1</number>
<result>SUCCESS</result>
<timestamp>1323931754000</timestamp>
<url>http://localhost/job/MyJob/1/</url>
</build>
<healthReport>
<description>Build stability: No recent builds failed.</description>
<score>100</score>
</healthReport>
</freeStyleProject>
Run Code Online (Sandbox Code Playgroud)
也许树查询参数不支持这些?使用xpath和exlude查询参数获取此节点的唯一方法是什么?