grails: table not found when using tomcat and jndi -


using datasource.groovy works. when switch using jndi on tomcat war, get:

2014-04-14 12:16:19,244 [localhost-startstop-1] error util.jdbcexceptionreporter  - table "report" not found;  sql statement: select [...] report this_ this_.name=? [42102-173] 

this looks connecting db ok, cant see table, bazaar.

working config in datasource.groovy (when run without tomcat):

  development2 {     datasource {         url = 'jdbc:mysql://localhost/rep'         username = "root"         password = ""         dialect = org.hibernate.dialect.mysql5innodbdialect         pooled = true         jmxexport = true     dbcreate = "update"         driverclassname = "com.mysql.jdbc.driver"         properties {             maxactive = -1             minevictableidletimemillis=1800000             timebetweenevictionrunsmillis=1800000             numtestsperevictionrun=3             testonborrow=true             testwhileidle=true             testonreturn=true             validationquery="select 1"         }     } 

not working jndi config in datasource.groovy:

localtomcat {     datasouce {         dbcreate = "update"         jndiname = "java:comp/env/repdb"     } 

context.xml in tomcat 7:

<resource name="repdb" auth="container" type="javax.sql.datasource"     maxactive="100" maxidle="5" maxwait="10000"     username="root" password="" driverclassname="com.mysql.jdbc.driver"     url="jdbc:mysql://localhost:3306/rep"/> 

i tried this:

localtomcat {     datasouce {         dialect = org.hibernate.dialect.mysql5innodbdialect         driverclassname = "com.mysql.jdbc.driver"         dbcreate = "update"         jndiname = "java:comp/env/repdb"     } 

any ideas why can see db, not tables (which exist, have data, , don't need updating)

some posts need in web.xml, dont. dont have in there.

the root user has global permissions on everything.

im building war thus:

grails -dgrails.env=localtomcat war 

update: should add have 2 datasources each environment, 1 grails uses, , 1 query (i.e. reporting server). works fine outside of tomcat. main datasource called "datasource" , defined below. other 1 called datasource_reporting. datasource.groovy looks this:

datasource {      pooled = true      jmxexport = true }  datasource_reporting { dialect = org.hibernate.dialect.mysql5innodbdialect pooled = true jmxexport = true driverclassname = "com.mysql.jdbc.driver" properties {     maxactive = -1     minevictableidletimemillis=1800000     timebetweenevictionrunsmillis=1800000     numtestsperevictionrun=3     testonborrow=true     testwhileidle=true     testonreturn=true     validationquery="select 1"   } } 

environments { production{ datasouce { dialect = org.hibernate.dialect.mysql5innodbdialect driverclassname = "com.mysql.jdbc.driver" dbcreate = "update" jndiname = "java:comp/env/rep" }

    datasource_reporting {         dialect = org.hibernate.dialect.mysql5innodbdialect         driverclassname = "com.mysql.jdbc.driver"             jndiname = "java:comp/env/reporting"     } } 

and have 2 corresponding entires in context.xml on tomcat:

<resource name="reporting" auth="container" type="javax.sql.datasource"     maxactive="20" maxidle="5" maxwait="20000"     username="someuser" password="somepass" driverclassname="com.mysql.jdbc.driver"     url="jdbc:mysql://xx.xx.xx.xx:3306/somemaindb"/>  <resource name="rep" auth="container" type="javax.sql.datasource"     maxactive="100" maxidle="5" maxwait="10000"     username="root" password="" driverclassname="com.mysql.jdbc.driver"     url="jdbc:mysql://localhost/rep"/> 

perhaps grails + tomcat cant handle 2 db connections?

the rep db has report table complaining missing, , permissions of root user god. perhaps grails trying open reprot table on wrong db?

we have these in our server.xml try looking block , putting within globalnamingresources

globalnamingresources>     <!-- editable user database can used          userdatabaserealm authenticate users         --> <resource name="repdb" auth="container" type="javax.sql.datasource"     maxactive="100" maxidle="5" maxwait="10000"     username="root" password="" driverclassname="com.mysql.jdbc.driver"     url="jdbc:mysql://localhost:3306/rep"/>      <resource name="userdatabase" auth="container"               type="org.apache.catalina.userdatabase"               description="user database can updated , saved"               factory="org.apache.catalina.users.memoryuserdatabasefactory"               pathname="conf/tomcat-users.xml" />   </globalnamingresources> 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -