You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Jacques Le Roux (JIRA)" <ji...@apache.org> on 2019/08/17 07:09:00 UTC

[jira] [Commented] (OFBIZ-9484) Enable webapp's META-INF/context.xml works

    [ https://issues.apache.org/jira/browse/OFBIZ-9484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16909612#comment-16909612 ] 

Jacques Le Roux commented on OFBIZ-9484:
----------------------------------------

Hi Shinguai,

Thanks for the tip. I tried it for OFBIZ-11156. Unfortunately it did not work there. I guess because I tried to set a JNDI environment but I'm unsure.

It would be good to know why and if we find a solution then I believe it would be a good addition to be able to read a context :)

Apply also to OFBIZ-10685

> Enable webapp's META-INF/context.xml works
> ------------------------------------------
>
>                 Key: OFBIZ-9484
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-9484
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: 16.11.02
>            Reporter: Shi Jinghai
>            Priority: Trivial
>
> Besides the EL error, another problem when deploying Drools-Workbench in OFBiz I met is the webapp's META-INF/context.xml not loaded.
> Add the following code in framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java and drools-wb works fine in OFBiz:
> {code:java}
>         context.addLifecycleListener(new ContextConfig());
>         // adding webapp's META-INF/context.xml begin
>         String contextXmlFilePath = new StringBuilder().append("file:///").append(location).append("/").append(Constants.ApplicationContextXml).toString();
>         URL contextXmlUrl = null;
>         try {
>             contextXmlUrl = FlexibleLocation.resolveLocation(contextXmlFilePath);
>             contextXmlFilePath = new StringBuilder().append(location).append("/").append(Constants.ApplicationContextXml).toString();
>             File contextXmlFile = FileUtil.getFile(contextXmlFilePath);
>             if(contextXmlFile.exists() && contextXmlFile.isFile()) { 
>                 // Debug.logInfo(contextXmlFilePath + " found and will be loaded.", module);
>     	        context.setConfigFile(contextXmlUrl);
>             }
>         } catch (MalformedURLException e) {
>             // Debug.logInfo(contextXmlFilePath+ " not found.", module);
>         }
>         // add webapp's META-INF/context.xml end
>         Tomcat.initWebappDefaults(context);
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)