hibernate - Grails JNDI data source not working -
i have grails application data source defined in datasource.groovy as:
datasource { pooled = true driverclassname = "oracle.jdbc.oracledriver" username = "myusername" password = "mypassword" } hibernate { cache.use_second_level_cache = true cache.use_query_cache = false cache.region.factory_class = 'net.sf.ehcache.hibernate.ehcacheregionfactory' } // environment specific settings environments { development { datasource { dbcreate = "validate" url = "jdbc:oracle:thin:@server:1521:instance" logsql = true } } }
this works fine want use jndi data source.
in config.groovy have:
grails.naming.entries = [ 'jdbc/pms_dev': [ type: 'java.sql.datasource', auth: 'container', description: 'main datasource', url: 'jdbc:oracle:thin:@server:1521:instance', username: "myusername", password: "mypassword", driverclassname: "oracle.jdbc.oracledriver", maxactive: "8", maxidle: "4" ] ]
i change datasource.groovy's development section to:
development { datasource { dbcreate = "validate" jndiname = "java:comp/env/jdbc/pms_dev" logsql = true } }
now following error when grails runapp:
| error 2014-02-06 11:25:58,402 [localhost-startstop-1] error context.grailscontextloader - error initializing application: error creating bean name 'transactionmanagerpostprocessor': initialization of bean failed; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'datasource' while setting bean property 'datasource'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource': cannot resolve reference bean 'datasourceunproxied' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance message: error creating bean name 'transactionmanagerpostprocessor': initialization of bean failed; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'datasource' while setting bean property 'datasource'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource': cannot resolve reference bean 'datasourceunproxied' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance line | method ->> 303 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread caused beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'datasource' while setting bean property 'datasource'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource': cannot resolve reference bean 'datasourceunproxied' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance ->> 303 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread caused beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'datasource' while setting bean property 'datasource'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource': cannot resolve reference bean 'datasourceunproxied' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance ->> 303 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread caused beancreationexception: error creating bean name 'datasource': cannot resolve reference bean 'datasourceunproxied' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance ->> 303 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread caused beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance ->> 303 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread caused namingexception: cannot create resource instance ->> 146 | getobjectinstance in org.apache.naming.factory.resourcefactory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 304 | getobjectinstance in javax.naming.spi.namingmanager | 843 | lookup . in org.apache.naming.namingcontext | 154 | lookup in '' | 831 | lookup . in '' | 154 | lookup in '' | 831 | lookup . in '' | 154 | lookup in '' | 831 | lookup . in '' | 168 | lookup in '' | 158 | lookup . in org.apache.naming.selectorcontext | 392 | lookup in javax.naming.initialcontext | 303 | innerrun in java.util.concurrent.futuretask$sync | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread | error 2014-02-06 11:25:58,574 [localhost-startstop-1] error context.grailscontextloader - error initializing grails: error creating bean name 'transactionmanagerpostprocessor': initialization of bean failed; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'datasource' while setting bean property 'datasource'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource': cannot resolve reference bean 'datasourceunproxied' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance message: error creating bean name 'transactionmanagerpostprocessor': initialization of bean failed; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'datasource' while setting bean property 'datasource'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource': cannot resolve reference bean 'datasourceunproxied' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance line | method ->> 303 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread caused beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'datasource' while setting bean property 'datasource'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource': cannot resolve reference bean 'datasourceunproxied' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance ->> 303 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread caused beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'datasource' while setting bean property 'datasource'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource': cannot resolve reference bean 'datasourceunproxied' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance ->> 303 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread caused beancreationexception: error creating bean name 'datasource': cannot resolve reference bean 'datasourceunproxied' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance ->> 303 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread caused beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance ->> 303 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread caused namingexception: cannot create resource instance ->> 146 | getobjectinstance in org.apache.naming.factory.resourcefactory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 304 | getobjectinstance in javax.naming.spi.namingmanager | 843 | lookup . in org.apache.naming.namingcontext | 154 | lookup in '' | 831 | lookup . in '' | 154 | lookup in '' | 831 | lookup . in '' | 154 | lookup in '' | 831 | lookup . in '' | 168 | lookup in '' | 158 | lookup . in org.apache.naming.selectorcontext | 392 | lookup in javax.naming.initialcontext | 303 | innerrun in java.util.concurrent.futuretask$sync | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread | error 2014-02-06 11:25:58,887 [localhost-startstop-1] error [localhost].[/osrpms] - exception sending context initialized event listener instance of class org.codehaus.groovy.grails.web.context.grailscontextloaderlistener message: error creating bean name 'transactionmanagerpostprocessor': initialization of bean failed; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'datasource' while setting bean property 'datasource'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource': cannot resolve reference bean 'datasourceunproxied' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance line | method ->> 303 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread caused beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'datasource' while setting bean property 'datasource'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource': cannot resolve reference bean 'datasourceunproxied' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance ->> 303 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread caused beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'datasource' while setting bean property 'datasource'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource': cannot resolve reference bean 'datasourceunproxied' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance ->> 303 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread caused beancreationexception: error creating bean name 'datasource': cannot resolve reference bean 'datasourceunproxied' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance ->> 303 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread caused beancreationexception: error creating bean name 'datasourceunproxied': invocation of init method failed; nested exception javax.naming.namingexception: cannot create resource instance ->> 303 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread caused namingexception: cannot create resource instance ->> 146 | getobjectinstance in org.apache.naming.factory.resourcefactory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 304 | getobjectinstance in javax.naming.spi.namingmanager | 843 | lookup . in org.apache.naming.namingcontext | 154 | lookup in '' | 831 | lookup . in '' | 154 | lookup in '' | 831 | lookup . in '' | 154 | lookup in '' | 831 | lookup . in '' | 168 | lookup in '' | 158 | lookup . in org.apache.naming.selectorcontext | 392 | lookup in javax.naming.initialcontext | 303 | innerrun in java.util.concurrent.futuretask$sync | 138 | run in java.util.concurrent.futuretask | 886 | runtask in java.util.concurrent.threadpoolexecutor$worker | 908 | run in '' ^ 662 | run . . in java.lang.thread | error 2014-02-06 11:25:59,184 [localhost-startstop-1] error core.standardcontext - error listenerstart | error 2014-02-06 11:25:59,184 [localhost-startstop-1] error core.standardcontext - context [/osrpms] startup failed due previous errors
this seems how data source setting grails not able access jndi data source...i don't think missed syntax or guess need check server accessible using url , app , running ....
@server
definition ? supposed ip address...
for can check:
check [1] jndi datasource oracle grails 1.3
and grails documentation [2] http://grails.org/doc/2.0.0.m2/guide/conf.html
Comments
Post a Comment