我有一个运行Jaxb 2.1.12的应用程序。我运行的是JDK1.5和OC4J 10.1.3.4.0。当我尝试使用我的应用程序中使用Jaxb的部分时,我得到以下错误:
Unable to locate jaxb.properties for package我将范围缩小到OC4J附带的xml.jar。它包含Jaxb 1.0类。我可以通过将以下内容添加到orion-application.xml文件来修复此错误:
<imported-shared-libraries>
<remove-inherited name="oracle.xml"/>
</imported-shared-libraries>问题是我使用admin_client.jar实用程序将WAR文件部署到OC4J。我没有用于放置orion-application.xml文件的EAR,因此我决定尝试将orion-web.xml文件添加到WAR的WEB-INF目录中,并将search-local-classes-first属性设置为true:
<?xml version="1.0"?>
<orion-web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-web-10_0.xsd" deployment-version="10.1.3.4.0"
jsp-cache-directory="./persistence"
jsp-cache-tlds="standard"
simple-jsp-mapping="false"
temporary-directory="./temp"
schema-major-version="10" schema-minor-version="0" >
<web-app-class-loader search-local-classes-first="true" />
<web-app>
</web-app>
</orion-web-app>这会导致应用程序根本不部署。我得到一个错误,说Spring配置文件不能被解析。我想先使用search-local-classes。如何使用此属性?另外,有没有一种方法可以将orion-application.xml文件与WAR文件一起部署?
09/11/16 13:26:01 WARNING: DeployerRunnable.run Unexpected exception parsing XML document from Servl
etContext resource [/WEB-INF/applicationContext-acegi-security.xml]; nested exception is java.lang.C
lassCastException: oracle.xml.jaxp.JXDocumentBuilderFactoryoracle.oc4j.admin.internal.DeployerExcept
ion: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationCon
text-acegi-security.xml]; nested exception is java.lang.ClassCastException: oracle.xml.jaxp.JXDocume
ntBuilderFactory
at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:126)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnabl
e.java:52)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledE
xecutor.java:303)
at java.lang.Thread.run(Thread.java:595)注意:我在Java 1.6中没有得到这个错误,我相信这是因为1.6附带了Jaxb 2。
发布于 2009-11-18 00:09:58
如果创建一个ear文件可以解决这个问题,我建议您这样做。此外,当您部署war文件时,容器会为您创建一个ear。在oc4j的安装目录的applications目录中查看ear文件。
发布于 2009-11-17 09:09:26
在"search-local-classes-first“的文档中,我看到了下面这行:
根据servlet规范,在java中加载类时不能使用搜索本地类优先功能。或javax.*包。*
由于JAXB2包含在JDK1.6中,并且现在在javax.*下,因此应用服务器可能会忽略类/库,即使它存在于WEB-INF/lib目录中。尝试将JAXB jars放在$JRE_HOME/lib目录中。如果它被选中,那么您可以尝试修改appserver的启动脚本,以便在原始类路径中包含JAXB jars。
这个解决方案有点像hack :)。这里有一个链接,其中包含对Apache CXF执行相同操作的步骤。
Replacing JAXB with JAXB2.0 in OC4j
https://stackoverflow.com/questions/1744064
复制相似问题