Jahia in English > Cannot connect to...

0 (0 Good)
0 (0 Bad)

Cannot connect to MySql with JPA in a Jahia module

by  rujan »  2015/11/13 11:04

Hi,

I have an OSGI Jahia module, on Digital Factory 7.1, that needs to connect to a MySql database.
But I never succeed to start the module because I have the following error on the DF startup :

13-Nov-2015 11:22:26.408 SEVERE [localhost-startStop-1] org.apache.tomcat.jdbc.pool.ConnectionPool.init Unable to create initial connections of pool.
 java.sql.SQLException: Unable to load class: com.mysql.jdbc.Driver from ClassLoader:java.net.URLClassLoader@681a9515;ClassLoader:WebappClassLoader
  context: ROOT
  delegate: true
----------> Parent Classloader:
java.net.URLClassLoader@681a9515

    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:280)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:200)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:699)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:633)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:484)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:142)
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:115)
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:102)
    at org.apache.tomcat.jdbc.pool.DataSourceFactory.createDataSource(DataSourceFactory.java:553)
    at org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance(DataSourceFactory.java:241)
    at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:94)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:841)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:829)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:166)
    at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1084)
    at org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:663)
    at org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:256)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5066)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1101)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1786)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: Unable to load class: com.mysql.jdbc.Driver from ClassLoader:java.net.URLClassLoader@681a9515;ClassLoader:WebappClassLoader
  context: ROOT
  delegate: true
----------> Parent Classloader:
java.net.URLClassLoader@681a9515

    at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:56)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:268)
    ... 32 more
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:38)
    ... 33 more

13-Nov-2015 11:22:26.424 WARNING [localhost-startStop-1] org.apache.naming.NamingContext.lookup Une erreur s est produite durant la résolution de la référence
 java.sql.SQLException: Unable to load class: com.mysql.jdbc.Driver from ClassLoader:java.net.URLClassLoader@681a9515;ClassLoader:WebappClassLoader
  context: ROOT
  delegate: true
----------> Parent Classloader:
java.net.URLClassLoader@681a9515

    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:280)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:200)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:699)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:633)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:484)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:142)
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:115)
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:102)
    at org.apache.tomcat.jdbc.pool.DataSourceFactory.createDataSource(DataSourceFactory.java:553)
    at org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance(DataSourceFactory.java:241)
    at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:94)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:841)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:829)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:166)
    at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1084)
    at org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:663)
    at org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:256)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5066)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1101)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1786)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: Unable to load class: com.mysql.jdbc.Driver from ClassLoader:java.net.URLClassLoader@681a9515;ClassLoader:WebappClassLoader
  context: ROOT
  delegate: true
----------> Parent Classloader:
java.net.URLClassLoader@681a9515

    at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:56)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:268)
    ... 32 more
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:38)
    ... 33 more

13-Nov-2015 11:22:26.486 WARNING [localhost-startStop-1] org.apache.catalina.core.NamingContextListener.addResource Failed to register in JMX: javax.naming.NamingException: Unable to load class: com.mysql.jdbc.Driver from ClassLoader:java.net.URLClassLoader@681a9515;ClassLoader:WebappClassLoader
  context: ROOT
  delegate: true
----------> Parent Classloader:
java.net.URLClassLoader@681a9515

Here are the files from my module. For information, I use Spring Data JPA to access the database.

pom.xml :

<?xml version="1.0" encoding="UTF-8"?>
<project
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.jahia.modules</groupId>
        <artifactId>myModule</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <artifactId>legacy-database-admin</artifactId>
    <packaging>bundle</packaging>
    <name>legacy-database-admin</name>
    <description>This is the custom module (legacy-database-admin) for running on a Digital Factory server.</description>
    <scm>
        <connection>scm:dummy:uri</connection>
        <developerConnection>scm:dummy:uri</developerConnection>
    </scm>
    <properties>
        <jahia-depends>default,siteSettings</jahia-depends>
    </properties>
    <repositories>
        <repository>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <id>jahia-public</id>
            <name>Jahia Public Repository</name>
            <url>https://devtools.jahia.com/nexus/content/groups/public</url>
        </repository>
    </repositories>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Import-Package>${jahia.plugin.projectPackageImport},javassist.util.proxy,org.springframework.context,org.springframework.beans,*</Import-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
            <version>1.6.5.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.35</version>
        </dependency>

        <dependency>
            <groupId>org.javassist</groupId>
            <artifactId>javassist</artifactId>
            <version>3.18.1-GA</version>
        </dependency>

    </dependencies>
</project>

spring context file :

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
                        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
                         http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
                        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">

    <context:component-scan base-package="fr.ca.cf.optimweb.database.action" />

    <bean id="legacyDataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost:3306/legacy_content" />
        <property name="username" value="root" />
        <property name="password" value="root" />
    </bean>

    <!-- Configure the entity manager factory bean -->
    <bean id="entityManagerFactory"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="legacyDataSource" />
        <property name="persistenceUnitName" value="legacyContent" />
        <property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" />
        <property name="jpaDialect">
            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
        </property>
        <property name="jpaPropertyMap">
            <map>
                <entry key="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
                <entry key="hibernate.hbm2ddl.auto" value="" />
                <entry key="hibernate.show_sql" value="false" />
            </map>
        </property>
    </bean>

    <!-- Configure the transaction manager bean -->
    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>

    <!-- Enable annotation driven transaction management -->
    <tx:annotation-driven />

    <!-- Configure Spring Data JPA and set the base package of the repository
        interfaces -->
    <jpa:repositories base-package="fr.ca.cf.optimweb.database.repository" />

</beans>

persistence file :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence version="2.0"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
                                 http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/persistence">

    <persistence-unit name="legacyContent"
        transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <non-jta-data-source>java:comp/env/jdbc/legacyContent</non-jta-data-source>
        <class>fr.myModule.database.entity.Tarif</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
    </persistence-unit>

</persistence>

I tried to add the Driver class in import or export module classes, but that doesn't change anything.

Thanks in advance for your help.

Best Regards,

Rudy

  • Cannot connect to MySql with JPA in a Jahia module
    2015/11/13 11:04

    rujan <p>Hi,</p> <p>I have an OSGI Jahia module, on Digital Factory 7.1, that needs to connect to a MySql database.<br /> But I never succeed to start the module because I have the following error on the DF startup :</p> <blockquote> <p>13-Nov-2015 11:22:26.408 SEVERE [localhost-startStop-1] org.apache.tomcat.jdbc.pool.ConnectionPool.init Unable to create initial connections of pool.<br /> &nbsp;java.sql.SQLException: Unable to load class: com.mysql.jdbc.Driver from ClassLoader:java.net.URLClassLoader@681a9515;ClassLoader:WebappClassLoader<br /> &nbsp; context: ROOT<br /> &nbsp; delegate: true<br /> ----------&gt; Parent Classloader:<br /> java.net.URLClassLoader@681a9515</p> <p>&nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:280)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:200)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:699)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:633)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:484)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.ConnectionPool.&lt;init&gt;(ConnectionPool.java:142)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:115)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:102)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.DataSourceFactory.createDataSource(DataSourceFactory.java:553)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance(DataSourceFactory.java:241)<br /> &nbsp;&nbsp; &nbsp;at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:94)<br /> &nbsp;&nbsp; &nbsp;at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)<br /> &nbsp;&nbsp; &nbsp;at org.apache.naming.NamingContext.lookup(NamingContext.java:841)<br /> &nbsp;&nbsp; &nbsp;at org.apache.naming.NamingContext.lookup(NamingContext.java:152)<br /> &nbsp;&nbsp; &nbsp;at org.apache.naming.NamingContext.lookup(NamingContext.java:829)<br /> &nbsp;&nbsp; &nbsp;at org.apache.naming.NamingContext.lookup(NamingContext.java:166)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1084)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:663)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:256)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5066)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1101)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1786)<br /> &nbsp;&nbsp; &nbsp;at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)<br /> &nbsp;&nbsp; &nbsp;at java.util.concurrent.FutureTask.run(FutureTask.java:266)<br /> &nbsp;&nbsp; &nbsp;at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)<br /> &nbsp;&nbsp; &nbsp;at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)<br /> &nbsp;&nbsp; &nbsp;at java.lang.Thread.run(Thread.java:745)<br /> Caused by: java.lang.ClassNotFoundException: Unable to load class: com.mysql.jdbc.Driver from ClassLoader:java.net.URLClassLoader@681a9515;ClassLoader:WebappClassLoader<br /> &nbsp; context: ROOT<br /> &nbsp; delegate: true<br /> ----------&gt; Parent Classloader:<br /> java.net.URLClassLoader@681a9515</p> <p>&nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:56)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:268)<br /> &nbsp;&nbsp; &nbsp;... 32 more<br /> Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)<br /> &nbsp;&nbsp; &nbsp;at java.lang.Class.forName0(Native Method)<br /> &nbsp;&nbsp; &nbsp;at java.lang.Class.forName(Class.java:348)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:38)<br /> &nbsp;&nbsp; &nbsp;... 33 more</p> <p>13-Nov-2015 11:22:26.424 WARNING [localhost-startStop-1] org.apache.naming.NamingContext.lookup Une erreur s est produite durant la r&eacute;solution de la r&eacute;f&eacute;rence<br /> &nbsp;java.sql.SQLException: Unable to load class: com.mysql.jdbc.Driver from ClassLoader:java.net.URLClassLoader@681a9515;ClassLoader:WebappClassLoader<br /> &nbsp; context: ROOT<br /> &nbsp; delegate: true<br /> ----------&gt; Parent Classloader:<br /> java.net.URLClassLoader@681a9515</p> <p>&nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:280)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:200)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:699)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:633)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:484)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.ConnectionPool.&lt;init&gt;(ConnectionPool.java:142)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:115)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:102)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.DataSourceFactory.createDataSource(DataSourceFactory.java:553)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance(DataSourceFactory.java:241)<br /> &nbsp;&nbsp; &nbsp;at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:94)<br /> &nbsp;&nbsp; &nbsp;at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)<br /> &nbsp;&nbsp; &nbsp;at org.apache.naming.NamingContext.lookup(NamingContext.java:841)<br /> &nbsp;&nbsp; &nbsp;at org.apache.naming.NamingContext.lookup(NamingContext.java:152)<br /> &nbsp;&nbsp; &nbsp;at org.apache.naming.NamingContext.lookup(NamingContext.java:829)<br /> &nbsp;&nbsp; &nbsp;at org.apache.naming.NamingContext.lookup(NamingContext.java:166)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1084)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:663)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:256)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5066)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1101)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1786)<br /> &nbsp;&nbsp; &nbsp;at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)<br /> &nbsp;&nbsp; &nbsp;at java.util.concurrent.FutureTask.run(FutureTask.java:266)<br /> &nbsp;&nbsp; &nbsp;at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)<br /> &nbsp;&nbsp; &nbsp;at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)<br /> &nbsp;&nbsp; &nbsp;at java.lang.Thread.run(Thread.java:745)<br /> Caused by: java.lang.ClassNotFoundException: Unable to load class: com.mysql.jdbc.Driver from ClassLoader:java.net.URLClassLoader@681a9515;ClassLoader:WebappClassLoader<br /> &nbsp; context: ROOT<br /> &nbsp; delegate: true<br /> ----------&gt; Parent Classloader:<br /> java.net.URLClassLoader@681a9515</p> <p>&nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:56)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:268)<br /> &nbsp;&nbsp; &nbsp;... 32 more<br /> Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)<br /> &nbsp;&nbsp; &nbsp;at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)<br /> &nbsp;&nbsp; &nbsp;at java.lang.Class.forName0(Native Method)<br /> &nbsp;&nbsp; &nbsp;at java.lang.Class.forName(Class.java:348)<br /> &nbsp;&nbsp; &nbsp;at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:38)<br /> &nbsp;&nbsp; &nbsp;... 33 more</p> <p>13-Nov-2015 11:22:26.486 WARNING [localhost-startStop-1] org.apache.catalina.core.NamingContextListener.addResource Failed to register in JMX: javax.naming.NamingException: Unable to load class: com.mysql.jdbc.Driver from ClassLoader:java.net.URLClassLoader@681a9515;ClassLoader:WebappClassLoader<br /> &nbsp; context: ROOT<br /> &nbsp; delegate: true<br /> ----------&gt; Parent Classloader:<br /> java.net.URLClassLoader@681a9515</p> </blockquote> <p>Here are the files from my module. For information, I use Spring Data JPA to access the database.</p> <p>pom.xml :</p> <blockquote> <p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br /> &lt;project<br /> &nbsp;&nbsp; &nbsp;xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;<br /> &nbsp;&nbsp; &nbsp;xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;parent&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;groupId&gt;org.jahia.modules&lt;/groupId&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;artifactId&gt;myModule&lt;/artifactId&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;/parent&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;artifactId&gt;legacy-database-admin&lt;/artifactId&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;packaging&gt;bundle&lt;/packaging&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;name&gt;legacy-database-admin&lt;/name&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;description&gt;This is the custom module (legacy-database-admin) for running on a Digital Factory server.&lt;/description&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;scm&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;connection&gt;scm:dummy:uri&lt;/connection&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;developerConnection&gt;scm:dummy:uri&lt;/developerConnection&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;/scm&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;properties&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;jahia-depends&gt;default,siteSettings&lt;/jahia-depends&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;/properties&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;repositories&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;repository&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;releases&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;enabled&gt;true&lt;/enabled&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;updatePolicy&gt;never&lt;/updatePolicy&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/releases&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;snapshots&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;enabled&gt;true&lt;/enabled&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/snapshots&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;id&gt;jahia-public&lt;/id&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;name&gt;Jahia Public Repository&lt;/name&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;url&gt;https://devtools.jahia.com/nexus/content/groups/public&lt;/url&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/repository&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;/repositories&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;build&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;plugins&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;plugin&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;groupId&gt;org.apache.felix&lt;/groupId&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;extensions&gt;true&lt;/extensions&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;configuration&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;instructions&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;Import-Package&gt;${jahia.plugin.projectPackageImport},javassist.util.proxy,org.springframework.context,org.springframework.beans,*&lt;/Import-Package&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/instructions&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/configuration&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/plugin&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/plugins&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;/build&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;dependencies&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;dependency&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;groupId&gt;org.springframework.data&lt;/groupId&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;artifactId&gt;spring-data-jpa&lt;/artifactId&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;exclusions&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;exclusion&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;groupId&gt;org.springframework&lt;/groupId&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;artifactId&gt;*&lt;/artifactId&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/exclusion&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;exclusion&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;groupId&gt;org.slf4j&lt;/groupId&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;artifactId&gt;*&lt;/artifactId&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/exclusion&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/exclusions&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;version&gt;1.6.5.RELEASE&lt;/version&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/dependency&gt;</p> <p>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;dependency&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;groupId&gt;mysql&lt;/groupId&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;version&gt;5.1.35&lt;/version&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/dependency&gt;</p> <p>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;dependency&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;groupId&gt;org.javassist&lt;/groupId&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;artifactId&gt;javassist&lt;/artifactId&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;version&gt;3.18.1-GA&lt;/version&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/dependency&gt;</p> <p>&nbsp;&nbsp; &nbsp;&lt;/dependencies&gt;<br /> &lt;/project&gt;</p> </blockquote> <p>spring context file :</p> <blockquote> <p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br /> &lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;<br /> &nbsp;&nbsp; &nbsp;xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:context=&quot;http://www.springframework.org/schema/context&quot;<br /> &nbsp;&nbsp; &nbsp;xmlns:jpa=&quot;http://www.springframework.org/schema/data/jpa&quot; xmlns:tx=&quot;http://www.springframework.org/schema/tx&quot;<br /> &nbsp;&nbsp; &nbsp;xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd<br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd&quot;&gt;</p> <p>&nbsp;&nbsp; &nbsp;&lt;context:component-scan base-package=&quot;fr.ca.cf.optimweb.database.action&quot; /&gt;</p> <p>&nbsp;&nbsp; &nbsp;&lt;bean id=&quot;legacyDataSource&quot;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;class=&quot;org.springframework.jdbc.datasource.DriverManagerDataSource&quot;&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;property name=&quot;driverClassName&quot; value=&quot;com.mysql.jdbc.Driver&quot; /&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;property name=&quot;url&quot; value=&quot;jdbc:mysql://localhost:3306/legacy_content&quot; /&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;property name=&quot;username&quot; value=&quot;root&quot; /&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;property name=&quot;password&quot; value=&quot;root&quot; /&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;/bean&gt;</p> <p>&nbsp;&nbsp; &nbsp;&lt;!-- Configure the entity manager factory bean --&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;bean id=&quot;entityManagerFactory&quot;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;class=&quot;org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean&quot;&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;property name=&quot;dataSource&quot; ref=&quot;legacyDataSource&quot; /&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;property name=&quot;persistenceUnitName&quot; value=&quot;legacyContent&quot; /&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;property name=&quot;persistenceXmlLocation&quot; value=&quot;classpath:META-INF/persistence.xml&quot; /&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;property name=&quot;jpaDialect&quot;&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;bean class=&quot;org.springframework.orm.jpa.vendor.HibernateJpaDialect&quot; /&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/property&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;property name=&quot;jpaPropertyMap&quot;&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;map&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;entry key=&quot;hibernate.dialect&quot; value=&quot;org.hibernate.dialect.MySQL5Dialect&quot; /&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;entry key=&quot;hibernate.hbm2ddl.auto&quot; value=&quot;&quot; /&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;entry key=&quot;hibernate.show_sql&quot; value=&quot;false&quot; /&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/map&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/property&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;/bean&gt;</p> <p>&nbsp;&nbsp; &nbsp;&lt;!-- Configure the transaction manager bean --&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;bean id=&quot;transactionManager&quot; class=&quot;org.springframework.orm.jpa.JpaTransactionManager&quot;&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;property name=&quot;entityManagerFactory&quot; ref=&quot;entityManagerFactory&quot; /&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;/bean&gt;</p> <p>&nbsp;&nbsp; &nbsp;&lt;!-- Enable annotation driven transaction management --&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;tx:annotation-driven /&gt;</p> <p>&nbsp;&nbsp; &nbsp;&lt;!-- Configure Spring Data JPA and set the base package of the repository<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;interfaces --&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;jpa:repositories base-package=&quot;fr.ca.cf.optimweb.database.repository&quot; /&gt;</p> <p>&lt;/beans&gt;</p> </blockquote> <p>persistence file :</p> <blockquote> <p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;<br /> &lt;persistence version=&quot;2.0&quot;<br /> &nbsp;&nbsp; &nbsp;xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/persistence<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd&quot;<br /> &nbsp;&nbsp; &nbsp;xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns=&quot;http://java.sun.com/xml/ns/persistence&quot;&gt;</p> <p>&nbsp;&nbsp; &nbsp;&lt;persistence-unit name=&quot;legacyContent&quot;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;transaction-type=&quot;RESOURCE_LOCAL&quot;&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;non-jta-data-source&gt;java:comp/env/jdbc/legacyContent&lt;/non-jta-data-source&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;class&gt;fr.myModule.database.entity.Tarif&lt;/class&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;exclude-unlisted-classes&gt;true&lt;/exclude-unlisted-classes&gt;<br /> &nbsp;&nbsp; &nbsp;&lt;/persistence-unit&gt;</p> <p>&lt;/persistence&gt;</p> </blockquote> <p>I tried to add the Driver class in import or export module classes, but that doesn&#39;t change anything.</p> <p>Thanks in advance for your help.</p> <p>Best Regards,</p> <p>Rudy</p>

  • Number of messages  3
    Registration date Nov 13, 2015
    0 (0 Good)
    0 (0 Bad)

    Re: Cannot connect to MySql with JPA in a Jahia module

    by  JM »  2016/08/02 14:18

    Hi,

     

    Did you finally find the pb ? I have exactly the same error, but even with the mysql jar in the classpath, it doesn't wotk...:'( so desesperated..

     

    JM

    JM
    Number of messages  1
    Not registered
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page