This discussion is archived
8 Replies Latest reply: Nov 16, 2012 11:26 AM by 967252 RSS

Nullpointer exception with XMLParserv2-11.2.0.1.0 version and JDK1.6

967252 Newbie
Currently Being Moderated
Hi,
I am receiving null pointer exception when using XMLParserv2-11.2.0.1.0.jar with Java and Oracle11g database while XSL transformation. However same code works with XMLParserv2-9.2.jar.

Please provide the possible cause.
  • 1. Re: Nullpointer exception with XMLParserv2-11.2.0.1.0 version and JDK1.6
    rp0428 Guru
    Currently Being Moderated
    >
    I am receiving null pointer exception when using XMLParserv2-11.2.0.1.0.jar with Java and Oracle11g database while XSL transformation. However same code works with XMLParserv2-9.2.jar.

    Please provide the possible cause.
    >
    Can you help me with my problem if all I say is this?
    >
    My car makes a funny noise when I rev the engine.

    Please provide the possible cause.
    >
    What Java? Post the code.

    What XSL? What XML? What is it you are doing?

    What XMLParserv2-11.2.0.1.0 jar file? One of the several that comes as part of the database? Last I checked there are at least three DIFFERENT versions of that jar file that get installed as part of the database.

    No one can help you if you don't provide information about what it is you are doing.

    The obvious solution is USE THE XMLParserv2-9.2.jar file and don't use the other one. That's about all anyone can say without more specific info.
  • 2. Re: Nullpointer exception with XMLParserv2-11.2.0.1.0 version and JDK1.6
    967252 Newbie
    Currently Being Moderated
    Sorry for the brief note. Here are the details:

    I am migrating from oracle 10g to 11G version. SO I all XSU related jars such as XSU,XDB,XMLParserv2 to 11G version of jars.

    JDK Version:1.6
    Oracle database: 11gR2
    XML ParserV2 version - 11.2.0.1.0

    I am passing result set to OracleXMLQuery and XSL file which transforms to output xml. This was working code with 10G database , JDK1.5 and XMLParserv2-9.2.jar.
    Code:
    OracleXMLQuery xmlQuery = new OracleXMLQuery(aConnection, queryResults);               
                   xmlQuery.keepObjectOpen(true);
                   xmlQuery.setRaiseException(true);
                   xmlQuery.useNullAttributeIndicator(false);
                   
                   // set the xslt file
                   if (xslFile != null) {     
                        InputStream is = getClass().getResourceAsStream(xslFile);
                        Reader reader = new InputStreamReader(is);                         
                        xmlQuery.setXSLT(reader, null);
                        reader.close();
                        is.close();          
                   }               
                   
                   // get the xml string
                   xmlString = xmlQuery.getXMLString();

    Below is the exception stack trace:

    oracle.xml.sql.OracleXMLSQLException: java.lang.NullPointerException
         at oracle.xml.sql.docgen.OracleXMLDocGenString.getXMLDocumentString(OracleXMLDocGenString.java:442)
         at oracle.xml.sql.query.OracleXMLQuery.getXMLString(OracleXMLQuery.java:333)
         at oracle.xml.sql.query.OracleXMLQuery.getXMLString(OracleXMLQuery.java:270)
         at oracle.xml.sql.query.OracleXMLQuery.getXMLString(OracleXMLQuery.java:246)

    Please let me know if you require any additional information
  • 3. Re: Nullpointer exception with XMLParserv2-11.2.0.1.0 version and JDK1.6
    rp0428 Guru
    Currently Being Moderated
    >
    Please let me know if you require any additional information
    >
    Still need this info
    >
    What XMLParserv2-11.2.0.1.0 jar file? One of the several that comes as part of the database? Last I checked there are at least three DIFFERENT versions of that jar file that get installed as part of the database.
    >
    There are xsu and parser jars in the Oracle 11 dbhome/lib folder, xdk/lib folder, and sqldeveloper/lib folder and they aren't necessarily exactly the same versions or identical to each other.

    None of those folders have an xdb jar.

    There will definitely be issues with some functionality if you mix and match any of these. I reported one such issue in this thread
    Re: oraxsl infinite loop using kutable.xsl and xml with default column value
  • 4. Re: Nullpointer exception with XMLParserv2-11.2.0.1.0 version and JDK1.6
    967252 Newbie
    Currently Being Moderated
    Thanks for the information. I got this jar from DBA. I need to check with them and will update you.
  • 5. Re: Nullpointer exception with XMLParserv2-11.2.0.1.0 version and JDK1.6
    967252 Newbie
    Currently Being Moderated
    Hi,
    The XMLParserV2.jar is the version available in lib folder where database is installed. Its size is 1350KB.
  • 6. Re: Nullpointer exception with XMLParserv2-11.2.0.1.0 version and JDK1.6
    sb92075 Guru
    Currently Being Moderated
    964249 wrote:
    Hi,
    The XMLParserV2.jar is the version available in lib folder where database is installed. Its size is 1350KB.
    I have a few to choose between

    /home/oracle/.apex/8888/apex/WEB-INF/lib/xmlparserv2-11.2.0.jar
    /home/oracle/datamodeler/datamodeler/lib/xmlparserv2.jar
    /home/oracle/datamodeler/modules/oracle.xdk_11.1.0/xmlparserv2_sans_jaxp_services.jar
    /home/oracle/datamodeler/modules/oracle.xdk_11.1.0/xmlparserv2_jaxp_services.jar
    /home/oracle/datamodeler/modules/oracle.xdk_11.1.0/xmlparserv2.jar
    /home/oracle/sqldeveloper/modules/oracle.xdk_11.1.0/xmlparserv2_sans_jaxp_services.jar
    /home/oracle/sqldeveloper/modules/oracle.xdk_11.1.0/xmlparserv2_jaxp_services.jar
    /home/oracle/sqldeveloper/modules/oracle.xdk_11.1.0/xmlparserv2.jar
    /home/oracle/app/oracle/product/JDeveloper/jdeveloper/modules/oracle.xdk_11.1.0/xmlparserv2.jar
    /home/oracle/app/oracle/product/11.2.0/dbhome_2/lib/xmlparserv2_sans_jaxp_services.jar
    /home/oracle/app/oracle/product/11.2.0/dbhome_2/lib/xmlparserv2_jaxp_services.jar
    /home/oracle/app/oracle/product/11.2.0/dbhome_2/lib/xmlparserv2.jar
    /home/oracle/app/oracle/product/11.2.0/dbhome_2/oc4j/lib/xmlparserv2.jar
    /home/oracle/app/oracle/product/11.2.0/dbhome_2/oui/jlib/lib/xmlparserv2.jar
    /home/oracle/app/oracle/product/11.2.0/dbhome_2/oui/jlib/jlib/xmlparserv2.jar
    /home/oracle/app/oracle/product/11.2.0/dbhome_2/oui/jlib/xmlparserv2.jar
    /home/oracle/app/oracle/product/11.2.0/dbhome_2/xdk/lib/xmlparserv2_sans_jaxp_services.jar
    /home/oracle/app/oracle/product/11.2.0/dbhome_2/xdk/lib/xmlparserv2_jaxp_services.jar
    /home/oracle/app/oracle/product/11.2.0/dbhome_2/xdk/lib/xmlparserv2.jar
    /home/oracle/app/oracle/product/11.2.0/dbhome_2/sysman/jlib/ocm/xmlparserv2.jar
    /home/oracle/app/oracle/product/11.2.0/dbhome_2/ccr/lib/xmlparserv2.jar
    /home/oracle/tmp/apex/apex/WEB-INF/lib/xmlparserv2-11.2.0.jar
  • 7. Re: Nullpointer exception with XMLParserv2-11.2.0.1.0 version and JDK1.6
    rp0428 Guru
    Currently Being Moderated
    >
    The XMLParserV2.jar is the version available in lib folder where database is installed. Its size is 1350KB
    >
    You need to make sure that all of those jars are from the same set. If the parser jar is from the dbhome/lib folder then the xsu jar should be from there also.

    And, as I said, none of those folders have an xdb jar file so it could be the wrong version.

    I never got an answer at all as to why Oracle ships three different sets of jars with the DB especially since some of the jars show the same version but are actually different. I think those dbhome/lib, xdk/lib and sqldeveloper/lib folders and content are managed by separate groups.

    You could also try different copies of those jar files to see if that solves the problem.

    Is there any reason why you can just use JDK 1.5 and the jars (XMLParserv2-9.2.jar file that used to work? Just put the jar versions that used to work in a project folder and add them to the classpath you are using instead of using the ones that dont' work.
  • 8. Re: Nullpointer exception with XMLParserv2-11.2.0.1.0 version and JDK1.6
    967252 Newbie
    Currently Being Moderated
    Sorry for the delay.. It took some time for me to get the various version of jars. Finally the version of jars in sqldeveloper folder worked. Thank you for your guidance and help.

    We are upgrading to Oracle-11G and JDK-1.6 and hence wanted to use 11G version of jars.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points