Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jetty Servlet does not run -- getting directory listing instead

I'm trying to get a servlet built and running in Netbeans to run on a jetty server. Deploying locally always works, however deploying on Jetty results in a directory listing rather than the servlet actually running.

The problem seems to be with 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'm deploying with a contex mapping setup this way:

<?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 greatly appricated.

like image 277
David Hamilton Avatar asked Aug 25 '09 15:08

David Hamilton


1 Answers

I have not worked with jetty but I would test the following url:

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

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

<url-pattern>/</url-pattern>

<url-pattern>*</url-pattern>

like image 106
ATorras Avatar answered Sep 28 '22 11:09

ATorras