Note that there are some explanatory texts on larger screens.

plurals
  1. POExecutable war file that starts jetty without maven
    primarykey
    data
    text
    <p>I'm trying to make an "executable" war file (<code>java -jar myWarFile.war</code>) that will start up a Jetty webserver that hosts the webapp contained in the WAR file I executed.</p> <p>I found <a href="http://eclipsesource.com/blogs/2009/10/02/executable-wars-with-jetty/" rel="noreferrer">a page</a> that described how to make what I'm looking for:</p> <p>However, following that advice along with how I think I'm supposed to make an executable jar (war) isn't working.</p> <p>I have an Ant task creating a WAR file with a manifest that looks like:</p> <blockquote> <pre><code>Manifest-Version: 1.0 Ant-Version: Apache Ant 1.7.1 Created-By: 1.5.0_18-b02 (Sun Microsystems Inc.) Main-Class: Start </code></pre> </blockquote> <p>The contents of the WAR file look like:</p> <pre><code>&gt; Start.class &gt; jsp &gt; build.jsp &gt; META-INF &gt; MANIFEST.MF &gt; WEB-INF &gt; lib &gt; jetty-6.1.22.jar &gt; jetty-util.6.1.22.jar </code></pre> <p>When I try to execute the WAR file, the error is:</p> <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/mortbay/jetty/Handler Caused by: java.lang.ClassNotFoundException: org.mortbay.jetty.Handler at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: Start. Program will exit. </code></pre> <p>There appears to be two errors here: one where it seems the JAR files can't be found, and one where the <code>Start</code> class can't be found.</p> <p>To fix the first one, I put the Jetty JAR files in the base of the WAR file and tried again -- same error. I also tried adding the <code>WEB-INF/lib/&lt;specific-JAR-files&gt;</code> to the <code>Class-Path</code> attribute of the manifest. That did not work either.</p> <p>Does anyone have any insight as to what I'm doing right/wrong and how I can get this executable WAR file up and running?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload