简体   繁体   English

JSF 2.0可以与Websphere应用程序服务器版本7.x一起使用

[英]Can JSF 2.0 be used with Websphere application server version 7.x

Can JSF 2.0 be used with WebSphere Application Server version 7.x? JSF 2.0可以与WebSphere Application Server V7.x一起使用吗?

If so, how? 如果是这样,怎么样?

The WebSphere Infocenter indicates that the right way to change to an alternative JSF implementation is to create a WebSphere Shared Library with the isolated classloader option enabled. WebSphere Infocenter表明,更改为替代JSF实现的正确方法是创建一个启用了隔离的类加载器选项的WebSphere共享库。

Any modules that need JSF 2 would be associated with the new shared library, and then the application would start with JSF 2 instead of JSF 1.2. 任何需要JSF 2的模块都将与新的共享库相关联,然后应用程序将以JSF 2而不是JSF 1.2开始。

It is also necessary to have fix pack 7.0.0.19 or later installed . 必须安装修订包7.0.0.19或更高版本

Step by step setting MyFaces 2.0 on WebSphere Application Server v7 as shared library as IBM recommends: http://wasbehindtheglass.blogspot.co.uk/ 逐步将WebSphere Application Server v7上的MyFaces 2.0设置为IBM建议的共享库: http//wasbehindtheglass.blogspot.co.uk/

I have applied similar steps for Majorra/JSF 2.0.4 and created a shared library using only jsf-api.jar and jsf-impl.jar. 我已经为Majorra / JSF 2.0.4应用了类似的步骤,并仅使用jsf-api.jar和jsf-impl.jar创建了一个共享库。 As @Ian McLaird has told WAS 7.0.0.19 and JSF 2.0.4 are required. 正如@Ian McLaird告诉WAS 7.0.0.19和JSF 2.0.4是必需的。 JSF 2.1.x requires Servlet 3 and is not supported by WAS7 JSF 2.1.x需要Servlet 3,WAS7不支持

My Experience: 我的经验:

-> WAS 7.0.0.11 on Windows - > Windows上的WAS 7.0.0.11

-> javax.faces-2.0.11.jar in WEB-INF/lib of my War application - >我的战争应用程序的WEB-INF / lib中的javax.faces-2.0.11.jar

-> WAS Shared librairies with javax.faces-2.0.11.jar with Isolated Class Loader - >使用隔离类加载器与javax.faces-2.0.11.jar共享库

-> WAS Shared librairies associated with my War App - > WAS与我的战争应用程序相关的共享库

-> No change on Class Loader for instance and application (PARENT_FIRST) - >类加载器的实例和应用程序没有变化(PARENT_FIRST)

With this conf (above) the application works fine with JSF 2.0 on WAS 7. if i delete the javax.faces-2.0.11.jar from my War app, it doesn't works. 有了这个conf(上面),应用程序可以在WAS 7上使用JSF 2.0。如果我从我的War应用程序中删除了javax.faces-2.0.11.jar,它就不起作用了。

Following worked for me 以下为我工作

  • Create a shared library and put your JSF 2.0 jars in it. 创建一个共享库并将JSF 2.0 jar放入其中。
  • Also add EL 2.2 API and EL-Impl 2.2 jars as well since JSF 2.0 implicitly needs this. 还要添加EL 2.2 API和EL-Impl 2.2 jar,因为JSF 2.0隐式需要这个。
  • Add this library to your application and make classloader preference as PARENT_LAST. 将此库添加到您的应用程序,并将classloader首选项设置为PARENT_LAST。

Change web.xml as following 更改web.xml如下

 <context-param>
                <param-name>com.sun.faces.expressionFactory</param-name>
                <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
    </context-param>
    <listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>

Thats it . 而已 。

Websphere ships with JSF 1.2.something and it loads that by default. Websphere附带JSF 1.2.something并默认加载它。 To use a different JSF library (or any other library that WS provides such as commons-logging) you need to change the way the classloader prioritizes locations. 要使用不同的JSF库(或WS提供的任何其他库,例如commons-logging),您需要更改类加载器对位置进行优先级排序的方式。 They call it 'parent last" meaning load your libs then the WS versions. 他们称之为“父级最后”意味着加载你的lib然后加载WS版本。

Hi I could run my website using this libraries 嗨,我可以使用这个库运行我的网站

librerias

Configuring in web.xml of my project 在我的项目的web.xml中配置

 <context-param>
    <param-name>com.sun.faces.expressionFactory</param-name>
    <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>

Configuring in websphere to load my libraries (Parent Last) 在websphere中配置以加载我的库(Parent Last)

Regards 问候

Thank you guys! 感谢你们!

It worked with a newer version of javax.faces. 它适用于更新版本的javax.faces。 See the maven dependencies: 查看maven依赖项:

    <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.faces</artifactId>
        <version>2.1.29-08</version>
    </dependency>
    <dependency>
        <groupId>javax.el</groupId>
        <artifactId>el-api</artifactId>
        <version>2.2</version>
    </dependency>
    <dependency>
        <groupId>com.sun.el</groupId>
        <artifactId>el-impl</artifactId>
        <version>2.2</version>
    </dependency>

Don't forget to add the following in your web.xml: 不要忘记在web.xml中添加以下内容:

<context-param>
   <param-name>com.sun.faces.expressionFactory</param-name>
   <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>

And finally change the WebSphere class loader order of the application and the module to the (parent last) settings: https://www.ibm.com/support/knowledgecenter/SSAW57_7.0.0/com.ibm.websphere.nd.doc/info/ae/ae/urun_rclassloader_inst.html 最后将应用程序和模块的WebSphere类加载器顺序更改为(父最后一个)设置: https//www.ibm.com/support/knowledgecenter/SSAW57_7.0.0/com.ibm.websphere.nd.doc/信息/ AE / AE / urun_rclassloader_inst.html

Regards 问候

I've been struggling to solve this for days. 几天来我一直在努力解决这个问题。 Here's how I solved it. 这是我解决它的方式。

Use the following library: javax.faces-2.1.7.jar 使用以下库: javax.faces-2.1.7.jar

If you are on PrimeFaces 3.1: primefaces-3.1.1.jar 如果你在PrimeFaces 3.1: primefaces-3.1.1.jar

Application Server instance: Class Loading - Parent Last Application Server实例: Class Loading - Parent Last

Enterprise Application instance (war Module): Class Loading - Parent Last 企业应用程序实例(战争模块): 类加载 - 父最后

Make sure to remove all Servlet Container libraries such as those needed by Tomcat. 确保删除所有Servlet容器库,例如Tomcat所需的库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Eclipse使用的Websphere应用程序服务器和JRE版本是否应具有完全相同的版本号? - Should Websphere application server and JRE version used by Eclipse have the exact same version number? Jboss(6.4 EAP)到WebSphere(7.x) - Jboss (6.4 EAP) to WebSphere (7.x) 无法在 WebSphere Application Server 8.5.5 中运行 JSF 1.1 应用程序 - cannot run JSF 1.1 application in WebSphere Application Server 8.5.5 在WebSphere Application Server中一起实现JSF-2.3和CDI - implementing JSF-2.3 and CDI together in WebSphere Application Server API alfresco repository version 6.X or 7.X 应用上下文的初始化问题 - initialization problem of the application context of the API alfresco repository version 6.X or 7.X IBM Websphere Application Server 6.1 版下载 windows - IBM Websphere Application Server version 6.1 download for windows 为什么Server Liferay 7.x无法启动? - Why Server Liferay 7.x is unable to start? Websphere Application Server中的XAException - XAException in Websphere Application Server 无法在Websphere 6.1上运行JSF应用程序 - Unable to run JSF application on websphere 6.1 Websphere Application Server v8 无法连接到服务器进程 - Websphere Application Server v8 can't connect to server process
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM