Grails App unable to connect to SQL Server (Malformed Reply from SOCKS Server) - sql-server

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.

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

Related

BeanNameAutoProxyCreator throws java.lang.ExceptionInInitializerError [duplicate]

Feb 02, 2022 12:58:03 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext#71318ec4: startup date [Wed Feb 02 12:58:03 IST 2022]; root of context hierarchy
Feb 02, 2022 12:58:03 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring.xml]
Feb 02, 2022 12:58:04 PM org.springframework.context.support.AbstractApplicationContext refresh
WARNING: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'triangle' defined in class path resource [spring.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.lang.ExceptionInInitializerError
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'triangle' defined in class path resource [spring.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:591)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:758)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)
at com.vishal.main.DrawingMain.main(DrawingMain.java:10)
Caused by: org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:215)
at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:473)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:355)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:304)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:438)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1714)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583)
... 11 more
Caused by: java.lang.ExceptionInInitializerError
at org.springframework.aop.framework.CglibAopProxy.createEnhancer(CglibAopProxy.java:232)
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:181)
... 18 more
Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module #8519cb4
at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:464)
at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91)
at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)
at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116)
at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:291)
at org.springframework.cglib.core.KeyFactory$Generator.create(KeyFactory.java:221)
at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:174)
at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:153)
at org.springframework.cglib.proxy.Enhancer.<clinit>(Enhancer.java:73)
... 20 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module #8519cb4
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at org.springframework.cglib.core.ReflectUtils$1.run(ReflectUtils.java:61)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
at org.springframework.cglib.core.ReflectUtils.<clinit>(ReflectUtils.java:52)
at org.springframework.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:243)
at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:329)
... 32 more
My first guess is that you want to run an older Spring version on a JRE 16+. Probably that old Spring version depends on an equally dated CGLIB version which uses internal Java APIs now blocked due to JEP 396, which was implemented for Java 16. Maybe you can simply upgrade CGLIB and continue to use your old Spring version, maybe you need to upgrade both. Without more detailed information from you, it is hard to say. A minimal example Maven or Gradle project on GitHub, reproducing the problem, would be great.
On a second thought, maybe for now you can get away with adding
--add-opens java.base/java.lang=ALL-UNNAMED
to your JVM command line. But even if it would work, it would not be a particularly sustainable solution, only a workaround.
I was able to fix this today (with JDK 17) by upgrading to SpringBoot 2.6.4 (specifically, you need spring framework 5.3.16, so if you're using spring dependency management plugin, you only need to set the springboot version to 2.6.4).
Seems like something was fixed in spring framework 5.3.16 that resolved the issue without having to add the --add-opens JVM option.
For reference, the error for me was happening because I had autowired a Supplier bean (not for Spring cloud function).

SolrCloud throw error while creating second collection "Underlying core creation failed while creating collection"

I was run 2 node in solr with single zookeeper to configure. I'll try to create a collection like location Its create successfully and then try to create second collection like contact. Its throw error.
Make API Call for create collection
curl -sS 'http://localhost:8983/solr/admin/collections?action=CREATE&name=contact&numShards=2&replicationFactor=2&maxShardsPerNode=2&collection.configName=conf_contact'
Response for create collection
"responseHeader":{
"status":400,
"QTime":1154},
"failure":{
"192.168.1.121:8983_solr":"org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://192.168.1.121:8983/solr: Error CREATEing SolrCore 'contact_shard2_replica_n6': Unable to create core [contact_shard2_replica_n6] Caused by: org.opensextant.solrtexttagger.TaggerRequestHandler",
"192.168.1.121:8983_solr":"org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://192.168.1.121:8983/solr: Error CREATEing SolrCore 'contact_shard1_replica_n3': Unable to create core [contact_shard1_replica_n3] Caused by: org.opensextant.solrtexttagger.TaggerRequestHandler",
"192.168.1.157:8983_solr":"org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://192.168.1.157:8983/solr: Error CREATEing SolrCore 'contact_shard2_replica_n5': Unable to create core [contact_shard2_replica_n5] Caused by: org.opensextant.solrtexttagger.TaggerRequestHandler",
"192.168.1.157:8983_solr":"org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://192.168.1.157:8983/solr: Error CREATEing SolrCore 'contact_shard1_replica_n1': Unable to create core [contact_shard1_replica_n1] Caused by: org.opensextant.solrtexttagger.TaggerRequestHandler"},
"Operation create caused exception:":"org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Underlying core creation failed while creating collection: contact",
"exception":{
"msg":"Underlying core creation failed while creating collection: contact",
"rspCode":400},
"error":{
"metadata":[
"error-class","org.apache.solr.common.SolrException",
"root-error-class","org.apache.solr.common.SolrException"],
"msg":"Underlying core creation failed while creating collection: contact",
"code":400}}```
**Note:** 1 GB for each node solr mem size

Error: Test Connection Failed for MC_Ten. Failed to Connect to the End Point : Reason Unknown

I'm trying to create a connection "Salesforce Marketing Cloud (Cloud Computing)" in Informatica Cloud as shown in the picture
But it gives me the error in question
File fuelsdk-test.properties I entered:
endpoint= https : // www . exacttargetapis . com
authEndpoint= https : // auth . exacttargetapis . com
soapEndpoint= https : // webservice . s7 . exacttarget . com / Service . asmx
username=********
password=*********
clientId=*************************
clientSecret=**********************
Can you tell me how to fix the error?
Below some log (tomcat.log) if can be useful for any response:
2015-11-30 22:17:43,936 ERROR [com.informatica.saas.toolkit.metadataRead.resources.PluginsResource] - Exception Thrown in Operation: connect
com.informatica.cloud.api.adapter.connection.ConnectionFailedException: Failed to Connect to the End Point : Reason Unknown
at com.informatica.saas.toolkit.metadataRead.Dao.PluginDao.connect(PluginDao.java:248)
at com.informatica.saas.toolkit.metadataRead.resources.PluginsResource.connect(PluginsResource.java:234)
at sun.reflect.GeneratedMethodAccessor349.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
I am working for Informatica,
Error message thrown when testing the connection is either one of the connection attributes or context of the plugin fails to do connection which results the code to throw the exception error message.
"Failed to Connect to the End Point : Reason Unknown"
There is no specific information supplied in the exception to find the reason of failure.
Please post your question in informatica community for more quicker response on informatica products.
https://network.informatica.com/welcome

How do I fix the org.springframework.beans.factory.BeanCreationException error in my Grails application?

I am receiving a huge error list when tying to run a grails application. The application worked fine until I migrated the database from MySQL to SQL Server. I used the SQL Server Migration Assistant and everything worked fine there. I also added the sqljdbc4.jar to the lib directory and updated DataSource.groovy to work with SQL Server. I have been trying to solve this problem for days now and would really appreciate your input. I am fairly new to Grails, Databases, Servers, etc. so I apologize if I have not described this error appropriately.
Thank you for your help!
Versions: Grails 1.3.9, JDK 1.7.0_21, NetBeans IDE 7.3.1, and Microsoft SQL Server 2008
This is the error I get when running the grails run-app command:
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 '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:
Error while extracting DatabaseMetaData; nested exception is
org.apache.commons.dbcp.SQLNestedException:
Cannot create PoolableConnectionFactory (Login failed for user 'dev'.)
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:
Error while extracting DatabaseMetaData; nested exception is
org.apache.commons.dbcp.SQLNestedException:
Cannot create PoolableConnectionFactory (Login failed for user 'dev'.)
at org.grails.tomcat.InlineExplodedTomcatServer.doStart(InlineExplodedTomcatServer.groovy:112)
at org.grails.tomcat.InlineExplodedTomcatServer$doStart.callCurrent(Unknown Source)
at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:97)
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 '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:
Error while extracting DatabaseMetaData; nested exception is
org.apache.commons.dbcp.SQLNestedException:
Cannot create PoolableConnectionFactory (Login failed for user 'dev'.)
... 25 more
Caused by: 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:
Error while extracting DatabaseMetaData; nested exception is
org.apache.commons.dbcp.SQLNestedException:
Cannot create PoolableConnectionFactory (Login failed for user 'dev'.)
... 25 more
Caused by: 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:
Error while extracting DatabaseMetaData; nested exception is
org.apache.commons.dbcp.SQLNestedException:
Cannot create PoolableConnectionFactory (Login failed for user 'dev'.)
... 25 more
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dialectDetector':
Invocation of init method failed; nested exception is
org.springframework.jdbc.support.MetaDataAccessException:
Error while extracting DatabaseMetaData; nested exception is
org.apache.commons.dbcp.SQLNestedException:
Cannot create PoolableConnectionFactory (Login failed for user 'dev'.)
... 25 more
Caused by: org.springframework.jdbc.support.MetaDataAccessException:
Error while extracting DatabaseMetaData;
nested exception is org.apache.commons.dbcp.SQLNestedException:
Cannot create PoolableConnectionFactory (Login failed for user 'dev'.)
... 25 more
Caused by: org.apache.commons.dbcp.SQLNestedException:
Cannot create PoolableConnectionFactory (Login failed for user 'dev'.)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at com.sun.proxy.$Proxy10.getMetaData(Unknown Source)
... 25 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'dev'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:246)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:83)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2529)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:1905)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:1893)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1045)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:817)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:700)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:842)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
... 28 more
Here is my DataSource.groovy file
dataSource {
pooled = true
//driverClassName = "com.mysql.jdbc.Driver" (driver for mysql)
driverClassName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
dialect = "org.hibernate.dialect.SQLServer2008Dialect"
username = "dev"
password = "dev"
properties {
maxActive = 30
maxIdle = 5
validationQuery = "/* ping */"
testWhileIdle = true
timeBetweenEvictionRunsMillis = 10000
minEvictableIdleTimeMillis = 120000
}
}
hibernate {
cache.use_second_level_cache=true
cache.use_query_cache=false
cache.provider_class='net.sf.ehcache.hibernate.EhCacheProvider'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop','update'
//url = "jdbc:mysql://localhost/timesheet_development?autoReconnect=true"
url = "jdbc:sqlserver://localhost:1433;instanceName=sqlexpress;databaseName=timesheet_development"
}
}
test {
dataSource {
dbCreate = "update"
//url = "jdbc:mysql://localhost/timesheet_test?autoReconnect=true"
url = "jdbc:sqlserver://localhost:1433;instanceName=sqlexpress;databaseName=timesheet_test"
}
}
production {
dataSource {
dbCreate = "update"
//url = "jdbc:mysql://localhost/timesheet_production?autoReconnect=true"
url = "jdbc:sqlserver://localhost:1433;instanceName=sqlexpress;databaseName=timesheet_update"
username = "********"
password = "********"
}
}
}
After working all day on this problem and getting valued input from comments, I have found the solution to my problem.
1) Dev was not a valid user for SQL Server so I added it in phpMyAdmin as well as the security folders for the database. I also re-migrated the database after adding user dev to MySQL.
2) plugins.searchable=0.6.4 needed be commented out from the application.properties file in order to fix the stack trace errors.
3) The Grails Runtime Exceptions were solved by going through the database tables and correcting the data types that were improperly migrated. All binary data types had to be changed to bit type.
The grails app now runs flawlessly. Hope this helps anybody else out there with this problem!

Exception attempting to inject Remote ejb-ref when running multiple tests with Arquillian

I have a number of test classes that are run using Arquillian (1.0.2.Final) using the 'arquillian-glassfish-embedded-3.1' container (1.0.0.CR3).
If I run any of the test classes in isolation they run as expected, if I attempt to run multiple test classes (TestSuite) I run into problems injecting EJB's into the classes.
java.lang.RuntimeException: Could not inject members
Caused by: java.lang.IllegalStateException: Exception attempting to inject Remote ejb-ref name=PackageManagerBean,Remote 3.x interface =com.dcp.pkg.PackageManager resolved to intra-app EJB PackageManagerBean in module test,ejb-link=PackageManagerBean,lookup=,mappedName=,jndi-name=PackageManagerBean,refType=Session into class com.dcp.transmission.TransmissionManagerBeanTest: Lookup failed for 'java:comp/env/PackageManagerBean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=PackageManagerBean,Remote 3.x interface =com.dcp.pkg.PackageManager resolved to intra-app EJB PackageManagerBean in module test,ejb-link=PackageManagerBean,lookup=,mappedName=,jndi-name=PackageManagerBean,refType=Session into class com.dcp.transmission.TransmissionManagerBeanTest: Lookup failed for 'java:comp/env/PackageManagerBean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
Caused by: javax.naming.NamingException: Lookup failed for 'java:comp/env/PackageManagerBean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=PackageManagerBean,Remote 3.x interface =com.dcp.pkg.PackageManager resolved to intra-app EJB PackageManagerBean in module test,ejb-link=PackageManagerBean,lookup=,mappedName=,jndi-name=PackageManagerBean,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'PackageManagerBean#com.dcp.pkg.PackageManager' [Root exception is javax.naming.NamingException: Lookup failed for 'PackageManagerBean#com.dcp.pkg.PackageManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.dcp.pkg.PackageManager [Root exception is java.lang.IllegalArgumentException: argument type mismatch]]]]
Caused by: javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=PackageManagerBean,Remote 3.x interface =com.dcp.pkg.PackageManager resolved to intra-app EJB PackageManagerBean in module test,ejb-link=PackageManagerBean,lookup=,mappedName=,jndi-name=PackageManagerBean,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'PackageManagerBean#com.dcp.pkg.PackageManager' [Root exception is javax.naming.NamingException: Lookup failed for 'PackageManagerBean#com.dcp.pkg.PackageManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.dcp.pkg.PackageManager [Root exception is java.lang.IllegalArgumentException: argument type mismatch]]]
Caused by: javax.naming.NamingException: Lookup failed for 'PackageManagerBean#com.dcp.pkg.PackageManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.dcp.pkg.PackageManager [Root exception is java.lang.IllegalArgumentException: argument type mismatch]]
Caused by: javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.dcp.pkg.PackageManager [Root exception is java.lang.IllegalArgumentException: argument type mismatch]
Caused by: java.lang.IllegalArgumentException: argument type mismatch
The Package Manager Bean is defined as follows:
#Stateless(mappedName = "PackageManagerBean")
#Remote({ PackageManager.class })
#Local({ PackageManagerLocal.class })
public class PackageManagerBean implements PackageManager {
}
The Package Manager is injected into several of the test classes as per the example below:
#RunWith(Arquillian.class)
public class TransmissionManagerBeanTest {
#Deployment
public static Archive<?> createDeployment() {
WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
.addPackages(true, TransmissionManager.class.getPackage(), Search.class.getPackage(), PackageManager.class.getPackage(), SiteManagerBean.class.getPackage())
.addAsResource("test-persistence.xml", "META-INF/persistence.xml").addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
return war;
}
#EJB
TransmissionManager transmissionManager;
#EJB
PackageManager packageManager;
#EJB
SiteManager siteManager;
#PersistenceContext
EntityManager entityManager;
#Inject
UserTransaction userTransaction;
}
I do not appear to be having problems with any of the other EJB's.
Does any one have any idea what the problem is and how I can get this working?
From what I can tell it appears to be an issue with cleaning up the resources deployed in the embedded Glassfish container between each test class. At this point I don't know if it is Arquillian, the embedded Glassfish container or my code that causes the problem.
I have found a workaround. By running in each test class in it's own JVM I avoid the issues above. It does add som additional overhead e.g. instead of re-using the embedded container for all of the test classes the container get's torn down and re-started for each test class but it does allow me to run all of my unit tests in one go.
I use maven to run the tests and use the following maven-surefire-plugin configuration to ensure each test class is run in it's own JVM:
<configuration><forkCount>1</forkCount><reuseForks>false</reuseForks>....</configuration>
For versions of maven-surefire-plugin older than 2.14 you can use forkMode=false

Resources