Apache的詹姆斯得到:ClassNotFoundException的:com.mysql.jdbc.Driver [英] Apache James gives: ClassNotFoundException: com.mysql.jdbc.Driver
本文介绍了Apache的詹姆斯得到:ClassNotFoundException的:com.mysql.jdbc.Driver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经配置 Apache的詹姆斯的按了的维基:
thufir@dur:~/apache-james-3.0-beta4$
thufir@dur:~/apache-james-3.0-beta4$ tail bin/setenv.sh
# limitations under the License.
# ----------------------------------------------------------------------------
#
# Add every needed extra jar to this
CLASSPATH_PREFIX=../conf/lib/*
export CLASSPATH_PREFIX
CLASSPATH_PREFIX=../conf/lib/mysql-connector-java-5.1.21-bin.jar
thufir@dur:~/apache-james-3.0-beta4$
thufir@dur:~/apache-james-3.0-beta4$ ll conf/lib/
total 824
drwxr-xr-x 2 thufir thufir 4096 Aug 16 19:40 ./
drwxr-xr-x 4 thufir thufir 4096 Aug 16 18:56 ../
-rw-r--r-- 1 thufir thufir 827942 Jun 21 06:41 mysql-connector-java-5.1.21-bin.jar
-rw------- 1 thufir thufir 66 Mar 21 03:33 README.txt
thufir@dur:~/apache-james-3.0-beta4$
thufir@dur:~/apache-james-3.0-beta4$ cat conf/james-database.properties
# MySQL JDBC database properties
database.driverClassName=com.mysql.jdbc.Driver
database.url=jdbc:mysql://localhost/james
database.username=james
database.password=password
vendorAdapter.database=MYSQL
openjpa.streaming=false
thufir@dur:~/apache-james-3.0-beta4$
但我发现了:
jvm 1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
jvm 1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
jvm 1 | at java.lang.reflect.Method.invoke(Method.java:616)
jvm 1 | at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
jvm 1 | at java.lang.Thread.run(Thread.java:679)
jvm 1 | Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
jvm 1 | at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)
jvm 1 | at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
jvm 1 | at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
jvm 1 | at org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:137)
jvm 1 | at org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:112)
jvm 1 | at org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:239)
jvm 1 | ... 98 more
jvm 1 | Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
jvm 1 | at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
jvm 1 | at java.security.AccessController.doPrivileged(Native Method)
jvm 1 | at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
jvm 1 | at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
jvm 1 | at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
jvm 1 | at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
jvm 1 | at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1420)
jvm 1 | ... 103 more
jvm 1 |
jvm 1 | at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:309)
jvm 1 | at org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1652)
jvm 1 | at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:645)
jvm 1 | at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:204)
jvm 1 | ... 80 more
wrapper | <-- Wrapper Stopped
thufir@dur:~/apache-james-3.0-beta4$
thufir@dur:~/apache-james-3.0-beta4$
thufir@dur:~/apache-james-3.0-beta4$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu2)
OpenJDK Client VM (build 20.0-b12, mixed mode, sharing)
thufir@dur:~/apache-james-3.0-beta4$
借助全控制台输出太大,粘贴在这里。
我是什么做错了吗?该JDBC JAR是存在的,它是在脚本和MySQL配置。
What am I doing wrong? The JDBC JAR is there, it's in the script, and MySql is configured.
呵呵,我用的OpenJDK 6因为有一个问题JDK 7和詹姆斯,但我预计,只有当你正在使用的JDK,而不仅仅是JRE,因为我适用。
Oh, I'm using OpenJDK 6 because there's a problem with JDK 7 and James, although I expect that only applies if you're using the JDK and not just the JRE as I am.
我可以围绕看到这是不是第一次在这个问题上,也许。
I can see that this isn't the first time around on this question, perhaps.
推荐答案
From: Eric Charles <eric <at> apache.org>
Subject: Re: mysql driver
Newsgroups: gmane.comp.jakarta.james.user
Date: 2012-08-17 10:48:28 GMT (13 minutes ago)
The conf/lib/*.jar loading in beta4 is buggy.
Can you edit the conf/wrapper.conf and change
'wrapper.java.classpath...=../conf/lib' to
'wrapper.java.classpath...=../conf/lib/*' (add a /* after lib).
Thx, Eric
虽然我需要对其进行测试了一下。
although I need to test it out a bit.
这篇关于Apache的詹姆斯得到:ClassNotFoundException的:com.mysql.jdbc.Driver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文