oracle.jdbc.driver.OracleDriver exception for Beginners Java - java

I searched a lot about this error but no solution works.
I'm just learning Java connection with Oracle.
But I'm getting this exception.
oracle.jdbc.driver.OracleDriver
I already placed ojdbc6.jar in C:\Program Files\Java\jre1.8.0_60\lib\ext now what to do next?
In few days ago I was working fine with database. But recently 2 days ago I reinstall windows not forgot how to setup it.
Here is Complete StackTrace.
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at RunQuery.main(RunQuery.java:11)

Please check this Setting multiple jars in java classpath link for adding third party jar (ojdbc6.jar) while running Java program.
and I suggest you to use latest driver jar which is compatible to JDK 8, You can check on this FAQ link http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#01_02

Related

java.lang.NoClassDefFoundError: oracle/dms/console/DMSConsole

My OS = CentOS-7
Oracle 18.4 XE
Java 8 JDK + Tomcat 8
I facing the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/dms/console/DMSConsole
at oracle.jdbc.driver.DMSFactory.<clinit>(DMSFactory.java:46)
at oracle.jdbc.driver.PhysicalConnection.createDMSSensors(PhysicalConnection.java:1713)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:849)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:443)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:712)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at Test.main(Test.java:9)
Caused by: java.lang.ClassNotFoundException: oracle.dms.console.DMSConsole
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 9 more
I searched a lot but was unable to find any forum where I can see aforementioned error related to oracle 18.4.0.
I searched my whole server even unzipped all ojdbc*.jar but not found DMSConsole anywhere
I removed all previous jdbc jar drivers and downloaded latest ojdbc8-full.tar.gz driver form this LINK but nothing fixed the problem
Best Regards
What are you trying to do? If you are planning to use dms jar then you should use
ojdbc8dms.jar. Check out the question "What are the different JAR files on the 19.3 JDBC driver download page for?" in JDBC FAQ
You can get these jars from maven. Check out the blog for details. You can also download these from ojdbc8-debug.tar.gz from OTN. Make sure to have dms.jar in the classpath.
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8dms</artifactId>
<version>19.6.0.0</version>
This can be solved by adding a correct dms.jar but when not detailled log is needed the following jars are the minimum to include
ojdbc8.jar
orai18n.jar

Classpath issue with Intellij Idea 2016.1.1 and Gradle

After a recent upgrade in Idea I now get a ClassNotFoundException in code that just a day ago was working perfectly.
If i run gradle in the command line it works perfectly, but if I run in Idea it fails with the ClassNotFoundException.
I've googled the problem and it seems that others have similar issues, but the solutions proposed for them don't seem to work for me.
I get that it's probably a classpath and/or gradle issue with the latest version of Idea, but I cannot see exactly what the issue would be since I've only recently moved over to both Idea and Gradle from Eclipse and Maven. My general Java experience is very good.
The full stack trace is as follows:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoClassDefFoundError: com/badlogic/gdx/physics/box2d/Shape
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:130)
Caused by: java.lang.NoClassDefFoundError: com/badlogic/gdx/physics/box2d/Shape
at uk.co.redfruit.gdx.skyisfalling.listeners.PlayButtonListener.changed(PlayButtonListener.java:18)
at com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.handle(ChangeListener.java:28)
at com.badlogic.gdx.scenes.scene2d.Actor.notify(Actor.java:181)
at com.badlogic.gdx.scenes.scene2d.Actor.fire(Actor.java:146)
at com.badlogic.gdx.scenes.scene2d.ui.Button.setChecked(Button.java:123)
at com.badlogic.gdx.scenes.scene2d.ui.Button$1.clicked(Button.java:91)
at com.badlogic.gdx.scenes.scene2d.utils.ClickListener.touchUp(ClickListener.java:89)
at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java:58)
at com.badlogic.gdx.scenes.scene2d.Stage.touchUp(Stage.java:354)
at com.badlogic.gdx.backends.lwjgl.LwjglInput.processEvents(LwjglInput.java:316)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:210)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:123)
Caused by: java.lang.ClassNotFoundException: com.badlogic.gdx.physics.box2d.Shape
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 12 more

Running jzy3d demos result in ClassNotFoundException

The problem is as follows, during startup of the jzy3d demo ScatterDemo.java :
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLProfile
at org.jzy3d.chart.Settings.<init>(Settings.java:19)
at org.jzy3d.chart.Settings.getInstance(Settings.java:48)
at org.jzy3d.analysis.AnalysisLauncher.open(AnalysisLauncher.java:18)
at org.jzy3d.analysis.AnalysisLauncher.open(AnalysisLauncher.java:13)
at org.jzy3d.demos.scatter.ScatterDemo.main(ScatterDemo.java:16)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLProfile
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 5 more
Java Result: 1
Configuration is NetBeans 7.3.1, jzy3d-api-0.9.1, jzy3d-swt-0.9.1, log4j-1.2.17, gluegen-rt (latest stable), jogl-all (latest stable), JDK1.7
I am aware of the following change (Moving all of javax.media.opengl to com.jogamp.opengl, https://jogamp.org/bugzilla/show_bug.cgi?id=682). I have gone through the usual process of including .jar files into the project.
Project compiles fine, does not run.
My question(s) are: Can I somehow redirect javax.media.opengl.* to com.jogamp.opengl.* ? What is the correct way to resolve this problem?
As you can see here, even the code on the master branch (0.9.2) isn't based on the latest version of JOGL. Please ask Martin Pernollet to make the necessary changes (replace javax.media.* by com.jogamp.*) or do it yourself. You can rebuild Jzy3d to test it with the modifications of the import clauses. This is the correct way of solving this simple problem.

Java communication with JavaDB classNotFoundException

I'm trying to make a Java program that can communicate with JavaDB. I've made the Database class, started a server and made a tiny client program to check if they would communicate.
The program crashes when i try to run it, giving a class not found exception at the line where i try to set the database driver. I googled it and found that this error appears if derbyclient.jar and derby.jar are not found in the classpath. I also read that the scripts setNetworkClientCP and setNetworkServerCP found in the db directory would set these in the classpath. I found the scripts, ran them, and checked to make sure the classpath got updated, but i still get the same error. Does anyone know what the problem might be?
EDIT: SOLVED - i just realized that i need to include the derbyclient.jar in the NetBeans project library.
I'm using NetBeans and the built in JavaDB. I set the classpath by using the scripts that i mentioned above, and upon checking the classpath i found these entries:
%DERBY_INSTALL%\lib\derbyclient.jar;
%DERBY_INSTALL%\lib\derby.jar;
%DERBY_INSTALL%\lib\derbytools.jar;
%DERBY_INSTALL%\lib\derbynet.jar;
The Error:
java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:260)
at Database.<init>(Database.java:14)
at TestKlient.main(TestKlient.java:8)

Exception in thread "main" java.lang.NoClassDefFoundError in Java3D

I'm trying to develop a java3d application, i try everything, i just download the jogamp-platform because how i could read in many websites the java3d is obsolete and for mac os x you need this, i put them all in /System/Frameworks/Java/Extensions where are my .jar files in order to not add to the classpath in Eclipse but it still getting the same error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/AbstractGraphicsDevice
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at javax.media.j3d.Pipeline$1.run(Pipeline.java:143)
at java.security.AccessController.doPrivileged(Native Method)
at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:138)
at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:926)
at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:280)
at javax.media.j3d.Canvas3D.<clinit>(Canvas3D.java:3862)
at Apartado_a.<init>(Apartado_a.java:17)
at Apartado_a.main(Apartado_a.java:67)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.AbstractGraphicsDevice
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 sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 10 more
These are the files inside extensions folder:
j3daudio.jar
j3dcore.jar
j3dutils.jar
joal-natives-macosx-universal.jar
jogl-all.jar
gluegen-rt.jar
gluegen-rt-natives-macosx-universal.jar
Regards!
Mac OS X comes pre-installed with Java 3D version 1.3. You can find these files in /System/Library/Java/Extensions. If you need to install Java 3D version 1.5 (and it sounds like you do), then you can use this installer: http://create.ife.no/vr/tools/j3d/java3d_1_5_2-macosx.pkg.zip
Don't use the /System/Frameworks/Java/Extensions folder for this.
Instead, include the relevant libraries in the lib/ folder of your application. Also, check which version of the JDK you are using. I believe there are some issues with Java3D running on the newer Apple-provided JVMs versus the older Oracle/Sun provided ones.

Categories

Resources