Hi Subash, please try URL url = XMLParser.class.getResource("serverConf.xml"); //...
instead. There are some configuration issues you have to fix in order to successfully use the class loader. Regards, Michele Subash Devkota wrote: > Hi, > > I am having problem reading my own XML file inside aar file. > The structure of my archive file is as shown below: > > * META-INF > o MANIFEST.MF > o services.xml > * security > o XMLParser.class > o serverConf.xml > o ...... > * key.jks > * services.properties > > I want to read parameters inside serverConf.xml from XMLParser class. I > have following code to read the xml file: > > URL > url=XMLParser.class.getClassLoader().getResource("security/serverConf.xml"); > > String fileName=url.toString(); > DocumentBuilderFactory docBuilderFactory = > DocumentBuilderFactory.newInstance(); > DocumentBuilder docBuilder = > docBuilderFactory.newDocumentBuilder(); > Document doc = docBuilder.parse (new File(fileName)); > > It works fine when i try it in java application from eclipse. But it has > problem reading the file when i make archive and deploy as web service. > I get the following error: > > java.io.FileNotFoundException: > jar:file:/home/oracle/app/jakarta-tomcat-5.0.28/webapps/axis2/WEB-INF/services/SecureServer.aar!/security/serverConf.xml > (No such file or directory) > at java.io.FileInputStream.open(Native Method) > at java.io.FileInputStream.<init>(FileInputStream.java:106) > at > org.apache.axiom.om.impl.dom.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:129) > > at security.XMLParser.loadXmlParameters(XMLParser.java:63) > > Can anyone suggest me how can i solve the problem? > > Thank You > Subash > > PRIVACY NOTICE > > This email and any attachments may be confidential and/or privileged. > Use of the information contained in this email by anyone other than the > intended recipient is strictly prohibited. If you have received this > email in error, please notify the sender by replying to this message and > delete this email. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]