AnsweredAssumed Answered

Tomcat can't access mysql - Solved but new problem

Question asked by dc41 on Mar 24, 2009
Latest reply on Mar 25, 2009 by dc41
I've installed the tomcat preconfig bundle in /usr/tomcat on a Fedora 10 box. I start the service with:

[root@charlie tomcat]# ./bin/startup.sh
Using CATALINA_BASE:   /usr/tomcat
Using CATALINA_HOME:   /usr/tomcat
Using CATALINA_TMPDIR: /usr/tomcat/temp
Using JRE_HOME:       /usr/java/jdk1.6.0_12
[root@charlie tomcat]#

My /usr/tomcat/shared/classes/alfresco/extension/custom-hibernate-dialect.properties file looks like this
#
# Sample Hibernate configuration for changing Database dialect
# For a full list: http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#configuration-optional-dialects
#

#
# Derby dialect
#
#hibernate.dialect=org.hibernate.dialect.DerbyDialect

#
# HSQL dialect
#
#hibernate.dialect=org.hibernate.dialect.HSQLDialect

#
# MySQL dialect (default)
#
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect

#
# PostgreSQL dialect
#
#hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
#hibernate.query.substitutions=true TRUE, false FALSE

My /usr/tomcat/shared/classes/alfresco/extension/custom-repository.properties looks like this.
###############################
## Common Alfresco Properties #
###############################

#
# Sample custom content and index data location
#
dir.root=./alf_data

#
# Sample database connection properties
#
db.username=alfresco
db.password=alfresco
db.pool.initial=10
db.pool.max=100

#
# Sample external executable locations
#
#ooo.exe=/opt/openoffice/program/soffice
#ooo.user=${dir.root}/oouser
#img.root=/srv/alfresco/ImageMagick
#swf.exe=/srv/alfresco/bin/pdf2swf

#
# Sample index tracking frequency
#
#index.tracking.cronExpression=0/5 * * * * ?

#
# Property to control whether schema updates are performed automatically.
# Updates must be enabled during upgrades as, apart from the static upgrade scripts,
# there are also auto-generated update scripts that will need to be executed.  After
# upgrading to a new version, this can be disabled.
#
#db.schema.update=true

#
# Derby connection
#
#db.driver=org.apache.derby.jdbc.EmbeddedDriver
#db.url=jdbc:derby:alf_data/derby_data/alfresco;create=true

#
# HSQL connection
#
#db.driver=org.hsqldb.jdbcDriver
#db.url=jdbc:hsqldb:file:alf_data/hsql_data/alfresco;ifexists=true;shutdown=true;

#
# MySQL connection (This is default and requires mysql-connector-java-5.0.3-bin.jar, which ships with the Alfresco server)
#
db.driver=org.gjt.mm.mysql.Driver
db.url=jdbc:mysql://localhost:3306/alfresco

#
# PostgreSQL connection (requires postgresql-8.2-504.jdbc3.jar or equivalent)
#
#db.driver=org.postgresql.Driver
#db.url=jdbc:postgresql://localhost:5432/alfresco

The alfresco database, db permissions, and user permissions have all been created. I can access the alfresco db via command prompted using alfresco credentials.

After a few minutes… I get the following entries in the alfresco.log
Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
   at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)

etc.  I'm sure you've all seen the rest many times  :P

The only thing I can figure is that the mysql-connector isn't the correct version or isn't in the right folder. Currently I have mysql-connector-java-5.0.8-bin.jar in the /usr/tomcat/lib folder. Should it be somewhere else? Do I need to use a older/newer version?

Thanks!

Outcomes