I tried to use tomcat 8 embedded for my application but i got this error:
Nov 21, 2017 11:37:18 AM org.apache.catalina.core.StandardContext setPath
WARNUNG: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to [] configuring app with basedir: C:\Users\hzammel\Downloads\boualiali-gestion_stock_mvc-086417808484\boualiali-gestion_stock_mvc-086417808484.\src\main\webapp Nov 21, 2017 11:37:19 AM org.apache.coyote.AbstractProtocol init
INFORMATION: Initializing ProtocolHandler ["http-nio-8080"] Nov 21, 2017 11:37:19 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMATION: Using a shared selector for servlet write/read Nov 21, 2017 11:37:19 AM org.apache.catalina.core.StandardService startInternal
INFORMATION: Starting service Tomcat Nov 21, 2017 11:37:19 AM org.apache.catalina.core.StandardEngine startInternal
INFORMATION: Starting Servlet Engine: Apache Tomcat/8.0.36 Nov 21, 2017 11:37:19 AM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFORMATION: No global web.xml found Nov 21, 2017 11:37:21 AM org.apache.catalina.core.ApplicationContext log INFORMATION: No Spring WebApplicationInitializer types detected on classpath Nov 21, 2017 11:37:21 AM org.apache.jasper.servlet.TldScanner scanJars
INFORMATION: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. Nov 21, 2017 11:37:22 AM org.apache.catalina.core.ApplicationContext log
INFORMATION: Initializing Spring root WebApplicationContext
this is my class Main :
public static void main(String[] args) throws LifecycleException,
InterruptedException, ServletException {
String docBase = "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(docBase).getAbsolutePath());
System.out.println("configuring app with basedir: " + new File("./" + docBase).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.addWebapp("", new File(docBase).getAbsolutePath());
System.out.println("configuring app with basedir: " + new File("./" + docBase).getAbsolutePath());
*/
tomcat.start();
tomcat.getServer().await();
my folders ##:
src
----------main
---------- webapp
----------WEB-INF
----------web.xml
any help please ??