如果webapp包含@无状态ejb,我无法在websphere 8.5.5上启动嵌入CODI的webapp。
我明白这一例外:
[ERROR ] null
java.lang.reflect.InvocationTargetException
[ERROR ] An error occured while initializing MyFaces: java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException
[ERROR ] Uncaught.init.exception.thrown.by.servlet
Faces Servlet
codiTest
javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @ApplicationScoped does not exist within current thread
at org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:342)
at [internal classes]
at org.apache.myfaces.extensions.cdi.core.api.config.CodiCoreConfig_$$_javassist_78.isAdvancedQualifierRequiredForDependencyInjection(CodiCoreConfig_$$_javassist_78.java)
at org.apache.myfaces.extensions.cdi.jsf.impl.listener.phase.PhaseListenerExtension.consumePhaseListeners(PhaseListenerExtension.java:110)
at org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleFactoryWrapper.getLifecycle(CodiLifecycleFactoryWrapper.java:67)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:119)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:322)
at [internal classes]
[ERROR ] SRVE0266E: Error occured while initializing servlets: javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:385)
at [internal classes]
Caused by: javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @ApplicationScoped does not exist within current thread
at org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:342)
at [internal classes]
at org.apache.myfaces.extensions.cdi.core.api.config.CodiCoreConfig_$$_javassist_78.isAdvancedQualifierRequiredForDependencyInjection(CodiCoreConfig_$$_javassist_78.java)
at org.apache.myfaces.extensions.cdi.jsf.impl.listener.phase.PhaseListenerExtension.consumePhaseListeners(PhaseListenerExtension.java:110)
at org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleFactoryWrapper.getLifecycle(CodiLifecycleFactoryWrapper.java:67)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:119)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:322)
... 1 more
[WARNING ] Unknown RenderKit 'HTML_BASIC'.
[WARNING ] Unknown RenderKit 'HTML_BASIC'.
[ERROR ] An exception occurred
java.lang.IllegalArgumentException: Could not find a RenderKit for "HTML_BASIC"我已经说明过,只有当项目中存在ejb (在我的例子中是@无状态ejb)时,问题才会发生。
在这种情况下,当服务器启动并安装/部署webapp时,应用程序上下文将被初始化。这里没问题。
当webapp处理第一个HTTP请求时,初始化FacesServlet并实例化CodiNavigationHandler。
在构造函数中调用方法CodiNavigationHandler.isAddViewConfigsAsNavigationCaseActivated(),并尝试获取对CODI JsfModuleConfig的引用。这个JsfModuleConfig有一个@ApplicationScoped注释,beanManager试图获取应用程序上下文。
这个应用程序上下文已经创建(在部署webapp时),但是还没有调用LibertyContextsService.initApplicationContext(String)。因此,应用程序上下文在LibertyContextsService.applicationContexts ThreadLocal变量上为null,并且出现错误:
WebBeans context with scope type annotation @ApplicationScoped does not exist within current thread复制:
beans元素)faces-config元素)nota:如果您删除了ejb上的@无状态,应用程序就能工作。
发布于 2013-11-04 11:00:58
实际上,它似乎是一个bug (我还在IBM上发布了这个问题:https://www.ibm.com/developerworks/community/forums/html/topic?id=f372bbc5-5ba4-4c2a-9ef0-0bdcd76766da#09228314-2baf-4892-899e-5a8cc52daa19)。
我要设法创建一个PMR (我在一家大公司,很难找到合适的人,允许我访问)。
所以现在我已经转到jboss了。
https://stackoverflow.com/questions/19709201
复制相似问题