Cannot run a Grails Application on the Linux Server - Tomcat and H2 database -
Cannot run a Grails Application on the Linux Server - Tomcat and H2 database -
i want run grails application on linux server embeded h2 database, tomcat , gradle. specs below
grails 2.4.4 groovy 2.3.7 gradle 2.2.1 tomcat 7.0.59 linux centos 6the buildconfig.groovy below
dependencies { test "org.grails:grails-datastore-test-support:1.0.2-grails-2.4" } plugins { build ":tomcat:7.0.55" compile ":scaffolding:2.1.2" compile ':cache:1.1.8' compile ":asset-pipeline:1.9.9" runtime ":hibernate4:4.3.6.1" runtime ":database-migration:1.4.0" runtime ":jquery:1.11.1" }
the detasourece.groovy below
datasource { pooled = true jmxexport = true driverclassname = "org.h2.driver" username = "sa" password = "" } hibernate { cache.use_second_level_cache = true cache.use_query_cache = false // cache.region.factory_class = 'net.sf.ehcache.hibernate.ehcacheregionfactory' // hibernate 3 cache.region.factory_class = 'org.hibernate.cache.ehcache.ehcacheregionfactory' // hibernate 4 singlesession = true // configure osiv singlesession mode flush.mode = 'manual' // osiv session flush mode outside of transactional context } // environment specific settings environments { development { datasource { dbcreate = "create-drop" // 1 of 'create', 'create-drop', 'update', 'validate', '' url = "jdbc:h2:mem:devdb;mvcc=true;lock_timeout=10000;db_close_on_exit=false" } } test { datasource { dbcreate = "update" url = "jdbc:h2:mem:testdb;mvcc=true;lock_timeout=10000;db_close_on_exit=false" } } production { datasource { dbcreate = "update" url = "jdbc:h2:proddb;mvcc=true;lock_timeout=10000;db_close_on_exit=false" properties { // see http://grails.org/doc/latest/guide/conf.html#datasource documentation jmxenabled = true initialsize = 5 maxactive = 50 minidle = 5 maxidle = 25 maxwait = 10000 maxage = 10 * 60000 timebetweenevictionrunsmillis = 5000 minevictableidletimemillis = 60000 validationquery = "select 1" validationquerytimeout = 3 validationinterval = 15000 testonborrow = true testwhileidle = true testonreturn = false jdbcinterceptors = "connectionstate" defaulttransactionisolation = java.sql.connection.transaction_read_committed } } } }
with config, made war file.
grails prod war
and then, deployed grails application on linux server. tomcat ran well. access http://myserver:8080. after that, accessed http://myserver:8080/application/. result, returned http code.
http status 404
i checked /etc/local/tomcat/log/stacktrace.log
[localhost-startstop-1] error stacktrace - total stack trace: org.springframework.beans.factory.beancreationexception: 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 'hibernateproperties' while setting bean property 'hibernateproperties'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'hibernateproperties': cannot resolve reference bean 'dialectdetector' while setting bean property 'properties' key [hibernate.dialect]; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'dialectdetector': invocation of init method failed; nested exception org.springframework.jdbc.support.metadataaccessexception: error while extracting databasemetadata; nested exception org.h2.jdbc.jdbcsqlexception: error opening database: "could not save properties /proddb.lock.db" [8000-176]
looks permission issue, trying create file in root directory.
try changing datasource url in prod env
url = jdbc:h2:~/db/test;mvcc=true;lock_timeout=10000;db_close_on_exit=false"
tomcat grails deployment h2
Comments
Post a Comment