Note that in OFBiz the Jboss templates are included in the location:
OFBiz_HOME/framework/appserver/templates/jboss422
This is for Jboss 4.2.2 version. Minor modifications are required to deploy this in Jboss 5.1.0. The above command will generate the script files and place the directory named jboss422 under OFBIZ_HOME/setup
Go to OFBIZ_HOME/setup/jboss422
The following files are created under this directory
Swap and keep a backup as follows
Rename entityengine.xml to entityengine.xml.bak
Rename entityengine-jboss.xml to entityengine.xml
Now open entityengine.xml file and modify the content accordingly.
Here basically we are setting jndi datasource names and connection manager
Comment the geronimo transaction manager
<!-transaction-factory class="org.ofbiz.geronimo.GeronimoTransactionFactory"/->
Uncomment the following and modify it as given below
<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" and then comment the following
<!-- <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
<!-- <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
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
<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
<!--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
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 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
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
This howto thanks to Vignesh Sabapathi