美好的一天,
现在我正在尝试将我当前正在运行的应用程序(Primefaces + EJB + JPA + Glassfish 4.0)迁移到WAS 8.5。我尝试使用mojarra来使Primefaces工作。我以为我已经成功了但是我在启动期间在SystemOut.log中的事件报告中偶然发现了这个例外:
FFDC异常:java.lang.IllegalStateException SourceId:com.ibm.ws.webbeans.services.JCDIWebListener.contextInitialized()ProbeId:104 Reporter:com.ibm.ws.webbeans.services.JCDIWebListener@fa0f39fa java.lang.IllegalStateException:与JCDI一起使用的不支持的JSF实现
当我尝试按下调用#{navigationBean.login}的按钮时,我得到了这个例外:
javax.el.PropertyNotFoundException: /login.xhtml @45,111 action="#{navigationBean.login}": Target Unreachable, identifier 'navigationBean' resolved to null
进一步的研究表明(如果我错了,请纠正我),使用MyFaces JSF实现,WAS的CDI实现(Apache OpenWebBeans)效果最好(或仅适用于?)。所以我怀疑这是因为我使用的是Mojarra而不是MyFaces。所以我继续尝试尝试替换OpenWebBeans只是为了发现我无法将其更改为Weld CDI Implementation(这是Glassfish使用的)。
有关如何解决此问题的任何建议?我真的希望能够在websphere中使用primefaces。
更新: 更新:我能够显示我的第一页(使用primeface + MyFaces的登录页面)。但是,当我点击带有EL表达式的第一个元素(#{navigationBean.login})指向@Named类NavigationBean时,我仍然得到
javax.el.PropertyNotFoundException: /login.xhtml @45,111 action="#{navigationBean.login}": Target Unreachable, identifier 'navigationBean' resolved to null
此外,我还看到了这个异常跟踪:
com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0014E: Uncaught service() exception root cause Faces Servlet: javax.servlet.ServletException: WebBeans context with scope type annotation @RequestScoped does not exist within current thread
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:221)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1227)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:776)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:458)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:79)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:928)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1385)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:194)
at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:3263)
at com.ibm.ws.webcontainer.webapp.WebApp.handleException(WebApp.java:3791)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3772)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:976)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:88)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
通过进一步的研究,我的假设是:(你们都可以纠正,以便引导我走上正确的道路) - Websphere中的Primefaces + MyFaces运行良好。但是如果我想实现一个依赖注入,我将不得不求助于使用@ManagedBean而不是@Named CDI实现(到目前为止更好)
但是,如果有人知道如何使@Named仍然使用primefaces,你可以展示如何或至少指出我所知道的可以提供帮助的资源。
非常感谢。
答案 0 :(得分:2)
我已经解决了自己的问题。 Primefaces适用于
MyFaces2.0+CDI(OpenWebbeans)+WAS8.5
我所做的是在我的bin文件夹中包含Primefaces所有必需的依赖文件,并在我的web.xml中进行一些调整然后它工作正常。 :)
这是我的web.xml的一部分:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>ISIP_DCE</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<enabled>true</enabled>
<async-supported>false</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>
*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<description>
</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<description>
</description>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value/>
</context-param>
<context-param>
<description>
</description>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<description>
</description>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<description>
</description>
<param-name>com.ibm.ws.jsf.JSP_UPDATE_CHECK</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>
</description>
<param-name>com.ibm.ws.jsf.LOAD_FACES_CONFIG_AT_STARTUP</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>
javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>primefaces.TRANSFORM_METADATA</param-name>
<param-value>true</param-value>
</context-param>
<filter>
<filter-name>Primefaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
<init-param>
<param-name>thresholdSize</param-name>
<param-value>51200</param-value>
</init-param>
</filter>
<context-param>
<param-name>primefaces.TRANSFORM_METADATA</param-name>
<param-value>true</param-value>
</context-param>
<filter-mapping>
<filter-name>Primefaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>Workaround for the bug reported for JSF 2.0.
(source: http://stackoverflow.com/questions/8026082/jsf-2-0-why-my-viewscope-beans-is-re-created-even-though-still-on-same-view)</description>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>