Jetty Servlet does not start - a directory listing appears instead

I am trying to run a servlet created and running on Netbeans to run on a mooring server. Deploying locally always works, but deploying to Jetty results in a directory listing, not a really running servlet.

The problem seems to be related to the context configuration, but I have no idea what I'm doing wrong.

Here is the XML for web.xml in the war file:

<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <servlet> <description>Raw Query</description> <servlet-name>query</servlet-name> <servlet-class>core.SQL</servlet-class> </servlet> <servlet-mapping> <servlet-name>query</servlet-name> <url-pattern>/query</url-pattern> </servlet-mapping> <session-config> <session-timeout> 30 </session-timeout> </session-config> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> 

On the Jetty side, I deploy with the configuration of the path mapping as follows:

 <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> <Configure class="org.mortbay.jetty.webapp.WebAppContext"> <Set name="contextPath">/query</Set> <Set name="war"> <SystemProperty name="jetty.home" default="."/>/webapps/Link/I5Link.war </Set> </Configure> 

Any help is very convenient.

+6
java servlets jetty
source share
1 answer

I did not work with the berth, but I would check the following URL:

http: // localhost: 8080 / query / query? whateverYouNeed

If this works, I would change your <url-pattern> for one of the following:

<URL pattern> / </ URL pattern>

<URL pattern> * </ URL pattern>

+3
source share

All Articles