1

我正在研究一个 Mule 流,它通过 JMS 队列接收 xml 并将该 xml 作为 clob 值存储在 Oracle 表中。我正在使用 C3P0 ComboPoolDataSource 来管理连接池。当我尝试使用以下方法调用设置 clob 时,出现 java.lang.NoClassDefFoundError: com/mchange/v2/c3p0/C3P0ProxyConnection 错误

getLobHandler().getLobCreator().setCloBAsString(pstmt,8,"Test Message");

我检查了 mule 日志,它确实说它加载了 c3p0-0.9.1.2.jar

INFO  2013-10-31 19:29:06,054 [WrapperListener_start_runner] org.mule.module.launcher.MuleApplicationClassLoader: [TestWorkflow] Loading the following jar
s:
=============================
file:/C:/Test_mule/mule-standalone-3.4.0/apps/TestWorkflow/lib/activemq-core-5.5.0.jar
file:/C:/Test_mule/mule-standalone-3.4.0/apps/TestWorkflow/lib/c3p0-0.9.1.2.jar
file:/C:/Test_mule/mule-standalone-3.4.0/apps/TestWorkflow/lib/geronimo-j2ee-management_1.1_spec-1.0.1.jar
file:/C:/Test_mule/mule-standalone-3.4.0/apps/TestWorkflow/lib/geronimo-jms_1.1_spec-1.1.1.jar
file:/C:/Test_mule/mule-standalone-3.4.0/apps/TestWorkflow/lib/jdom2-2.0.5.jar
file:/C:/Test_mule/mule-standalone-3.4.0/apps/TestWorkflow/lib/log4j-1.2.16.jar
file:/C:/Test_mule/mule-standalone-3.4.0/apps/TestWorkflow/lib/mchange-commons-0.2.jar
file:/C:/Test_mule/mule-standalone-3.4.0/apps/TestWorkflow/lib/ojdbc14.jar
file:/C:/Test_mule/mule-standalone-3.4.0/apps/TestWorkflow/lib/slf4j-api-1.5.11.jar
file:/C:/Test_mule/mule-standalone-3.4.0/apps/TestWorkflow/lib/slf4j-nop-1.5.11.jar
file:/C:/Test_mule/mule-standalone-3.4.0/apps/TestWorkflow/lib/spring.jar
file:/C:/Test_mule/mule-standalone-3.4.0/apps/TestWorkflow/lib/test-notifier.jar

下面是我的 spring 应用程序上下文配置。

<?xml version="1.0" encoding="UTF-8"?>
-<beans xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd" xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans"> -<bean class="com.zanaco.mule.workflow.NotificationListener" name="notifcationListener" id="notifcationListener"> <property name="oracleDAO" ref="oracleDAO"/> </bean> 
<!-- Configurer that replaces ${...} placeholders with values from properties files -->

<!-- (in this case, mail and JDBC related properties) -->

<!-- <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:jdbc.properties</value> </list> </property> </bean> -->

<!-- c3p0 data source added to manage Connection pooling and to handle deadlock scenario and bad performance of Apache DBCP -->
 -<bean class="com.mchange.v2.c3p0.ComboPooledDataSource" id="dataSource" scope="singleton" destroy-method="close"> <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/> <property name="jdbcUrl" value="jdbc:oracle:thin:@xxxx:1521:fcdb"/> <property name="user" value="XXXXX"/> <property name="password" value="xxxxx"/> <property name="maxIdleTime" value="1000000"/> 
<!-- <property name="debugUnreturnedConnectionStackTraces" value="${debugUnreturnedConnectionStackTraces}" /> <property name="unreturnedConnectionTimeout" value="${unreturnedConnectionTimeout}" /> -->
 </bean> 
<!-- LobHandler for well-behaved JDBC drivers -->

<!-- (simply delegating to corresponding PreparedStatement and ResultSet methods) -->
 <bean class="org.springframework.jdbc.support.lob.DefaultLobHandler" id="defaultLobHandler" lazy-init="false"/> 
<!-- LobHandler for Oracle JDBC drivers -->

<!-- (refers to the NativeJdbcExtractor above to get access to native OracleConnections) -->
 -<bean class="org.springframework.jdbc.support.lob.OracleLobHandler" id="oracleLobHandler" lazy-init="false"> <property name="nativeJdbcExtractor" ref="nativeJdbcExtractor"/> </bean> 
<!-- NativeJdbcExtractor for the C3P0 connection pool above -->

<!-- (just needed for oracleLobHandler) -->
 <bean class="org.springframework.jdbc.support.nativejdbc.C3P0NativeJdbcExtractor" id="nativeJdbcExtractor" lazy-init="false"/> -<bean class="com.zanaco.db.OracleDAO" name="oracleDAO" id="oracleDAO"> -<property name="dataSource"> <ref bean="dataSource"/> </property> -<property name="lobHandler"> <ref bean="oracleLobHandler"/> </property> </bean> </beans> 

以下是日志跟踪:

ERROR [[TestWorkflow].ReceiveObject.stage1.02] (DispatchingLogger.java:341) - Work caused exception on 'workCompleted'. Work being executed was: org.mule.
processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker@22b429
Exception in thread "[TestWorkflow].ReceiveObject.stage1.02" org.mule.api.MuleRuntimeException: An exception occurred while invoking message processor "De
faultMessageProcessorChain '(inner iterating chain) of 'ReceiveObject' processor chain'
[
  DefaultJavaComponent{ReceiveObject.component.7097325},
  DefaultOutboundEndpoint{endpointUri=smtp://test-abc:<password>@mail.abc.com, connector=SmtpConnector
  {
    name=smtpConnector
    lifecycle=start
    this=fc6af5
    numberOfConcurrentTransactedReceivers=4
    createMultipleTransactedReceivers=true
    connected=true
    supportedProtocols=[smtp]
    serviceOverrides=<none>
  }
  ,  name='endpoint.smtp.test.abc.abc.com.25', mep=ONE_WAY, properties={}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, tim
eout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=50000, endpointEncoding=UTF-8, disableTransportTransformer=false},
  org.mule.routing.requestreply.AsyncReplyToPropertyRequestReplyReplier
]" for asynchronously.
        at org.mule.processor.AsyncWorkListener.handleWorkException(AsyncWorkListener.java:74)
        at org.mule.processor.AsyncWorkListener.workCompleted(AsyncWorkListener.java:50)
        at org.mule.work.WorkerContext.run(WorkerContext.java:338)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: com/mchange/v2/c3p0/C3P0ProxyConnection
        at org.springframework.jdbc.support.nativejdbc.C3P0NativeJdbcExtractor.doGetNativeConnection(C3P0NativeJdbcExtractor.java:97)
        at org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractorAdapter.getNativeConnection(NativeJdbcExtractorAdapter.java:99)
        at org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractorAdapter.getNativeConnectionFromStatement(NativeJdbcExtractorAdapter.java:135)
        at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.getOracleConnection(OracleLobHandler.java:533)
        at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.createLob(OracleLobHandler.java:493)
        at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.setClobAsString(OracleLobHandler.java:420)
        at com.test.db.OracleDAO.saveTransaction(OracleDAO.java:51)
        at com.test.mule.workflow.NotificationListener.onCall(NotificationListener.java:53)
        at org.mule.model.resolvers.CallableEntryPointResolver.invoke(CallableEntryPointResolver.java:50)
        at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:39)
        at org.mule.component.DefaultComponentLifecycleAdapter.invoke(DefaultComponentLifecycleAdapter.java:343)
        at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:86)
        at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:77)
        at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:126)
        at org.mule.component.AbstractComponent.access$000(AbstractComponent.java:61)
        at org.mule.component.AbstractComponent$1$1.process(AbstractComponent.java:242)
        at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
        at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
        at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
        at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:95)
        at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
        at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:54)
        at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
        at org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:26)
        at org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:70)
        at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
        at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
        at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
        at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:65)
        at org.mule.component.AbstractComponent.process(AbstractComponent.java:160)
        at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
        at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
        at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
        at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:95)
        at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
        at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
        at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
        at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:106)
        at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
        at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:122)
        at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:192)
        at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:185)
        at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:20)
        at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:34)
        at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:18)
        at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:58)
        at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:48)
        at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54)
        at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:44)
        at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:44)
        at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:52)
        at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:32)
        at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:17)
        at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:113)
        at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:34)
        at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:184)
        at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:43)
        at org.mule.work.WorkerContext.run(WorkerContext.java:311)
        ... 3 more
Caused by: java.lang.ClassNotFoundException: com.mchange.v2.c3p0.C3P0ProxyConnection
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 61 more
4

1 回答 1

1

就好像com.test.db.OracleDAO.saveTransaction()执行的类加载器不是TestWorkflow应用程序的类加载器。

你有几个应用程序?

如果没有,您可以尝试添加 c3p0-0.9.1.2.jar$MULE_HOME/lib/user以查看是否有帮助。

于 2013-10-31T15:59:51.640 回答