2010-12-07 17 views
1

我在試圖將一個域對象的成員類型映射到OracleXmlType。我已經遵循了Graeme Rocher的建議 here關於將xmlparserv2.jar添加到類路徑,以及this post描述如何聲明靜態映射。如果我開始與Grails的Grails中的OracleXmlType

Grails的-cp%ORACLE_LIBS%/ xmlparserv2.jar運行的應用程序

我得到如下:

2010-12-07 11:25:41,532 [main] ERROR context.GrailsContextLoader - Error executing bootstraps: java.lang.LinkageError: loader constraint violation: loader (instance of <bootloader>) previously initiated loading for a different type with name "org/w3c/dom/NamedNodeMap" 
org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.LinkageError: loader constraint violation: loader (instance of <bootloader>) previously initiated loading for a different type with name "org/w3c/dom/NamedNodeMap" 
     at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:723) 
     at grails.spring.BeanBuilder.beans(BeanBuilder.java:573) 
     at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:519) 
     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: java.lang.LinkageError: loader constraint violation: loader (instance of <bootloader>) previously initiated loading for a different type with name "org/w3c/dom/NamedNodeMap" 
     at java.lang.Class.getDeclaredMethods0(Native Method) 
     at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) 
     at java.lang.Class.getDeclaredMethods(Class.java:1791) 
     at java.security.AccessController.doPrivileged(Native Method) 
     at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) 
     at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) 
     at grails.spring.DynamicElementReader.invokeMethod(DynamicElementReader.groovy:121) 
     ... 26 more 

這個開始的Grails(添加XDB。罐子到classpath):

>grails -cp %ORACLE_LIBS%/xmlparserv2.jar:%ORACLE_LIBS%/xdb.jar run-app 

結果在此:

Running Grails application.. 
2010-12-07 11:15:23,497 [main] ERROR context.GrailsContextLoader - Error executing bootstraps: 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': Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsDomainException: Error evaluating ORM mappings block for domain [com.mydomain.DropFile]: No such property: OracleXmlType for class: org.codehaus.groovy.grails.orm.hibernate.cfg.HibernateMappingBuilder 
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': Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsDomainException: Error evaluating ORM mappings block for domain [com.mydomain.DropFile]: No such property: OracleXmlType for class: org.codehaus.groovy.grails.orm.hibernate.cfg.HibernateMappingBuilder 
     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': Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsDomainException: Error evaluating ORM mappings block 
for domain [com.mydomain.DropFile]: No such property: OracleXmlType for class: org.codehaus.groovy.grails.orm.hibernate.cfg.HibernateMappingBuilder 
     ... 23 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsDomainException: Error evaluating ORM mappings block for domain [com.mydomain.DropFile]: No such property: OracleXmlType for class: org.codehaus.groovy.grails.orm.hibernate.cfg.HibernateMappingBuilder 
     ... 23 more 
Caused by: org.codehaus.groovy.grails.exceptions.GrailsDomainException: Error evaluating ORM mappings block for domain [com.mydomain.DropFile]: No such property: OracleXmlType for class: org.codehaus.groovy.grails.orm.hibernate.cfg.HibernateMappingBuilder 
     ... 23 more 
Caused by: groovy.lang.MissingPropertyException: No such property: OracleXmlType for class: org.codehaus.groovy.grails.orm.hibernate.cfg.HibernateMappingBuilder 
     at com.mydomain.DropFile$__clinit__closure2.doCall(DropFile.groovy:24) 
     at com.mydomain.DropFile$__clinit__closure2.doCall(DropFile.groovy) 
     ... 23 more 

如果我使用相同的類路徑作爲我的最後調用,並改變我的映射到這一點:

static mapping = { 
    xmlContent type:"OracleXmlType" // quotes around OracleXmlType 
} 

...我得到這個:

Running Grails application.. 
2010-12-07 11:30:24,589 [main] ERROR context.GrailsContextLoader - Error executing bootstraps: 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': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: OracleXmlType, at table: drop_file, for columns: [org.hibernate.mapping.Column(xml_content)] 
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': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: OracleXmlType, at table: drop_file, for columns: [org.hibernate.mapping.Column(xml_content)] 
     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': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: OracleXmlType, at table: drop_file, for columns: [org.hibernate.mapping.Column(xml_content)] 
     ... 23 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: OracleXmlType, at table: drop_file, for columns: [org.hibernate.mapping.Column(xml_content)] 
     ... 23 more 
Caused by: org.hibernate.MappingException: Could not determine type for: OracleXmlType, at table: drop_file, for columns: [org.hibernate.mapping.Column(xml_content)] 
     ... 23 more 

第二和第三的嘗試看起來很近。任何人都可以闡明我錯過的東西嗎?我是否必須提供OracleXmlType的實現?

在此先感謝。

回答

0

我不確定這是否能解決這個問題,但這聽起來很像我從使用Glassfish中的JSF應用程序使用XDB的問題。問題是xmlparserv2.jar註冊了一個較舊的XML庫,而不是某些服務器組件。

創建一個臨時目錄,將xmlparserv2.jar放入它,除去META-INF/services目錄,然後將它備份起來。現在用應用程序部署修改的jar文件,看看它是否有幫助。