You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Dave Lindquist (JIRA)" <ji...@apache.org> on 2010/02/09 19:25:28 UTC

[jira] Created: (AXIS2-4618) Configuration from URL ("axis2.xml.url") fails with 'stream closed' (unusable)

Configuration from URL ("axis2.xml.url") fails with 'stream closed' (unusable)
------------------------------------------------------------------------------

                 Key: AXIS2-4618
                 URL: https://issues.apache.org/jira/browse/AXIS2-4618
             Project: Axis2
          Issue Type: Bug
    Affects Versions: 1.5.1
         Environment: * Java:
     java version "1.6.0_16"
     Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
     Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)
* Eclipse Dynamic Web Project
* Apache Axis2 v1.5.1 
            Reporter: Dave Lindquist


Attempting to use a URL to point to the axis2.xml file does not work -- every call will fail with a "stream closed" exception.

The problem is in WarBasedAxisConfigurator, which has these lines of code (lines 113 to 135, nb line 124):

                String axis2xmlpath = config.getInitParameter(PARAM_AXIS2_XML_PATH);
                if (axis2xmlpath != null) {
                    // when init parameter was present.
                    axis2Stream = new FileInputStream(axis2xmlpath);
                    log.debug("using axis2.xml from path: " + axis2xmlpath);
                }

                if (axis2Stream == null) {
                    String axisurl = config.getInitParameter(PARAM_AXIS2_XML_URL);
                    if (axisurl != null) {
                        axis2Stream = new URL(axisurl).openStream();
                        axisConfig = populateAxisConfiguration(axis2Stream);
                        log.debug("loading axis2.xml from URL: " + axisurl);
                    }
                }

                if (axis2Stream == null) {
                    // both the axis2.xml.path and axis2.xml.url init parameters were not present
                    // try to find the default /WEB-INF/conf/axis2.xml
                    axis2Stream = config.getServletContext()
                            .getResourceAsStream("/WEB-INF/conf/axis2.xml");
                    log.debug("trying to load axis2.xml from module: /WEB-INF/conf/axis2.xml");
                }

And then further down at line 157:

            axisConfig = populateAxisConfiguration(axis2Stream);

The problem is that we are attempting to call populateAxisConfiguration TWICE -- once when we grab the URL, and once at the very end.  No other configuration method attempts to do this; just the URL-based method.

This should be an incredibly easy fix -- just remove the call on line 124.

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