JNDI 연결 시 문제

Web/JSP 2012. 5. 25. 15:14 Posted by Request

환경설정 :

톰캣 : 6.0

jdk : 1.6

oracle : 10g

-ojdbc5.jar

 

META-INF/context.xml Cannot create JDBC driver of class '' for connect URL 'null'

 

Connection Exception 발생..

책에 있는 내용 그대로~ 해봤지만 왜 안되나 구글링과 인맥을 통해서 얻은 결론은...

 

 

 

1)WEB-INF 에 Context.xml  생성

<Context>

<Resource name="jdbc/OracleDB"
    auth="Container"
    type="javax.sql.DataSource"
    username="scott"
    password="tiger"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    factory="org.apache.commons.dbcp.BasicDataSourceFactory"
    url="jdbc:oracle:thin:@127.0.0.1:1521:ORCL"
    removeAbandoned="true"
    removeAbandonedTimeout="60"
    logAbandoned="true"
    maxActive="500"
    maxIdle="100"/>

</Context>

2)WEB-INF 의 web.xml

<resource-ref>
<description>Connection</description>
<res-ref-name>jdbc/OracleDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

 

3)Servers의 톰캣 프로젝트에서 server.xml 설정

<GlobalNamingResources>

...

<Resouce  name="jdbc/OracleDB"
    auth="Container"
    type="javax.sql.DataSource"
    username="scott"
    password="tiger"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    factory="org.apache.commons.dbcp.BasicDataSourceFactory"
    url="jdbc:oracle:thin:@127.0.0.1:1521:ORCL"
    removeAbandoned="true"
    removeAbandonedTimeout="60"
    logAbandoned="true"
    maxActive="500"
    maxIdle="100"/>

</GlobalNamingResources>

 

 




4) $CATALINA_HOME\conf\context.xml

<Context>

...

<ResourceLink global="jdbc/OracleDB" name="jdbc/OracleDB" type="javax.sql.DataSource"/>

</Context>

5) $CATALINA_HOME\conf\web.xml

<web-app>

...

<resource-ref>

<description>DB Connection</description>

<res-ref-name>jdbc/OracleDB</res-ref-name>

<res-type>javax.sql.DataSource</res-type>

<res-auth>Container</res-auth>

</resource-ref>

</web-app>

=================================================

 

됐다가 다시 안된다... 간만에 하루치 삽질 중.....