На самом деле я развернул свое приложение Grails на двух экземплярах Tomcat. Теперь я столкнулся с проблемой. Моя Кварцевая Работа должна быть сгруппирована.
Я прочитал документацию по плагину и нашел возможность кластеризовать задания Quartz в сочетании с базой данных.
Поэтому я должен создать отображение hibernate ('grails-app / conf / hibernate / hibernate.cfg.xml') в моем приложении grails.
<?xml version='1.0' encoding='UTF-8'?>
<session-factory>
<mapping resource='Quartz.hbm.xml'/>
</session-factory>
Затем я также создал Quartz.hbm.xml. Этот создает таблицы для Quartz Plugin.
Когда я запускаю свое приложение, создается впечатление, что hibernate.cfg.xml не используется grails и таблицы не создаются.
Я думал, что проблема в моем определении источника данных Spring ниже.
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://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
2010-09-29 11:30:39,852 [main] DEBUG org.hibernate.util.DTDEntityResolver - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
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://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
2010-09-29 11:30:39,852 [main] DEBUG org.hibernate.util.DTDEntityResolver - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
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://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
2010-09-29 11:30:39,884 [main] DEBUG org.hibernate.util.DTDEntityResolver - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
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://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
2010-09-29 11:30:39,884 [main] DEBUG org.hibernate.util.DTDEntityResolver - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
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
Есть идеи?