This discussion is archived
1 Reply Latest reply: Dec 6, 2012 5:35 AM by 880554 RSS

java.lang.ClassNotFoundException: oracle.xml.parser.v2.XMLParseException

880554 Newbie
Currently Being Moderated
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());
}
}
}
  • 1. Re: java.lang.ClassNotFoundException: oracle.xml.parser.v2.XMLParseException
    880554 Newbie
    Currently Being Moderated
    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

Legend

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