Following are the steps involved in deploying OFBiz 9.04 on JBoss AS 5.1.0:
- Download latest ofbiz 9.04 release
- Unzip it under desired directory.
- Download Jboss 5.1.0.GA
- Unzip in desired directory
- Go to OFBiz directory. Now compile and build ofbiz with derby database using the following ant command: ant run-install. The command finishes by showing build successful message.
- Generate give the following ant command to generate the script for deploying Ofbiz in jboss: java -jar ofbiz.jar -setup jboss422
...
- application.xml
- build.xml
- deploy.sh
- run.conf
For Jboss 5.1.0
...
- Navigate to Jboss 5.1.0 home directory and go to server/default/deploy directory. Under this directory make a new directory and name it a ofbiz.ear
...
Uncomment the following and modify it as given below
Code Block |
---|
<transaction-factory class="org.ofbiz.entity.transaction.JNDIFactory"> |
...
<user-transaction-jndi jndi-server-name="default" jndi-name="UserTransaction"/> |
...
<transaction-manager-jndi jndi-server-name="default" jndi-name="java:/TransactionManager"/> |
...
</transaction-factory> |
Navigate down and find the tag <datasource name=�localderby� "localderby" and then comment the following
Code Block |
---|
<!-- |
...
<inline-jdbc |
...
jdbc-driver="org.apache.derby.jdbc.EmbeddedDriver" |
...
jdbc-uri="jdbc:derby:ofbiz;create=true" |
...
jdbc-username="ofbiz" |
...
jdbc-password="ofbiz" |
...
isolation-level="ReadCommitted" |
...
pool-minsize="2" |
...
pool-maxsize="250"/> |
...
--> |
Uncomment the below line and change the jndi-name according to the name in derby-ds.xml file
<jndi-jdbc jndi-server-name="default" jndi-name="java:/OFBizDS" isolation-level="ReadCommitted"/>
Navigate down and find the tag <datasource name="localderbyolap"
and then comment the following
Code Block |
---|
<!-- |
...
<inline-jdbc |
...
jdbc-driver="org.apache.derby.jdbc.EmbeddedDriver" |
...
jdbc-uri="jdbc:derby:ofbizolap;create=true" |
...
jdbc-username="ofbiz" |
...
jdbc-password="ofbiz" |
...
isolation-level="ReadCommitted" |
...
pool-minsize="2" |
...
pool-maxsize="250"/> |
...
--> |
Uncomment the below line and change the jndi-name according to the name in derby-ol-ds.xml file
<jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/OFBizOlapDS" isolation-level="ReadCommitted"/>
Now all set to go. Start Jboss by navigating to JBOSS_HOME/bin/ directory with the following command: run.sh
Troubleshooting steps
If you get an exception like the one below
Code Block |
---|
Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: The content of element type "web-app" must match "(icon |
...
, display-name |
...
, description |
...
, distributable |
...
, context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config |
...
, mime-mapping*,welcome-file-list |
...
, error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config |
...
, security-role*,env-entry*,ejb-ref*,ejb-local-ref*)". @ vfsfile:/opt/jboss-5.1.0.GA/server/default/deploy/ofbiz.ear/webtools.war/WEB-INF/web.xml |
JBOSS 5.1 version is strict in XML validation. It founds that the content of web.xml of webtools application is not valid.
Go to JBOSS_HOME/server/default/deploy/ofbiz.ear/webtools.war/WEB-INF/web.xml
file and scroll down to the last few lines which starts with
Code Block |
---|
<context-param> |
...
<param-name>GeronimoMultiOfbizInstances</param-name> |
...
<param-value>true</param-value> |
...
<description>This is only used in case of Geronimo or WASCE using OFBiz multi-instances. It allows to retrieve ofbiz.home value set in JVM env</description> |
...
</context-param> |
Comment the above
Code Block |
---|
<!-- |
...
context-param> |
...
<param-name>GeronimoMultiOfbizInstances</param-name> |
...
<param-value>true</param-value> |
...
<description>This is only used in case of Geronimo or WASCE using OFBiz multi-instances. It allows to retrieve ofbiz.home value set in JVM env</description> |
...
</context- |
...
param--> |
Now save the file and then restart the JBOSS server
If you get an exception like below
...
Code Block |
---|
ERROR |
...
[org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]. |
...
[ |
...
] |
...
] |
...
(main) |
...
Exception starting filter ContextFilter |
...
java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException |
This Error is caused by a missing codec jar file in jboss to work with OFBiz
: Google for commons-codec-x.jar file. Where x stands for version number.It is available with jboss 4.2.2 version. Copy the jar file and paste it under /JBOSS_HOME/server/default/deploy/ofbiz.ear/lib/the . The exact file name will be commons-codec-1.3.jar
Now Restart jboss again and now fire a request in the browser to see OFBiz in action
Making SSL to work in Jboss
Navigate to JBOSS_HOME/server/default/deploy/jbossweb.sar/server.xml file and uncomment the SSL connector configuration settings and add keystore file path to it. Now you are done
Advantages in deploying OFBiz in JBoss AS
- Clustering in Jboss 5.1.0 is easier when compared to lower version of Jboss
- After deployment, we can create multiple nodes in jboss and cluster all the nodes to support more load
- Jboss can be easily load balanced with Apache making it to create more virtual host address
- We can tune maximum client settings for Apache and Jboss and JVM memory settings to improve the performance of Ofbiz
- We can also make busyiness based, request based load balancing using Mod_jk
...