1

I was trying to execute SELECT statement by connecting from Java to Oracle DB. One of the table has column with Timestamp datatype .when i ran the jUnit test i got the below exception

 java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to java.sql.Timestamp
at com.sun.rowset.CachedRowSetImpl.getTimestamp(Unknown Source)
at org.springframework.jdbc.support.rowset.ResultSetWrappingSqlRowSet.getTimestamp(ResultSetWrappingSqlRowSet.java:491)
at com.wellpoint.provider.rnr.biz.integration.dao.PropsDAO.buildPropsResponse(PropsDAO.java:1476)
at com.wellpoint.provider.rnr.biz.integration.dao.PropsDAO.populatProps(PropsDAO.java:1320)
at com.wellpoint.provider.rnr.biz.integration.dao.PropsDAO.getProps(PropsDAO.java:388)
at com.wellpoint.provider.rnr.biz.managers.PropsManager.getProps(PropsManager.java:95)
at com.wellpoint.provider.rnr.biz.managers.PropsTest.testGetProps(PropsTest.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
...... .....

set the -D oracle.jdbc.J2EE13Compliant=true for PropsTest.java in the argument VM tab, tried to execute and got the below

java.lang.NoClassDefFoundError: oracle/jdbc/J2EE13Compliant=true
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.J2EE13Compliant=true
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)
Exception in thread "main" 

am i missing adding any jars or have to follow some other approach to solve this?

Any of your help is appeciated!

Thanks!

5
  • 2
    show the codes pleases Commented Sep 23, 2013 at 10:09
  • 2
    instead of casting, do new myResult.timestampValue() Commented Sep 23, 2013 at 10:13
  • Please edit your last comment into your question. Commented Sep 23, 2013 at 11:45
  • Thankyou all for your suggestions. I resolved the same by modifying the type of columns in code. Commented Sep 23, 2013 at 13:57
  • Relate: stackoverflow.com/questions/13269564/… Commented May 30, 2016 at 10:52

2 Answers 2

4

I've also seen this ClassNotFound exception. And it was caused by space between -D and o...

-Doracle.jdbc.J2EE13Compliant=true

should work

Sign up to request clarification or add additional context in comments.

Comments

0

It would appear you are missing the Oracle JDBC driver JAR in your runtime classpath.

Check out Oracle JDBC driver downloads page.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.