Hello world JAX-RS WAB示例不适用于Glassfish 3.1.2

Hello world JAX-RS WAB示例不适用于Glassfish 3.1.2,glassfish,osgi,jersey,Glassfish,Osgi,Jersey,我来自新泽西州,我正在尝试运行一个关于Glassfish 3.1.2的示例项目。该示例包括一个任务,该任务使用Jersey 1.12通过PAX runner运行测试,并且所有测试都通过。Glassfish为服务器和servlet定制了JAR文件,版本为1.11。部署时,我会收到以下错误消息: [#|2012-06-11T09:30:19.718-0400|SEVERE|glassfish3.1.2|com.sun.jersey.spi.inject.Errors|_ThreadID=24;_Th

我来自新泽西州,我正在尝试运行一个关于Glassfish 3.1.2的示例项目。该示例包括一个任务,该任务使用Jersey 1.12通过PAX runner运行测试,并且所有测试都通过。Glassfish为服务器和servlet定制了JAR文件,版本为1.11。部署时,我会收到以下错误消息:

[#|2012-06-11T09:30:19.718-0400|SEVERE|glassfish3.1.2|com.sun.jersey.spi.inject.Errors|_ThreadID=24;_ThreadName=Thread-3;|The following errors and warnings have been detected with resource and/or provider classes:
SEVERE: Method, public java.lang.String com.sun.jersey.samples.helloworld.HelloWorldResource.getClichedMessage(), annotated with GET of resource, class com.sun.jersey.samples.helloworld.HelloWorldResource, is not recognized as valid resource method.
SEVERE: Method, public java.lang.String com.sun.jersey.samples.helloworld.AnotherResource.getAnotherMessage(), annotated with GET of resource, class com.sun.jersey.samples.helloworld.AnotherResource, is not recognized as valid resource method.
SEVERE: Method, public synchronized javax.ws.rs.core.Response com.sun.jersey.server.impl.wadl.WadlResource.geExternalGramar(javax.ws.rs.core.UriInfo,java.lang.String), annotated with GET of resource, class com.sun.jersey.server.impl.wadl.WadlResource, is not recognized as valid resource method.
SEVERE: Method, public synchronized javax.ws.rs.core.Response com.sun.jersey.server.impl.wadl.WadlResource.getWadl(javax.ws.rs.core.UriInfo), annotated with GET of resource, class com.sun.jersey.server.impl.wadl.WadlResource, is not recognized as valid resource method.|#]
在上面的错误消息之后还有一个堆栈跟踪:

[#|2012-06-11T09:30:19.719-0400|SEVERE|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=24;_ThreadName=Thread-3;|WebModule[/helloworld]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 com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:766)
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:488)
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:1445)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1242)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5093)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5380)
at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2018)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:183)
at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.execute(OSGiDeploymentRequest.java:118)
at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:121)
at org.glassfish.osgijavaeebase.OSGiContainer.deploy(OSGiContainer.java:154)
at org.glassfish.osgijavaeebase.JavaEEExtender.deploy(JavaEEExtender.java:107)
at org.glassfish.osgijavaeebase.JavaEEExtender.access$200(JavaEEExtender.java:61)
at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:151)
at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:148)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)

请发布HelloWorldResource和其他资源的代码。不确定你的应用程序出了什么问题。您可能想将其与我们的简单JAX-RS/OSGi示例进行比较,该示例可在以下位置获得:这是泽西岛网站上的hello world:我最终能够实现这一点,但不确定到底是什么让它工作。在运行调试器时,我注意到唯一注册的ResourceMethodDispatchProvider服务来自多部分包。这使得资源方法的调度程序为null,从而导致拒绝该方法。由于某些原因,服务器捆绑包中的服务未注册。我卸载了除Jersey core/server/servlet之外的所有Jersey捆绑包,这使它正常工作。由于另一个原因,我不得不重新安装Glassfish,现在它正在工作。请发布HelloWorldResource和其他资源的代码。不确定你的应用程序出了什么问题。您可能想将其与我们的简单JAX-RS/OSGi示例进行比较,该示例可在以下位置获得:这是泽西岛网站上的hello world:我最终能够实现这一点,但不确定到底是什么让它工作。在运行调试器时,我注意到唯一注册的ResourceMethodDispatchProvider服务来自多部分包。这使得资源方法的调度程序为null,从而导致拒绝该方法。由于某些原因,服务器捆绑包中的服务未注册。我卸载了除Jersey core/server/servlet之外的所有Jersey捆绑包,这使它正常工作。我不得不重新安装Glassfish的另一个原因,现在它正在工作。