ここでサンプルアプリケーションを実行していますhttps://github.com/heroku/devcenter-embedded-tomcat
'mvn package'を使用してアプリケーションを実行しましたが、ビルドは成功しました。しかし、 "sh target / bin / webapp"を使用してスクリプトを実行すると、以下のエラーが発生します。
C:\ Documents and Settings \ srinivasa \ Documents \ワークスペース-sts-2.9.0.RELEASE\ sriniv as> sh target / bin /webappスレッド"main"の例外java.lang.NoClassDefFoundError:launch / Main原因:java。 lang.ClassNotFoundException:launch.Main 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:306)at sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:301)at java.lang.ClassLoader.loadClass(ClassLoader.java:247)見つかりませんでしたメインクラス:launch.Main。プログラムは終了します。
@james先生、このエラーが発生するのを手伝ってください
C:\Documents and Settings\srinivasa\Documents\workspace-sts-2.9.0.RELEASE\testhe
roku\target\bin>webapp.bat
configuring app with basedir: C:\Documents and Settings\srinivasa\Documents\work
space-sts-2.9.0.RELEASE\testheroku\target\bin\.\src\main\webapp
Apr 16, 2012 8:12:01 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Apr 16, 2012 8:12:01 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Apr 16, 2012 8:12:01 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.22
Apr 16, 2012 8:12:01 PM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base C:\Documents and Settings\srin
ivasa\Documents\workspace-sts-2.9.0.RELEASE\testheroku\target\bin\src\main\webap
p does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.
java:140)
私のpom.xml卿
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.heroku.sample</groupId>
<artifactId>embeddedTomcatSample</artifactId>
<version>1.0-SNAPSHOT</version>
<name>embeddedTomcatSample Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>7.0.22</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-logging-juli</artifactId>
<version>7.0.22</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>7.0.22</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>
<version>7.0.22</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper-el</artifactId>
<version>7.0.22</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jsp-api</artifactId>
<version>7.0.22</version>
</dependency>
</dependencies>
<build>
<finalName>embeddedTomcatSample</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<assembleDirectory>target</assembleDirectory>
<programs>
<program>
<mainClass>main.java.launch.Main</mainClass>
<name>webapp</name>
</program>
</programs>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
同じMain.java、HelloServlet.java、index.jspを使用しています