Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Tomcat Can';t将JavaDB与ZK框架一起使用-错误:无法加载JDBC驱动程序类';org.apache.derby.jdbc.ClientDriver';_Tomcat_Derby_Zk_Javadb - Fatal编程技术网

Tomcat Can';t将JavaDB与ZK框架一起使用-错误:无法加载JDBC驱动程序类';org.apache.derby.jdbc.ClientDriver';

Tomcat Can';t将JavaDB与ZK框架一起使用-错误:无法加载JDBC驱动程序类';org.apache.derby.jdbc.ClientDriver';,tomcat,derby,zk,javadb,Tomcat,Derby,Zk,Javadb,我多次尝试在web应用程序和Derby之间建立连接,在eclipse控制台中收到以下错误消息: INFO: Server startup in 3772 ms ERROR: Cannot load JDBC driver class 'org.apache.derby.jdbc.ClientDriver' ERROR: Cannot load JDBC driver class 'org.apache.derby.jdbc.ClientDriver' 11/02/2011 19:08:53

我多次尝试在web应用程序和Derby之间建立连接,在eclipse控制台中收到以下错误消息:

INFO: Server startup in 3772 ms

ERROR: Cannot load JDBC driver class 'org.apache.derby.jdbc.ClientDriver'

ERROR: Cannot load JDBC driver class 'org.apache.derby.jdbc.ClientDriver'

11/02/2011 19:08:53 org.apache.catalina.core.StandardContext reload 


My class and database definition is showed bellow:

// Obtain our environment naming context            
javax.naming.Context initCtx = new InitialContext();

javax.naming.Context envCtx = (Context) initCtx.lookup("java:comp/env");


// Look up our data source by the name we gave it when we created it.
// In this case that's "jdbc/customer".
javax.sql.DataSource ds = (DataSource) envCtx.lookup("jdbc/customer");

conn = ds.getConnection();

And my web.xml and context are showed bellow.

in context.xml ...

Resource name="jdbc/customer" 
auth="Container"
type="javax.sql.DataSource"
username="qwert"
password="asdf"
driverClassName="org.apache.derby.jdbc.ClientDriver"
url="jdbc:derby://localhost:1527/C:\\testes_db\\customer;create=true;"
       maxActive="8"

and in the web.xml ...

res-ref-name jdbc/customer

res-type javax.sql.DataSource

res-auth Container


-- my second attempt 

resource-env-ref-name jdbc/customer

resource-env-ref-type javax.sql.DataSource
我正在windows中使用Tomcat6和EclipseWTP(europa)。我已经把derby.jar和derbclinet.jar放在WEB\u INF\lib目录中了

我可以做些什么来解决这个问题


谢谢

因为您正在context.xml中配置数据源,所以是Tomcat管理它,而不是您的webapp


您必须将JDBC驱动程序derbyclient.jar放在$TOMCAT_HOME/lib/目录中,而不是放在webapp/WEB-INF/lib/

中,因为您是在context.xml中配置数据源的,所以是TOMCAT管理它,而不是您的webapp

您必须将JDBC驱动程序derbyclient.jar放在$TOMCAT_HOME/lib/目录中,而不是webapp/WEB-INF/lib目录中/