[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jetty-users] Embedded Jetty environment does not work
|
hi all,
I am trying to set up environment using embedded jetty. I followed the
instructions from the tutorial http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty using the OneWebAppUnassembled example.
This is the structure of my web project:
myDir
myDir/context/webapp (my web app directory containing index.jsp)
myDir/context/webapp/WEB-INF (contains descriptor web.xml, libs and classes)
myDir/src (source code of some java classes)
now I was trying to deploy jetty inside this web project.
I run the main class within eclipse:
I open on the browser the url
http://localhost:8080/testComet/index.jsp
unfortunately nothing appears.
any suggestions?
thanks markus
this is my code:
**********************************
public static void main(String[] args) {
Server jettyServer = null;
try {
jettyServer = new Server(8080);
SocketConnector conn = new SocketConnector();
conn.setAcceptQueueSize(100);
jettyServer.setConnectors(new Connector[] { conn });
String home = System.getProperty("user.dir");
WebAppContext context = new WebAppContext();
context.setDescriptor(home + "/context/webapp/WEB-INF/web.xml");
context.setResourceBase(".");
context.setContextPath("/testComet");
context.setClassLoader(Thread.currentThread().getContextClassLoader());
context.setParentLoaderPriority(true);
context.setTempDirectory(new File(home + "/context/webapp/tmp"));
jettyServer.setHandler(context);
jettyServer.start();
} catch (Exception e) {
e.printStackTrace();
}
}
**********************************
using:
jdk 6.0
jetty: 7.1.6.v20100715