oracle.sql.TIMESTAMP cannot be cast to java.sql.Timestamp - java

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!

I've also seen this ClassNotFound exception. And it was caused by space between -D and o...
-Doracle.jdbc.J2EE13Compliant=true
should work

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

Related

Errors in Eclipse after Java update

I recently updated java, I went to eclipse opened up my code and saw that there were a lot of errors that weren't there before I saved last time I dont know what it's asking for and I know its not a problem with my code. Everytime i run it says the following:
Exception in thread "main" java.lang.NoClassDefFoundError: [LString;
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: String
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)
... 7 more
as well as saying an JNI error has occured as well as Java Exception.
I haven't tried adding classes as I don't know what will happen if I do.
Did you remove the old version when you upgraded Java? Go to Preferences->Java->Installed JREs and check that the new version is selected.
If the new version isn't listed, use the Search button.

Exception in thread "main" dropbox application

I'm trying to make a simple application with Java, using Eclipse that could upload a file from my computer to Dropbox but whenever I compile, I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/conn/params/ConnPerRoute
at javaaplication1.JavaApplication11.main(JavaApplication11.java:32)
Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.params.ConnPerRoute
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)
... 1 more
Can you help me figure this out?
Thank you in advance.
You miss the httpclient.jar in your classpath. Download it and add it to your classpath.

eclipse errors while running custom code

While adding custom jar files in the project and executing some java code I am getting this error any idea how to solve this .There is no error in code ,it was running smoothly before this happen.
Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
at com.util.DfExSession.connectToDocbase(DfExSession.java:18)## Heading ##
at com.console.TestConsole.main(TestConsole.java:17)
Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.Signature
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)
... 2 more
Look's like the aspectjrt.jar is missing in your classptah. Download & add it to your classpath.

CodenameOne stopped working after build

I have an odd issue with codenameone, and I'm not even sure what went wrong. I've tried to "send windows phone build", and don't think I have changed anything else since then. However, after I did so the simulator wouldn't launch and kept saying my imports were wrong. They weren't, the suggested solution was importing once that were already in.
The errors I get
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.codename1.impl.javase.Simulator.main(Simulator.java:59)
Caused by: java.lang.ClassNotFoundException: com.mycompany.myapp.MyApplication
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 java.lang.ClassLoader.findSystemClass(Unknown Source)
at com.codename1.impl.javase.ClassPathLoader.findClass(ClassPathLoader.java:100)
at com.codename1.impl.javase.ClassPathLoader.loadClass(ClassPathLoader.java:50)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.codename1.impl.javase.Executor.main(Executor.java:45)
... 5 more
All the classes he can't find are actually in my solution, I already tried re-adding them to the build path. Any suggestions?
That is odd.
First check that you indeed still have the package com.mycompany.myapp where you have the public class MyApplication. Do a clean build of the project and see if this class makes it into the jar file under the dist folder.

Getting the c3p0 "ClassNotFound" Exception on MCServer start

iam trying to use MySQL Connection Pooling using c3p0.
I want to use c3p0 for a bukkit plugin.
The MANIFEST.MF looks as follow and is placed at Pooling.jar/META-INF/MANIFEST.MF
Manifest-Version: 1.0
class-path: ./Pooling/lib/c3p0.jar ./Pooling/lib/mchange.jar
I've placed the 2 files at
plugins/Pooling/lib/
However, it keeps printing this error:
2013-09-13 16:35:19 [SEVERE] Error occurred while enabling Pooling
v1.0.0 (Is it up to date?) java.lang.NoClassDefFoundError:
com/mchange/v2/c3p0/ComboPooledDataSource at
com.frostforce.Pooling.Database.setup(Database.java:11) at
com.frostforce.Pooling.Main.onEnable(Main.java:16) at
org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217) at
org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457)
at
org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
at
org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugin(CraftServer.java:282)
at
org.bukkit.craftbukkit.v1_6_R2.CraftServer.enablePlugins(CraftServer.java:264)
at
net.minecraft.server.v1_6_R2.MinecraftServer.l(MinecraftServer.java:313)
at
net.minecraft.server.v1_6_R2.MinecraftServer.f(MinecraftServer.java:290)
at
net.minecraft.server.v1_6_R2.MinecraftServer.a(MinecraftServer.java:250)
at
net.minecraft.server.v1_6_R2.DedicatedServer.init(DedicatedServer.java:151)
at
net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:391)
at
net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)
Caused by: java.lang.ClassNotFoundException:
com.mchange.v2.c3p0.ComboPooledDataSource 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
org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader.java:80)
at
org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:53)
at java.lang.ClassLoader.loadClass(Unknown Source) at
java.lang.ClassLoader.loadClass(Unknown Source) ... 13 more
I have no idea at all what Iam doing wrong at the moment.
Thanks in advance!

Categories

Resources