gpt4 book ai didi

java - xmlparserv2.jar 和 Oracle 数据库错误

转载 作者:太空宇宙 更新时间:2023-11-04 08:07:26 25 4
gpt4 key购买 nike

当我针对 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数据库有关。大家有什么建议吗?

最佳答案

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

"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

  • 用于 javax.xml.parsers.SAXParserFactory 替换 oracle.xml.jaxp.JXSAXParserFactory 替换为 com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl

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

使用以下命令重新 jar 文件:

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

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

关于java - xmlparserv2.jar 和 Oracle 数据库错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11853967/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com