Mule 3.5 Community throwing No Suitable Driver fou

2019-06-14 06:35发布

问题:

I was working on the AnyPoint Studio with Mule 3.5 Community Runtime, while trying to connec to my oracle db it is throwing the following error at runtime

INFO 2014-05-30 12:16:32,875 [[externaladdresssearch].connector.http.mule.default.receiver.02] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.VM.mule.default.dispatcher.1832211181'. Object is: VMMessageDispatcher INFO 2014-05-30 12:16:32,875 [[externaladdresssearch].connector.http.mule.default.receiver.02] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.VM.mule.default.dispatcher.1832211181'. Object is: VMMessageDispatcher ERROR 2014-05-30 12:16:32,882 [[externaladdresssearch].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy:


Message : java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@10.211.55.8:1521:mosaic (org.mule.module.db.internal.domain.connection.ConnectionCreationException). Message payload is of type: InterfacesRequestDto Type : org.mule.api.MessagingException Code : MULE_ERROR--2 Payload : uk.co.corelogic.mosaic.interfaces.common.dto.InterfacesRequestDto@6ac1abcf JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html


I have used Generic DB connection The following is the DB config

<spring:beans>
    <spring:bean id="jdbcDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" name="jdbcDataSource">
        <spring:property name="url" value="jdbc:oracle:thin:@10.211.55.8:1521:mosaic"/>
        <spring:property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
        <spring:property name="username" value="fw"/>
        <spring:property name="password" value="fw"/>
    </spring:bean>
</spring:beans>
<db:generic-config name="Mosaic_Database_Configuration" dataSource-ref="jdbcDataSource" doc:name="Generic Database Configuration"/>

回答1:

You need to have the ojdbc.jar included in your Classpath. There is a good tutorial provided here that details how to do this.

Alternatively, if you already have the jar in your classpath, I'd suggest trying a different spring bean. I've used the following to connect to an Oracle database previously:

<spring:bean id="dataSource" class="org.enhydra.jdbc.standard.StandardDataSource" destroy-method="shutdown">
    <spring:property name="driverName" value="${Driver}"/>
    <spring:property name="url" value="${URL}"/>
    <spring:property name="user" value="${User}"/>
    <spring:property name="password" value="${Password}"/>
</spring:bean>


回答2:

I had same issue. Place database driver, in the following path.,

AnypointStudio/plugins/org.mule.tooling.server.3.5.***/mule/lib/mule

If you are running from standalone, place the driver jar inside,

mule-standalone-3.5.0/lib/mule

But I am not sure why it is expected database driver when driver is packaged with the deployed app.