Installation issues with Tomcat7/Bonita 6.1.1

OK. I have installed Tomcat 7 on Ubuntu 12. Tested the default install and it ran fine.

I followed the instructions here for a Ubuntu/OpenJDK/Tomcat/MySQL install and found the instructions to be very detailed and clear. I am having one hitch though. Tomcat won't start.

In the instructions there is a place referencing the mysql jar:

Add JDBC driver

<p>
	You need to include JDBC driver in Tomcat classpath:</p>

<ul>
	<li>
		Change to Tomcat libraries directory:&nbsp;<code>cd /usr/share/tomcat7/lib</code></li>
	<li>
		Create a link to include the driver (don't forget the command ending dot character):&nbsp;<code>sudo ln -s ../../java/mysql.jar .</code></li>
</ul>

 

I could not find a file /usr/share/java/mysql.jar??? I assumed it was just a standin name for the latest mysql jar so I downloaded and placed "mysql-connector-java-5.1.29-bin" from the MySQL site and then created a link as instructed.

I have confirmed everything else about the instructions aboud copied files, permissions, etc.

When I try to start Tomcat I get the following in the log:

 

Feb 19, 2014 4:30:24 PM bitronix.tm.resource.ResourceLoader init
INFO: reading resources configuration from /opt/bonita/btm/conf/bitronix-resources.properties
bitronix.tm.utils.InitializationException: initialization failed, cannot safely start the transaction manager
    at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:102)
    at bitronix.tm.TransactionManagerServices.getTransactionManager(TransactionManagerServices.java:75)
    at bitronix.tm.integration.tomcat55.BTMLifecycleListener.lifecycleEvent(BTMLifecycleListener.java:18)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:401)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:645)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot configure resource for configuration entries with name [ds1] - failing property is [className]
    at bitronix.tm.resource.ResourceLoader.buildXAResourceProducer(ResourceLoader.java:254)
    at bitronix.tm.resource.ResourceLoader.initXAResourceProducers(ResourceLoader.java:170)
    at bitronix.tm.resource.ResourceLoader.init(ResourceLoader.java:152)
    at bitronix.tm.resource.ResourceLoader.init(ResourceLoader.java:84)
    at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:86)
    ... 13 more
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:190)
    at bitronix.tm.utils.ClassLoaderUtils.loadClass(ClassLoaderUtils.java:63)
    at bitronix.tm.resource.ResourceLoader.instantiate(ResourceLoader.java:119)
    at bitronix.tm.resource.ResourceLoader.createBean(ResourceLoader.java:271)
    at bitronix.tm.resource.ResourceLoader.buildXAResourceProducer(ResourceLoader.java:239)
    ... 17 more

I have check my connection string and have connected manually to the MySQL server and database using the bonita credentials that I set up.

Any help would be appreciated. 

PS> I really like what I see upgrading from 5.7 to 6.2!

 

Hi,

I think you don't put the following librairies in [YOUR_TOMCAT_HOME]\lib\ :

  • jta
  • btm-tomcat55-lifecycle
  • btm

Best regards,

<p>
	Céline</p>

Where is the \lib\bonita folder? There is no \bonita folder in my \lib folder???

Hi,

Have you put your JAR mysql-connector-java in [YOUR_TOMCAT_HOME]\lib\bonita ?

Have you configurate the files [YOUR_TOMCAT_HOME]\conf\bitronix-resources.properties, [YOUR_TOMCAT_HOME]\conf\Catalina\localhost\bonita.xml, and [YOUR_TOMCAT_HOME]\bin\setenv. bat (for Windows) or .sh (for Linux) ?

 

Best regards,

Céline

Sorry, my bad...

I started over and followed the instructions. At every step I started and stopped Tomcat7 to insure that it was still working. The installation is failing for me at this step when I add the Bitronix stuff.

When I add the following lines:

Edit server.xml (sudo nano /etc/tomcat7/server.xml) and add:
Listener declaration after existing listeners: <Listener className="bitronix.tm.integration.tomcat55.BTMLifecycleListener" ></Listener>
Add Valve declaration after existing Valve: <Valve className="org.bonitasoft.console.security.SessionFixationValve" authenticationUrl="/loginservice"></Valve>

I get the following error when starting Tomcat7:

Feb 20, 2014 5:54:46 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Feb 20, 2014 5:54:46 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 801 ms
Feb 20, 2014 5:54:46 PM bitronix.tm.integration.tomcat55.BTMLifecycleListener lifecycleEvent
INFO: Starting Bitronix Transaction Manager
java.lang.NoClassDefFoundError: bitronix/tm/TransactionManagerServices
    at bitronix.tm.integration.tomcat55.BTMLifecycleListener.lifecycleEvent(BTMLifecycleListener.java:18)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:401)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:645)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
Caused by: java.lang.ClassNotFoundException: bitronix.tm.TransactionManagerServices
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
    ... 12 more

Also, When the line is added to /usr/share/tomcat7/bin/setenv.sh:

DB_OPTS="-Dsysprop.bonita.db.vendor=mysql"

Does it need to be in any specific place? It seems it would need to be before the "CATALINA_OPTS=" line and this line would need to change.

CATALINA_OPTS="${CATALINA_OPTS} ${BONITA_HOME} ${BTM_OPTS} -Dfile.encoding=UTF-8 -Xshare:auto -Xms1024m -Xmx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError"

 

 

 

I think you don't put the following librairies in [YOUR_TOMCAT_HOME]\lib\ :

  • Copy the libraries (.jar files) from the Deploy bundle to your Tomcat folder:sudo cp bonita-tomcat-valve-6.0.35.jar btm-2.1.3.jar btm-tomcat55-lifecycle-2.1.3.jar jta-1.1.jar slf4j-api-1.6.1.jar slf4j-jdk14-1.6.1.jar /usr/share/tomcat7/lib/

Yes. They are there. 

Now I am at work (wayyyyyy early):

eric@sl24:/usr/share/tomcat7/lib$ ls -l
total 68
lrwxrwxrwx 1 root root    44 Apr  1  2013 annotations-api.jar -> ../../java/tomcat-annotations-api-7.0.26.jar
-rw-r--r-- 1 root root  3416 Feb 20 14:42 bonita-tomcat-valve-6.0.35.jar
-rw-r--r-- 1 root root  3416 Feb 20 14:42 btm-2.1.3.jar
-rw-r--r-- 1 root root  3177 Feb 20 14:42 btm-tomcat55-lifecycle-2.1.3.jar
lrwxrwxrwx 1 root root    34 Apr  1  2013 catalina-ant.jar -> ../../java/catalina-ant-7.0.26.jar
lrwxrwxrwx 1 root root    40 Apr  1  2013 catalina-ha.jar -> ../../java/tomcat-catalina-ha-7.0.26.jar
lrwxrwxrwx 1 root root    37 Apr  1  2013 catalina.jar -> ../../java/tomcat-catalina-7.0.26.jar
lrwxrwxrwx 1 root root    37 Apr  1  2013 catalina-tribes.jar -> ../../java/catalina-tribes-7.0.26.jar
lrwxrwxrwx 1 root root    27 Apr  1  2013 commons-dbcp.jar -> ../../java/commons-dbcp.jar
lrwxrwxrwx 1 root root    27 Apr  1  2013 commons-pool.jar -> ../../java/commons-pool.jar
lrwxrwxrwx 1 root root    32 Apr  1  2013 el-api.jar -> ../../java/tomcat-el-api-2.2.jar
lrwxrwxrwx 1 root root    38 Apr  1  2013 jasper-el.jar -> ../../java/tomcat-jasper-el-7.0.26.jar
lrwxrwxrwx 1 root root    35 Apr  1  2013 jasper.jar -> ../../java/tomcat-jasper-7.0.26.jar
lrwxrwxrwx 1 root root    33 Apr  1  2013 jsp-api.jar -> ../../java/tomcat-jsp-api-2.2.jar
-rw-r--r-- 1 root root 15071 Feb 20 14:42 jta-1.1.jar
lrwxrwxrwx 1 root root    25 Feb 20 12:41 mysql.jar -> /usr/share/java/mysql.jar
lrwxrwxrwx 1 root root    37 Apr  1  2013 servlet-api.jar -> ../../java/tomcat-servlet-api-3.0.jar
-rw-r--r-- 1 root root 25496 Feb 20 14:42 slf4j-api-1.6.1.jar
-rw-r--r-- 1 root root  8890 Feb 20 14:42 slf4j-jdk14-1.6.1.jar
lrwxrwxrwx 1 root root    32 Apr  1  2013 tomcat-api.jar -> ../../java/tomcat-api-7.0.26.jar
lrwxrwxrwx 1 root root    35 Apr  1  2013 tomcat-coyote.jar -> ../../java/tomcat-coyote-7.0.26.jar
lrwxrwxrwx 1 root root    36 Apr  1  2013 tomcat-i18n-es.jar -> ../../java/tomcat-i18n-es-7.0.26.jar
lrwxrwxrwx 1 root root    36 Apr  1  2013 tomcat-i18n-fr.jar -> ../../java/tomcat-i18n-fr-7.0.26.jar
lrwxrwxrwx 1 root root    36 Apr  1  2013 tomcat-i18n-ja.jar -> ../../java/tomcat-i18n-ja-7.0.26.jar
lrwxrwxrwx 1 root root    33 Apr  1  2013 tomcat-util.jar -> ../../java/tomcat-util-7.0.26.jar

<p>
	&nbsp;</p>

 

Have you put the files bitronix-resources.properties & bitronix-config.properties  in [YOUR_TOMCAT_HOME]\conf ?
In your Setenv, have you the following lines ?
set BONITA_HOME="-Dbonita.home=%CATALINA_HOME%\bonita"
set BTM_OPTS="-Dbtm.root=%CATALINA_HOME%" "-Dbitronix.tm.configuration=%CATALINA_HOME%\conf\bitronix-config.properties"

Yes:

eric@sl24:/opt/bonita/btm/conf$ ls -l
total 8
-rw-r--r-- 1 root root  322 Feb 20 17:08 bitronix-config.properties
-rw-r--r-- 1 root root 1603 Feb 20 17:10 bitronix-resources.properties

<p>
	&nbsp;</p>

 

Yes. Although the docs on the page differ in that they do not have the "set" in front of both lines that did not make a difference.

My current setenv.sh file:

#!/bin/sh
# Define location of Bonita "home" folder
BONITA_HOME="-Dbonita.home=/opt/bonita/bonita_home-6.1.1"
# Bitronix (JTA for Tomcat) configuration
#BTM_OPTS="-Dbtm.root=/opt/bonita/btm -Dbitronix.tm.configuration=/opt/bonita/btm/conf/bitronix-config.properties"

<p>
	#SET DB_OPTS="-Dsysprop.bonita.db.vendor=mysql"</p>

<p>
	set BONITA_HOME="-Dbonita.home=%CATALINA_HOME%\bonita"<br />
	set BTM_OPTS="-Dbtm.root=%CATALINA_HOME%" "-Dbitronix.tm.configuration=%CATALINA_HOME%\conf\bitronix-config.properties"</p>

<p>
	CATALINA_OPTS="${CATALINA_OPTS} ${BONITA_HOME} ${BTM_OPTS} ${DB_OPTS} -Dfile.encoding=UTF-8 -Xshare:auto -Xms1024m -Xmx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError"<br />
	export CATALINA_OPTS<br />
	&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</p>

<p>
	&nbsp;</p>

I really need to get this running today. It has been down (for other reasons) all week. At some point If this is noit up then I need to shift gears and try the prepackaged Bonita in Tomcat 6.

With your conf, you need to have the files bitronix-resources.properties & bitronix-config.properties in %CATALINA_HOME%\conf\ ([YOUR_TOMCAT_HOME]\conf), and not in /opt/bonita/btm/conf.

 

If you want use MySQL, you need to uncomment the line SET DB_OPTS="-Dsysprop.bonita.db.vendor=mysql".

OK:

Here are the instructions from the example page:

Then you need to configure the data source:

  • Create new folders in order to store Bitronix files: sudo mkdir -p /opt/bonita/btm/conf && sudo mkdir /opt/bonita/btm/work
  • Set the ownership of the Bitronix folder: sudo chown -R root:tomcat7 /opt/bonita/btm
  • Allow a group to write to the folder: sudo chmod g+w /opt/bonita/btm/conf && sudo chmod g+w   /opt/bonita/btm/work
  • Copy the Bitronix configuration files to /opt/bonita/btm/conf folder: sudo cp ~/BonitaBPMSubscription-6.1.1-deploy/Tomcat-6.0.37/conf/bitronix-* /opt/bonita/btm/conf/
  • Edit bitronix-resources.properties file, comment (using #) h2 section, uncomment MySQL example and update the username, password and DB name ("bonita" in the URL property) to match your configuration (e.g. bonita_db_user, bonita_db_password and bonita_db): sudo nano /opt/bonita/btm/conf/bitronix-resources.properties
  • Save and quit: CTRL+X, Y, ENTER
<p>
	&nbsp;</p>

You are saying that this is incorrect? That it needs to change from /opt/bonita/btm/ to /usr/share/tomcat7/conf? What about the /opt/bonita/btm/work folder? Does that change to  /usr/share/tomcat7/conf as well?

If this is true /usr/share/tomcat7 does not currently have a conf folder. Do I create one? If my path tomcat oath is  /usr/share/tomcat7/conf then what shoulkd the path be to these two folders?

 

Either you change the configuration your setenv.sh file with :

#!/bin/sh

<p>
	# Sets some variables<br />
	BONITA_HOME="-Dbonita.home=/opt/bonita/bonita_home-6.1.1"<br />
	DB_OPTS="-Dsysprop.bonita.db.vendor=mysql"<br />
	BTM_OPTS="-Dbtm.root=/opt/bonita/btm -Dbitronix.tm.configuration=/opt/bonita/btm/conf/bitronix-config.properties"</p>

<p>
	CATALINA_OPTS="${CATALINA_OPTS} ${BONITA_HOME} ${DB_OPTS} ${BTM_OPTS} -Dfile.encoding=UTF-8 -Xshare:auto -Xms512m -Xmx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError"<br />
	export CATALINA_OPTS</p>

<p>
	CATALINA_PID=${CATALINA_BASE}/catalina.pid<br />
	export CATALINA_PID</p>

Or you move the Bitronix configuration files in /usr/share/tomcat7/conf.

I changed gears and installed thge jBoss bundle - now it is working. NOt sure where Tomcat when wrong???