我有一个 groovy 脚本转换器,它位于 src\main\resources 下存储的文件中。
我的项目在 Mule Studio 中按预期工作。当我将它部署到独立的 Mule 服务器时,它无法部署,因为它找不到相关文件位置。无法从类路径或文件系统加载“src\main\resources\myTransform.groovy”
<scripting:transformer doc:name="myXform">
<scripting:script engine="Groovy"
file="src\main\resources\myTransform.groovy">
</scripting:script>
</scripting:transformer>
我有几个问题:
- 这是保持我的 groovy 转换的合适位置吗?
- 我该如何解决这个问题,因为在部署版本中 src\main\resources 存在于 META-INF 下?
- 如果它是一个类路径设置,那么我应该更改什么来修复它(.classpath、独立服务器上的系统变量等)?
谢谢你。
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
好的,我重新安装了 Mule Studio(版本:3.5.0 Build Id:201312091746)并从头开始构建(使用 Maven)一个 vanilla 项目:
`
<mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:file="http://www.mulesoft.org/schema/mule/file" 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"
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/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd">
<flow name="gpFlow1" doc:name="gpFlow1">
<file:inbound-endpoint path="H:\DCH_ESB_Test\InMuleTest" responseTimeout="10000" doc:name="FileIn"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<scripting:transformer doc:name="Groovy">
<scripting:script engine="Groovy" file="myTransform.groovy"/>
</scripting:transformer>
<file:outbound-endpoint path="H:\DCH_ESB_Test\OutMuleTest" responseTimeout="10000" …Run Code Online (Sandbox Code Playgroud)