stackoverflow에서 여러 가지 유사한 질문을 본 적이 있지만 문제가 해결되지 않았습니다. This one은 공식 tomcat documentation 및 특별히 this section을 가리키므로 특히 유용합니다.tomcat7 : JDBC 드라이버 클래스 [com.mysql.jdbc.Driver]를로드 할 수 없습니다.
제공되는 솔루션은 간단합니다 : 에서 찾을 수 없기 때문에 tomcat은 $CATALINA_HOME/lib
으로 복사 할 jdbc 데이터베이스 드라이버가 필요합니다. 좋아,하지만 여전히 나에게는 효과가 없으며 나는 화를 내고있다.
추가 아이디어를 제공해 줄 수 있는지 알아 보겠습니다.
환경은 입니다. Windows XP, Tomcat7, Eclipse Indigo, Java6 및 Spring3입니다.
mysql-connector
이 ($CATALINA_HOME/lib
C:\>dir "c:\Program Files\Apache-Tomcat-7.0.12\lib"\mysql*
[...]
/2012 13:39 877.094 mysql-connector-java-5.1.21.jar
[...]
C:\>
당신은 아마 이클립스의 톰캣 통합은 배포 (CATALINA_BASE
)에 대한 WTP-특정 디렉토리를 생성 알고 복사, 그래서도 MySQL의 커넥터를 복사 된 나는 실패했습니다 지금까지 내가 Tomcat의 캘리포니아를 이해
C:\>dir c:\Share\genesis\wsEclipse-indigo\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\lib
[...]
29/08/2012 13:39 877.094 mysql-connector-java-5.1.21.jar
[...]
C:\>
을 : CATALINA_BASE
와 둘 다)에, CATALINA_HOME
에서 mysql-conector.jar
으로 시도 talina.properties 파일은 둘 다 classpath에 추가되었으므로 어떤 차이도 기대하지는 않았지만, 경우에 따라 시도했습니다.
내 스프링 소스의 정의는 매우 간단합니다 :
<bean id="securityDataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/venus" />
<property name="username" value="root" />
<property name="password" value="" />
</bean>
그러나 나는 다시 시작할 때 바람둥이 내가받을 다음과 같은 오류 :
ERROR: org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityDataSource' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4701)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver]
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393)
... 21 more
30-ago-2012 8:38:11 org.apache.catalina.core.StandardContext listenerStart
GRAVE: Excepción enviando evento inicializado de contexto a instancia de escuchador de clase org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityDataSource' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4701)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver]
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393)
... 21 more
이 하나 더 힌트 : 사용 시스 인 터널 프로세스 탐색기가 나는 것을 볼 수 mysql-connector-java.jar
톰캣에 의해 개방되고 있습니다 :
"C:\Program Files\Java\jre6\bin\javaw.exe" -Dcatalina.base=C:\Share\genesis\wsEclipse-indigo\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 "-Dcatalina.home=C:\Program Files\Apache-Tomcat-7.0.12" -Dwtp.deploy=C:\Share\genesis\wsEclipse-indigo\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps "-Djava.endorsed.dirs=C:\Program Files\Apache-Tomcat-7.0.12\endorsed" -Dfile.encoding=Cp1252 -classpath "C:\Program Files\Apache-Tomcat-7.0.12\bin\bootstrap.jar;C:\Program Files\Apache-Tomcat-7.0.12\bin\tomcat-juli.jar" org.apache.catalina.startup.Bootstrap start
더 이상의 아이디어?
EDIT1 : 나는 오라클을 사용하는 시도하고 그것을 작동합니다!
C:\>dir "c:\Program Files\Apache-Tomcat-7.0.12\lib"\oci*
[...]
02/10/2006 22:36 1.545.954 ocijdbc10.jar
[...]
C:\>
데이터 소스 : 내가 MySQL을 잘못하고있는 중이 야 무엇
<bean id="securityDataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:oci:@BARVDB002D:1545:TFSDB0" />
<property name="username" value="me" />
<property name="password" value="qwerty" />
</bean>
?
:-(자신을 위해
Downvote 아래의 답변을 참조하십시오 –
이 아이디어는 문제를 찾을 수있는 핵심이었다 간단한 자바 applicatoin 내에서 loding에게 동일한 드라이버를 시도 –