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
Q: How to make Jboss 4.2.x to ignore old JSF libraries and use one within your project libs?
Q: How to make Jboss scan specific path for WAR
file scanning?
Q: How to bind Jboss with IP address rather then localhost?
Q: Where Jboss put exploded WAR
file?
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
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.
Q: How to change Servlet version of a Dynamic Web Project?
Q: How to make Jboss scan specific path for WAR file scanning?
- Open
$JBOSS_HOME/server/default/conf/jboss-service.xml
Add the path where you put your war after comma in the following tag. Suppose my war are pasted at /Oracle/my-web-apps
<attribute name="URLs">
deploy,/Oracle/my-web-apps <as many comma separated path for Jboss to scan war>
</attribute>
Q: How to bind Jboss with IP address rather then localhost?
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
Q: Where Jboss put exploded WAR file?
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.
Q: How to make Jboss 4.2.x to ignore old JSF libraries and use one within your project libs?
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>
Link: http://docs.jboss.org/jbossas/6/JSF_Guide/en-US/html/
Q: Hibernate-annotations
conflict with Jboss 4.2.3 annotations and throwing following Exception.
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. :-)
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.
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
Link to Original Answer of this question --> https://stackoverflow.com/a/5998625/185022
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
:
el-api.jar
file copied from lib
folder of Tomcat 6.0.x
jboss-el.jar
file (implements EL 2.1 and supports EL 2.2 like method invocation with arguments)
jsf-api.jar
and jsf-impl.jar
from Mojarra 2.0.x
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>
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.
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.
Q: How to change Servlet version of a Dynamic Web Project?
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.
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">