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 Sardar Hussain <sa...@yahoo.com> on 2011/02/02 01:07:01 UTC

[AXIS2] Reading a configuration file in Handler

Hi,

I am trying to read a configuration file in AXIS2 module handler however it shows error. 
When I test the same module before deploying into Axis2 it works fine. My code and configuration files are as follows:

ClassLoader tcl = Thread.currentThread().getContextClassLoader();
      InputStream is = tcl.getResourceAsStream("C:\\apache-tomcat-6.0.29\\webapps\\axis2\\WEB-INF\\modules\\webConfig.xml");

PolicyDecisionPoint pdp = new JBossPDP(is);

the webConfig.xml is as follows

<ns:jbosspdp xmlns:ns="urn:jboss:xacml:2.0">
  <ns:Policies> 
      <ns:Policy>
         <ns:Location>policy.xml</ns:Location>
      </ns:Policy> 
  </ns:Policies>
  <ns:Locators>
    <ns:Locator Name="org.jboss.security.xacml.locators.JBossPolicyLocator"> 
    </ns:Locator>
  </ns:Locators>
</ns:jbosspdp>

It can't read the policy.xml file from the configuration file. I have put this policy file on different locations within the module archive outside module archive but it can not work.

Can anyone kindly help in this regard.

The JBossPDP constructor behave with the webConfig.xml file like the following.

public JBossPDP(InputStream configFile)
        {
           this();
           try
           {
              JAXBElement<?> jxb = (JAXBElement<?>) unmarshaller.unmarshal(configFile);
              bootstrap((PDP) jxb.getValue());
           }
           catch (Exception e)
           {
              throw new RuntimeException(e);
           }
        }


Regards,

Sardar