2

I am using IBM Websphere 8.0. We are trying to create the ear archive with all our CDI beans packaged in JAR directly in the ear file. The war manifest lists down the names of the jars packaged.

My issue is that I see a this stacktrace even though the application seems to have worked

Caused by: javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @RequestScoped does not exist within current thread
at org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:321)
at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.getContextualInstance(NormalScopedBeanInterceptorHandler.java:124)
at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:95)
at org.apache.webbeans.conversation.ConversationImpl_$$_javassist_0.isTransient(ConversationImpl_$$_javassist_0.java)
at org.apache.webbeans.jsf.WebBeansPhaseListener.beforePhase(WebBeansPhaseListener.java:93)
at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:76)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:159)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)

I am having a tough time comprehending it. As soon as I move the jars back into WEB-INF/lib, the application works fine again without this stacktrace in SystemOut logs. Could someone please shed some light or even direct me to any article on CDI and Classloader specifially if there is a Classloader heirarchy like in IBM.

My application is using PARENT_FIRST class loading for the application with a war class loader policy of PARENT_FIRST and a classloader per war. Any Help would be greatly appreciated

Sekhon
  • 108
  • 1
  • 10
  • I would be surprised that moving the jar from the war to the ear would cause a ContextNotActiveException. I would guess that some other error happened earlier than prevented CDI from activiating the request context, or possibly you are in a sendError codepath where the request has been destroyed. When you put the jar in the EAR, are you placing it in EAR/lib? If not you should probably update the classpath in the MANIFEST.MF of the WAR to point to the jar that contains the classes – jbergmark Mar 14 '14 at 17:58

0 Answers0