Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JAVA and MySQL Connections

Status
Not open for further replies.

mfalomir

Technical User
Feb 6, 2003
78
MX
Im having problems connecting to MySQL, i already defined all my classpaths, and Im getting this error, which Im not really sure what it means:

Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at TestConnection.main(testconnection.java:17)

Thanks in advanced :)
 
It means either you dind't set you classpath properly or, which is more probable, the class Signature you have on yor classpath is not compatible with you testConnection class because of a bad compilation.

Cheers,

Dian
 
Hi, I just got it, I run

java -cp "C:\Program Files\java\jdk1.5.0\jre\lib\rt.jar;C:\Program Files\java\jdk1.5.0_02\jre\lib\mysql-
connector-java-3.1.8-bin.jar;." TestConnection

Thanks!
 
I just test the app locally and it ran well, but what if I want the app to run at my web server, if I place the app at my web server and try to access it in my PC i get the driver error again .. what do I have to do at my web server ?

Thanks!
 
Dunno what do you mean by "access it in my PC" but if you still get the first error, check that the jar file at the webserver that contains with Signature class is the same version as your local one.

Cheers,

Dian
 
Hi Dian, what i meant is to browse the app through my web browser. I just put the app at my web server, including the same jar files, but no success ... do I have to declare classpaths or install some other stuff to make it work ?

Thanks in advanced.
 
Well, dunno about your particular webserver but yes, you need to set the classpath on it.

Cheers,

Dian
 
This may seem a stupid question, but do I need to install JRE at my webserver ? :)
 
Sorry, Dian: NoClassDefFoundError means "no class definition found" :), not "incompatible". I found java-error-messages allways pretty accurate.
I know, you know, but we shouldn't confuse people with impromper speculations.

mfalomir:
java -cp "C:\Program Files\java\jdk1.5.0\jre\lib\rt.jar;..."

You never set the classpath to the commonly used jre-libs like rt.jar.
Code:
SET JAVA_HOME="C:\Program Files\java\jdk1.5.0"

3rd-party jars which are commonly used are placed at:
Code:
%JAVA_HOME%\jre\lib\ext"
to be found automatically.
which means: the mysql-jar, and the aspectj.jar(s).

seeking a job as java-programmer in Berlin:
 
Hi Stefan, and I a want to have all my apps at my webserver to be accesed by clients ? Do i need to do something else, the only problem that Im having regarding the Web Server is to handle DB COnnections, I have not figured it out how do I make a successful DB connection through my web server...

Here is what happened, i did a test connection class to connect to the MySQL DB at my web server, I ran it locally at my own PC with the java command, now that I want to move that app to my web server to test the connection through my web browser is where I get in trouble...

Any help will be appreciated :)

Thanks!
 
When you say "web server" do you mean a J2EE or servlet container like JBoss, Resin or Tomcat ? You will find it hard to run Java code for a webapp without it.
And yes, you will need a JRE on the "web server".

--------------------------------------------------
Free Database Connection Pooling Software
 
What I meant with incompatible is :

Imagine you hava a class that depends on an external jar. If you replace the version of the external jar with another one compiled in another way, you get a NoClassDefFoundError.

And I have to disagree: this error message and the AbstracMethodError are the most imprecise and inaccurate of the Java language.

Cheers,

Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top