我在JBoss AS7.1.1中通过RESTful接口公开了Session Bean;这同时具有EJB模块和WAR模块,WAR模块对EJB模块具有(maven)依赖性; WAR只是带有RestEasy指令的web.xml。 (沿https://github.com/alexcpn/rest_in_sessionbean建模)
Stateless
@Path("sessionbean")
public class ControllerRest {
@EJB
Controller mroController;
/**
* Default constructor.
*/
public ControllerRest() {
}
@GET
@Path("/test")
@Produces(MediaType.TEXT_PLAIN)
public String test( ){
return "Hello from Mro SessionBean Jar ";
}
我在调用REST接口时间歇性地收到'HTTP Status 500 - 传递错误的参数'错误; (普通的REST调用和带有Query接口的调用)。这似乎是类加载的一些问题 如 - https://community.jboss.org/thread/175629中所述。看起来像RESTEasy与JBOSS集成中的错误。
17:31:28,142 SEVERE [org.jboss.resteasy.core.SynchronousDispatcher] (http--127.0.0.1-8080-4) Failed executing GET /sessionbean/test: org.jboss.resteasy.spi.InternalServerErrorException: Bad arguments passed to public java.lang.String com.nokia.oss.MroControllerRest.test() ( )
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:196) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.2.Final.jar:]