4 Replies Latest reply on Dec 1, 2013 9:16 PM by Wind Wild

    Could not load JDBC driver class on Jboss as 7

    Wind Wild Newbie



      I have a problem, the problem is described as follows:

      There is a web application which datasource do not use JNDI.It Configure a datasource bean in the spring's configuration,the file of bean as follow:


        <bean id="dataSource"


                 <property name="driverClassName">



                          <property name="url">

                          <value>jdbc:mysql://;autoReconnect=true&amp;generateSimpleParameterMetadata=true </value>


                 <property name="username">



                <property name="password">





      In spite of this application don't use JNDI datasource,we also have to configure database-drivern on Jboss as 7

      As recommended, I created a module:

      • in D:\jboss-as-7.1.1.Final\modules\com\microsoft\mysql\main, I copied the mysql-connector-java-5.1.7-bin.jar file
      • in the same directory, I created the following module.txt file


      <module xmlns="urn:jboss:module:1.1" name="com.microsoft.mysql">


                        <property name="jboss.api" value="unsupported"/>



                      <resource-root path="mysql-connector-java-5.1.7-bin.jar"/>



                   <module name="javax.api"/>

                   <module name="javax.transaction.api"/>

                  <module name="javax.servlet.api" optional="true"/>



      • It has updated the D:\jboss-as-7.1.1.Final\standalone\configuration\standalone.xml file to include both the datasource and the driver


              <driver name="h2" module="com.h2database.h2">



               <driver name="mysql" module="com.microsoft.mysql">





      But when I deploy the web application on the Jboss and start jboss, I always get the following error :

      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) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]

        at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]

        ... 57 more


      Faced with this problem,I has find solutions online.

      The way solve this proplem on Tomcat is putting the  mysql-connector-java-5.1.7-bin.jar to the Tomcat's Installation directory path:apache-tomcat-7.0.27\lib.

      The way solve this proplem on the old version of Jboss is putting the  mysql-connector-java-5.1.7-bin.jar to the the old version of Jboss's Installation directory path:jboss-5.0.0.Beta1\lib

      But I don't find the same path in the Jboss as 7,and I try to put the mysql-connector-java-5.1.7-bin.jar to the path:




      but they all can not work.


      Finally,I summarize my question:

      1.I want to know why I had configured the datasource-drivern in the Jboss as 7 but it can not load the mysql-connector-java-5.1.7-bin.jar ?

      2.I want to know the sencond method about that where could I put the mysql-connector-java-5.1.7-bin.jar to the path of Jboss as 7's Installation directory path?


      I need your help,thanks!