[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jetty-users] Embeded jetty 7.2.2 issue.
|
Hi All,
I am using Jetty 7.2.2 embedded in my application . It is an osgi based application running on equinox. Now my requirement is to run jetty server using the configuration file . below is the snippet which i have used to read the configuration file . The execution goes fine w/o any exception but when i open the URL
http://localhost:50099/timeline it says
no resource found error 404.
I have written one servlet and now i wanted to register that servlet with the connector so that i can run the servlet from the broswer. To incorporate this did necessary changes in jetty.xml.
Resource fileserver_xml;
try {
Thread.currentThread().setContextClassLoader(Activator.class.getClassLoader());
fileserver_xml = Resource.newResource("newWP/testapplication/jetty.xml");
XmlConfiguration configuration = new XmlConfiguration(fileserver_xml.getInputStream());
Server server = (Server)configuration.configure();
server.start();
server.join();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Attached is the jetty .xml file attached for reference.
Could you please let me know what went wrong in this ?
Best Regards,
mitul
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="FileServer" class="org.eclipse.jetty.server.Server">
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="port">50091</Set>
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
<New id="handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New id="contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
</Item>
<Item>
<New id="defaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
<!-- ======================================================= -->
<!-- Configure specific contexts -->
<!-- ======================================================= -->
<Ref id="contexts">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<!-- ======================================================= -->
<!-- Configure a context directly - no XML parser required -->
<!-- ======================================================= -->
<Item>
<New id="aContext" class="org.eclipse.jetty.servlet.ServletContextHandler">
<Set name="contextPath">/timeline</Set>
<Set name="resourceBase">newWP/testapplication/src/</Set>
<Set name="handler">
<New id="javadocServletHandler" class="org.eclipse.jetty.servlet.ServletHandler">
<Set name="servlets">
<Array type="org.eclipse.jetty.servlet.ServletHolder">
<Item>
<New class="org.eclipse.jetty.servlet.ServletHolder">
<Set name="name">Timeline</Set>
<Set name="className">org.eclipse.jetty.servlet.DefaultServlet</Set>
</New>
</Item>
</Array>
</Set>
<Set name="servletMappings">
<Array type="org.eclipse.jetty.servlet.ServletMapping">
<Item>
<New class="org.eclipse.jetty.servlet.ServletMapping">
<Set name="pathSpec">/</Set>
<Set name="servletName">Timeline</Set>
</New>
</Item>
</Array>
</Set>
</New>
</Set>
</New>
</Item>
</Array>
</Set>
</Ref>
</Configure>