[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-users] Embedded Jetty: Failed to locate resource XmlRpcServlet.properties
|
Hi David,
thanks for your pointers, just what I was looking for.
It seems the XmlRpcServlet.properties was located in the wrong
directory. It is loaded via .getResource(...), and from what I have read
the rule is:
* files in src/main/webapp/WEB-INF/classes are loaded with
getServletContext().getResource()
* files in src/main/resources are loaded with getClass().getResource()
At any rate, I moved the file to src/main/resources and everything works
fine. Just for the record, is this the correct location?
Also weird: before I moved it the file wasn't even copied to the target/
directory, unless I explicitly added src/main/webapp/WEB-INF/classes to
the list of source folders in Eclipse. Is this excepted? Just curious,
this is a whole different topic :)
Thanks again, David, and best regards,
Georg
On 25.10.2010 12:23, David Parks wrote:
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: jetty-users-bounces@xxxxxxxxxxx
[mailto:jetty-users-bounces@xxxxxxxxxxx] On Behalf Of Georg M. Sorst
Sent: Monday, October 25, 2010 4:46 PM
To: jetty-users@xxxxxxxxxxx
Subject: [jetty-users] Embedded Jetty: Failed to locate resource
XmlRpcServlet.properties
My apologies for cross-posting this from users@xxxxxxxxxxxxxxxxxx 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
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users
--
Georg M. Sorst
Dipl. Inf. (FH)
http://vergiss-blackjack.de
Ignaz-Harrer-Str. 13 / Top 19
5020 Salzburg
Österreich
Tel: +43 (0)650 / 53 47 200