我有可能重复使用我现有的问题。 Connecting a groovy application to SQL server Express
但这似乎有点不同。在配置测试应用程序时提出了这个问题,现在我正在做真实的事情,这是它真正错误的时候。
正如您所见,Jar文件位于我的lib和classpath
中
我的数据源配置如下(几乎是我工作示例中的复制粘贴作业)
dataSource {
username = "sa"
password = "password"
url = "jdbc:sqlserver://localhost:1433;databaseName=TimeTracker"
driverClassName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
dialect = "org.hibernate.dialect.SQLServerDialect"
我在grails run-app上收到以下错误,任何建议都会张开双臂欢迎
Error 2013-01-27 16:09:06,772 [localhost-startStop-1] ERROR context.GrailsContextLoader
- Error executing bootstraps: Error creating bean with name 'transactionManagerPostProcessor':
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 'lobHandlerDetector' while setting bean property
'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'lobHandlerDetector':
Invocation of init method failed; nested exception is
org.springframework.jdbc.support.MetaDataAccessException:
Error while extracting DatabaseMetaData;
nested exception is org.apache.commons.dbcp.SQLNestedException:
Cannot load JDBC driver class 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
Message: Error creating bean with name 'transactionManagerPostProcessor':
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 'lobHandlerDetector'
while setting bean property 'lobHandler'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'lobHandlerDetector': Invocation of init method failed; nested exception is
org.springframework.jdbc.support.MetaDataAccessException:
Error while extracting DatabaseMetaData; nested exception is
org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class
'com.microsoft.sqlserver.jdbc.SQLServerDriver'
答案 0 :(得分:2)
再做一次grails --refresh-dependencies compile
,这样做会很好。
如果问题仍然存在,请参阅以下附加信息:
under ~/.grails/
或c:\<your home>\.grails
)是否健康。如果没有,只需删除它,Grails将为您重新创建一个新的常春藤缓存。~/.grails
或c:\<your home>\.grails
以清除与Grails相关的所有内容,然后重新开始。答案 1 :(得分:0)
这个问题很大程度上取决于我的Grails版本,特别是随着时间的推移而建立起来的IVY文件......从第一天开始,我几乎已经消灭了这个项目,并且每个项目都以grails运行在你的家庭grails目录中创建它自己的配置文件。经过几个月的虐待,我的行为已经变得非常腐败。
通过重命名文件夹并将我的grails版本再次下载到预期的目录,应用程序文件是新创建的,应用程序立即能够找到SQL JDBC jar。
我欠ChanWit找到这个解决方案而没有他,我想我会精神崩溃。