Hi! try putting the "myresource.xml" under /WEB-INF/classes/ and get access to it as below.
public void init() throws ServletException { try{ SAXBuilder builder = new SAXBuilder(); URL confFileURL = this.getServletContext().getResource("/WEB-INF/classes/MyResource.xml"); logger.info("the config resource was " + (confFileURL != null ? "found" : "not found")); Document doc = builder.build(confFileURL); logger.info("Root Element -->"+doc.getRootElement()); }catch (MalformedURLException e) { logger.info("Malformed URL Exception"+e.toString()); }catch(JDOMException de){ logger.info("JDOM Exception"+de.toString()); } } rgds, Dinesh On Thu, 21 Oct 2004 08:25:31 -0600, kjc <[EMAIL PROTECTED]> wrote: > > I have an ActionServlet that subclasses the struts action servlet. In my > init() method i'm trying to load a resource > like this. > > public void init(){ > > URL url = this.getServletContext().getResource("/myresource.xml"); > > logger.info("the config resource was " + (url != null ? "found" > : "not found")); > > } > > The "not found" statement is printed. > > I checked my .war file and the resource is properly placed under > WEB-INF/myresource.xml > > Note, that this war file is part of a .ear file. > > Thanks in advance. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Dinesh B Sampangi **************************** Software Engineer FCG Software Services, Brigade Road,Bangalore - 560025 Ph: 56917777 ext:2523 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]