<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.mulesoft.org/schema/mule/jdbc"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
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.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/jdbc http://www.mulesoft.org/schema/mule/jdbc/current/mule-jdbc.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
<flow name="worldfiletestFlow1" doc:name="worldfiletestFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<logger message="==========started=========" level="INFO" doc:name="Logger"/>
<scripting:component doc:name="Python">
<scripting:script engine="jython" >from java.lang import Class
Class.forName("org.hsqldb.jdbc.JDBCDriver");
from java.sql import Statement, ResultSet, DriverManager
connection = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost","sa","")
statement = connection.createStatement()
resultSet = statement.executeQuery("select * from test");
while resultSet.next():
print "%s (%s)" % (resultSet.getString("name"), resultSet.getString("personId"))
resultSet.close();
statement.close();
connection.close();
</scripting:script>
</scripting:component>
<logger message="=========END==========" level="INFO" doc:name="Logger"/>
</flow>
</mule>
1)當我運行僅 Jython腳本,從DB數據在控制檯顯示。只有當hsqldb.jar被添加到pydev-PYTHONPATH-> EXTERNAL LIBRARIES->添加jar文件時,纔會運行。如果我不在這裏添加,它不運行,它說ClassNotFoundException org.hsqldb.jdbc.JDBCDriver。騾ClassNotFoundException的:jdbcDriver
2)當我從騾子上運行,它說的ClassNotFoundException:org.hsqldb.jdbc.JDBCDriver
我已經添加在騾子的hsqldb.jar工作室 - >項目 - >屬性 - >構建路徑 - > libraries->添加外部庫。
錯誤信息:
java.lang.ClassNotFoundException: java.lang.ClassNotFoundException: org.hsqldb.jdbc.JDBCDriver
at org.python.core.Py.JavaError(Unknown Source)
at org.python.core.Py.JavaError(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(Unknown Source)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
我使用hsqldb2.3.2.jar。
當我將驅動程序名稱更改爲以上驅動程序名稱時,它會顯示以下錯誤: SyntaxError :(''invalid syntax',''',3,25,'\ t \ t \ tClass.forName(「org.hsqldb .jdbcDriver「);')) –
bekur
不,它不。該編譯時錯誤仍然顯示舊名稱;你改變了別的東西。 – chrylis
編輯器可能會出現問題,我在mule工作室創建了新項目,現在得到的錯誤是: java.lang.ClassNotFoundException:java.lang.ClassNotFoundException:org.hsqldb.jdbc.JDBCDriver – bekur