I am using Mule requester module for lookup service using the file connector.it is working perfectly in anypoint studio and not working in cloudhub environment.Does it requires any configuration in cloud hub?
Cloudhub only allows access to one flat directory '/tmp/'. That's the only directory you can use with the file connector on Cloudhub. https://github.com/mulesoft/mulesoft-docs/blob/9f9c8a3950c4cb68e22f579c0ef979658acd170d/runtime-manager/v/latest/cloudhub-and-mule.adoc#disk-persistence
UPDATE FROM COMMENT:
You shouldn't use the Maven directory structure src/main.. etc. as thats not part of the packaged zip so its not on the classpath. If you need to read a resource from the classpath i'm not sure you can do that with the file transport on Cloudhub. If you simply want to load a file from the classpath you're better off using something like:
<set-payload value="#[Thread.currentThread().getContextClassLoader().getResourceAsStream('my-file.abc')]" />
or use the parse-template transformer or other options detailed here:mule read single file from classpath during flow
when we worked on Mule requester with Anypoint studio version 5.4.2, it was working fine for us. We deployed to cloudhub also and it was working for us. we did not faced any issues.
Related
I have a Mule project that I want to run from AnypointStudio. It uses the default log4j2.xml, but I want to change that.
According to the documentation (http://www.mulesoft.org/documentation/display/current/Logging+in+Mule), it is posible to put another log4j2.xml file on the classpath, but that does not work.
In the "run configuration" of Anypoint I added a classpath. In that classpath folder I added another log4j2.xml file, but that is ignored by the Mule, although it sees another file in that folder.
How do I add an log4j2.xml file?
Put your log4j2.xml config in src/test/resources, that way it won't be packaged in the app but will be available in Studio, when you launch the app.
Hi I am working with Mule Standalone server and when i am deploying my application as a ZIP to Standalone server as mentioned in the Mule Website Deployment Structure. In my project structure i have one file inside
src/main/resources/myfolder/myfile.xml.
When i am reading this file from Anypoint Studio using System.getProperty("user.dir") it is working fine .
When i am reading deploying the same in Standalone server it is throwing file not found exception, because their System.getProperty("user.dir") is returning till bin where file not exist \Java\MuleStandAlone\bin.
So to deploy to Mule Standalone where i will place my files so that i can read.
files under src/main/resources will be available from the classpath, so there should be no reason to lookup the root directory.
Just read it from classpath as "myfolder/myfile.xml".
E.g:
<set-payload value="#[Thread.currentThread().getContextClassLoader().getResourceAsStream('myfolder/myfile.xml')]" />
I have tried the way as Ryan Carter mention in the answer works for me and reading path as a String instead of Stream that also works for me.
String path= MyClass.class.getClassLoader().getResource("myfolder/myfile.xml").getPath();
If I run the application in server, which is working fine, but If i run application in anypoint studio doesn't run. Here is the error message for loading oracle driver.
error message:
2015-02-04 11:18:34 WARN DriverManagerDataSource:107 - Could not load driverClass oracle.jdbc.OracleDriver
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
I have placed all jdbc and other jars under studio->project->properties->libraries.
This is caused by the Studio's classloading policies. The workaround is to copy the JDBC Driver .jar to ${studio.home}/plugins/org.mule.tooling.server.${mule.version}.ee_${mule.version}.${release.date}/mule/lib/user
Hi there actually that's kind of a hack :P though it works.
The more proper way to deal with this is, when coding your application (that's why one should use Mule Studio), to place the jars like drivers in a particular folder, like a /lib in the root of you project.
Then add these jars to the classpath.
I know what you did is the way it should be done when running on Mule stand alone in order to share such jars but try this one if you can ;)
I was also facing the same problem. As the application runtime fails to locate the jdbc driver jar in classpath So It is unable to load the same.
the simple and easiest way to handle this error is just put your lib folder containing the ojdbc jar file inside the app resource (src/main/app) of the project. During the building of project it will automatically be place in classpath.
I have tried the same approach and It works for me.
Hope this helps.
The way I fixed the problem was removing the .classpath / .project files from my project root folder. I re-imported the project and then I saw a bin folder created. I removed this bin folder then right-click on the project -> Refresh and then Run As -> Mule Application.
I have seen some strange behaviour in Mule Application. I created a sample mule project(created flows) and opened mule-deploy.properties file "config.resources" value is empty.
But the same above mentioned key value is getting updated with "configuration xml file name" when i run my mule project.
Is this the behaviour or any updates need to be done.
Can some clarify?
Regards
Vikram
There are some known issues/features around mule-deploy.properties and Mule Studio.
Currently it is expected that when running your project from Mule Studio that mule-deploy.properties-config.resources is automatically populated with all your configuration files.
There are some open issues on this here: https://www.mulesoft.org/jira/browse/STUDIO-3297 that you can vote on.
Once you run the mule application it will automatically updated with the configuration file by default if you have only one main configuration file.But If you are using more configuration files in your application you should manually add all the filenames to the config.properties key separated by comma before run the application.
I'm trying to load javax.validation.ValidationFactory from a library containing the javax.validation package (retrieved from jboss.org). I see that the library is included when I export the Mule Studio Project to a zip file, so I'm assuming it is also exported when I deploy the application to CloudHub (all of my other 3rd party jars have deployed with minimal trouble).
Unfortunately, I get a ClassNotFound error. I've tried overriding the class definition using loader.override=javax.validation.ValidatorFactory in the mule-deploy.properties, but I get an error in CloudHub saying that I can't override a system package. I thought the above override would only override the given class, asking CloudHub to look within the deployed application for a class definition rather than from the CloudHub supplied libraries.
As a side note, searching through a copy of the Mule Standalone server, I don't see javax.validation.ValidationFactory anywhere. Can anyone tell me why I can't force the load of this one class using loader.override?