tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Gallimore (JIRA)" <j...@apache.org>
Subject [jira] Updated: (OPENEJB-997) context.xml is ignored
Date Sat, 31 Jan 2009 19:29:59 GMT

     [ https://issues.apache.org/jira/browse/OPENEJB-997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jonathan Gallimore updated OPENEJB-997:
---------------------------------------

    Attachment: tomcat.diff

Potential patch for this issue

> context.xml is ignored
> ----------------------
>
>                 Key: OPENEJB-997
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-997
>             Project: OpenEJB
>          Issue Type: Bug
>            Reporter: Jonathan Gallimore
>            Assignee: Jonathan Gallimore
>         Attachments: tomcat.diff
>
>
> Hi,
> I have a similar problem with TomcatWebAppBuilder which is related to
> user-defined contexts:
> In the method
> public void deployWebApps(AppInfo appInfo, ClassLoader classLoader);
> the standardContext is initialized as follows:
> if (getContextInfo(webApp) == null) {
>     StandardContext standardContext = new StandardContext();
>     standardContext.addLifecycleListener(new ContextConfig());
>     standardContext.setPath("/" + webApp.contextRoot);
>     standardContext.setDocBase(webApp.codebase);
>     standardContext.setParentClassLoader(classLoader);
>     standardContext.setDelegate(true);
> The problem in my opinion is the line
> standardContext.addLifecycleListener(new ContextConfig());
> i.e. the standardContext is initialized with an empty ContextConfig. If a
> context.xml is defined for a WebApp (located in one of the standard places,
> conf/Catalina/<host>/, META-INF/context.xml, ...) it is ignored. This is
> very undesirable if a context.xml defines Resources, ...
> With the following hack the ContextConfig is initialized with
> META-INF/context.xml:
> StandardContext standardContext = new StandardContext();
> standardContext.setConfigFile(
>     webApp.codebase + "/META-INF/context.xml"
> );
> WebAppContextConfig.initContext(standardContext);
> standardContext.setPath("/" + webApp.contextRoot);
> standardContext.setDocBase(webApp.codebase);
> standardContext.setParentClassLoader(classLoader);
> standardContext.setDelegate(true);
> and the helper class
> private static class WebAppContextConfig extends ContextConfig {
>     private void init(
>         StandardContext standardContext
>     ) {
>         standardContext.addLifecycleListener(this);
>         this.context = standardContext;
>         boolean tmpOverride = standardContext.getOverride();
>         standardContext.setOverride(true);
>         this.contextConfig();            
>         standardContext.setOverride(tmpOverride);
>     }
>     
>     public static void initContext(
>         StandardContext standardContext
>     ) {
>         WebAppContextConfig config = new WebAppContextConfig();
>         config.init(standardContext);
>     }
>             
> }
> Of course this is far from a clean solution. Any comments?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message