Problem connecting to Grails database during deployment

I can successfully run the Grails application in Jetty. He manages to connect to my MsSql database, and everything is fine. When I deploy the same application to Tomcat 6 on the same computer, I get the following error when starting in Tomcat log:

Caused by: java.net.ConnectException: Connection refused: connect 

I do not think that my MsSql server is a problem, since I have another Java application running on the same Tomcat instance and accessing the same database server successfully.

The connection string is exactly the same when I deploy it to Jetty and Tomcat. Any ideas why I can't connect to my database when deploying a Grails application to Tomcat 6? It seems I canโ€™t access the databases when the Grails application was deployed to Tomcat. (My other Java application (Confluence) has no connectivity issues.

Here is my connection information:

 dataSource { pooled = true driverClassName = "net.sourceforge.jtds.jdbc.Driver" username = "user" password = "pass" } hibernate { cache.use_second_level_cache=true cache.use_query_cache=true cache.provider_class='com.opensymphony.oscache.hibernate.OSCacheProvider' } // environment specific settings environments { development { dataSource { dbCreate = "update" // one of 'create', 'create-drop','update' url = "jdbc:jtds:sqlserver://localhost:1143/holidayCards" } } test { //for AD-DEV02 dataSource { dbCreate = "update" url = "jdbc:jtds:sqlserver://AD-DEV02:1237/holidayCards;instance=SQL2005" } } production { dataSource { dbCreate = "update" url = "jdbc:jtds:sqlserver://SQL:1433/holidayCards" } } } 

I always use the "test":

 grails test war 

As you will see from my answer below, I do not think this is a connection problem, since I was able to work successfully when I lowered the level from grails 1.1beta1 to 1.0.4 .

Any help is appreciated

Andrew

+4
source share
2 answers

This is a problem with grails 1.1beta1. When I returned my application to grails 1.0.4, it seemed to work. Unfortunately, I had to change a couple of code snippets because the grails beta version fixed some bugs, but this seems to be rooted in the version of grails that I used.

I just created an empty grails application using 1.1beta1, and I was able to successfully deploy it to Tomcat (and access the database). This makes me think that there are other settings in my project that do not work very well with the beta version. Perhaps this is my jquery plugin. Perhaps this was an update to my project from grails 1.0.4 to 1.1beta1

This does not completely solve the problem, but narrows it down.

Andrew

+1
source

What does your DataSource.groovy file look like? When you launch the application using the grails run-app, Grails uses the data source in the "development" section. When you create a war file with "grails war" and deploy it to the application server, Grails uses the data source in the "Production" section. You may need to make sure that your data source for development and production is configured the same.

+3
source

All Articles