I have a single web-service implemented in Jersey (no container or anything else). When I run it through maven jetty:run, it works fine but I get the HTTP ERROR 404 when I use java -jar target/dependency/jetty-runner.jar --port 9090 target/*.war
I checked a similar post here but the solution does not work for me.
Here’s how my pom.xml looks like:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.22</version>
<configuration>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>9090</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<jetty-config>jetty.xml</jetty-config>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals><goal>copy</goal></goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-runner</artifactId>
<version>8.1.6.v20120903</version>
<destFileName>jetty-runner.jar</destFileName
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
I would appreciate any hint to solve my problem.
The problem was that the artifactId of my project was XXX. When I used mvn jetty:run, the url looked like this:
localhost:9090/XXX/path/to/service. It did not return anything by calling:localhost:9090/path/to/service. However, when I change it tojava -jar target/dependency/jetty-runner.jar --port 9090 target/*.war, the url should belocalhost:9090/path/to/serviceand not the other one (localhost:9090/XXX/path/to/service).I don’t know what caused this setting, but at least I can get it to work.