0

I am using this code to deploy a web application. I want to add webserver functionality. For this purpose I have modified pom.xml by adding this code fragment:

<plugins>
...
    <plugin>
     <groupId>org.eclipse.jetty</groupId>
     <artifactId>jetty-maven-plugin</artifactId>
     <version>9.0.5.v20130815</version>
    </plugin>
...
</plugins>

Also I added in the root of the project the folder webapp with this structure:

+ webapp
    +META-INF
    +WEB-INF
        +lib
        -web.xml
    -index.html
    -index2.html

In web.xml I have this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>test-jetty</display-name>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

I can compile the project by two ways:

  1. By Maven: SOAP and REST work, but webserver not. Steps I do:
    • (in project root) mvn package
    • cd target
    • java -jar server.jar
  2. By Jetty: Web server works but SOAP and REST not. Steps I do:
    • (in project root) mvn jetty:run OR
    • (in Eclipse) Run > Run as > Run with Jetty

How can I integrate both functionalities?

Angel F.
  • 176
  • 1
  • 16
  • I have done several modifications, but didn't success. I have an idea: Could I run with Jetty and call Main.java at start? – Angel F. Jul 30 '15 at 12:26
  • You might want to see [this](http://stackoverflow.com/q/10284584/2587435) – Paul Samsotha Jul 30 '15 at 12:33
  • I am trying, but I'm not be able to change ServletContectHandler to ResourceHandler. I'm not understand the difference and how I should implement this class. – Angel F. Jul 31 '15 at 07:23

0 Answers0