Good time of day!
A small introduction: some time ago, I opened an old (working!) Project, compiled it, uploaded it on Red5 (I had just updated it to the next version).
When restarting, Red5 gave an error message - I can’t load the com.mysql.jdbc.Driver driver.
I found a solution, fixed the problem, after a couple of days I myself distributed advice (it helped me myself then).
I decided to redo the project a little, post the file classes, etc. Has commented on work from a DB. Now I’ve got to rework working with the database - and the guys aren’t working ...
Now the question is: why can java.lang.ClassNotFoundException: com.mysql.jdbc.Driver be thrown ? And how to get around this? Tips of the type to connect / specify the connector will not work - everything has already been done, see below.
I tried mysql-connector-java - *. Jar to shove in different folders (both in the root of the disk, in the project's WEB-INF directory, and in the folder with RED5) did not help. I tried instead of the connector to add a folder with this file to the Build Path (Add Class Folder in Eclipse which), I tried to add the connector along with the folder. I even tried to specify CLASSPATH
and the classpath
does not help (I use Eclipse - that is, CLASSPATH is not necessarily a bit like). I tried to leave only one CLASSPATH, and from the project to remove the mention - nothing helped ...
Looked - in the .classpath project all the necessary paths are indicated.
True, I read that sometimes it is enough to specify the parameter in the command line - classpath with the desired directory - it has not tried yet, because I did not understand where to specify these parameters for Red5. Can you tell me?
Moreover, if I create a separate JAVA project (not Red5) in the same way, it seems to work there with a database (though I started it with a debugger from IDE). Those. I do everything correctly ... I did not check the work with the database, but
Class.forName("com.mysql.jdbc.Driver");
and
connInfo.put("characterEncoding","UTF8"); connInfo.put("user", "root"); connInfo.put("password", "root"); cn = DriverManager.getConnection("jdbc:mysql://localhost/db", connInfo);
There are no exceptions.
Established:
mysql-connector-java - *. jar tried both 5.1.18 and 5.1.21.
Red5 - 1.0 RC2.
MySQL client version: 5.0.51a.
Server version: 5.5.21.
Eclipse Java EE IDE for Web Developers. Version: Indigo Service Release 1 Build id: 20110916-0149