I tried to get the xml value from database and display in the text box,but when i execute the code getting the below exception when i execute the code,
similarly i tried to get the string value(text) from database to and display in the text box its working fine.problem with XMLType and the exceptions.
I am executing the code using the eclipse application and included the jars xdb6,ojdbc14,xmlparserv2
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: oracle/jdbc/internal/XMLTypeIntf at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at oracle.xdb.XMLTypeFactory.create(XMLTypeFactory.java:74) at oracle.sql.OPAQUE.toClass(OPAQUE.java:376) at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:318) at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:144) at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:100) at oracle.jdbc.driver.OracleResultSetImpl.getObject(OracleResultSetImpl.java:915) at Searchdb.actionPerformed(Searchdb.java:327) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: oracle.jdbc.internal.XMLTypeIntf at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 55 more
String strxa = tfx1.getText(); //here i will get the student id from user.
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@//host:1521/service","username","pwd");
Statement st =con.createStatement();
String str3 ="select student_xml from student where student_id='"+strxa+"'";
System.out.println(str3);
ResultSet rs = st.executeQuery(str3);
System.out.println(str3);
if (rs.next()) {
XMLType poxml = (XMLType)rs.getObject(1);
System.out.println(poxml); //when i try to print this no output in console
String poString =poxml.getStringVal();
System.out.println(poString); when i try to print this no output in console
//Sets Records in TextFields.
area.setText(poString);
}
Is there any problem with my jars or code.when i tried to print the value inside the while loop its not getting printed in console.