xmlparserv2.jar和Oracle数据库出错

时间:2012-08-07 20:52:53

标签: java xml oracle hibernate

当我对oracle数据库运行代码时,出现以下错误:

Error parsing XML (31) : http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd<Line 31, Column 2>: XML-20068: (Fatal Error) content model is not deterministic
[07 Aug 2012 14:41:36,643](UTC 20:41:36) WARN   ApplicationLifecycle      | Unable to install module at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.hibernate.InvalidMappingException: Unable to read XML
at org.hibernate.util.xml.MappingReader.readMappingDocument(MappingReader.java:101)
at org.hibernate.cfg.Configuration.add(Configuration.java:513)
at org.hibernate.cfg.Configuration.add(Configuration.java:509)
at org.hibernate.cfg.Configuration.add(Configuration.java:716)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:801)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:2344)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:2310)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2290)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2243)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2158)
Caused by: org.dom4j.DocumentException: Error on line 31 of document http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd : http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd<Line 31, Column 2>: XML-20068: (Fatal Error) content model is not deterministic Nested exception: http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd<Line 31, Column 2>: XML-20068: (Fatal Error) content model is not deterministic
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.util.xml.MappingReader.readMappingDocument(MappingReader.java:75)
... 20 more

主要错误是Error parsing XML (31) : http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd<Line 31, Column 2>: XML-20068: (Fatal Error) content model is not deterministic

当我删除jar xmlparserv2.jar时,我收到以下错误。

Caused by: java.lang.NoClassDefFoundError: oracle/xml/parser/v2/XMLParseException
at oracle.jdbc.driver.OracleSQLXML.setString(OracleSQLXML.java:415)
at com.capitaliq.loader.persistence.messaging.QueueUtils$1FlushMessages.execute(QueueUtils.java:358)
at com.capitaliq.loader.persistence.messaging.QueueUtils.flushMessages(QueueUtils.java:378)
at com.capitaliq.loader.persistence.AbstractControlFacadeHelper$ControlFacadeRetrier.performOperation(AbstractControlFacadeHelper.java:303)
at com.capitaliq.loader.persistence.AbstractRetryLimitedDurationWithTimout.retryContinuously(AbstractRetryLimitedDurationWithTimout.java:66)
at com.capitaliq.loader.persistence.AbstractControlFacadeHelper.performRetries(AbstractControlFacadeHelper.java:138)
... 12 more
Caused by: java.lang.ClassNotFoundException: oracle.xml.parser.v2.XMLParseException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 18 more
at com.capitaliq.loader.control.ClientManager$HeartbeatCity.safeRun(ClientManager.java:429)
at com.capitaliq.common.thread.SafeRunnable.run(SafeRunnable.java:57)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NoClassDefFoundError: oracle/xml/parser/v2/XMLParseException
at oracle.jdbc.driver.OracleSQLXML.setString(OracleSQLXML.java:415)
... 12 more
Caused by: java.lang.ClassNotFoundException: oracle.xml.parser.v2.XMLParseException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 18 more  
   Caused by: oracle.xml.parser.v2.XMLParseException

从堆栈跟踪中,我可以推断出我需要在我的类路径中使用这个jar来读取xml,但我不能拥有它,因为它与我的hibernate版本不兼容。在升级到Hibernate 3.6之前,我没有出现此错误。 我的问题是,有没有人曾经这样做过?还有另一个与oracle数据库一起使用的xmlparser吗?

如果我针对SQL数据库运行我的代码,如果jar在类路径上,我会得到相同的错误。但如果我删除一切正常。所以我知道它与oracle数据库有关。有人有什么建议吗?

1 个答案:

答案 0 :(得分:1)

试试这个: 使用以下命令解压缩文件:

"C:\Program Files\Java\jdk1.7.0_02\bin\jar" -xvf xmlparserv2.jar

更改META-INF / services中文件中的条目,如下所示:

  • javax.xml.parsers.DocumentBuilderFactory 替换 oracle.xml.jaxp.JXDocumentBuilderFactory com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

    < / LI>
  • for javax.xml.parsers.SAXParserFactory 替换 oracle.xml.jaxp.JXSAXParserFactory com.sun.org。 apache.xerces.internal.jaxp.SAXParserFactoryImpl

  • for javax.xml.transform.TransformerFactory 替换 oracle.xml.jaxp.JXSAXTransformerFactory com.sun.org。 apache.xalan.internal.xsltc.trax.TransformerFactoryImpl

使用以下命令重新封存文件:

"C:\Program Files\Java\jdk1.7.0_02\bin\jar" -cvfm xmlparserv2.jar META-INF\MANIFEST.MF -c ./ .

将这个新的xmlparserv2.jar文件复制到项目的lib目录中