I have a groovy scripting transformer that is in a file stored under src\main\resources.<scripting:transformer doc:name="myXform">
<scripting:script engine="Groovy"
file="src\main\resources\myTransform.groovy">
</scripting:script>
</scripting:transformer>
My project works as expected within Mule Studio. When I deploy it to the standalone Mule server it fails to deploy as it cannot find the relative file location.
Failed to load "src\main\resources\myTransform.groovy" from classpath or file system
I have a couple of questions:
- Is this the appropriate place to keep my groovy transforms?
- How do I fix the problem because in the deployed version the src\main\resources exists under META-INF?
- If it is a classpath setting then what do I change to fix it (.classpath, system variable on standalone server, etc.) ?
Thank you.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ok, I reinstalled Mule Studio (Version: 3.5.0 Build Id: 201312091746) and built (using Maven) a vanilla project from scratch:
`
<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" doc:name="FileOut"/>
</flow>
</mule>`
myTransform.groovy simply contains return payload.toUpperCase()
The first thing I see is Studio does not like the non-pathed file and flags an error on the scripting transformer of: "Path does not exist".
However, when I run the project within Studio it works.
When deployed I still get:
` ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ New app 'gp' +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2014-02-13 10:05:47,282 [Mule.app.deployer.monitor.1.thread.1] org.mule.module.launcher.MuleApplicationClassLoader: [gp] Loading the following jars:
=============================
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/asm-3.1.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/cloveretl-engine-3.4.1.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/commons-logging-1.1.1.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/ftplet-api-1.0.2.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/ftpserver-core-1.0.2.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/jaxb-impl-2.1.5.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/jaxb-xjc-2.2.5.1.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/jcl-over-slf4j-1.6.1.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/jsch-0.1.42.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/mina-core-2.0.0-M6.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/mockito-all-1.9.0.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/mockobjects-core-0.09.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/mule-core-ee-3.4.1.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/mule-module-boot-ee-3.4.1.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/slf4j-api-1.6.1.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/slf4j-log4j12-1.6.1.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/spring-tx-3.0.6.RELEASE.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/spring-web-3.0.6.RELEASE.jar
file:/C:/mule-enterprise-standalone-3.3.0/apps/gp/lib/sshd-core-0.6.0.jar
=============================
ERROR 2014-02-13 10:05:49,294 [Mule.app.deployer.monitor.1.thread.1] org.mule.module.launcher.DeploymentService: Failed to deploy application archive: gp.zip
org.mule.module.launcher.DeploymentInitException: InitialisationException: Failed to load "myTransform.groovy" from classpath or file system
at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:220)
at org.mule.module.launcher.application.ApplicationWrapper.init(ApplicationWrapper.java:64)
at org.mule.module.launcher.DefaultMuleDeployer.deploy(DefaultMuleDeployer.java:46)
at org.mule.module.launcher.DeploymentService.guardedDeploy(DeploymentService.java:398)
at org.mule.module.launcher.DeploymentService.deploy(DeploymentService.java:365) `
My .classpath file within Studio looks like:<classpath>
<classpathentry kind="src" path="src/main/app" excluding="**/*.java"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
<classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
<classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="MULE_RUNTIME"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/asm/asm/3.1/asm-3.1.jar"/>
<classpathentry kind="var" path="M2_REPO/com/cloveretl/cloveretl-engine/3.4.1/cloveretl-engine-3.4.1.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/ftpserver/ftplet-api/1.0.2/ftplet-api-1.0.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/ftpserver/ftpserver-core/1.0.2/ftpserver-core-1.0.2.jar"/>
<classpathentry kind="var" path="M2_REPO/com/sun/xml/bind/jaxb-impl/2.1.5/jaxb-impl-2.1.5.jar"/>
<classpathentry kind="var" path="M2_REPO/com/sun/xml/bind/jaxb-xjc/2.2.5.1/jaxb-xjc-2.2.5.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.1/jcl-over-slf4j-1.6.1.jar"/>
<classpathentry kind="var" path="M2_REPO/com/jcraft/jsch/0.1.42/jsch-0.1.42.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/mina/mina-core/2.0.0-M6/mina-core-2.0.0-M6.jar"/>
<classpathentry kind="var" path="M2_REPO/org/mockito/mockito-all/1.9.0/mockito-all-1.9.0.jar"/>
<classpathentry kind="var" path="M2_REPO/mockobjects/mockobjects-core/0.09/mockobjects-core-0.09.jar"/>
<classpathentry kind="var" path="M2_REPO/com/mulesoft/muleesb/mule-core-ee/3.4.1/mule-core-ee-3.4.1.jar"/>
<classpathentry kind="var" path="M2_REPO/com/mulesoft/muleesb/modules/mule-module-boot-ee/3.4.1/mule-module-boot-ee-3.4.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-tx/3.0.6.RELEASE/spring-tx-3.0.6.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-web/3.0.6.RELEASE/spring-web-3.0.6.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/sshd/sshd-core/0.6.0/sshd-core-0.6.0.jar"/>
</classpath>
In the export zip file, myTransform.groovy is found under:
gp.zip\META-INF\src\main\resources\
I did not reinstall my standalone.
Thanks, -- Don