Reputation: 182
I use jetty in my spring app. After migrating from Jetty 8 to Jetty 9 (replacing SelectChannelConnector with ServerConnector) I'm left with 404 error code after navigating to main website address (spring security redirects me to /login) and log:
ERROR: PWC6117: File "/Users/jonny/projects/mypro/modules/backoffice/src/main/webapp/login" not found
it looks like jetty 9 doesn't honor web.xml file?, which is in my case
<servlet>
<servlet-name>login</servlet-name>
<jsp-file>/login.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
and my configuration of WebApp object is:
Server server = new Server();
WebAppContext webapp = new WebAppContext();
webapp.setContextPath(path);
webapp.setDescriptor("*src/main/webapp*/WEB-INF/web.xml");
webapp.setBaseResource(new ResourceCollection("*src/main/webapp*"));
HandlerList handlers = new HandlerList();
ServerConnector connector = new ServerConnector(server);
connector.setPort(*port*);
server.setConnectors(new Connector[]{connector});
handlers.addHandler(webApp);
server.setHandler(handlers);
server.start();
server.join();
I wish that /login
served login.jsp
, how to do that?
But the body of login.jsp
is pure html and all I want is to serve it from /login
context
Old: While searching for a hint I red:
but still don't know how to properly setup jetty with web.xml
, any ideas?
Upvotes: 0
Views: 1094
Reputation: 49515
If that code snippet represents how you are initializing your webapp, then you are missing a lot of JSP initialization steps.
There's an example project produced by the Jetty Project showing how to use JSP with embedded Jetty at
https://github.com/jetty-project/embedded-jetty-jsp
Pay attention to ...
(just to name a few big ones)
Upvotes: 0