Is this resource being loaded by a servlet? I would bet that the WebAppContext is the only thing that considers WEB-INF/classes and you are actually loading those resources under a different classloader (the primary JVM classloader perhaps rather than one Jetty probably uses to load webapps) and the classloader you're using doesn't have the WEB-INF directories in its classpath (whereas the classloader used by Jetty naturally would know about the WEB-INF directory by servlet specifications without you specifying it in particular).
Try out java -verbose to get a better sense of what is being loaded at JVM load and try getting your WEB-INF/classes directory on the primary JVM classpath. You might also try logging the toString method of the classloader at the point that you call getResource() vs the same thing from your servlet, this will probably help you see the conflict yourself. Hope it helps some, I'm not certain about it all, but maybe it'll point you in a direction that gets you somewhere. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Georg M. Sorst Sent: Monday, October 25, 2010 4:46 PM To: [email protected] Subject: [jetty-users] Embedded Jetty: Failed to locate resource XmlRpcServlet.properties My apologies for cross-posting this from [email protected] but this list seems slightly more active and I'm still having the same problem with Jetty 7. Here goes: Hey list, I am currently trying to setup an embedded Jetty instance for use in test cases. It's just lovely with how few lines of code Jetty can be started but I'm currently stumbling with properly running my web app. It uses Apache's XmlRpcServlet internally. The way I'm firing up Jetty is this: Server jetty = new Server(); XmlConfiguration configuration = new XmlConfiguration( new FileInputStream("src/main/config/jetty.xml")); configuration.configure(jetty); WebAppContext wac = new WebAppContext( "src/main/webapp", "/pm-server"); jetty.setHandler(wac); jetty.start(); jetty.join(); Now the context is basically starting up fine, I can reach it at http://localhost:8081/pm-server/xmlrpc (as defined in web.xml). However, when I go to that link I get the error "Failed to locate resource XmlRpcServlet.properties". The XmlRpcServlet.properties is loaded with XmlRpcServlet.class.getResource("XmlRpcServlet.properties"); and is located in src/main/webapp/WEB-INF/classes/org/apache/xmlrpc/webserver/XmlRpcServlet.pr operties. It seems the class loader is looking for resources in the wrong directory. Is there a way I can check which directories it searches? How can I tell it where to look? When I run Jetty with mvn jetty:run everything is fine so I guess my configs and the location of XmlRpcServlet.properties are correct but of course I can post them as well. Any hints would be greatly appreciated. Thanks and best regards, Georg _______________________________________________ jetty-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/jetty-users _______________________________________________ jetty-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/jetty-users
