Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.4.4, 2.0.0-M2
  • Component/s: Core: Configuration
  • Labels:
    None
  • User impact:
    Medium
  • Similar Issues:
    None

Description

In a webapp context, using IOUtils directly to load a resource ignores the ServletContext and the org.mule.webapp.classpath value set on that context. Ideally, I would like all resource loading done while evaluating a configuration file to use [Webapp]MuleXmlConfigurationBuilder.loadResource(). This method gets the "org.mule.webapp.classpath" semantics right.

Instead, MulePropertiesRuleSet.addFilePropertiesRule() adds a Rule which calls IOUtils.getResourceAsStream() directly.

This type of usage means that I need to switch to using absolute filepaths for a file reference inside my config XML when I use org.mule.webapp.classpath to use configuration information outside my webapp.

Issue Links

Activity

Hide
Anatoli Kuzmin added a comment -

usage FileUtils was changed relative path to absolute path
as a result web app could not find resource

Show
Anatoli Kuzmin added a comment - usage FileUtils was changed relative path to absolute path as a result web app could not find resource
Hide
Prem added a comment -

I'm using Mule1.4.4-snapshot version, but still I'm facing the same problem (as mentioned in the MULE-2410) while loading the mule config file.
The following is my web.xml file & I put all mule-configs under the WEB-INF directory.
Could you please tell me where it is going wrong:
<web-app>
<context-param>
<param-name>org.mule.config</param-name>
<param-value>
/WEB-INF/jmx-config.xml,
/WEB-INF/multicast-mule-config.xml,
/WEB-INF/p2p-mule-config.xml
</param-value>
</context-param>

<listener>
<listener-class>org.mule.config.builders.MuleXmlBuilderContextListener</listener-class>
</listener>
.....
</web-app>

Show
Prem added a comment - I'm using Mule1.4.4-snapshot version, but still I'm facing the same problem (as mentioned in the MULE-2410) while loading the mule config file. The following is my web.xml file & I put all mule-configs under the WEB-INF directory. Could you please tell me where it is going wrong: <web-app> <context-param> <param-name>org.mule.config</param-name> <param-value> /WEB-INF/jmx-config.xml, /WEB-INF/multicast-mule-config.xml, /WEB-INF/p2p-mule-config.xml </param-value> </context-param> <listener> <listener-class>org.mule.config.builders.MuleXmlBuilderContextListener</listener-class> </listener> ..... </web-app>
Hide
Anatoli Kuzmin added a comment -

The initial point for servlet classloader is WEB-INF/clasess
see web app example

Show
Anatoli Kuzmin added a comment - The initial point for servlet classloader is WEB-INF/clasess see web app example
Hide
Brendan MacLean added a comment -

The default, I think, is now (as of 1.4.3) anywhere on your webapp classpath, and the path must be classpath relative, e.g.

com/company/mule/config/jmx-config.xml

or indeed just

jmx-config.xml

if you put the config file in WEB-INF/classes.

You can also use the context-param "org.mule.webapp.classpath" to set a path outside your webapp to allow post-build configuration. e.g.

<Context path="/myapp" docBase="myapp" ...>
<Parameter name="org.mule.webapp.classpath" value="C:\mule-config\myapp"/>
</Context>

would allow you to put a modified version of jmx-config.xml at, say:

C:\mule-config\myapp\org\company\mule\config\jmx-config.xml

if your web.xml read:

<context-param>
<param-name>org.mule.config</param-name>
<param-value>
com/company/mule/config/jmx-config.xml,
com/company/mule/config/multicast-mule-config.xml,
com/company/mule/config/p2p-mule-config.xml
</param-value>
</context-param>

I think this all works in 1.4.4 now. Unfortunately, I believe, when you do this you still must change some of the internal paths used inside your config XML to be absolute references to any override files you wish to provide for these. This particular bug refers to a case like:

<file-properties location="email.properties" />

which, in the case described would have to become:

<file-properties location="/C:/mule-config/myapp/email.properties" />

And a related issue (MULE-2490) with SpringContainerContext was just marked "won't fix".

Show
Brendan MacLean added a comment - The default, I think, is now (as of 1.4.3) anywhere on your webapp classpath, and the path must be classpath relative, e.g. com/company/mule/config/jmx-config.xml or indeed just jmx-config.xml if you put the config file in WEB-INF/classes. You can also use the context-param "org.mule.webapp.classpath" to set a path outside your webapp to allow post-build configuration. e.g. <Context path="/myapp" docBase="myapp" ...> <Parameter name="org.mule.webapp.classpath" value="C:\mule-config\myapp"/> </Context> would allow you to put a modified version of jmx-config.xml at, say: C:\mule-config\myapp\org\company\mule\config\jmx-config.xml if your web.xml read: <context-param> <param-name>org.mule.config</param-name> <param-value> com/company/mule/config/jmx-config.xml, com/company/mule/config/multicast-mule-config.xml, com/company/mule/config/p2p-mule-config.xml </param-value> </context-param> I think this all works in 1.4.4 now. Unfortunately, I believe, when you do this you still must change some of the internal paths used inside your config XML to be absolute references to any override files you wish to provide for these. This particular bug refers to a case like: <file-properties location="email.properties" /> which, in the case described would have to become: <file-properties location="/C:/mule-config/myapp/email.properties" /> And a related issue (MULE-2490) with SpringContainerContext was just marked "won't fix".
Hide
Prem added a comment -

Thanks for the information Brendan MacLean.

Show
Prem added a comment - Thanks for the information Brendan MacLean.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: