spring - Unable to embedded tomcat war file using command prompt -
i have started add embedded tomcat in our spring web application. working fine in eclipse. trying start application using command prompt,it giving following exception
no main manifest attribute ,in order-spring-mvc-web-1.0-snapshot.war
in pom.xml file follows
<dependency> <groupid>org.apache.tomcat.embed</groupid> <artifactid>tomcat-embed-core</artifactid> <version>${tomcat.version}</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.apache.tomcat.embed</groupid> <artifactid>tomcat-embed-logging-juli</artifactid> <version>${tomcat.version}</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.apache.tomcat.embed</groupid> <artifactid>tomcat-embed-jasper</artifactid> <version>${tomcat.version}</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.apache.tomcat</groupid> <artifactid>tomcat-jasper</artifactid> <version>${tomcat.version}</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.apache.tomcat</groupid> <artifactid>tomcat-jasper-el</artifactid> <version>${tomcat.version}</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.apache.tomcat</groupid> <artifactid>tomcat-jsp-api</artifactid> <version>${tomcat.version}</version> <scope>provided</scope> </dependency>
my main class follows
public class embeddedtomcatmain { public static void main(string[] args) throws exception { string webappdirlocation = "src/main/webapp/"; tomcat tomcat = new tomcat(); string webport = system.getenv("port"); if(webport == null || webport.isempty()) { webport = "8080"; } tomcat.setport(integer.valueof(webport)); standardcontext ctx = (standardcontext) tomcat.addwebapp("/", new file(webappdirlocation).getabsolutepath()); system.out.println("configuring app basedir: " + new file("./" + webappdirlocation).getabsolutepath()); file additionwebinfclasses = new file("target/classes"); webresourceroot resources = new standardroot(ctx); resources.addpreresources(new dirresourceset(resources, "/web-inf/classes", additionwebinfclasses.getabsolutepath(), "/")); ctx.setresources(resources); tomcat.start(); tomcat.getserver().await(); } }
it creates 1 war file.
Comments
Post a Comment