JDBC datasource using tomcat with standalone war

394 views
Skip to first unread message

D...@spotlight-education.com

unread,
Mar 25, 2015, 3:13:52 PM3/25/15
to camunda-...@googlegroups.com
Hi --
I'm having trouble getting the camunda standalone war to work with a tomcat JDBC connection pool.

In catalina's log, it says:

Mar 25, 2015 12:04:44 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.59
Mar 25, 2015 12:04:44 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive C:\apache-tomcat-7.0.59-camundaStandalone2\webapps\camunda.war
Mar 25, 2015 12:04:47 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart

In the localhost log file, I see this exception:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/ProcessEngine] is not bound in this Context. Unable to find [jdbc].

I modified applicationContext.xml, with this dataSource:

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:jdbc/ProcessEngine</value>
</property>
</bean>

And I added this Resource to tomcat's server.xml:

<Resource name="jdbc/ProcessEngine"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
uniqueResourceName="process-engine"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/camunda2?useJDBCCompliantTimezoneShift=true&amp;useUnicode=true&amp;characterEncoding=UTF-8&amp;characterSetResults=UTF-8"
username="root"
password="root"
localDataSource="true" maxActive="20" maxIdle="1" maxWait="10000" testOnBorrow="true" validationQuery="select 1"
maxPoolSize="20"
minPoolSize="5" />

I also added the mysql jar file to the tomcat lib directory. And I created a mysql database cumunda2 and ran the create scripts.


Any clues about why it can't find the tomcat connection pool?

Thanks,
Dan

D...@spotlight-education.com

unread,
Mar 31, 2015, 5:11:57 PM3/31/15
to camunda-...@googlegroups.com, D...@spotlight-education.com
In case this issue happens to someone else, here's the solution. I had misspecified the spring dataSource bean. It should have been

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:comp/env/jdbc/ProcessEngine</value>
</property>
</bean>

Also, I moved the <Resource> section from server.xml to context.xml.

Best,
Dan
Reply all
Reply to author
Forward
0 new messages