| 

.NET C# Java Javascript Exception

1
Ich muss einen Zugriff auf die Access-DB prodTest.mdb über Grails herstellen und habe die DataSource.groovy wie folgt bearbeitet:

production {
dataSource {
dbCreate = "update"
driverClassName="sun.jdbc.odbc.JdbcOdbcDriver"
url = "jdbc:odbc:file:prodTest"


}


Die Datei prodTest.mdb habe ich als System-DSN in Windows-XP angelegt.

Dennoch bekomme ich immer die Fehlermeldung, das der Datenbankquellenname falsch ist und das kein Standardtreiber geladen sei.

Laut Dokumentation muss für ODBC keine Treiberdatei in das lib-Verzeichnis kopiert werden.

Was mache ich falsch?? Hat mir da jemand einen Tip??
28.02.2011
TeacherMC 11 1
2 Antworten
0
production {
dataSource {
dbCreate = "update"
driverClassName="sun.jdbc.odbc.JdbcOdbcDriver"
url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=z:/prodTest.mdb"
username=""
password=""
}
}


Auch die direkte Methode, wie sie in Java funktioniert, wirft mir in Grails eine Exception.

Welcome to Grails 1.3.7 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: C:\grails-1.3.7

Base Directory: Z:\grailsProjects\support
Resolving dependencies...
Dependencies resolved in 1860ms.
Running script C:\grails-1.3.7\scripts\RunApp.groovy
Environment set to production
[groovyc] Compiling 1 source file to Z:\grailsProjects\support\target\classes
[delete] Deleting directory C:\Dokumente und Einstellungen\1\.grails\1.3.7\projects\support\tomcat
Running Grails application..

Configuring Spring Security ...
2011-02-28 21:30:00,281 [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 org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212)
at grails.web.container.EmbeddableServer$start.call(Unknown Source)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149)
at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
at _GrailsRun_groovy.runInline(_GrailsRun_groovy:116)
at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
at RunApp$_run_closure1.doCall(RunApp.groovy:33)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)
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
... 23 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
... 23 more
Caused by: 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
... 23 more
Caused by: 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
... 23 more
Caused by: org.springframework.jdbc.support.MetaDataAccessException: Invocation of DatabaseMetaData method 'getDatabaseMajorVersion' failed; nested exception is java.lang.reflect.InvocationTargetException
... 23 more
Caused by: java.lang.reflect.InvocationTargetException
... 23 more
Caused by: java.lang.UnsupportedOperationException
at org.apache.commons.dbcp.DelegatingDatabaseMetaData.getDatabaseMajorVersion(DelegatingDatabaseMetaData.java:249)
... 23 more
2011-02-28 21:30:00,281 [main] ERROR [localhost].[/support] - 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 '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 org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212)
at grails.web.container.EmbeddableServer$start.call(Unknown Source)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149)
at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
at _GrailsRun_groovy.runInline(_GrailsRun_groovy:116)
at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
at RunApp$_run_closure1.doCall(RunApp.groovy:33)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)
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
... 23 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
... 23 more
Caused by: 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
... 23 more
Caused by: 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
... 23 more
Caused by: org.springframework.jdbc.support.MetaDataAccessException: Invocation of DatabaseMetaData method 'getDatabaseMajorVersion' failed; nested exception is java.lang.reflect.InvocationTargetException
... 23 more
Caused by: java.lang.reflect.InvocationTargetException
... 23 more
Caused by: java.lang.UnsupportedOperationException
at org.apache.commons.dbcp.DelegatingDatabaseMetaData.getDatabaseMajorVersion(DelegatingDatabaseMetaData.java:249)
... 23 more
2011-02-28 21:30:00,281 [main] ERROR core.StandardContext - Error listenerStart
2011-02-28 21:30:00,296 [main] ERROR core.StandardContext - Context [/support] startup failed due to previous errors
Server running. Browse to http://localhost:8080/support
Batchvorgang abbrechen (J/N)?


Hat jemand eine Idee? Am Spring Framework liegt es denke ich nicht, denn das funktioniert wunderbar mit mySQL. Nur wenn ich versuche auf die AccessDB zuzugreifen, kommt die Exception.
28.02.2011
TeacherMC 11 1
0
(noch) keine komplette Lösung, aber vielleicht ein Schritt dahin: hier und hier haben andere User die gleiche Exception bekommen, und der Verdacht ging beide Male in die Richtung, dass die automatische Erkennung des DB-Dialekts nicht funktioniert hat (mit dem Lösungsvorschlag, ihn explizit zu setzen)
01.03.2011
Matthias Hlawatsch 8,4k 2 8
Hallo Matthias,

das ist mal ein Ansatz. Werde versuchen den Dialekt festzulegen.

Inzwischen habe ich auch eine "Zwischenlösung" gefunden, bei welcher ich mit grails in eine mySQL Datenbank schreibe. Die mySQL DB kommuniziert dann mit dem mySQL-ODBC Connector. Das funktioniert.

Werde aber den Ansatz mit den Dialekten auch verfolgen. Danke für den Tip.
TeacherMC 01.03.2011

Stelle deine Access-Frage jetzt!