MySQL connection problem

A

ahd292

Hi everyone.
in my java application I want to connect to MySQL via jdbc connector
but I encountered with this error:

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 chatbot.ChatBot.<init>(ChatBot.java:19)
at chatbot.ChatFrame.jbInit(ChatFrame.java:27)
at chatbot.ChatFrame.<init>(ChatFrame.java:15)
at chatbot.ChatFrame.main(ChatFrame.java:23)

in my searches in google for that I find good forums and links such as
this:
http://forums.mysql.com/read.php?39,22579,22579#msg-22579

but their guides didn't help me. and now my situation:

IDE: NetBeans 6.1, alternatively I used Eclipse but I got same error.

Connector : mysql-connector-java-5.1.6-bin.jar
first I add this jar file to Project Library(within netbeans and also
eclipse) and get this problem.
secondly I switch to another version : ~3.1.14-bin but I got same
error.

JDK: 1.6.0_02
JRE: 1.6.0_02

I really confused with aspectjrt! I saw in that forum of MySQL that I
must to add both "mysql-connector-java-5.1.6-bin.jar" and
aspectjrt.jar into Classpath with -cp command or Environment Variable.
but none of them didn't work. maybe I didn't add them to classpath but
I don't know.

Does anyone tell me the step by step and clear guide to solve this
poblem?

here is part of my code.

public class ChatBot extends Chatter {
private Connection conn;
private String chname="";
private String driver = "com.mysql.jdbc.Driver",url =
"jdbc:mysql://localhost/chatdb";
private ResultSet rs;
private Sentence sentence;
private Stack stack;
private GrammarRule[] rules=new GrammarRule[254];
private boolean eof=false;
private Statement s;
public ChatBot(ChatFrame c) {
super(c);
try {
Class.forName(driver);
conn = DriverManager.getConnection(url, "root", "");
s = conn.createStatement();
}
catch (Exception ex) {}
sentence=new Sentence();
stack=new Stack();
// said=new DStack();
}
.....
 
A

Arne Vajhøj

ahd292 said:
in my java application I want to connect to MySQL via jdbc connector
but I encountered with this error:

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 chatbot.ChatBot.<init>(ChatBot.java:19)
at chatbot.ChatFrame.jbInit(ChatFrame.java:27)
at chatbot.ChatFrame.<init>(ChatFrame.java:15)
at chatbot.ChatFrame.main(ChatFrame.java:23)
Connector : mysql-connector-java-5.1.6-bin.jar
first I add this jar file to Project Library(within netbeans and also
eclipse) and get this problem.

You need to add aspectjrt.jar the same way.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top