I'm getting ClassNotFoundException on Class.forname("com.mysql.jdbc.Driver")
I'm using Windows Vista 64-bit, Eclipse Galileo, GWT framework. I downloaded mysql-connector-java-5.1.6-bin, but what is the exact path I should put this file in? I'm getting this exception while I'm in gwt-projects, but in normal projects it works good. Any idea how that should be done?
Finally its worked, the problem was not in the classpath, but from the .jar file itself, im using mysql-connector-java-5.1.6-bin which was not working, but when i tried mysql-connector-java-3.0.17-ga-bin everything works good, i hope to fix the new version soon
anyway thanks BalusC for helping :)
Just put the JAR file in the runtime classpath of the application in question.
In case of a Servlet based webapplication, you normally put it in /WEB-INF/lib folder. It's by default covered by the webapp's runtime classpath.
Disable Google App Engine. Its a setting in Eclipse.
Google App Engine doesn't allow you to open Sockets. When you try to load the JDBC driver, it makes a socket connection in a static block. An exception in the static block leads to a ClassNotFoundException, which is what you are seeing.
Related
So in the past days i've decompiled minecraft 1.12.2 using mcp to make an "own" client. I ran it from eclipse and all was working just fine. But once i exported it, added the needed JSON file and started it from the minecraft launcher, it resulted the following error:
Exception in thread "Client thread" java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.info(Ljava/lang/String;Ljava/lang/Object;)V
at net.minecraft.client.Minecraft.<init>(Minecraft.java:420)
at net.minecraft.client.main.Main.main(Main.java:115)
In my opinion that'a a bit strange, because when I ran it from eclipse that error did NOT occur.
I was thinking about adding the logger in the specific JSON file for the version but I do not know how to do it. I took the JSON file from a video where I expected my problem to be solved, made some changes, but it didn't. I also put the folder containing the logger-jar (org.apache....) in the client jar, but still no success.
Also i just decompiled 1.12.2 and recompiled it right away to see if i had messed up my code some how.
I hope someone can help.
This means at runtime you have a class that is different than what you had at compile time. You should try unzipping the jar and searching for the class file. It sounds like you need to potentially remove it and replace it with your own version.
Thanks to all who viewed an wanted to help!
Now I found an other way to use it. I wanted to export it to test
it on my server. But instead I used my account credentials to log in directly from eclipse.
:)
I'm tasked with integrating a collection of native libraries into a web application running in a Tomcat7 container.
I already found out that in order to be able to restart the application without restarting the whole server I must load the libs using the Tomcat "shared"-loader, outside the actual application.
For that I followed the accepted answer in this SO question: Shared JNI library (.so) in Tomcat - UnsatisfiedLinkError, but no luck so far.
As described I created a small "DLLBootstrapper" java class for loading the libs, compiled it and put it in "CATALINA_HOME/shared/lib" next to the libs I'm loading.
In the "catalina.properties" I set the path of the "shared.loader" to that folder.
However when I try to obtain the "DLLBootstrapper" in my application using Class.forName("msm.DLLBootstrapper"); I get a java.lang.ClassNotFoundException: msm.DLLBootstrapper.
What am I missing here?
Edit:
Sorry, forgot to mention java.library.path is set to the CATALINA_HOME/shared/lib folder.
I have been working on creating a simple Java desktop app using the RESTful API for Business Objects and have run into an issue. Whenever I run my app in Eclipse in works fine; whenever I export it as a 'Runnable Jar' and select the Library handling option 'Package required libraries into generated JAR' it works fine. However, whenever I try to export it using the Library handling option 'Extract required libraries into generated JAR' I get the following error after running the app:
java.lang.NoClassDefFoundError: Could not initialize class com.businessobjects.bcm.BCM
I have the 'bcm.jar' file added under a 'res' Source Folder and have it added to the Build Path. At one point I added all the JARs under the 'SAP BusinessObjects' java folder, and external folder, but it still throws the error. The problem stems from this line of code:
enterpriseSession = CrystalEnterprise.getSessionMgr().logon(userID, password, CMS, auth);
Would anyone know why I am getting said error? I really want to use the Extract option as it will improve performance as my app becomes larger. Any help resolving this issue would be greatly appreciated :)
EDIT: I would be happy to provide clarification or further detail upon request!
Seems this was introduced in SP04 and SAP has no intent of fixing it as the RESTful API wasn't designed to be used with Desktop apps.
Have you included the cryptojFIPS.jar? Leaving it out can cause the error.
I haven't worked with Java in about 10 years, so it's very probable I'm doing something elementary wrong here...
I am writing a "server-side extension" for SmartFoxServer (SFS). In my login script, I need to make a connection to MS SQL Server, which I am attempting to do using JDBC. I have tested the JDBC code in my debug environment, and it works fine.
BUT
When I put the server-side extension in the SFS "extensions" folder (as per spec), I'm getting a NoClassDefFoundError thrown - clearly SFS can't find the required JAR (sqljdbc4.jar). I have tried putting this JAR in my classpath; I tried including it in my Eclipse project - but for some reason, SFS adamantly refuses to accept the existence of this JAR.
What am I doing wrong?
I have no experience with the product you mention but many years of Java experience.
Have you tried putting the sqljdbc4.jar in the same location as your server-side extension (the extensions 'directory') ? You will likely have to restart SFS after this.
Whenever we run our Java client from within Eclipse to contact a server app using RMI, we get an exception:
java.io.StreamCorruptedException: invalid type code: 01
This only happens from within Eclipse, nowhere else (IntelliJ, command line, etc.).
Does anyone know what's going on?
You seem to have encountered this issue before ;) and it is seen with JBoss too.
It usually is a:
classpath problem (you need to include some j2ee libraries).
Or your stream is used by another method.
Or the context class loader is not appropriately set in eclipse:
example below:
The ClassLoader that is in the context when the viewer is running is the org.apache.catalina.loader.WebappClassLoader.
So if I do the following:
ClassLoader savedClassLoader = Thread.currentThread.getContextClassLoader();
if (savedClassLoader.getClass().getName().equalsIgnoreCase("org.apache.catalina.loader.WebappClassLoader")){
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
}
and then set the saved loader back in the IConnection.Close(), it works
Could it be incompatibility between server and client code? What JVM did you use to compile each one?