配置都配置好了连接oracle可以正常连接,连接sql servle 2000报错信息如下。 
Running Grails application.. 
2009-09-29 17:07:16,359 [main] 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 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Invocation of DatabaseMetaData method 'getDatabaseMajorVersion' failed; nested exception is java.lang.reflect.InvocationTargetException 
at java.security.AccessController.doPrivileged(Native Method) 
at grails.web.container.EmbeddableServer$start.call(Unknown Source) 
at _GrailsRun_groovy$_run_closure5_closure11.doCall(_GrailsRun_groovy:145) 
at _GrailsRun_groovy$_run_closure5_closure11.doCall(_GrailsRun_groovy) 
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:274) 
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) 
at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:137) 
at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy) 
at _GrailsRun_groovy.runInline(_GrailsRun_groovy:104) 
at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy) 
at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:58) 
at RunApp$_run_closure1.doCall(RunApp.groovy:33) 
at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324) 
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334) 
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy) 
at gant.Gant.withBuildListeners(Gant.groovy:344) 
at gant.Gant.this$2$withBuildListeners(Gant.groovy) 
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) 
at gant.Gant.dispatch(Gant.groovy:334) 
at gant.Gant.this$2$dispatch(Gant.groovy) 
at gant.Gant.invokeMethod(Gant.groovy) 
at gant.Gant.processTargets(Gant.groovy:495) 
at gant.Gant.processTargets(Gant.groovy:480) 
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) 
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 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Invocation of DatabaseMetaData method 'getDatabaseMajorVersion' failed; nested exception is java.lang.reflect.InvocationTargetException 
at java.security.AccessController.doPrivileged(Native Method) 
... 24 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Invocation of DatabaseMetaData method 'getDatabaseMajorVersion' failed; nested exception is java.lang.reflect.InvocationTargetException 
at java.security.AccessController.doPrivileged(Native Method) 
... 25 more ---------------------------------------------------------------------- 一下是grails 的dateSource文件内容 
dataSource { 
  pooled = false 
  driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver" 
  url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=exam" 
  
  username = "sa" 
  password = "sa" 

hibernate { 
  cache.use_second_level_cache = true 
  cache.use_query_cache = true 
  cache.provider_class = 'com.opensymphony.oscache.hibernate.OSCacheProvider' 

// environment specific settings 
environments { 
  development { 
    dataSource { 
      dbCreate = "create-drop" // one of 'create', 'create-drop','update' 
    } 
  } 
  test { 
    dataSource { 
      dbCreate = "update" 
    } 
  } 
  production { 
    dataSource { 
      url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=exam" 
      dbCreate = "update"     } 
  } 

-------- 
哪位高手知道问题原因呢?

解决方案 »

  1.   

       改成这个试试:
    dataSource { 
      pooled = false 
      

    hibernate { 
      cache.use_second_level_cache = true 
      cache.use_query_cache = true 
      cache.provider_class = 'com.opensymphony.oscache.hibernate.OSCacheProvider' 

    // environment specific settings 
    environments { 
      development { 
        dataSource { 
          dbCreate = "create-drop" // one of 'create', 'create-drop','update' 
          driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver" 
          url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=exam" 
      
          username = "sa" 
          password = "sa"     } 
      } 
      test { 
        dataSource { 
          dbCreate = "update" 
        } 
      } 
      production { 
        dataSource { 
          url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=exam" 
          dbCreate = "update"     } 
      }