XML Parsing in Java Stored Proc--Oracle XML Support Installation?

I am working with a third party product that is having difficulty running a java stored proc that is parsing a supplied XML file. The proc basically looks like:
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
InputStream is = getXMLAsInputStream(xml);
try {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse( is );
... parse the document ....
catch (FactoryConfigurationError e) {
// unable to get a document builder factory
We are running on 9.2.0.6, HP-UX 64-bit. At first, when we would attempt to run the proc, a database hang would occur; now after attempting to install using loadjava jars for xerces2.6: ORA-29532: Java call terminated by uncaught Java exception:
javax.xml.parsers.FactoryConfigurationError: Provider
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found)
The vendor says that the errors we are getting when running are not due to any dependency on xerces or jre1.4, and that we need to "install Oracle XML support", but I'm not certain what this means (I cannot find any documentation on what to install). I believe that there are jars that need to be loaded into the database to support the XML parsing, as jre1.3 does not include built-in XML support, and Oracle 9.2.0.6 uses jre1.3.
So...does anyone have any thoughts as to how to resolve the missing references? Is there a way to "install Oracle XML support", or is it to install the necessary jars?
Thanks,
Candi

Candi,
The following resources should be of help:
Oracle9i Database Release 2 (9.2) Documentation Library
In particular, check out the following:
Java Developer's Guide
Java Stored Procedures Developer's Guide
XML API Reference - XDK and Oracle XML DB
XML Database Developer's Guide - Oracle XML DB
XML Developer's Kits Guide - XDK
If that doesn't help, then try the following:
OracleJVM and Java Stored Procedures
XML Technology Center
Good Luck,
Avi.

Similar Messages

  • Parse XML in a java stored proc

    I am trying to parse an xml document in a java stored procedure. Just following my nose, I have developed a stored proc that works fine in development (outside the database using JRE 1.4.1) using the Xerces 2.5 parser. But, after having transferred the xerces xercesImpl.jar, xmlapis.jar, and my implementation class into oracle using loadjava when I call my stored proc the code throws an exception trying to build the document with an error like:
    NoClassDef exception org.apache.xerces.jaxp.DocumentFactoryBuilderImpl
    My Code looks like this:
    import java.io.IOException;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.xml.sax.SAXException;
    InputStream is = getXMLAsInputStream(xml);
    try {
    DocumentBuilderFactory factory =
    DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse( is );
    ... parse the document ....
    catch (FactoryConfigurationError e) {
    // unable to get a document builder factory
    The exception caught is a FactoryConfigurtionError.
    I'm not particularly attached to xerces, I'm really just looking for a way to parse XML inside my java stored proc, so any help to solve my problem, or an alternative suggestion will be greatly appreciated.
    thanks
    Dale

    I looked again and sure enough the xerces implementation classes were missing. I had run a .cmd file containing these two lines, but it looks like only the first one ran...
    loadjava -u ncc/xyz@usd -v -r M:\Database\JavaGeocode\Xerces2_5_0\xml-apis.jar
    loadjava -u ncc/xyz@usd -v -r M:\Database\JavaGeocode\Xerces2_5_0\xercesImpl.jar
    Now I've got everything working fine with Xerces!
    Dale

  • Java Stored Proc - Oracle DBMS Output

    The title pretty much says it all. I have a Java Stored Procedure and I need to direct output preferably to DBMS output from within the Java code. (This is a proof of concept and the managers want to see out put from it so they "know" it's working.)
    System.out.println seems to disappear (though why that is the case I have no idea) in spite of the fact that the samples all show the use of System.err to generate error messages.
    I'm not married to the idea of DBMS output, but it's an easy place to have the output for debugging purposes.
    Comments suggestions and ideas most welcome.
    Regards,
    P

    This might get you going in the right direction:
    DBMS_JAVA
    Gives you the ability to modify the behavior of the Aurora Java Virtual Machine (JVM) in Oracle. You can enable output (meaning that System.out.println will act like DBMS_OUTPUT.PUT_LINE), set compiler and debugger options, and more.
    You can try this link and look for SET_OUTPUT
    http://www.unix.org.ua/orelly/oracle/guide8i/ch09_07.htm
    Good Luck!

  • Xml parsing using java DefaultHandler of org.xml.sax.helpers.DefaultHandler

    i am using
    org.xml.sax.helpers.DefaultHandler api for parsing xml file ,while parsing i am getting exception sometimes ,
    i am using code below to parse the element and then store it to vectore
    parser truncate the charaacters sometimes like parsing string
    " NJ-HealthCare " i am getting only " NJ-HealthCare " and remaing characters are added in new element
    public void characters(char ch[], int start, int length) {
    try{
    ElementVal="";
    System.out.println(" start "+start+" ength :: "+length);
    String ElementVal = new String(ch,start,length);
    v.addElement( ElementVal );
    }catch(Exception ex){
    System.out.println("Exception in vector::"+ex);
    System.out.println(""+ex.getMessage());
    ex.printStackTrace();
    }

    This is an FAQ in the XML forum. The characters() method is not required to give you an entire text node all at once. The parser is free to split up the text node and call characters() several times if it likes. Your program will have to account for that possibility.

  • Problem with java stored procs.

    Is there a restriction on accessing XML documents from Java stored procs?
    I have a Java program to parse XML document and return a string. If I run this program as a stand alone, the program runs fine.
    I loaded the oracle xmlparser.jar into ORACLE8i db sucessfully (used -resolve option). Then I loaded my .class file with -verbose and -resolve option and I did not get any erros. I created function which return string. When I ran the function, I did not get any value bacmk.
    Can I use System.out.println in java programs in ORACLE8i. If I can where can I see the output when the program runs? I not waht other mehtods I can use to debug the program running in ORACLE8i JVM.
    Thank You

    Hello again,
    I read the documentation of 9i and found some hints about different TCP/IP socket handling of 9i and a standard JVM.
    There are some parts that give hints but I couldn't find a sample code to show how to handle the differences.
    Could anyone tell me how to handle the differences or give some links to sample code?
    Thanks
    Detlev

  • Java.lang.ClassNotFoundException: oracle.xml.parser.v2.XMLParseException

    Hi there Masters
    I am new in Java and I would need your help please..
    I am calling a function in Java passing 1 parameter and returning an XML back but at the point of execution I get an error below... At the end I have attached my java code...PLEASE HELP
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/parser/v2/XMLParseException
         at oracle.xdb.XMLTypeFactory.create(XMLTypeFactory.java:78)
         at oracle.sql.OPAQUE.toClass(OPAQUE.java:328)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:278)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:259)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:190)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:117)
         at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:1578)
         at oracle.jdbc.driver.OracleCallableStatementWrapper.getObject(OracleCallableStatementWrapper.java:815)
         at hospitaltool.RunAsnIn.runAsnIn(RunAsnIn.java:41)
         at hospitaltool.HospitalTool.main(HospitalTool.java:38)
    Caused by: java.lang.ClassNotFoundException: oracle.xml.parser.v2.XMLParseException
         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
         ... 10 more
    =====================JAVA CODE====================================
    package hospitaltool;
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.xdb.XMLType;
    public class RunAsnIn {
    public void runAsnIn(Connection con, Boolean fam) throws SQLException {
    System.out.println("RunASNIn Section");
    String messStatus;
    int numRecs = 0; //to hold the number of Records processed
    int totRecs = 0; //to hold the number of total records processed
    ResultSet rs = null;
    Statement stmt = null;
    stmt = con.createStatement();
    //Delete all already caused messages
    try {
    rs = stmt.executeQuery("DELETE FROM asnin WHERE message_num IN(SELECT message_num FROM asnin MINUS SELECT message_num FROM hospital WHERE family = 'ASNIn')");
    //Select all the uncaused messages
    rs = stmt.executeQuery("SELECT message_num FROM hospital WHERE family = 'ASNIn' and rownum <= 1 MINUS SELECT message_num FROM asnin");
    //Go thru the uncaused messages
    } catch (Exception e) {
    while (rs.next()) {
    String messageNum = rs.getString(1);
    // System.out.println("tableName=" + messageNum);
    System.out.println(messageNum);
    //Get the XMLDoc
    XMLType xml = null;
    //Get the XML Doc
    CallableStatement cs1 = null;
    //CallableStatement proc = con.prepareCall("? {call rmsauto.hospitaltool.getmessagedoc(?)}");
    try {
    cs1 = con.prepareCall("{? = call rmsauto.hospitaltool.getmessagedoc(?)}");
    cs1.registerOutParameter(1, OracleTypes.OPAQUE, "SYS.XMLTYPE");
    cs1.setString(2, messageNum);
    cs1.execute();
    } catch (Exception e) {
    xml = (XMLType) cs1.getObject(1);
    System.out.println(xml.getStringVal());
    }

    I did google this and found that I needed a specific jar file called xmlparserv2.jar and I did download it and loaded it on as part of my Libraries the I got a new error... I am using NetBeans
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/binxml/BinXMLMetadataProvider
         at oracle.xdb.XMLTypeFactory.create(XMLTypeFactory.java:78)
         at oracle.sql.OPAQUE.toClass(OPAQUE.java:328)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:278)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:259)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:190)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:117)
         at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:1578)
         at oracle.jdbc.driver.OracleCallableStatementWrapper.getObject(OracleCallableStatementWrapper.java:815)
         at hospitaltool.RunAsnIn.runAsnIn(RunAsnIn.java:41)
         at hospitaltool.HospitalTool.main(HospitalTool.java:38)
    Caused by: java.lang.ClassNotFoundException: oracle.xml.binxml.BinXMLMetadataProvider
         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
         ... 10 more
    Java Result: 1

  • ANN: Oracle XML Parser for Java v2.0.0.1

    A new maintenance release of the Oracle Parser for Java is
    available for download. It has the following fixes and changes:
    Bug fixes for #920536, i.e. Cannot access element attributes via
    XSLT; #898423. i.e. ElementDecl's in DTDs; #774774, i.e. DOM
    extensions using XSL pattern matching; #863890 i.e. SAX
    IOException not thrown.
    New APIs in the following new interface:
    1. oracle.xml.parser.v2.NSResolver
    - resolveNamespacePrefix( find the namespace definition in scope
    for a given namespace prefix )
    New APIs in the following classes:
    1. oracle.xml.parser.v2.XMLNode
    - selectNodes( Selects nodes from the tree which match the given
    pattern; client can provide an NSResolver implementation to
    resolve namespace prefixes in the pattern ).
    2. oracle.xml.parser.v2.ElementDecl
    - getParseTree( Returns the root Node of Content Model parse
    tree, which could then be traversed node by node using
    getFirstChild() and getLastChild(). The Node types are: PLUS,
    COMMA, ASTERISK, ELEMENT, QMARK ).
    This is the first beta patch release for v2.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

    unzip -l appsborg2.zip | grep 9.0.4
    0 04-18-03 20:10 .xdkjava_version_9.0.4.0.0_production
    do i still need to do that step?No, you do not have to since "XML Parser for Java v9.0.4" is already installed as part of appsborg2.zip

  • Nls support with oracle xml parser in java

    I'm using The JAXP interface to manipulate xml with xsl. the implementation that I use is Oracle xml parser.
    My xml contains a lot of hebrew chars, and in the result stream each char translated into 5-6 chars, which makes the result to be 5-6 times bigger than it suppose to be, and harder for me to debug my application.
    The client's browser shows the results well.
    How can I make the transformator to transform the hebrew chars to hebrew char istead of longer and not readable string ?

    Oracle XML Team wrote:
    : Stephen Flinter (guest) wrote:
    : : Environment: WinNT 4.0/SP4, Apache 1.3.6, JServ 1.0, Oracle
    : 8.1.5
    : : I have downloaded the new Java v2 XML Parser (2.0.2), and
    have
    : : replaced the wrapper.classpath entry in my jserv.properties
    : file
    : : with the path to the new parser.
    : : When I rerun the "Employee Page" demo, I get the following
    : : exception message:
    : : [15/09/1999 11:02:22:974 GMT] java.lang.NoSuchMethodError:
    : : oracle.xml.parser.v2.XSLProcessor: method
    : : processXSL
    : (Loracle/xml/parser/v2/XSLStylesheet;Loracle/xml/parser
    : : /v2/XMLDocument;)Lorg/w3c/dom/DocumentFragment; not found
    : : at oracle.xml.xsql.XSLHelper.process(XSLHelper.java:34)
    : : at oracle.xml.xsql.XSQLServlet.doGet(XSQLServlet.java,
    : : Compiled Code)
    : : at
    : : javax.servlet.http.HttpServlet.service(HttpServlet.java:499)
    : : at
    : : javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
    : : at
    : : org.apache.jserv.JServConnection.processRequest
    : (JServConnection.j
    : : ava)
    : : at
    : : org.apache.jserv.JServConnection.run(JServConnection.java)
    : : at java.lang.Thread.run(Thread.java:479)
    : : This demo was works fine with the parser shipped with the
    : : xsql_servlet download.
    : : Regards,
    : : Steve
    : Version 2.0.2 uses the August XSLT WD which is incompatible
    with
    : the April WD on which our previous releases including the demos
    : were based.
    : Oracle XML Team
    : http://technet.oracle.com
    : Oracle Technology Network
    Hi,
    Can someone from the Oracle XML Team point us to a fix so we can
    continue our testing???
    Steve...
    null

  • Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/parser/v2/

    Hi!
    Kindly assist on the following error.
    I'm doing the sample acmevideo on Cashier Application deploying as a Java Application from JDeveloper3.0 and Oracle8i 8.1.5. And I had this error after executing the following command;
    Path=e:\javaWebServer2.0\jre\bin;%Path%
    jre -cp "e:\cashier\acme.jar" acmevideo.swing.CashierApp
    ERROR MESSAGE ARE FOLLOWS:
    E:\cashier>jre -cp "e:\cashier\acme.jar" acmevideo.swing.CashierAppException in thread "main" java.lang.NoClassDefFoundError:
    oracle/xml/parser/v2/DOMParser
    at
    at oracle.jbo.server.SessionImpl.init(SessionImpl.java:82)
    at oracle.jbo.server.ApplicationModuleHomeImpl.create(ApplicationModuleHomeImpl.java:81)
    at oracle.dacf.dataset.SessionInfo._createAppModule(SessionInfo.java:1776)
    at oracle.dacf.dataset.SessionInfo.connect(SessionInfo.java:1370)
    at oracle.dacf.dataset.SessionInfo.open(Compiled Code)
    at oracle.dacf.dataset.SessionInfo.publishSession(SessionInfo.java:952)
    at oracle.dacf.dataset.SessionInfo.publishSession(SessionInfo.java:934)
    at acmevideo.infoswing.ViewRentalsForm.<init>(ViewRentalsForm.java:189)
    at acmevideo.swing.CashierApp.<init>(CashierApp.java:45)
    at acmevideo.swing.CashierApp.main(CashierApp.java:141)

    Make sure the classpath for the application includes all necessary dependency archives.
    The error in question is referring to the XMLParverv2.jar. This needs to be in the application's classpath when you launch it.
    The jar is available from JDEV_HOME\lib.
    Laura

  • ORACLE XML PARSER FOR JAVA FOR AIX

    Hi people!
    I'm looking for the Oracle XML Parser for Java 9.0.2.0.0C, my 9iAS is BI Installation 9.0.2.3, where can I get it? In the Downloads Section there is only the version for 10g, and the existing versions for 9i are not for AIX (my OS is AIX 5.2L).
    Thanks.

    Thanks for your help, I navigate through this link and, even it shows a table where appears the release for AIX (9.2.0.6.0), when I get to http://www.oracle.com/technology/tech/xml/xdk/software/prod/utilsoft_java.htm
    it shows me only downloads for Sun, Linux and HP-UX, but not for AIX.
    Has the version for AIX being deprecated or something like that?

  • Java.lang.ClassCastException: oracle.xml.parser.v2.XMLText cannot be cast to org.w3c.dom.Element

    Hello
    I am getting java.lang.ClassCastException: oracle.xml.parser.v2.XMLText cannot be cast to org.w3c.dom.Element error. This code is in java which is present in java embedding.
    The SOA is parsing the xml in java code using oracle.xml.parser.v2 . This wont be a problem if the SOA uses default w3c DOM parser. How do i force SOA to use w3c DOM parser.
    Is there any thing i can do with class loading?
    Kindly help.
    Regards
    Sharat

    Can you paste your java code here ? I assume, you must have tried type-casting.

  • Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/parse

    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/parser/v2/
    XSLException
    Hi
    I have downloaded XDK and was trying to use the XSU feature..
    I unzipped the XDK file, I ran the following query on SQL plus
    select * from emp. It displayed the full table.
    Then i set the class path for XDK,XMLparserv2,oracle JDBC driver and then ran the same query on dos prompt(that is front end command line for java in my case).
    The following is the line i tried to execute on the command prompt
    java OracleXML getXML -user "scott/tiger" -conn "jdbc:oracle:thin:@localhost
    :1521:PomonaT" "select * from emp"
    PomonaT is the db name(Host string i use to enter SQL+)
    I get the following error
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/parser/v2/
    XSLException
    at OracleXML.To_XML(OracleXML.java:1038)
    at OracleXML.ExecuteGetXML(OracleXML.java:917)
    at OracleXML.main(OracleXML.java:184)
    IS SOMETHING MISSING IN MY CLASSPATH??
    IF YES? Could anyone tell what??
    Kunal

    Add xmlparserv2.jar to Classpath & reboot.

  • Oracle XML Parser for Java

    Does the latest release of the Oracle XML Parser for Java support JDK 1.2.2?
    I have an application which makes use of the XML Parser which runs fine with JDK 1.1.7.
    But the application crashes with the use of JDK 1.2.2 .
    Any insight into this is appreciated.
    null

    The Oracle XSQL Servlet makes extensive use of the Oracle XML Parser for Java V2 as well as its XSLT Engine and runs without issue under 1.1.8 and 1.2.2.

  • Upgrading Oracle XML Parser for Java v9.0.4 with Oracle Applications 11i

    Guys, I applied ATG.PF.H.RUP4. In postinstall steps it is mentioned,Upgrading Oracle XML Parser for Java v9.0.4 with Oracle Applications 11i(doc-271148.1)
    which says after applying patch 4038964 do the following--
    AUTOCONFIG ENABLED APPLICATIONS ENVIRONMENT
    If the Oracle E-Business Suite configuration files are maintained using the AutoConfig infrastructure, proceed with the following:
    1. Run the AutoConfig utility.
    2. Go to [JAVA_TOP].
    3. Run the unzip -l appsborg2.zip | grep 9.0.4 command. If there is a file named as .xdkjava_version_9.0.4.0.0_production, which indicates that XML Parser for Java v9.0.4 is installed correctly as part of appsborg2.zip. Otherwise, run ADAdmin to regenerate the appsborg2.zip file.
    4. Restart the application tier server processes such that the new version of Oracle XML Parser for Java will take effect.
    but actually the patch is already applied- 4038964. How do i verify if i need to do these steps or not.
    The xmlparserv2-904.zip file is already there in wrapper.classpath. of jserv.properties, forms.properties. So i think i dont need to do these steps.

    unzip -l appsborg2.zip | grep 9.0.4
    0 04-18-03 20:10 .xdkjava_version_9.0.4.0.0_production
    do i still need to do that step?No, you do not have to since "XML Parser for Java v9.0.4" is already installed as part of appsborg2.zip

  • ANN: Oracle XML Parser for Java v1.0.1.1 Maintenance

    The first maintenance release of the Oracle XML Parser for
    Java is available for download here.
    It has the following fixes and changes since 1.0.1:
    Bug Fixes:
    #843157, parseDTD(InputSource, rootElement) and
    parseDTD(URL, rootelement) then parse(InputSource) bugs;
    #843143, parse(InputSource) bug;
    #793012, no need to print a trace of an exception which is
    rethrown.
    Changes: None
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

    The first maintenance release of the Oracle XML Parser for
    Java is available for download here.
    It has the following fixes and changes since 1.0.1:
    Bug Fixes:
    #843157, parseDTD(InputSource, rootElement) and
    parseDTD(URL, rootelement) then parse(InputSource) bugs;
    #843143, parse(InputSource) bug;
    #793012, no need to print a trace of an exception which is
    rethrown.
    Changes: None
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

Maybe you are looking for

  • Nokia c5-03 volume and media player issues

    i recently bought a nokia C5-03, i transfered some music from my pc to the phone but after playing 2 or 3 songs(video clips), the clips start breaking up, this has been happening since i purchased it a month ago. now the phone has started acting up o

  • Help with PDF program

    Hi- I need help in getting the PDF program I purchased to function- it needs to be re-installed & I can not get it to do this- Tech Case #185313234 open-I need someone in English to help thru the problem- Thanks B.Carr @ [email protected] or [email p

  • Window open function

    Hi, I am using the following link to open a new window. but it opens two windows. I dont know why? a href="javascript:window.open('index.html','newWin','toolbars=no')" It opens index.html and also some other page in between saying [object]. I cant fi

  • What is wrong with photoshop loading process

    I recently bought a new laptop , I5 processor , 4 gb of ram , pretty powerfull system in general but like the previous photoshop versions this new one is a pain to load everything . I installed about 2 weeks ago the trial version of CS5 and since i h

  • PE 11 Update and Windows 8

    I still have not yet found a solution for this problem.  I am running PE 11 on a new Toshiba laptop using Windows 8.  When I try to check for updates for photoshop elements 11, I get an error message from "adobe application manager", "the update serv