Error- java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory

CODEDRAGON Development/JSP

반응형


 

 

 

에러메시지

 java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory

javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory]

 

 

 

해결방법

factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" 값을 factory="org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory"로 변경해 줍니다.

 

톰캣7.0 이하

factory=

"org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"

톰캣8.0 이상

factory=

"org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory"

 

 

Servers\Tomcat v7.0 Server at localhost-config\context.xml

<?xml version="1.0" encoding="UTF-8"?>

<!--

--><Context>

 

    <!-- Default set of monitored resources -->

    <WatchedResource>WEB-INF/web.xml</WatchedResource>

 

    <!-- Uncomment this to disable session

    -->

        <Resource

   name="jdbc/OracleDB"

   auth="Container"

   type="javax.sql.DataSource"

   username="codelab"

   password="oracle_11g"

   driverClassName="oracle.jdbc.driver.OracleDriver"

   factory=

"org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"

   url="jdbc:oracle:thin:@localhost:1521:ORCL"

   maxActive="500"

   maxIdle="100"/> 

   

</Context>

<?xml version="1.0" encoding="UTF-8"?>

<!--

--><Context>

 

    <!-- Default set of monitored resources -->

    <WatchedResource>WEB-INF/web.xml</WatchedResource>

 

    <!-- Uncomment this to disable session

    -->

        <Resource

   name="jdbc/OracleDB"

   auth="Container"

   type="javax.sql.DataSource"

   username="codelab"

   password="oracle_11g"

   driverClassName="oracle.jdbc.driver.OracleDriver"

   factory=

"org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory"

   url="jdbc:oracle:thin:@localhost:1521:ORCL"

   maxActive="500"

   maxIdle="100"/> 

   

</Context>