<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Can't connect to MySQL in Java EE/JBoss application
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/krzemian">Sz Krze</a> in <i>Datasource Configuration</i> - <a href="https://community.jboss.org/message/757495#757495">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>While deploying my app I'm getting the following errors (I've also included subjectively significant warnings):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; 03:36:42,113 WARN&#160; [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: com.mysql.jdbc.Driver; - nested throwable: (java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from BaseClassLoader@66a8c396{vfs:///D:/MobilnyPodroznik/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.x_Runtime_Server1345902635716/deploy/MP01.jar}))</p><p>&#160;&#160;&#160; (...)</p><p>&#160;&#160;&#160; Caused by: org.jboss.resource.JBossResourceException: Failed to register driver for: com.mysql.jdbc.Driver; - nested throwable: (java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from BaseClassLoader@66a8c396{vfs:///D:/MobilnyPodroznik/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.x_Runtime_Server1345902635716/deploy/MP01.jar})</p><p>&#160;&#160;&#160; (..)</p><p>&#160;&#160;&#160; Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from BaseClassLoader@66a8c396{vfs:///D:/MobilnyPodroznik/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.x_Runtime_Server1345902635716/deploy/MP01.jar}</p><p>&#160;&#160;&#160; </p><p>&#160;&#160;&#160; 03:36:42,122 WARN&#160; [org.hibernate.cfg.SettingsFactory] Could not obtain connection to query metadata: org.jboss.util.NestedSQLException: Unable to get managed connection for MP01Local; - nested throwable: (javax.resource.ResourceException: Unable to get managed connection for MP01Local)</p><p>&#160;&#160;&#160; (...)</p><p>&#160;&#160;&#160; Caused by: javax.resource.ResourceException: Unable to get managed connection for MP01Local</p><p>&#160;&#160;&#160; (...)</p><p>&#160;&#160;&#160; Caused by: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: com.mysql.jdbc.Driver; - nested throwable: (java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from BaseClassLoader@66a8c396{vfs:///D:/MobilnyPodroznik/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.x_Runtime_Server1345902635716/deploy/MP01.jar}))</p><p>&#160;&#160;&#160; (...)</p><p>&#160;&#160;&#160; Caused by: org.jboss.resource.JBossResourceException: Failed to register driver for: com.mysql.jdbc.Driver; - nested throwable: (java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from BaseClassLoader@66a8c396{vfs:///D:/MobilnyPodroznik/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.x_Runtime_Server1345902635716/deploy/MP01.jar})</p><p>&#160;&#160;&#160; (...)</p><p>&#160;&#160;&#160; Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from BaseClassLoader@66a8c396{vfs:///D:/MobilnyPodroznik/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.x_Runtime_Server1345902635716/deploy/MP01.jar}</p><p>&#160;&#160;&#160; </p><p>&#160;&#160;&#160; 03:36:42,143 WARN&#160; [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: com.mysql.jdbc.Driver; - nested throwable: (java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from BaseClassLoader@66a8c396{vfs:///D:/MobilnyPodroznik/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.x_Runtime_Server1345902635716/deploy/MP01.jar}))</p><p>&#160;&#160;&#160; (...)</p><p>&#160;&#160;&#160; Caused by: org.jboss.resource.JBossResourceException: Failed to register driver for: com.mysql.jdbc.Driver; - nested throwable: (java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from BaseClassLoader@66a8c396{vfs:///D:/MobilnyPodroznik/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.x_Runtime_Server1345902635716/deploy/MP01.jar})</p><p>&#160;&#160;&#160; (...)</p><p>&#160;&#160;&#160; Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from BaseClassLoader@66a8c396{vfs:///D:/MobilnyPodroznik/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.x_Runtime_Server1345902635716/deploy/MP01.jar}</p><p>&#160;&#160;&#160; </p><p>&#160;&#160;&#160; 03:36:42,147 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] schema export unsuccessful: org.jboss.util.NestedSQLException: Unable to get managed connection for MP01Local; - nested throwable: (javax.resource.ResourceException: Unable to get managed connection for MP01Local)</p><p>&#160;&#160;&#160; (...)</p><p>&#160;&#160;&#160; Caused by: javax.resource.ResourceException: Unable to get managed connection for MP01Local</p><p>&#160;&#160;&#160; (...)</p><p>&#160;&#160;&#160; Caused by: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: com.mysql.jdbc.Driver; - nested throwable: (java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from BaseClassLoader@66a8c396{vfs:///D:/MobilnyPodroznik/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.x_Runtime_Server1345902635716/deploy/MP01.jar}))</p><p>&#160;&#160;&#160; (...)</p><p>&#160;&#160;&#160; Caused by: org.jboss.resource.JBossResourceException: Failed to register driver for: com.mysql.jdbc.Driver; - nested throwable: (java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from BaseClassLoader@66a8c396{vfs:///D:/MobilnyPodroznik/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.x_Runtime_Server1345902635716/deploy/MP01.jar})</p><p>&#160;&#160;&#160; (...)</p><p>&#160;&#160;&#160; Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from BaseClassLoader@66a8c396{vfs:///D:/MobilnyPodroznik/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.x_Runtime_Server1345902635716/deploy/MP01.jar}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>As for the whole console output: <a class="jive-link-external-small" href="http://pastebin.com/de2Br9xL">http://pastebin.com/de2Br9xL</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>Basically, it seems as if my JDBC driver is not visible, but I have placed the .jar both in the server's default/lib folder and in project's build path, thus I'm clueless now.</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>persistence.xml</strong></p><p>&#160; </p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160; &lt;?xml version="1.0" encoding="UTF-8"?&gt;</span></p><p><span style="font-family: 'courier new', courier;"><span>&#160;&#160;&#160; &lt;persistence xmlns="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence" target="_blank">http://java.sun.com/xml/ns/persistence</a><span>" xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>"</span></span></p><p><span style="font-family: 'courier new', courier;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; xsi:schemaLocation="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence" target="_blank">http://java.sun.com/xml/ns/persistence</a><span> </span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" target="_blank">http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd</a><span>"</span></span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; version="2.0"&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160; &lt;persistence-unit name="mp" transaction-type="JTA"&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;jta-data-source&gt;java:/MP01Local&lt;/jta-data-source&gt;</span></p><p>&#160;&#160;&#160; </p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;properties&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!--s</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; --&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;property name="hibernate.hbm2ddl.auto" value="create-drop"/&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160; &lt;/properties&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160; &lt;/persistence-unit&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160; &lt;/persistence&gt;</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>mysqllocal-ds.xml</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160; &lt;?xml version="1.0" encoding="UTF-8"?&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160; &lt;!DOCTYPE datasources</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"</span></p><p><span style="font-family: 'courier new', courier;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; "</span><a class="jive-link-external-small" href="http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd" target="_blank">http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd</a><span>"&gt;</span></span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160; &lt;datasources&gt;</span></p><p>&#160;&#160;&#160;&#160;&#160;&#160; </p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160; &lt;local-tx-datasource&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;jndi-name&gt;MP01Local&lt;/jndi-name&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;connection-url&gt;jdbc:mysql://localhost:3306/mp&lt;/connection-url&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;driver-class&gt;com.mysql.jdbc.Driver&lt;/driver-class&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;user-name&gt;mproot&lt;/user-name&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;password&gt;mproot123&lt;/password&gt;</span></p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160;&#160;&#160; &lt;/local-tx-datasource&gt;</span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><span style="font-family: 'courier new', courier;">&#160;&#160;&#160; &lt;/datasources&gt;</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have placed the DS XML file in default/deploy path of the JBoss server and mysql-connector-java-5.0.8-bin in default/lib, as indicated in the JBoss manual.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>I'm using</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p> - Eclipse, build 20120614-1722, </p><p> - JBoss AS 6, </p><p> - mysql-connector-java-5.0.8-bin driver. </p><p> - As for the MySQL, mysql --version prints out "mysql&#160; Ver 14.14 Distrib 5.5.25a, for Win32 (X86)".</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>My project build path</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p> 1. jre6</p><p> 2. JBoss 6.x Runtime</p><p> 3. MySQL JDBC Driver 5.0.8, including mysql-connector-java-5.0.8-bin.jar [I have created it in Data Source Explorer)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p> Any clues? Thanks in advance.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/757495#757495">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Datasource Configuration at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>