tags:

views:

304

answers:

2

I have an application that is running Jaxb 2.1.12. I am running JDK 1.5 and OC4J 10.1.3.4.0. When I try to use the portion of my application that is using Jaxb, I get the following error:

Unable to locate jaxb.properties for package

I narrowed this down to the xml.jar that comes with OC4J. It contains Jaxb 1.0 classes. I can fix this error by adding the following to the orion-application.xml file:

<imported-shared-libraries>
    <remove-inherited name="oracle.xml"/>
</imported-shared-libraries>

The problem is that I am deploying the WAR file to OC4J by using the admin_client.jar utility. I do not have an EAR to put the orion-application.xml file in, so I decided to try adding the orion-web.xml file to the WAR's WEB-INF directory and setting the search-local-classes-first property to 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>

This causes the application to not deploy at all. I get an error saying that the Spring configuration files cannot be parsed. I would like to use search-local-classes-first. How can I use this property? Also is there a way that I can deploy the orion-application.xml file with the WAR file?

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)

Note: I do not get this error with Java 1.6 and I believe that is because 1.6 comes packaged with Jaxb 2.

A: 

In the documentation for "search-local-classes-first" I saw the following line:

In accordance with the servlet specification, search-local-classes-first functionality cannot be used in loading classes in java. or javax.* packages.*

Since, JAXB2 is included in JDK 1.6 and is now under javax.*, maybe the appserver ignores the classes/library even though it is present in the WEB-INF/lib directory. Try putting the JAXB jars in your $JRE_HOME/lib directory. If it is picked up, then you can try modifying the startup scripts for your appserver to include the JAXB jars in the primordial classpath.

The solution is a bit of a hack :). Here's a link with steps for doing the same thing for Apache CXF.

Replacing JAXB with JAXB2.0 in OC4j

Thimmayya
+1  A: 

If creating a ear file solves the problem, I recomend you go this way. Also, when you deploy a war file, the container creates an ear for you. Check in the applications directory of the oc4j's install dir for the ear file.

rodrigoap