0
votes

I'm a newbie learning Grails by developing a small application that retrieves codes from a database. The details are -
- Apple Mac OS X (i.e. Unix).
- Grails 1.3.5 using NetBeans 6.9.1.
- SQL Server 2008 R2 Database, located on a different server.
- JTDS Driver

Here is the DataSource.groovy -

dataSource {
    pooled = false
    driverClassName = "net.sourceforge.jtds.jdbc.Driver"
    dialect="org.hibernate.dialect.SQLServerDialect"

}
hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = true
    cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider'
}
// environment specific settings
environments {
    development {
          dataSource {
            dbCreate = "update" // one of 'create', 'create-drop','update'
            url = "jdbc:jtds:sqlserver://hbtsqldev.domain.omitted.com.au:1433;databasename=TempDatabase;useCursorFetch=true;user=username;password=omitted"

        }
    }
    test {
        dataSource {
            dbCreate = "update"
            url = "jdbc:jtds:sqlserver://hbtsqldev.domain.omitted.com.au:1433;databasename=TempDatabase;useCursorFetch=true;user=username;password=omitted"
        }
    }
    production {
        dataSource {
            dbCreate = "update"
            url = "jdbc:jtds:sqlserver://hbtsqldev.domain.omitted.com.au:1433;databasename=TempDatabase;useCursorFetch=true;user=username;password=omitted"
        }
    }
}

When I run the Grails app, I receive the following (very long) error messages -

2010-11-11 10:58:00,709 [main] ERROR context.GrailsContextLoader - Error executing bootstraps: 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 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Network error IOException: Malformed reply from SOCKS server 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 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Network error IOException: Malformed reply from SOCKS server at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212) at grails.web.container.EmbeddableServer$start.call(Unknown Source) at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158) at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy) at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280) at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149) at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy) at _GrailsRun_groovy.runInline(_GrailsRun_groovy:116) at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy) at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59) at RunApp$_run_closure1.doCall(RunApp.groovy:33) at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381) at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415) at gant.Gant$_dispatch_closure7.doCall(Gant.groovy) at gant.Gant.withBuildListeners(Gant.groovy:427) at gant.Gant.this$2$withBuildListeners(Gant.groovy) at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) at gant.Gant.dispatch(Gant.groovy:415) at gant.Gant.this$2$dispatch(Gant.groovy) at gant.Gant.invokeMethod(Gant.groovy) at gant.Gant.executeTargets(Gant.groovy:590) at gant.Gant.executeTargets(Gant.groovy:589) Caused by: 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 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Network error IOException: Malformed reply from SOCKS server ... 23 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Network error IOException: Malformed reply from SOCKS server ... 23 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Network error IOException: Malformed reply from SOCKS server ... 23 more Caused by: org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Network error IOException: Malformed reply from SOCKS server ... 23 more Caused by: java.sql.SQLException: Network error IOException: Malformed reply from SOCKS server at net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:410) at net.sourceforge.jtds.jdbc.ConnectionJDBC3.(ConnectionJDBC3.java:50) at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:154) at $Proxy8.getMetaData(Unknown Source) ... 23 more Caused by: java.net.SocketException: Malformed reply from SOCKS server at java.net.SocksSocketImpl.readSocksReply(SocksSocketImpl.java:147) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:495) at java.net.Socket.connect(Socket.java:529) at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:307) at net.sourceforge.jtds.jdbc.SharedSocket.(SharedSocket.java:257) at net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:311) ... 28 more

Can anyone see where the problem might be? If you need me to provide any further info, please let me know.

1
Try removing useCursorFetch from the connection string. For a start, make sure that the connection user doesn't suffer from missing privileges. - Important: Look at the SQL Server logs.robbbert

1 Answers

0
votes

Are you able to ping the database server from where you are running your tomcat? I am using Grails 1.3.5 with SQL Server 2005 with Microsoft JDBC 4.0 Driver. Works fine for me.

dataSource.driverClassName = com.microsoft.sqlserver.jdbc.SQLServerDriver
dataSource.url = jdbc:sqlserver://dbserver:1433;databaseName=testDB