cancel
Showing results for 
Search instead for 
Did you mean: 

Tomcat can't access mysql - Solved but new problem

dc41
Champ in-the-making
Champ in-the-making
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  Smiley Tongue

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!
2 REPLIES 2

dc41
Champ in-the-making
Champ in-the-making
After making a few changes to the /etc/host file alfresco is finally connecting to the mysql server. It has 8 sleeping connections.

I can connect to 8080/share, but not alfresco explorer. After loooog waits it get 404 erros "request resource () is not available. Log shows something new:

15:37:31,959 INFO  [org.alfresco.web.site.FrameworkHelper] Successfully Initialized Web Framework
15:37:49,766 ERROR [org.alfresco.repo.content.transform.magick.AbstractImageMagickContentTransformer] ImageMagickContentTransformer not available: Failed to perform ImageMagick transformation:
Execution result:
   os:         Linux
   command:    [./ImageMagick/bin/convert, /usr/tomcat/temp/Alfresco/ImageMagickContentTransformer_init_source_77314502998182974.gif, /usr/tomcat/temp/Alfresco/ImageMagickContentTransformer_init_target_5295094491735433673.png]
   succeeded:  false
   exit code:  1
   out:       
   err:        Cannot run program "./ImageMagick/bin/convert": java.io.IOException: error=2, No such file or directory
15:44:10,908 INFO  [org.alfresco.config.xml.XMLConfigService$PropertyConfigurer] Loading properties file from class path resource [alfresco/file-servers.properties]
15:47:23,154 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.remoting.rmi.RmiServiceExporter' defined in class path resource [alfresco/emailserver/email-service-context.xml]: Invocation of init method failed; nested exception is java.rmi.server.ExportException: internal error: ObjID already in use
Caused by: java.rmi.server.ExportException: internal error: ObjID already in use
   at sun.rmi.transport.ObjectTable.putTarget(ObjectTable.java:169)
   at sun.rmi.transport.Transport.exportObject(Transport.java:74)
   at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:229)
   at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:393)
   at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:129)
   at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:190)
   at sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:92)
   at sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:78)
   at java.rmi.registry.LocateRegistry.createRegistry(LocateRegistry.java:186)
   at org.springframework.remoting.rmi.RmiServiceExporter.getRegistry(RmiServiceExporter.java:398)
   at org.springframework.remoting.rmi.RmiServiceExporter.getRegistry(RmiServiceExporter.java:370)
   at org.springframework.remoting.rmi.RmiServiceExporter.getRegistry(RmiServiceExporter.java:331)
   at org.springframework.remoting.rmi.RmiServiceExporter.prepare(RmiServiceExporter.java:263)
   at org.springframework.remoting.rmi.RmiServiceExporter.afterPropertiesSet(RmiServiceExporter.java:227)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1201)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1171)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
   at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)
   at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:719)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
   at org.apache.catalina.core.StandardService.start(StandardService.java:516)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

Do I need to configure something in catalina?

dc41
Champ in-the-making
Champ in-the-making
Solved. The old hostname bugaboo.