Shi Jinghai created OFBIZ-9484:
----------------------------------

             Summary: 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
(v6.4.14#64029)

Reply via email to