In fact, I deployed the grails application on two tomcat instances. Now I am facing a problem. My Quartz task should be grouped.
I read the documentation for the plugin and found an opportunity to copy Quartz jobs in combination with a database.
So I have to create a hibernate mapping ('grails-app / conf / hibernate / hibernate.cfg.xml') in my grails application.
<?xml version='1.0' encoding='UTF-8'?>
<session-factory>
<mapping resource='Quartz.hbm.xml'/>
</session-factory>
Then I also created Quartz.hbm.xml. This creates tables for the Quartz plugin.
When I run my application, it seems that hibernate.cfg.xml is not used by grails, and tables are not created.
My thought was that the problem is to determine
import org.apache.commons.dbcp.BasicDataSource
import org.codehaus.groovy.grails.commons.ConfigurationHolder as CH
// Place your Spring DSL code here
beans = {
dataSource(BasicDataSource) { bean ->
bean.destroyMethod = 'close'
def ds = CH.config.dataSource
// required attributes
if(ds.driverClassName == "com.mysql.jdbc.Driver") {
url = ds.url
username = ds.username
password = ds.password
driverClassName = ds.driverClassName
// optional attributes
minEvictableIdleTimeMillis = 1000 * 60 * 30
timeBetweenEvictionRunsMillis = 1000 * 60 * 30
numTestsPerEvictionRun = 3
testOnBorrow = true
testWhileIdle = false
testOnReturn = false
initialSize = 2
minIdle = 1
maxIdle = 4
validationQuery = "SELECT NOW()"
} else {
url = ds.url
username = ds.username
password = ds.password
driverClassName = ds.driverClassName
}
}
}
. , . ? .
2010-09-29 11:30:39,852 [main] DEBUG org.hibernate.util.DTDEntityResolver - trying to resolve system-id [http:
2010-09-29 11:30:39,852 [main] DEBUG org.hibernate.util.DTDEntityResolver - trying to resolve system-id [http:
2010-09-29 11:30:39,852 [main] DEBUG org.hibernate.util.DTDEntityResolver - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
2010-09-29 11:30:39,852 [main] DEBUG org.hibernate.util.DTDEntityResolver - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
2010-09-29 11:30:39,852 [main] DEBUG org.hibernate.util.DTDEntityResolver - located [http:
2010-09-29 11:30:39,852 [main] DEBUG org.hibernate.util.DTDEntityResolver - located [http:
2010-09-29 11:30:39,868 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - null <- org.dom4j.tree.DefaultAttribute@1374ffd [Attribute: name resource value "Quartz.hbm.xml"]
2010-09-29 11:30:39,868 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - null <- org.dom4j.tree.DefaultAttribute@1374ffd [Attribute: name resource value "Quartz.hbm.xml"]
2010-09-29 11:30:39,868 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource : Quartz.hbm.xml
2010-09-29 11:30:39,868 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource : Quartz.hbm.xml
2010-09-29 11:30:39,884 [main] DEBUG org.hibernate.util.DTDEntityResolver - trying to resolve system-id [http:
2010-09-29 11:30:39,884 [main] DEBUG org.hibernate.util.DTDEntityResolver - trying to resolve system-id [http:
2010-09-29 11:30:39,884 [main] DEBUG org.hibernate.util.DTDEntityResolver - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
2010-09-29 11:30:39,884 [main] DEBUG org.hibernate.util.DTDEntityResolver - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
2010-09-29 11:30:39,884 [main] DEBUG org.hibernate.util.DTDEntityResolver - located [http:
2010-09-29 11:30:39,884 [main] DEBUG org.hibernate.util.DTDEntityResolver - located [http:
2010-09-29 11:30:39,930 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
2010-09-29 11:30:39,930 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
?