Я пытаюсь развернуть веб-приложение Grailsn (1.3.7) в Tomcat 7.023 и использовать JNDI.
Я добавил следующий код в conf / Config.groovy
grails.naming.entries = [
"jdbc/turismoenguada": [
type: "javax.sql.DataSource",
auth: "Container",
url: "jdbc:mysql://localhost:3306/turismoenguada",
driverClassName: "org.gjt.mm.mysql.Driver",
description: "Development Datasource",
username: "turismoenguada",
password: "mypassword",
maxActive: "8",
maxIdle: "4"
]
]
Мой conf / DataSource.groovy имеет следующую производственную конфигурацию:
production {
dataSource {
pooled = false
dbCreate = "update"
jndiName = "java:comp/env/jdbc/turismoenguada"
}
}
Мой tomcat / conf / server.xml имеет хост:
<Host name="turismoenguadalajara" appBase="webapps">
<Context path="" docBase="TurismoEnGuadalajara-0.1" debug="0">
<Resource
name="jdbc/turismoenguada"
auth="Container"
type="javax.sql.DataSource"
username="turismoenguada"
password="mypassword"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/turismoenguada"/>
</Context>
</Host>
Когда я запускаю tomcat, я получаю следующую ошибку:
2011-12-11 21:24:37,673 [pool-2-thread-1] ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'jdbcUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'jdbcUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
... 6 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'jdbcUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
... 6 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'jdbcUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
... 6 more
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'jdbcUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
... 6 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
... 6 more
2011-12-11 21:24:37,676 [pool-2-thread-1] ERROR [/TurismoEnGuadalajara-0.1] - Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'jdbcUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'jdbcUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
... 6 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'jdbcUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
... 6 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'jdbcUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
... 6 more
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'jdbcUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
... 6 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
... 6 more
Dec 11, 2011 9:24:37 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Dec 11, 2011 9:24:37 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/TurismoEnGuadalajara-0.1] startup failed due to previous errors
2011-12-11 21:24:37,686 [pool-2-thread-1] ERROR [/TurismoEnGuadalajara-0.1] - Exception sending context destroyed event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'jdbcUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'jdbcUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
... 6 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'jdbcUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
... 6 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'jdbcUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
... 6 more
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'jdbcUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
... 6 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'jdbcUrl': no matching editors or conversion strategy found
... 6 more
Если кто-то может помочь, я действительно ценю это!