I want to create simple Spring MVC \"Hello world\" application that runs under Jetty (wich is a part of application).
Structure of my application is:
The application-context.xml file should be placed inside the WEB-INF directory.
If you are running with an exploded war directory try setting the resource base property explicitly:
context.setResourceBase("/path-to-your-project/WebContent");
context.setDescriptor("/path-to-your-project/WebContent/WEB-INF/web.xml");
or if you are deploying the war itself you can just use:
context.setWar("/path-to-your-project/WebContent");
Here are the docs showing embedded Jetty samples.
In the context of your app:
Resource jettyConfig = Resource.newSystemResource("jetty.xml");
XmlConfiguration configuration = new XmlConfiguration(jettyConfig.getInputStream());
Server server = (Server)configuration.configure();
WebAppContext wac = new WebAppContext();
wac.setResourceBase(".");
wac.setDescriptor("WEB-INF/web.xml");
wac.setContextPath("/");
wac.setParentLoaderPriority(true);
server.setHandler(wac);
server.start();
This assumes that your base path where you're running your server from is the same as the path to the web content.