简体   繁体   中英

Running Primefaces (JSF2) application on Websphere 6.1

I have been attempting to get my Primefaces based web application to run on the customer's WAS 6.1.0.23 machine. I have tried both the reference and Myfaces implementations of JSF2, the latter of which has instructions for install on this specific server version ( http://wiki.apache.org/myfaces/Websphere_Installation ).

I have included the necessary libraries (listed below for each implementation individually) in the .war file of the application.

The reference implementation

  • primefaces-5.0.jar
  • jstl-api.jar
  • jstl-impl.jar (both 1.2.2)
  • el-api-2.2.jar
  • el-impl-2.2.jar
  • el-ri-1.0.jar
  • javax.faces.jar
  • JDK 1.5

The Myfaces implementation

  • commons-beanutils-1.8.3.jar
  • commons-collections-3.2.jar
  • commons-codec-1.3.jar
  • commons-digester-1.8.jar
  • commons-el.jar/(el-api-2.2.jar, el-impl-2.2.jar, el-ri-1.0.jar) [tried both, only the latter seems to be recognized]
  • myfaces-api-2.1.1
  • myfaces-bundle-2.1.17.jar
  • myfaces-impl-2.1.17.jar
  • JDK 1.5

I have set the application to load classes application first.

Enterprise Applications > MyWebApp_war > Manage Modules > MyWebApp.war
Class loader order:
Classes loaded with application class loader first

When using the reference implementation, I progressively added necessary libraries to the .war file until I got an exception that I could not get around.

[7/9/15 16:09:42:909 EDT] 00001183 WebApp        E   Exception caught while initializing context
java.lang.RuntimeException: java.lang.NoClassDefFoundError: java/util/ServiceLoader
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:280)
at com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:652)
at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:355)
at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:292)
at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:92)
at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:157)
at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(WebContainer.java:671)
at com.ibm.ws.wswebcontainer.WebContainer.addWebApplication(WebContainer.java:624)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:335)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:551)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1274)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1138)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:569)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:817)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:921)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$1.run(ApplicationMgrImpl.java:1461)
at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:4132)
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:4229)
at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:245)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1466)
at sun.reflect.GeneratedMethodAccessor789.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:36)
at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:243)
at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1073)
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:954)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1106)
...

With the Myfaces implementation, the same process was followed. However, it was not able to start the application with the commons-el.jar. So, switching it out for el-api-2.2.jar, el-impl-2.2.jar, and el-ri-1.0.jar produced a result where the application would start, and catch a NameNotFoundException on the JSTL namespace

Warning: The page /template/common/commonLayout.xhtml declares namespace http://xmlns.jcp.org/jsf/core and uses the tag f:view , but no TagLibrary associated to namespace.

The following snippet is of the addition to WEB-INF/web.xml that changed to using the provided expresion language implementation. It is followed by a System out dump.

<context-param>
    <param-name>org.apache.myfaces.EXPRESSION_FACTORY</param-name>
    <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
<context-param>
    <param-name>com.sun.faces.expressionFactory</param-name>
    <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>

Sorry, the SystemOut.log is too long to paste directly: http://pastebin.com/JQ2br2Dq

So, my question is, has anyone successfully gotten a JSF2-based (Primefaces) web application to run on WAS 6.1, and what are the step-by-step instructions to do so? Thank you very much for your help.

Also, NB this application is known working on all Apache Tomcat versions that support JSF2.

WebSphere Application Server only supports Java 5, but the error indicates that the JSF implementation ( com.sun.faces.config.ConfigureListener ) requires Java 6 since it is attempting to use java.util.ServiceLoader , which was only added in that version. You'll either need to pick an older JSF implementation or a newer WebSphere Application Server version (note that 6.1 was end of service as of 2013).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM