我希望你们都能帮助我,我和MuleSoft(MS)大师已经有2天了,我们无法解决这个问题。简单地说,我们无法连接到SQL Server数据库。我正在使用Generic_Database_Connectory
,其中包含以下信息:
jdbc:jtds:sqlserver://ba-crmdb01.ove.local:60520;Instance=CRM;user=rcapilli...
com.microsoft.sqlserver.jdbc.SQLServerDriver
这是最新的sqljdbc4.jar
文件。 “测试连接”工作正常。没问题。但是当我运行应用程序时,我收到此错误(如下)
任何人都能够使SQL Server数据库连接正常工作???
ERROR 2015-04-09 14:05:31,106 [pool-17-thread-1] org.mule.exception.DefaultSystemExceptionStrategy: Caught exception in Exception Strategy: null
java.lang.NullPointerException
at org.mule.module.db.internal.domain.connection.DefaultDbConnection.isClosed(DefaultDbConnection.java:100) ~[mule-module-db-3.6.1.jar:3.6.1]
at org.mule.module.db.internal.domain.connection.TransactionalDbConnectionFactory.releaseConnection(TransactionalDbConnectionFactory.java:136) ~[mule-module-db-3.6.1.jar:3.6.1]
at org.mule.module.db.internal.processor.AbstractDbMessageProcessor.process(AbstractDbMessageProcessor.java:99) ~[mule-module-db-3.6.1.jar:3.6.1]
at org.mule.transport.polling.MessageProcessorPollingMessageReceiver$1.process(MessageProcessorPollingMessageReceiver.java:164) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.transport.polling.MessageProcessorPollingMessageReceiver$1.process(MessageProcessorPollingMessageReceiver.java:148) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:16) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:30) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:14) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:54) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:44) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:50) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:40) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:41) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:48) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:28) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:13) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:109) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:30) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.transport.polling.MessageProcessorPollingMessageReceiver.pollWith(MessageProcessorPollingMessageReceiver.java:147) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.transport.polling.MessageProcessorPollingMessageReceiver.poll(MessageProcessorPollingMessageReceiver.java:138) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.transport.AbstractPollingMessageReceiver.performPoll(AbstractPollingMessageReceiver.java:216) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.transport.PollingReceiverWorker.poll(PollingReceiverWorker.java:80) ~[mule-core-3.6.1.jar:3.6.1]
at org.mule.transport.PollingReceiverWorker.run(PollingReceiverWorker.java:49) ~[mule-core-3.6.1.jar:3.6.1]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) ~[?:1.7.0_75]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) ~[?:1.7.0_75]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) ~[?:1.7.0_75]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.7.0_75]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_75]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_75]
at java.lang.Thread.run(Thread.java:745) [?:1.7.0_75]
答案 0 :(得分:2)
这就是我以前的配置方式,它对我有用..你可以尝试这个例子: -
<db:generic-config name="Generic_Database_Configuration"
url="jdbc:sqlserver://ANIRBAN-PC\\SQLEXPRESS:1433;databaseName=MyDBName;user=sa;password=mypassword"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" doc:name="Generic Database Configuration" />
并在骡子流中: -
<db:select config-ref="Generic_Database_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[select * from table1]]></db:parameterized-query>
</db:select>
答案 1 :(得分:0)
如果您的测试连接正常,则数据库连接应该没有问题。请发布配置XML,这将有助于确定问题。
答案 2 :(得分:0)
您尝试使用数据库连接器执行查询字符串时会出现问题。由于Mule连接器测试仅检查连接,而不检查查询的正确性。
你测试了你的查询吗?在DB sql查询编辑器中运行此查询时是否显示该值?
如果这不能解决问题,那么请您与我们分享您的流程。
希望这有帮助
答案 3 :(得分:0)
我也遇到了同样的问题,所以我尝试了不同的jar。您可以从以下位置获取jdbc jar文件: https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc/6.1.0.jre8
不确定问题是否是jar,但在使用这个新的jar文件后它才有效。此外,如果您已对项目进行了整理,请从pom.xml文件中删除现有的sqljdbc jar文件及其依赖项。