Missing Oracle jdbc Driver for Mule ESB Datamapper

1.9k views Asked by At

Good morning to everyone,

I have a big issue to run a job in Mule ESB. I'm trying to map an CSV file in a table of an oracle database. To do that, I created a JDBC Connector with a Oracle DataSource and the Connection Test is Valid. But if i run The Job an error Message appears.

[Error Message]

-------------------------------------

ERROR 2015-06-17 09:01:26,223 [[....].connector.file.mule.default.receiver.01] org.mule.exception.DefaultMessagingExceptionStrategy: 
******************************************************************************
Message               : com.mulesoft.mule.module.datamapper.api.exception.DataMapperCreationException: Element [JDBC0:]-Can't initialize connection DBConnection driver[null]:jndi[null]:url[jdbc:oracle:thin:@.....:....:.......]:user[......]. (java.lang.RuntimeException). Message payload is of type: ReceiverFileInputStream
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Cannot load class 'oracle.jdbc.OracleDriver' (java.lang.ClassNotFoundException)
  org.mule.module.launcher.application.CompositeApplicationClassLoader:74 (null)
2. Cannot create JDBC driver 'Oracle'. Cannot find class. (org.jetel.exception.ComponentNotReadyException)
  org.jetel.connection.jdbc.driver.JdbcDriverImpl:188 (null)
3. Can't initialize connection DBConnection driver[null]:jndi[null]:url[..............]:user[.......]. (org.jetel.exception.ComponentNotReadyException)
  org.jetel.graph.TransformationGraph:413 (null)
4. Element [JDBC0:]-Can't initialize connection DBConnection driver[null]:jndi[null]:url[..............]:user[...........]. (com.mulesoft.mule.module.datamapper.api.exception.DataMapperCreationException)
  com.mulesoft.mule.module.datamapper.clover.impl.graphfactory.DocumentCloverGraphFactoryImpl:59 (null)
5. com.mulesoft.mule.module.datamapper.api.exception.DataMapperCreationException: Element [JDBC0:]-Can't initialize connection DBConnection driver[null]:jndi[null]:url[............]:user[.....]. (java.lang.RuntimeException)
  com.mulesoft.mule.module.datamapper.clover.impl.graphprovider.PoolGraphProvider:109 (null)
6. com.mulesoft.mule.module.datamapper.api.exception.DataMapperCreationException: Element [JDBC0:]-Can't initialize connection DBConnection driver[null]:jndi[null]:url[..............]:user[..............]. (java.lang.RuntimeException). Message payload is of type: ReceiverFileInputStream (org.mule.api.MessagingException)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.ClassNotFoundException: Cannot load class 'oracle.jdbc.OracleDriver'
    at org.mule.module.launcher.application.CompositeApplicationClassLoader.loadClass(CompositeApplicationClassLoader.java:74)
    at org.jetel.util.classloader.GreedyURLClassLoader.loadClassGreedy(GreedyURLClassLoader.java:137)
    at org.jetel.util.classloader.GreedyURLClassLoader.loadClass(GreedyURLClassLoader.java:111)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
******************************************************************************

Do I have to put the driver "ojdbc7.jar" in a specific directory?

1

There are 1 answers

0
Anirban Sen Chowdhary On

What it looks like you have configured oracle.jdbc.OracleDriver instead of oracle.jdbc.driver.OracleDriver You can configure the following example :-

<spring:beans> 
<spring:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"    destroy-method="close"> 
        <spring:property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/> 
        <spring:property name="url" value="jdbc:oracle:thin:@192.168.28.129:1521:xe"/> 
        <spring:property name="username" value="yourUserName"/> 
        <spring:property name="password" value="yourPassword"/> 
        <spring:property name="removeAbandoned" value="true"/> 
        <spring:property name="initialSize" value="10"/> 
        <spring:property name="maxActive" value="50"/> 
        </spring:bean> 
</spring:beans>

<db:generic-config name="Database_Configuration" dataSource-ref="dataSource" doc:name="Generic Database Configuration" />

 <flow name="mainFlow">
     <http:listener config-ref="httpListenerConfig" path="/*" doc:name="HTTP" allowedMethods="GET"/> 
///////////////////////////////////////

Your Code
////////////////////////////////////
 <db:select config-ref="Database_Configuration" doc:name="Database">
    <db:parameterized-query><![CDATA[select * from yourtableName]]></db:parameterized-query>
</db:select>
</flow>

You need to configure and change as per your ip, username, password etc

Add commons-dbcp-1.2.2.jar or other version and ojdbc6.jar in your classpath as dependancy