2011-02-11 3 views
0

웹 응용 프로그램과 Derby 간의 연결을 여러 번 시도했는데 이러한 오류가 발생했습니다. 이클립스 콘솔의 메시지 :ZK 프레임 워크에서 Java DB를 사용할 수 없습니다 - ERROR : JDBC 드라이버 클래스 'org.apache.derby.jdbc.ClientDriver'를로드 할 수 없습니다.

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에서 이클립스 wtp (europa)와 함께 tomcat 6을 사용하고있다. 그리고 이미 derby.jar와 derbclinet.jar을 WEB_INF \ lib 디렉토리에 넣었습니다 ...

이 문제를 해결하기 위해 할 수있는 방법이 있습니까?

감사합니다.

답변

4

DataSource를 context.xml에 구성 했으므로 웹 응용 프로그램이 아니라 해당 데이터베이스를 관리하는 Tomcat입니다.

yourwebapp/WEB-INF/lib/

가 아닌 derbyclient.jar을 $ TOMCAT_HOME/lib/디렉토리에 두어야합니다.
관련 문제