I missed a payment for my server and hey suspended my account for a day or so. When they brought the server back up all my data was in tact but for some reason Tomcat can't make a JDBC connection to my MySql server. They both run on the same machine and hence I have a bind address of 127.0.0.1.
It's strange because I have reset the machine of my own accord before without issue but clearly something has been reset in the downtime.
I followed this guide (Just the bits which don't concern S3, I am not on Amazon infrastructure) originally and everything worked as expected.
I'm very new to being a SysAdmin and I'm not sure what to try, how would you go about diagnosing this issue? The stack trace I get is as follows;
INFO: Deploying web application archive myapp-1.1.war
2010-05-26 22:07:22,221 [main] ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory.doCreateBean(ReloadAwareAutowireCapableBeanFactory.java:129)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.context.support.AbstractApplicationContext.initMessageSource(AbstractApplicationContext.java:714)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:404)
at org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext.refresh(GrailsWebApplicationContext.java:153)
...
I get this error for a number of 'beans'.
If I type mysql at my command prompt then I can easily login with the same credentials as my grails app which uses GORM and Hibernate to persist objects to the DB.
I might not have given enough info to start with but I'm really interested to learn and will certainly provide it if asked, I just really don't know where to start on this one.
UPDATE: I can connect to mysql by running the binary at the command line. I also ran mysql over tcp and couldn't connect, does this spread any light on the issue?
root@88:~# mysql -u grails --protocol=tcp -p
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (110)
I have bind-address as 127.0.0.1 as previously discussed so maybe it's not a surprise this doesn't work. Is there anything I need to check in my hosts file?
Thanks,
Gav
The main difference between using the
mysql
command-line utility and using the MySQL JDBC driver is that themysql
command will use a Unix socket file by default (e.g./tmp/mysql.sock
), whereas the JDBC driver always uses TCP/IP.Try forcing the
mysql
command to use TCP/IP as well, by passing the--protocol=tcp
option, and see what happens. This might give you a more illuminating error message (or, if it succeeds, that will tell us something too).First things first, make sure the MySQL server is up and running:
If it is not, start it: