我正在尝试将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

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

  ask by Sergio del Amo translate from so

本文未有回复,本站智能推荐:

1回复

结合Grails的Tomcat和嵌入式Tomcat JNDI配置3

我试图在我的Grails 3应用程序中结合使用JNDI配置,该应用程序利用嵌入式Tomcat Servlet容器以及独立的tomcat容器(由我们的系统团队设置)。 我已经使用这个SO问题来使我的JNDI配置与Embedded Tomcat容器一起使用(用于localhost开发,例如gr
1回复

在Tomcat上使Oracle陷入困境-JNDI配置-InstanceAlreadyExistsException等错误

我正在从Grails 2过渡到Grails 3,并处理有关Tomcat上Oracle的Jndi数据源的问题,而Tomcat 7和Tomcat 8.5之间存在差异。 简而言之,在我的Grails 3应用程序上...我在Tomcat 8.5上遇到了错误,而在Tomcat 7上却没有。在我的Gr
1回复

JNDI Tomcat Servelet(grails)尝试从身份验证的LDAP绑定中获取更多属性

我很沮丧 我正在研究一个现有的grails项目,该项目在Apache Tomcat下作为servelet运行。 身份验证是通过JNDI领域完成的,这一切都很好。 这是绑定类型身份验证。 LDAP连接后面的活动目录中还有许多其他属性。 我想在我的grails应用程序中使用它们,但
1回复

使用JNDI Connection进行Grails 3.1.1部署

我正在使用grails 3.1.1,我试图用jndi连接来配置我的应用程序,例如.. 25-Oct-2016 11:41:03.764 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
1回复

grails生产jdbc池commons-dbcp与tomcat 7 jndi

对于tomcat grails jdbc访问,建议的生产配置是什么? commons-dbcp还是tomcat jndi轮询? 是否有人对此配置有性能或轶事建议? 我们一直在使用Grails和tomcat jndi来解决配置以及可能出现的事务问题,并且我们正在尝试确定是否要花费
1回复

如何在Grails中指定可移植的Jndi数据源查找

我知道grails中的JNDI查找非常简单 这在Tomcat上效果很好。 在其他容器(WebLogic,JBOSS等)上,同一内容的jndiName只是myDataSource 。 问题是我如何将其配置为通用且可移植的,从而无需根据部署目标更改代码?
1回复

即使使用JNDI,Grails / Tomcat / MySQL过时的连接错误?

我有几个在Tomcat 6.0.18上运行的Grails 1.3.3应用程序。 我知道使用默认的Grails数据源时数据库连接陈旧性问题(一段时间不活动后连接被杀死),所以我切换到Tomcat提供的JNDI。 我部署的第一个应用程序从未出现过时的数据库连接问题。 现在,我将第二个应用程
3回复

Tomcat中的JNDI配置

我正在尝试在Web应用程序中设置JNDI查找以在Tomcat 7中部署。我在jndi.properties文件中指定了以下属性: java.naming.factory.initial = org.jnp.interfaces.NamingContextFactory,java.nam
1回复

Grails + MySQL-BasicDataSource或JNDI

我需要在具有MySQL的Grails中部署应用程序。 在性能上使用基本数据源或JNDI有什么区别?
1回复

Grails查找安全的JNDI

我正在使用Weblogic 12c,并具有一个jndiName为“ myDataSource”的数据源。 dataSource允许对任何人的查找访问,我可以通过执行以下操作来正常查找它: 在配置文件中。 然后,我向数据源添加了一些安全设置,这些安全设置仅指定某些用户或管理员有