Grails中的JNDI配置出错

时间:2011-12-11 20:37:09

标签: tomcat grails jndi

我正在尝试将Grailsn(1.3.7)Webapp部署到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:

<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

如果有人可以提供帮助,我真的很感激!

0 个答案:

没有答案