[mule-user] Mule IDE issues with context:property-placeholder (Eclipse Galileo)

48 views
Skip to first unread message

andy e

unread,
Jan 12, 2010, 2:50:39 AM1/12/10
to us...@mule.codehaus.org
Tried to use an "external" .properties file in a Mule project today and was getting weird errors re: Eclipse. We use mvn eclipse:eclipse to build our eclipse projects, maybe that is part of the problem.
The first problem I received was that when starting Mule, it just didn't seem to like the <context:property-placeholder /> tag. I didn't write down the exact error, but I did manage to "fix" it by following the steps re: XML validation settings as seen on the MuleSoft blog - http://blogs.mulesoft.org/overcoming-xml-validation-errors-in-eclipse-35/.

However, no matter where I put the .properties file within the project (really just want it in /conf along with the mule-config.xml file) and or tweaked the location= portion of the tag, I always got FileNotFound exception when looking for the .properties file. The only way to fix it was to add the folder containing the .properties file into the classpath of the project (either directly or via Run Configuration settings).

The problem is likely that since my development systems are on a standalone network, I had to find an "old" version of the Mule IDE plugin so that I could download it and install separately. If you have done this, did you notice this odd (and confusing/annoying) behaviour? I couldn't recreate the issue at home when I was able to do a "Add new software..." option in Eclipse 3.5.

That leads to my real question, I guess - is there anywhere I can download a .zip version of the Mule plugin so I can download it, burn to CD and then install?

thanks,

Andy

Dirk Olmes

unread,
Jan 12, 2010, 3:39:07 AM1/12/10
to us...@mule.codehaus.org
andy e wrote:
> Tried to use an "external" .properties file in a Mule project today and
> was getting weird errors re: Eclipse. We use mvn eclipse:eclipse to
> build our eclipse projects, maybe that is part of the problem.
> The first problem I received was that when starting Mule, it just didn't
> seem to like the <context:property-placeholder /> tag. I didn't write
> down the exact error, but I did manage to "fix" it by following the
> steps re: XML validation settings as seen on the MuleSoft blog -
> http://blogs.mulesoft.org/overcoming-xml-validation-errors-in-eclipse-35/.
>
> However, no matter where I put the .properties file within the project
> (really just want it in /conf along with the mule-config.xml file) and
> or tweaked the location= portion of the tag, I always got FileNotFound
> exception when looking for the .properties file. The only way to fix it
> was to add the folder containing the .properties file into the classpath
> of the project (either directly or via Run Configuration settings).

Note that all of this has nothing to do with Mule IDE or Eclipse. It's
even Spring that loads the properties so you may best consult their docs.

> The problem is likely that since my development systems are on a
> standalone network, I had to find an "old" version of the Mule IDE
> plugin so that I could download it and install separately. If you have
> done this, did you notice this odd (and confusing/annoying) behaviour? I
> couldn't recreate the issue at home when I was able to do a "Add new
> software..." option in Eclipse 3.5.
>
> That leads to my real question, I guess - is there anywhere I can
> download a .zip version of the Mule plugin so I can download it, burn to
> CD and then install?

Hmm ... maybe I should really publish downloadable zips along with the
update site. I just checked out the 2.0.1 tag and built a zip that
should to the trick. Get it from [1] and let me know if it works.

-dirk

[1] http://dist.muleforge.org/mule-ide/releases/muleide-2.0.1.zip

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


andy e

unread,
Jan 12, 2010, 9:36:01 PM1/12/10
to us...@mule.codehaus.org
dirk,

Thanks for the .zip, very much appreciated. I didn't get the chance to try it today but should be able to before week's end.

Note that all of this has nothing to do with Mule IDE or Eclipse. It's
even Spring that loads the properties so you may best consult their docs.

Understood - and I need to do more testing to try to isolate the fix (if the .zip doesn't take care of it magically). I guess why I thought it might be related to the plugin is that when I tried it at work (with eclipse 3.3 and 3.5) I had issues, but at home (with eclipse 3.5) it worked fine. Of course, at home, I'm not using mvn eclipse:eclipse to build by project files, either. So it's very likely it's just something quirky in our development environment. 

thanks again!

andy

andy e

unread,
Jan 16, 2010, 12:22:05 PM1/16/10
to us...@mule.codehaus.org
OK, apparently I was sleeping when I wrote this, because now that I try to use an external properties file at home, I am still getting the FileNotFound exception (but only from command line).

To start over, I'm trying to use a .properties file in conjunction with my mule-config xml file. According to the Mule docs, it is done with the following:
<context:property-placeholder location="test.properties" />

When I run this from my Eclipse 3.5 and Mule IDE 2.0.2 (whichever is latest?), it works fine. If I run from command line, it fails with the error I'll post at the bottom.
At work, neither option works (Eclipse 3.5 with Dirk's .zip Mule IDE he attached, nor command line). Is there something simple I'm missing in my work environment?

Here's the basic mule config for testing:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:file="http://www.mulesource.org/schema/mule/file/2.2"
     
      xmlns:context="http://www.springframework.org/schema/context"
      xsi:schemaLocation="
          http://www.mulesource.org/schema/mule/file/2.2 http://www.mulesource.org/schema/mule/file/2.2/mule-file.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
          http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd">

    <context:property-placeholder location="test.properties" />
</mule>

Note that I've tried several options for the location value, i.e. "test.properties", "classpath:test.properties", etc. None seem to work when I run mule from the command line (i.e. mule -config mule-config.xml) and no matter which dir I'm in when I run mule.

Here is the error I get outside of the one working Eclipse:

Running in console/foreground mode by default, use Ctrl-C to exit...
--> Wrapper Started as Console
Launching a JVM...
Starting the Mule Server...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

INFO  2010-01-16 12:13:11,500 [WrapperListener_start_runner] org.mule.MuleServer: Mule Server initializing...
INFO  2010-01-16 12:13:11,796 [WrapperListener_start_runner] org.mule.config.spring.MuleApplicationContext: Refreshing org.mule.config.spring.MuleApplicationContext@11978b: display name [org.mule.config.spring.MuleApplicationContext@11978b]; startup date [Sat Jan 16 12:13:11 EST 2010]; root of context hierarchy
INFO  2010-01-16 12:13:12,375 [WrapperListener_start_runner] org.mule.config.spring.MuleApplicationContext: Bean factory for application context [org.mule.config.spring.MuleApplicationContext@11978b]: org.springframework.beans.factory.support.DefaultListableBeanFactory@118278a
ERROR 2010-01-16 12:13:12,468 [WrapperListener_start_runner] org.mule.config.spring.SpringXmlConfigurationBuilder: Configuration with "org.mule.config.spring.SpringXmlConfigurationBuilder" failed.
org.mule.api.lifecycle.InitialisationException: Initialisation Failure: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [test.properties] cannot be opened because it does not exist
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:76)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:98)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:69)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:39)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:112)
    at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:58)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:39)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:177)
    at org.mule.MuleServer.initialize(MuleServer.java:351)
    at org.mule.MuleServer.run(MuleServer.java:257)
    at org.mule.MuleServer.start(MuleServer.java:244)
    at org.mule.module.boot.MuleServerWrapper.start(MuleServerWrapper.java:48)
    at org.tanukisoftware.wrapper.WrapperManager$12.run(WrapperManager.java:2788)
Caused by: org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [test.properties] cannot be opened because it does not exist
    at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:78)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:553)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:527)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:362)
    at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:87)
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:68)
    ... 14 more
Caused by: java.io.FileNotFoundException: class path resource [test.properties] cannot be opened because it does not exist
    at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:143)
    at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:182)
    at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:161)
    at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:69)
    ... 19 more
ERROR 2010-01-16 12:13:12,468 [WrapperListener_start_runner] org.mule.config.builders.AutoConfigurationBuilder: Configuration with "org.mule.config.builders.AutoConfigurationBuilder" failed.
org.mule.api.config.ConfigurationException: Initialisation Failure: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [test.properties] cannot be opened because it does not exist (org.mule.api.lifecycle.InitialisationException)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:112)
    at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:58)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:39)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:177)
    at org.mule.MuleServer.initialize(MuleServer.java:351)
    at org.mule.MuleServer.run(MuleServer.java:257)
    at org.mule.MuleServer.start(MuleServer.java:244)
    at org.mule.module.boot.MuleServerWrapper.start(MuleServerWrapper.java:48)
    at org.tanukisoftware.wrapper.WrapperManager$12.run(WrapperManager.java:2788)
Caused by: org.mule.api.lifecycle.InitialisationException: Initialisation Failure: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [test.properties] cannot be opened because it does not exist
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:76)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:98)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:69)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:39)
    ... 11 more
Caused by: org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [test.properties] cannot be opened because it does not exist
    at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:78)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:553)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:527)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:362)
    at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:87)
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:68)
    ... 14 more
Caused by: java.io.FileNotFoundException: class path resource [test.properties] cannot be opened because it does not exist
    at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:143)
    at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:182)
    at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:161)
    at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:69)
    ... 19 more
ERROR 2010-01-16 12:13:12,531 [WrapperListener_start_runner] org.mule.MuleServer:
********************************************************************************
Message               : Initialisation Failure: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [test.properties] cannot be opened because it does not exist
Type                  : org.mule.api.lifecycle.InitialisationException
Code                  : MULE_ERROR-72085
JavaDoc               : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/lifecycle/InitialisationException.html
Object                : org.mule.config.spring.SpringRegistry@2c17f7
********************************************************************************
Exception stack is:
1. class path resource [test.properties] cannot be opened because it does not exist (java.io.FileNotFoundException)
  org.springframework.core.io.ClassPathResource:143 (null)
2. Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [test.properties] cannot be opened because it does not exist (org.springframework.beans.factory.BeanInitializationException)
  org.springframework.beans.factory.config.PropertyResourceConfigurer:78 (null)
3. Initialisation Failure: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [test.properties] cannot be opened because it does not exist (org.mule.api.lifecycle.InitialisationException)
  org.mule.registry.AbstractRegistry:76 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/lifecycle/InitialisationException.html)
********************************************************************************
Root Exception stack trace:
java.io.FileNotFoundException: class path resource [test.properties] cannot be opened because it does not exist
    at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:143)
    at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:182)
    at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:161)
    at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:69)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:553)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:527)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:362)
    at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:87)
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:68)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:98)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:69)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:39)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:112)
    at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:58)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:39)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:177)
    at org.mule.MuleServer.initialize(MuleServer.java:351)
    at org.mule.MuleServer.run(MuleServer.java:257)
    at org.mule.MuleServer.start(MuleServer.java:244)
    at org.mule.module.boot.MuleServerWrapper.start(MuleServerWrapper.java:48)
    at org.tanukisoftware.wrapper.WrapperManager$12.run(WrapperManager.java:2788)

********************************************************************************

ERROR 2010-01-16 12:13:12,640 [WrapperListener_start_runner] org.mule.MuleServer:
********************************************************************************
* A Fatal error has occurred while the server was running:                     *
* class path resource [test.properties] cannot be opened because it does not   *
* exist (java.io.FileNotFoundException)                                        *
*                                                                              *
* The error is fatal, the system must shutdown                                 *
* Server started: 12/31/69 7:00 PM                                             *
* Server shutdown: 1/16/10 12:13 PM                                            *
********************************************************************************
INFO  2010-01-16 12:13:12,812 [Thread-1] org.mule.MuleServer: Mule server shutting down due to normal shutdown request
INFO  2010-01-16 12:13:12,828 [Thread-1] org.mule.MuleServer:
**************************************************************************************
* The server is shutting down due to normal shutdown request                         *
* Server started: 12/31/69 7:00 PM                                                   *
* Server shutdown: 1/16/10 12:13 PM                                                  *
**************************************************************************************
<-- Wrapper Stopped

Dirk Olmes

unread,
Jan 18, 2010, 8:42:27 AM1/18/10
to us...@mule.codehaus.org
andy e wrote:
> OK, apparently I was sleeping when I wrote this, because now that I try
> to use an external properties file at home, I am still getting the
> FileNotFound exception (but only from command line).
>
> To start over, I'm trying to use a .properties file in conjunction with
> my mule-config xml file. According to the Mule docs, it is done with the
> following:
> <context:property-placeholder location="test.properties" />

So your problem has nothing to do with Mule IDE. Good.

Now, where did you put your test.properties in your project? Can the
file be found if you specify the absolute path in the config?

The "classpath:" prefix only works if you have your test.properties on
the classpath. Is that the case?

-dirk

andy e

unread,
Jan 18, 2010, 11:45:24 AM1/18/10
to us...@mule.codehaus.org
Dirk,

Correct (Mule IDE + Eclipse seems to work better than command line) and thanks again for providing the Mule 2.0.1 plugin .zip file.

I've tried the test.properties file in a number of places - in the /conf director where my mule-config resides, in the director just above that, etc. Come to think of it, I haven't tried the absolute path when I was using it via command line. I will try that today. 

I guess my question at this point is - why does Mule IDE/Eclipse pick up my .properties file as part of my classpath, but mule -config from the command line doesn't (if I'm using location="classpath:test.properties"). Or is the only way to get mule to pick it up to set the MULE_LIB environment (or another CLASSPATH environment)?

andy
Reply all
Reply to author
Forward
0 new messages