calalli
calalli

Reputation: 1

mule mysql configuration test connection works, but fails on endpoint

I am using Studio 5.4 and working with a local MySQL database. I have configured a MySQL Configuration and the test connection works fine. When I run the server the endpoint fails to get a connection. I have verified that the mysql-connector-java-5.1.34-bin.jar is in the classpath. I have verified the username and password and run the insert statement successfully in MySQL workbench. I am at a loss of what to try next.

The exception:

Root Exception stack trace: java.sql.SQLException: Error trying to load driver: com.mysql.jdbc.Driver : com.mysql.jdbc.Driver at org.enhydra.jdbc.standard.StandardDataSource.getConnection(StandardDataSource.java:184) at org.enhydra.jdbc.standard.StandardDataSource.getConnection(StandardDataSource.java:144) at org.mule.module.db.internal.domain.connection.SimpleConnectionFactory.create(SimpleConnectionFactory.java:26) at org.mule.module.db.internal.domain.connection.RetryConnectionFactory$1.doWork(RetryConnectionFactory.java:46)

My config:

<flow name="insertErrorMessage">
    <logger level="INFO" doc:name="Logger" message="error messages to process"/>
    <set-variable variableName="errorMessage" value="#[exceptionMessage]" doc:name="Variable"/>
    <set-variable variableName="currentTime" value="#[server.dateTime]" doc:name="Variable"/>
    <set-variable variableName="selectQuery" value="${insert.error.message}" doc:name="Variable"/>
    <set-variable variableName="changeLogId" value="999" doc:name="Variable"/>
            <db:insert config-ref="MySQL_Configuration" doc:name="Insert Error Message">
        <db:dynamic-query><![CDATA[#[flowVars.selectQuery]]]></db:dynamic-query>
    </db:insert>    
</flow> 

and the connector:

db:mysql-config name="MySQL_Configuration" host="localhost" port="3306" user="xxxx_erp" password="passw0rd" database="xxxx_mule_dev" doc:name="MySQL Configuration"/>

Upvotes: 0

Views: 937

Answers (2)

siva
siva

Reputation: 1

Add mysql connector jar in Build Path->configure build path->libraries

Upvotes: 0

David Dossot
David Dossot

Reputation: 33413

Add the following to your project pom.xml:

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

Upvotes: 1

Related Questions