Mule standalone (command line) cannot find file in its classes folder

I have a mule thread in Project B

that references a Java component in Project A

. The projects are structured as follows.

Project A
   src/test/java-ComponentClass
   src/test/resources- propertyfile.properties
 Project B(Mule project)
   src/main/app(Flows)- testflow(flow with component referencing ComponentClass)
   src/main/resources - propertyfile.properties

      

testFlow

creates a bean class as follows.

 <spring:beans>

        <spring:bean id="beanA"   class="com.packagename.ComponentClass"/>
    </spring:beans>

      

The next segment shows how the ComponentClass

properties file is accessed.

propFilePath="src/test/resources/propertyfile.properties"
File propFile = new File(propFilePath);
if(!propFile.exists())// To handle mule flow as mule doesnt bundle src/test/resources
{
   propFilePath=this.getClass().getResource("/propertyfile.properties");
   // points to /usr/local/mule/mule-enterprise-standalone-3.6.0-M2/apps/ProjectB-1.0-SNAPSHOT/classes/propertyfile.properties -for standalone.- 1
  //propFilePath="propertyfile.properties". <--eclipse-mule plugin-2

}

//process the file from its path-- 

      

Project A

was compiled in such a way that its test classes are available. Project B

imports a test jar from Project A

via its pom.

Now when I am trying to start a thread through a standalone mule on my system after building the project. The project fails to deploy on a mule, throwing a nested exception that is missing propertyfile

and the bean creation for ComponentClass

failed. However, by checking the location of the path in 1- (within the zip), I found that the file does exist in the classes folder. Any thoughts what is going on and how can I fix this?

Also when I put the file in the base folder ProjectB

and provide the path as in line - there 2

seems to be no problem when I run the project from the mule runtime in eclipse, but that fails when I try deploying to standalone.

Any feedback or suggestions would be appreciated.

+3


source to share


1 answer


Anyway, the mule uses a hierarchical class that deliberately isolates applications to reduce conflict. Please read this document to understand it better.



If you have some kind of general utility, why not just create a generic project that creates a jar and then just depend on both projects?

0


source







All Articles