添加了JBoss 4.2.3 Servlet API 2.5 JSF 2.0 Hibernate 3.0支持 [英] JBoss 4.2.3 Servlet API 2.5 JSF 2.0 Hibernate 3.0 Support Added
问题描述
在使用Jboss 4.2.3在Redhat 6上部署我的项目时,我遇到了以下困难,因此我决定将其置于stackoverflow上,以便它可以帮助其他人.如果有人可以建议一个好标题以便于搜索,请
While deploying my project on Redhat 6 with Jboss 4.2.3 I was having following difficulties so I decided to put it on stackoverflow so that it can help other people. If anyone could suggest a good title so that it can easily be searched, please
问:如何使Jboss 4.2.x忽略旧的JSF库并在项目库中使用一个库?
Q: How to make Jboss 4.2.x to ignore old JSF libraries and use one within your project libs?
问:如何使Jboss扫描WAR
文件扫描的特定路径?
Q: How to make Jboss scan specific path for WAR
file scanning?
问:如何用IP地址而不是localhost绑定Jboss?
Q: How to bind Jboss with IP address rather then localhost?
问:Jboss在哪里分解了WAR
文件?
Q: Where Jboss put exploded WAR
file?
Q:Hibernate-annotations
与Jboss 4.2.3注释冲突并引发以下Exception.
Q: Hibernate-annotations
conflict with Jboss 4.2.3 annotations and throwing following Exception.
java.lang.ClassCastException: org.hibernate.validator.event.ValidateEventListener cannot be cast to org.hibernate.event.PreInsertEventListener
问:如何在JBoss 4.0.x
上运行JSF 2.0.x
?由于JSF 2.0
至少支持Servlet 2.5 API
,而JBoss的Tomcat 5.x
最多可以支持Servlet 2.4
Q: How to run JSF 2.0.x
on JBoss 4.0.x
? As JSF 2.0
supports at least Servlet 2.5 API
and JBoss has Tomcat 5.x
that can support Servlet 2.4
at max.
问:如何更改动态Web项目的Servlet版本?
Q: How to change Servlet version of a Dynamic Web Project?
推荐答案
问:如何使Jboss扫描WAR文件扫描的特定路径?
Q: How to make Jboss scan specific path for WAR file scanning?
- 打开
$JBOSS_HOME/server/default/conf/jboss-service.xml
-
在以下标记中添加在逗号后放置战争的路径.假设我的战争粘贴在
/Oracle/my-web-apps
<attribute name="URLs">
deploy,/Oracle/my-web-apps <as many comma separated path for Jboss to scan war>
</attribute>
问:如何用IP地址而不是localhost绑定Jboss?
Q: How to bind Jboss with IP address rather then localhost?
使用IP地址绑定JBOSS,以便使用以下命令使用IP进行访问
Bind JBOSS with ip address so that you can access if with IP with following command
sh /Jboss/bin/run.sh -b 0.0.0.0
问:Jboss在哪里分解了WAR文件?
Q: Where Jboss put exploded WAR file?
您的WAR
将在/Jboss/server/default/temp/deploy
处爆炸,但是请注意,只有在您运行Jboss服务器时,deploy文件夹才会显示,因为当您停止Jboss服务器时,它会取消部署所有项目.
Your WAR
will be exploded at /Jboss/server/default/temp/deploy
but please note on thing that deploy folder will only be visible when you run your Jboss server, because when you stop your Jboss server it undeploys all the projects.
问:如何使Jboss 4.2.x忽略旧的JSF库并在项目库中使用一个库?
Q: How to make Jboss 4.2.x to ignore old JSF libraries and use one within your project libs?
为此,您不需要在JBoss方面进行任何更改,而只需在您自己的项目的web.xml
中进行任何更改.放置以下context-param
并完成
For this you don't need to change anything on JBoss side but in web.xml
of your own project. Put following context-param
and all done
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>
链接: http://docs.jboss.org/jbossas/6/JSF_Guide/zh-CN/html/
Q:
Hibernate-annotations
与Jboss 4.2.3注释冲突并引发以下Exception.
Q:
Hibernate-annotations
conflict with Jboss 4.2.3 annotations and throwing following Exception.
转到/jboss-4.2.3.GA/server/default/lib
并复制hibernate-annotations.jar
并将其替换为您的hibernate-annotations
jar.然后再次导出并部署项目.问题解决了. :-)
Go to /jboss-4.2.3.GA/server/default/lib
and copy hibernate-annotations.jar
and replace it with your hibernate-annotations
jar. Then again export and deploy project. Problem Solved. :-)
问:如何在JBoss 4.0.x上运行JSF 2.0.x?由于JSF 2.0至少支持Servlet 2.5 API,而JBoss拥有的Tomcat 5.x最多可以支持Servlet 2.4.
Q: How to run JSF 2.0.x on JBoss 4.0.x ? As JSF 2.0 supports at least Servlet 2.5 API and JBoss has Tomcat 5.x that can support Servlet 2.4 at max.
EL标签只是有一个区别,前提是您不使用Servlet 3.0的任何高级功能(例如异步支持等).请按照以下步骤操作,您可以在Jboss 4.x上运行JSF 2.0.
There is merely a difference of EL tags providing that you are not using any advance features of Servlet 3.0 like Async Support etc. Follow the steps below and You can run JSF 2.0 on Jboss 4.x
此问题的原始答案链接-> https://stackoverflow.com/a/5998625/185022
Link to Original Answer of this question --> https://stackoverflow.com/a/5998625/185022
JSF 2.0在很大程度上取决于 EL 2.1 是Servlet 2.5的一部分,相对于 EL 2.0 ,它是Servlet 2.4的一部分,但它不依赖于任何特定的Servlet 2.5特定的API. Servlet 2.4应该可以正常工作.因此,从理论上讲,如果在/WEB-INF/lib
中提供自己的EL 2.1 API和实现,则可以使JSF 2.0在Servlet 2.4上运行.我在Tomcat 5.5.33上使用/WEB-INF/lib
中的以下库在此处进行了快速测试:
JSF 2.0 depends heavily on EL 2.1 which is part of Servlet 2.5 and is a major change as opposed to EL 2.0 which is part of Servlet 2.4, but it does not depend on any particular Servlet 2.5 specific API. Servlet 2.4 should work as good. So in theory, you could get JSF 2.0 to work on Servlet 2.4 if you provide your own EL 2.1 API and implementation in /WEB-INF/lib
. I did a quick test here on Tomcat 5.5.33 with the following libraries in /WEB-INF/lib
:
-
从 Tomcat 6.0.x 的
-
el-api.jar
文件 - Mojarra 2.0.x 中的
-
jsf-api.jar
和jsf-impl.jar
lib
文件夹复制的el-api.jar
file copied fromlib
folder of Tomcat 6.0.xjboss-el.jar
file (implements EL 2.1 and supports EL 2.2 like method invocation with arguments)jsf-api.jar
andjsf-impl.jar
from Mojarra 2.0.x
还有一个声明了JBoss EL的Servlet 2.4 web.xml
:
And a Servlet 2.4 web.xml
where the JBoss EL is been declared:
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<context-param>
<param-name>com.sun.faces.validateXML</param-name>
<param-value>false</param-value>
一个简单的JSF 2.0 Facelet(不是JSP!),一个简单的<h:form>
,一个带有<f:ajax>
的按钮和一个简单的@ViewScoped
@ManagedBean
,对我来说适用于Tomcat 5.5.33.尝试在您的JBoss 4.0.5上进行彻底的测试.
A simple JSF 2.0 Facelet (not JSP!) with a simple <h:form>
with a button with <f:ajax>
and a simple @ViewScoped
@ManagedBean
works for me on Tomcat 5.5.33. Give it a try on your JBoss 4.0.5 and test it thoroughly.
请注意,您至少需要JDK 1.5,而不是JDK 1.4.还请注意,由于存在Servlet 2.5特定的el-api.jar
文件,因此您的应用程序无法以这种方式移植到任何Servlet 3.0容器.
Note that you need a minimum of JDK 1.5, not JDK 1.4. Also note that your application is this way unportable to any Servlet 3.0 container due to presence of the Servlet 2.5 specific el-api.jar
file.
问:如何更改动态Web项目的Servlet版本?
Q: How to change Servlet version of a Dynamic Web Project?
在Eclipse中,右键单击一个项目并转到属性,然后单击Project Facet(如下图所示),如果它允许您进行更改,那么这很好,否则会有黑客来做.
In Eclipse right click a project and go to properties and then click on Project Facet as shown in the image below if it will allow you to change then it's good otherwise there is a hack to do it.
如果Eclipse不允许您执行此操作,请转到$ProjectWorkSpace/.settings/org.eclipse.wst.common.project.facet.core.xml
并将facet="jst.web"
的值更改为2.4
,也不要忘记在Web.xml
中将Servlet 2.4的XML Schema更改为如下所示
If Eclipse doesn't allows you to do that then go to $ProjectWorkSpace/.settings/org.eclipse.wst.common.project.facet.core.xml
and change the value of facet="jst.web"
to 2.4
and also don't forget to change XML Schema for Servlet 2.4 in your Web.xml
as shown below
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
这篇关于添加了JBoss 4.2.3 Servlet API 2.5 JSF 2.0 Hibernate 3.0支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!