1

我在 TomEE 服务器上使用 OpenJPA。

我构建了我的 .war,将其部署在服务器上,但是当我使用我的应用程序打开页面时,我得到了这个 execption:

javax.servlet.ServletException: WebBeans context with scope type annotation @RequestScoped does not exist within current thread
  javax.faces.webapp.FacesServlet.service(FacesServlet.java:229)
  filters.NoCacheFilter.doFilter(NoCacheFilter.java:42)
  org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:98)
  com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)


javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @RequestScoped does not exist within current thread
  org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:351)
  org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.getContextualCreationalContext(NormalScopedBeanInterceptorHandler.java:169)
  org.apache.webbeans.web.intercept.RequestScopedBeanInterceptorHandler.getContextualInstance(RequestScopedBeanInterceptorHandler.java:79)
  org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:114)
  org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:108)
  org.apache.webbeans.conversation.ConversationImpl_$$_javassist_0.isTransient(ConversationImpl_$$_javassist_0.java)
  org.apache.webbeans.jsf.WebBeansPhaseListener.beforePhase(WebBeansPhaseListener.java:106)
  org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:77)
  org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:158)
  org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
  javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
  filters.NoCacheFilter.doFilter(NoCacheFilter.java:42)
  org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:98)
  com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
4

2 回答 2

1

好的,我发现问题出在哪里。

首先,我必须阅读启动我的 TomEE 服务器的日志。我在那里发现,我的一个 EJB 类有问题。我用事务管理器注入资源:

   @Resource
   private UserTransaction userTransaction;

但我忘记通过以下方式注释我的服务 EJB:

@Stateless
@TransactionManagement(TransactionManagementType.BEAN)
public class TaskService {
  ...
}
于 2014-09-05T18:26:34.033 回答
1

如果“某人”不加批判地删除了应用程序的登录页面,也可能会发生这种情况。

于 2016-06-16T12:44:51.630 回答