This discussion is archived
1 2 Previous Next 21 Replies Latest reply: Jun 6, 2008 4:08 AM by Bogumil Laska RSS

How can I use a 3rd party XML parser such as xerces with OC4J ?

470777 Newbie
Currently Being Moderated
Hi all tech experts,

I am using Oracle Application Server 10g Release 2 (10.1.2) and i have
installed Portal and Wireless and OracleAS Infrastructure on the same
computer.

i tried all the solutions on this thread

Use of Xerces Parser in out application with Oracle App Server 9.0.4

but still fighting.

I have also posted this query on OTN on following thread

How can I use a 3rd party XML parser such as xerces with OC4J?

but no reply....

Please help me on this issue.

Since OC4J is preconfigured to use the Oracle XML parser which is xmlparserv2.jar.

i have read the following article which states that

OC4J is preconfigured to use the Oracle XML parser. The Oracle XML parser is fully JAXP 1.1 compatible and will serve the needs of applications which require JAXP functionality. This approach does not require the download, installation, and configuration of additional XML parsers.

The Oracle XML parser (xmlparserv2.jar) is configured to load as a system level library of OC4J through it's inclusion as an entry in the Class-Path entry of the oc4j.jar Manifest.mf file. This results in the Oracle XML parser being used for all common deployment and packaging situations. You are not permitted to modify the Manifest.mf file of oc4j.jar.

It must be noted that configuring OC4J to run with any additional XML parser or JDBC library is not a supported configuration. We do know customers who have managed to successfully replace the system level XML parser and the Oracle JDBC drivers that ship with the product, but we do not support this type of configuration due to the possibility of unexpected system behavior and system errors that might occur from replacing the tested and certified libraries.

If you absolutely must use an additional XML parser such as xerces, then you have to start OC4J such that the xerces.jar file is loaded at a level above the OC4J system classpath. This can be accomplished using the -Xbootclasspath flag of the JRE.


i have also run the following command

java -Xbootclasspath/a:d:\xerces\xerces.jar -jar oc4j.jar


but no success.

How could i utilize my jar's like xerces.jar and xalan.jar for parsing instead of OC4J in-built parser ?

All reply will be highly appreciated.

Thnx in advance to all.

Neeraj Sidhaye
try_catch_finally @ Y !
  • 1. Re: How can I use a 3rd party XML parser such as xerces with OC4J ?
    388251 Newbie
    Currently Being Moderated
    HI Neeraj,

    I have used the -Xbootclasspath successfully in the past, just make sure that the actual jar file is being picked up. You can print out the classpath of OC4J at start up by doing this:

    System.getProperty("java.class.path"); --> this will tell you whats on the classpath and if the xerces.jar is on the classpath or not (kindly check your syntax with the "\") .

    If this does not work you can try this:

    1. Copy the xerces.jar into the applib directory
    2. Modify your startup for OC4J like this:

    -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl

    Hope this helps.

    Cheers,

    Deepak
  • 2. Re: How can I use a 3rd party XML parser such as xerces with OC4J ?
    470777 Newbie
    Currently Being Moderated
    Hi Deepak,

    First thanks for ur prompt reply.

    I have already tried of copying xerces.jar to applib directory.
    but not done with modifying startup for OC4J.

    Could u please explain me how to modify the startup for OC4J.
    do i need to run the command like follwoing

    java -jar oc4j.jar -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl

    i run this command but it's saying invalid switch.

    or do i need to make entry of -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl into an xml file which is responsible for OC4J startup and if yes then where to do this entry.

    Waiting for ur reply.

    thanks again Deepak.

    ~Neeraj Sidhaye
    try_catch_finally @ Y !
  • 3. Re: How can I use a 3rd party XML parser such as xerces with OC4J ?
    388251 Newbie
    Currently Being Moderated
    Neeraj,

    All you are doing by the implementing this switch -Djavax.xml.parsers.SAXParserFactory is telling OC4J to use another XML parser. Please try the following:

    I know that this switch works in 10.1.2 AS. Please note that you should be doing all these changes through the iAS Console if you have the whole Application Server stack. These changes will be applied to your OC4J instance.

    Open the opmn.xml file located at ORACLE_HOME/opmn/conf and add the following environment variable just after the line <ias-component id="OC4J_name">
    <environment>
    <variable id="PATH" value="path to the folder that has your xerces.jar" append="true"/>
    </environment>

    To your Java options add the following:

    Under the Command line options you need to change the Java Options. Add the following after server –Xrs
    -Xms256M -Xmx512M -Djava.library.path=<path to xerces.jar>
    -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.
    SAXParserFactoryImpl

    If you are using standalone OC4J:

    java -jar oc4j.jar -server -Xrs -Xms256M -Xmx512M -Djava.library.path=<path to where your xerces.jar is> -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl

    I would like to see whats on your classpath so please use the System.property command and print whats on your classpath. The -Xbootclasspath option should work without issues.

    Hope this helps.

    Deepak

    Message was edited by:
    Deepak Arora
  • 4. Re: How can I use a 3rd party XML parser such as xerces with OC4J ?
    470777 Newbie
    Currently Being Moderated
    Hi Deepak,

    I am trying the solutions u mentioned.

    These are the versions that i m working with

    1->I am using Oracle Application Server 10g Release 2 (10.1.2) and i have installed Portal and Wireless and OracleAS Infrastructure on the same computer.

    2->Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)

    3-> Oracle JDeveloper 10 g
    Version 10.1.2.1.0(Build 1913).
    with portal-addin-install.jar configured.


    I have one more query

    Where(in which log file) can i find my System.out.println log on the Server ?

    Thanks again for quick responding.

    nJoy Work
    ~Neeraj Sidhaye
    try_catch_finally @ Y !
  • 5. Re: How can I use a 3rd party XML parser such as xerces with OC4J ?
    388251 Newbie
    Currently Being Moderated
    Neeraj,

    The Sys.out statements are printed in the $OH/opmn/logs/<OC4J_name>defaultisland_#. You can also check out the debugging options here:

    http://download-west.oracle.com/docs/cd/B14099_17/web.1012/b14011/advanced.htm#sthref286

    Hope this helps.

    Deepak
  • 6. Re: How can I use a 3rd party XML parser such as xerces with OC4J ?
    470777 Newbie
    Currently Being Moderated
    Hi Deepak,

    Yeah.. definitely it helped me.
    i got my sys.out trace....so now can trace better.

    Thanx a lot. :-)

    nJoy work

    ~Neeraj Sidhaye
    try_catch_finally @ Y !
  • 7. Re: How can I use a 3rd party XML parser such as xerces with OC4J --Success
    470777 Newbie
    Currently Being Moderated
    HI Deepak,

    I have successfully achieved my task.
    Now every thing is working fine and able to parse XML.

    I tried so many solutions so i m not sure..which one worked :-)
    May be following thing worked

    1.copying jar to applib folder
    2.and when u depoly the ear on portal then there is a file called orin-web.xml , in this file there is a line as below.....i uncommented this tag
    Uncomment this element to control web application class loader behavior.
    <web-app-class-loader search-local-classes-first="true" include-war-manifest- class-path="true" />

    3.<environment>
    <variable id="PATH" value="path to the folder that has your xerces.jar" append="true"/>
    </environment>
    by Deepak. very cool help from deepak....:-)

    but soon i will do fresh installation of Oracle Portal and then will come out with the concrete reason.

    But now..i feel good.

    My JPDK Portlet is working fine and also i have upgraded my portal version to 10.1.4 for JSR168 enabling..

    Also I am successfully able to deploy JSR168 Portlet on Oracle Portal.


    I really nJoyed with this task and learnt lot..

    nJoy Work.

    ~Neeraj Sidhaye
    try_catch_finally @ Y !
  • 8. Re: How can I use a 3rd party XML parser such as xerces with OC4J --Success
    501911 Newbie
    Currently Being Moderated
    Hai
    This is ajith,
    I tried to deploy our appplication in oracle 9.0.4.It is a general webapplication .I faced the same problem which Neeraj Sidhaye was facing.I tried all the option which deepak have suggested,but that was of no use.Likes wise i cannot able to find orin-web.xml which Neeraj was saying can u guys help me in this to sort out the issue


    Thanks in Advance
    S.Ajithkumar
  • 9. Re: How can I use a 3rd party XML parser such as xerces with OC4J --Success
    470777 Newbie
    Currently Being Moderated
    Hi Ajithkumar,

    Just try the following.

    1) copy the file xalan.jar and xerces.jar to ORACLE_HOME\lib\

    2) Locate the file opmn.xml in ORACLE_HOME\opmn\config\

    3) Find the <process-type id="logloaderd" module-id="LOGLDR" working-dir="$ORACLE_HOME"> in opmn.xml file
    and there add the following inside the <environment> tag
    <variable id="CLASSPATH" value="$ORACLE_HOME/lib/xerces.jar" append="true"/>

    If above doesn't work then
    One more thing u can try is

    1) copy the file xalan.jar and xerces.jar to ORACLE_HOME\jdk\jre\lib\ext

    2) find the entry <ias-component id="wireless" status="enabled"> in opmn.xml

    3) add the folloing line
         <variable id="CLASSPATH" value="C:\oracle\OraPortal\jdk\jre\lib\ext\xerces.jar" append="true"/>
    inside the <environment> tag.

    Restart the server


    Hope this helps..

    Let me know ur Happy Status :-)

    ~Neeraj Sidhaye
    Try_Catch_Finally @ Yahoo Dot Com
    ChkOut_ChkIn @ Yahoo Dot Co Dot In
  • 10. Re: How can I use a 3rd party XML parser such as xerces with OC4J --Success
    519092 Newbie
    Currently Being Moderated
    Is there a similar solution for standalone Oc4J ? There is no opmn.xml file
  • 11. Re: How can I use a 3rd party XML parser such as xerces with OC4J --Success
    533434 Newbie
    Currently Being Moderated
    Hi Neeraj Sidhaye,

    I am trying to deploy a sample xform application to the Oracle Application Server (10.1.3). However, I encountered the class loader issue that is similar to your stuation. I tried all the three solutions but the application is still use the Oracle xml paser class. I am wondering if you have any insight about this?

    Thanks for your help.
    Xingsheng Qian
    iPass Inc.
    ------------------------------------------------------------------------------------------------------------------
    Here is the error message I got.
    Message:

    java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement

    Stack Trace:

    org.chiba.xml.xforms.exception.XFormsException: java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement
         at org.chiba.xml.xforms.Container.dispatch(Unknown Source)
         at org.chiba.xml.xforms.Container.dispatch(Unknown Source)
         at org.chiba.xml.xforms.Container.initModels(Unknown Source)
         at org.chiba.xml.xforms.Container.init(Unknown Source)
         at org.chiba.xml.xforms.ChibaBean.init(Unknown Source)
         at org.chiba.adapter.servlet.ServletAdapter.init(ServletAdapter.java:153)
         at org.chiba.adapter.servlet.ChibaServlet.doGet(ChibaServlet.java:303)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:299)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:187)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement
         at org.chiba.xml.xforms.Instance.iterateModelItems(Unknown Source)
         at org.chiba.xml.xforms.Bind.initializeModelItems(Unknown Source)
         at org.chiba.xml.xforms.Bind.init(Unknown Source)
         at org.chiba.xml.xforms.Initializer.initializeBindElements(Unknown Source)
         at org.chiba.xml.xforms.Model.modelConstruct(Unknown Source)
         at org.chiba.xml.xforms.Model.performDefault(Unknown Source)
         at org.chiba.xml.xforms.XFormsDocument.performDefault(Unknown Source)
         at org.chiba.xml.xforms.XFormsDocument.dispatchEvent(Unknown Source)
         at org.apache.xerces.dom.NodeImpl.dispatchEvent(Unknown Source)
         ... 18 more
  • 12. Re: How can I use a 3rd party XML parser such as xerces with OC4J --Success
    470777 Newbie
    Currently Being Moderated
    Hi ,

    Did you try with copying your xml parser jar files to ORACLE_HOME\jdk\jre\lib\ext ?

    Also try with Printing System.getProperty("java.class.path"); --> this will tell you whats on the classpath.

    After doing this restart the server and then check.

    Thanks
    <Neeraj Sidhaye/>
  • 13. Re: How can I use a 3rd party XML parser such as xerces with OC4J --Success
    533434 Newbie
    Currently Being Moderated
    Hi Neeraj,

    Once I put the xml parser jar files to ORACLE_HOME\jdk\jre\lib\ext, the opmnctl start will fail. I guess Oracle Application Server is trying to start using the xml parser class in the \ext instead of the Oracle xml parser for the server itself.

    Thanks,
    Xingsheng
  • 14. Re: How can I use a 3rd party XML parser such as xerces with OC4J --Success
    164415 Oracle ACE
    Currently Being Moderated
    If you are using 10.1.3 then there is a fully supported way to use Xerces within your application with the new shared-library functionality.

    There is a how-to on OTN that walks you through the details:

    See http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/index.html and look for "How to Swap XML Parsers"

    The 10.1.3 Developer's Guide has a chapter on classloading that contains more information about shared-libraries.

    cheers
    -steve-
1 2 Previous Next