It turns out that the problem was not with getResource() but with embedded spaces in the returned resource string being converted to %20. The following code resolved it:
File propfile; try { propfile = new File(propUrl.toURI()); } catch (URISyntaxException e) { propfile = new File(propUrl.getPath()); } An interesting and useful additional point emerged, which I will mention just in case anyone ever runs into this sort of problem. Because Axis2 is running the class, the syntax: propUrl = this.getClass().getResource("/myservice.properties"); looks in <TOMCAT_HOME>/webapps/axis2/WEB-INF/classes, not in the root of the .aar. Knowing this can be handy, as it allows a service aar to be updated without resetting custom properties. Not knowing it can be frustrating, for obvious reasons. _____________________________________________________________ Stephen Kilburn, GeoPraxis Inc. -----Original Message----- From: Stephen Kilburn [mailto:[EMAIL PROTECTED] Sent: June 9, 2008 22:15 To: axis-user@ws.apache.org Subject: getClass().getResource() in .aar? Hi, I am attempting to embed a resource file in an Axis2 .aar, but haven't been able to make this work. I have been using the syntax: URL propUrl = this.getClass().getResource("/myResource.properties"); This returns null. I've tried putting the resource file in various places in the .aar, but so far no joy. I'm running this as a Spring application, BTW. Not sure if that makes a difference. Am I missing something, or is there some special syntax I need to use to make this work? (I would be happy placing the properties outside the .aar if that is easier.) Thanks in advance for any replies. _____________________________________________________________ Stephen Kilburn, GeoPraxis Inc. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]