0

Can't use Java DB with ZK framework - ERROR: Cannot load JDBC driver class 'org.apache.derby.jdbc.Cl

asked 2011-02-11 15:33:49 +0800

Bera gravatar image Bera
121 1 3

I tried many times to get the connection between my web application and Derby and I received these error messages in the eclipse console:

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 ...

and in the web.xml ...

DB Connection jdbc/customer javax.sql.DataSource Container

jdbc/customer javax.sql.DataSource

I'm using tomcat 6 with eclipse wtp (europa) in windows. And I already put derby.jar and derbclinet.jar inside of WEB_INF\lib directory ...

There are something that I can do to solve this issue?

Thanks!

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2011-02-11 15:42:16 +0800

Bera gravatar image Bera
121 1 3

more information of web.xml and context.xml

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

Thanks again!

link publish delete flag offensive edit

answered 2011-02-11 20:54:54 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

this is 100% a classpath issue...where'd you put the Derby jar file?

link publish delete flag offensive edit

answered 2011-02-12 08:25:37 +0800

Bera gravatar image Bera
121 1 3

Hi clark

You are right. In my classpath I just put the directory path instead put the complete path WITH jar. I'll try to fix my classpath. Thx!

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-02-11 15:33:49 +0800

Seen: 426 times

Last updated: Feb 12 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More