遵循JDBC设置尝试Grails启动时出错 [英] Error when attempting Grails start up, following JDBC setup

查看:179
本文介绍了遵循JDBC设置尝试Grails启动时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有可能重用现有的一个我的问题。
将Groovy应用程序连接到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上遇到以下错误,任何建议都会受到欢迎张开双臂

 错误2013-01-27 16:09:06,772 [localhost-startStop-1]错误context.GrailsContextLoader 
- 执行bootstraps时出错:使用名称'transactionManagerPostProcessor'创建bean时出错:
bean初始化失败;嵌套异常是
org.springframework.beans.factory.BeanCreationException:创建名为
'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'
的引用。嵌套异常是
org.springframework.beans.factory.BeanCreationException:
创建名为'sessionFactory'的bean时出错:
设置bean属性
时无法解析对bean'lobHandlerDetector'的引用'LobHandler接口';嵌套异常是org.springframework.beans.factory.BeanCreationException:
创建名为'lobHandlerDetector'的bean时出错:
调用init方法失败;嵌套异常是
org.springframework.jdbc.support.MetaDataAccessException:
提取DatabaseMetaData时出错;
嵌套的异常是org.apache.commons.dbcp.SQLNestedException:
无法加载JDBC驱动程序类'com.microsoft.sqlserver.jdbc.SQLServerDriver'
消息:使用名称'transactionManagerPostProcessor创建bean时出错':
初始化bean失败;嵌套异常是
org.springframework.beans.factory.BeanCreationException:
创建名为'transactionManager'的bean时出错:
设置bean属性
时无法解析对bean'sessionFactory'的引用'的sessionFactory';嵌套的异常是org.springframework.beans.factory.BeanCreationException:
创建名为'sessionFactory'的bean时出错:无法在设置bean属性'lobHandler'时解析对bean'lobHandlerDetector'
的引用;嵌套的异常是
org.springframework.beans.factory.BeanCreationException:创建名为
'lobHandlerDetector'的bean时出错:init方法的调用失败;嵌套异常是
org.springframework.jdbc.support.MetaDataAccessException:
提取DatabaseMetaData时出错;嵌套异常是
org.apache.commons.dbcp.SQLNestedException:无法加载JDBC驱动程序类
'com.microsoft.sqlserver.jdbc.SQLServerDriver'

解决方案 ,如果问题仍然存在,请参阅以下双重检查的附加信息:




ol>
  • 检查路径中是否有空白。如果路径中包含空格字符,特别是在Windows上,Grails运行效果不佳。

  • 检查您的Grails安装,确保它适用于简单应用程序。

  • 检查您的常青藤缓存(在〜/ .grails / 或 c:\< your home> \.grails )是健康的。如果不是,只需将其删除,Grails将为您重新创建一个新的常青藤缓存。

  • 如果不是。 1-3帮不上忙,请删除〜/ .grails c:\< your home> \.grails 清理与Grails相关的所有内容,并重新开始。


  • There is a potential that I should be reusing an existing question of mine. Connecting a groovy application to SQL server Express

    BUT this seems to be a bit different. The question was brought up while configuring a test application, now I am doing the real thing and this is the time that it goes really wrong.

    As you can see the Jar file is in my lib and classpath

    my datasource is configured as below (pretty much a copy paste job from my working example)

    dataSource {
    username = "sa"
    password = "password"
    url = "jdbc:sqlserver://localhost:1433;databaseName=TimeTracker"
    driverClassName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    dialect = "org.hibernate.dialect.SQLServerDialect"
    

    and I am getting the following error on grails run-app, any advice would be welcomed with open arms

    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'
    

    解决方案

    Do grails --refresh-dependencies compile one more time, and it will be good to go.

    If the problem still persists, here's additional information to double checking:

    1. Check if there's whitespace in your path. Grails does not work well if the path contains whitespace characters, especially on Windows.
    2. Check your Grails installation, and make sure it's working for a simple app.
    3. Check if your ivy cache (under ~/.grails/ or c:\<your home>\.grails) is healthy. If not, just delete it and Grails will recreate a new ivy cache for you.
    4. If no. 1-3 couldn't help, delete ~/.grails or c:\<your home>\.grails to clean everything releated to Grails, and start over.

    这篇关于遵循JDBC设置尝试Grails启动时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆