1

我正在尝试触发导致 WELD 001303 问题的获取请求。@Path("/test") @RequestScoped 公共类 TestRest {

    @EJB
    HelloWorldInterface helloWorld;

    @GET
    @Path("/get")
    public Response get() {
        return Response.status(201).entity(helloWorld.sayHello()).build();
    }

    @POST
    @Path("/post")
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    public Response post(String request) {
        String answer = helloWorld.sayHello() + request;
        return Response.status(201).entity(answer).build();
    }

}

使用:来自http://sourceforge.net/projects/mobicents/files/Mobicents%20Sip%20Servlets/Mobicents%20Sip%20Servlets%201.7.0.FINAL/的 mss-1.7.0FINAL-jboss-as-7.1.1.FINAL

我需要这个 MSS 包来支持 sip。

我的项目为Sourecode,项目为.war

工作流程:

1. install mss package

2. start mss/jboss server with sip support (standalone-sip.xml) and deploy project

3. open http://127.0.0.1:8080/my-sipapp/rest/test/get

--> `org.jboss.resteasy.spi.UnhandledException: org.jboss.weld.context.ContextNotActiveException: WELD-001303 范围类型 javax.enterprise.context.RequestScoped org.jboss.resteasy.core.SynchronousDispatcher 没有活动上下文。 handleApplicationException(SynchronousDispatcher.java:340) org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214) org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190) org.jboss.resteasy。 core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:540) org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502) org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) org. jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher。服务(ServletContainerDispatcher.java:208) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java: 50) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) 根本原因62) 根本原因62) 根本原因

org.jboss.weld.context.ContextNotActiveException: WELD-001303 范围类型 javax.enterprise.context.RequestScoped org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:598) org.jboss.weld 没有活动上下文。 bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:71) org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79) com.mycompany.app.rest.TestRest$Proxy$_$$ WeldClientProxy .get(TestRest$Proxy$$$_WeldClientProxy.java) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect .Method.invoke(Method.java:601) org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155) org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) org.jboss .resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211) org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525 ) org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502) org.jboss.resteasy.core。SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher. java:55) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.jboss.weld.servlet。 ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)`plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) `plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) `

4

1 回答 1

1

有2个解决方案。您等到weld-core-1.1.8.FINAL.jar 更新!或者您获取源代码并在 org.jboss.weld.context.AbstractBoundContext 中进行硬修复:

public void deactivate() {
if (getBeanStore() != null )
{ getBeanStore().detach(); super.deactivate(); }
}

有关更多信息,请参阅https://issues.jboss.org/browse/WELD-1020?_sscc=t

于 2013-05-03T14:00:27.667 回答