Thank you for providing the example code. I have changed my ServerConnector class accordingly and included asm and annotations-api jars to classpath which were causing classnotfound exception. After making all these changes, I still get HTTP ERROR 404 Problem accessing /. Reason:Not Found. I have uncommented Options for jsp in start.ini and have javax.servlet.jsp-2.2.0.v201112011158.jar in lib/jsp of jetty server.
Initializing server...
Starting server...
2013-05-29 09:43:45.308:INFO:oejs.Server:main: jetty-9.0.0.v20130308
2013-05-29 09:43:45.411:INFO:oejpw.PlusConfiguration:main: No Transaction manager found - if your webapp requires one, please configure one.
2013-05-29 09:43:45.425:INFO:oejw.StandardDescriptorProcessor:main: NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet
2013-05-29 09:43:45.441:INFO:oejsh.ContextHandler:main: started o.e.j.w.WebAppContext@1ac6103{/,file:/C:/Users/XCB638/svn/test-jetty-webapp/src/main/webapp,AVAILABLE}
2013-05-29 09:43:45.467:INFO:oejs.ServerConnector:main: Started ServerConnector@163b85{HTTP/1.1}{
0.0.0.0:8080}
2013-05-29 09:43:57.127:INFO:/:qtp27880366-15: No JSP support. Check that JSP jars are in lib/jsp and that the JSP option has been specified to start.jar
package com.motorolasolutions.atr.server;
import org.eclipse.jetty.annotations.AnnotationConfiguration;
import org.eclipse.jetty.plus.webapp.EnvConfiguration;
import org.eclipse.jetty.plus.webapp.PlusConfiguration;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.FragmentConfiguration;
import org.eclipse.jetty.webapp.MetaInfConfiguration;
import org.eclipse.jetty.webapp.TagLibConfiguration;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.webapp.WebInfConfiguration;
import org.eclipse.jetty.webapp.WebXmlConfiguration;
public class ServerConnector
{
@SuppressWarnings("deprecation")
public static void main(String[] args) throws Exception
{
System.out.println("Initializing server...");
final Server server = new Server(8080);
System.out.println("Starting server...");
try
{
WebAppContext context = new WebAppContext();
context.setDescriptor(context+"/WEB-INF/web.xml");
context.setResourceBase("../test-jetty-webapp/src/main/webapp");
context.setConfigurations(new Configuration[] {
new AnnotationConfiguration(), new WebXmlConfiguration(),
new WebInfConfiguration(), new TagLibConfiguration(),
new PlusConfiguration(), new MetaInfConfiguration(),
new FragmentConfiguration(), new EnvConfiguration() });
context.setContextPath("/");
context.setParentLoaderPriority(true);
server.setHandler(context);
server.start();
server.join();
System.out.println("Server running...");
}
catch (Exception e)
{
System.out.println("Failed to start server!");
return;
}
}
}