0
我有部署,並在獨立的Tomcat 8.0.28服務器與Java 8.0.66嵌入式Tomcat的8未能啓動
我想從一個嵌入的Tomcat運行它運行集成測試運行的罐子。 戰爭部署,但無法啓動,我跑出去的想法,我收到以下錯誤:
Dec 07, 2015 6:11:46 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-9191"]
Dec 07, 2015 6:11:46 PM org.apache.tomcat.util.net.NioSelectorPool
getSharedSelector
INFO: Using a shared selector for servlet write/read
Dec 07, 2015 6:11:46 PM org.apache.catalina.core.StandardService
startInternal
INFO: Starting service Tomcat
Dec 07, 2015 6:11:46 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.28
Dec 07, 2015 5:43:47 PM org.apache.catalina.startup.ContextConfig
getDefaultWebXmlFragment
INFO: No global web.xml found
Dec 07, 2015 5:43:47 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException:
org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Tomcat].StandardHost[localhost].
StandardContext[/StrateboBackEnd]]
...
Caused by: org.apache.catalina.LifecycleException:
Failed to start component StandardEngine[Tomcat].StandardHost[localhost].
StandardContext[/myApp]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 6 more
Caused by: java.lang.NoSuchMethodError:
javax.servlet.ServletContext.getClassLoader()Ljava/lang/ClassLoader;
我有嵌入的Tomcat
final Tomcat tomcat = new Tomcat();
tomcat.setPort(9191);
File baseDir = new File(".");
Context context = tomcat.addContext("", baseDir.getAbsolutePath());
tomcat.addWebapp("/Myapp", "C://Users//Add//git//Myapp//build//libs//Myapp-1.1.war");
tomcat.enableNaming();
ContextResource res = new ContextResource();
res.setName("jdbc/myDatabase");
res.setType("javax.sql.DataSource");
res.setAuth("Container");
res.setProperty("username", "username");
res.setProperty("password", "password");
res.setProperty("driverClassName","net.sourceforge.jtds.jdbc.Driver");
res.setProperty("url", "jdbc:jtds:sqlserver://127.0.0.1:1433//myDatabase");
res.setProperty("maxTotal", "10");
res.setProperty("maxIdle", "10");
res.setProperty("maxWaitMillis", "10000");
res.setProperty("removeAbandonedTimeout","300");
res.setProperty("defaultAutoCommit","true");
context.getNamingResources().addResource(res);
tomcat.start();
tomcat.getServer().await();
我有一個上下文以下設置。 xml,我用於正常的部署,但這並不能從我所知道的嵌入式中讀取。
由於在獨立的jar作品我知道罐子裏是沒有問題的
有了這個信息行 信息:沒有全局web.xml中找到 可能指向一個問題,但一直沒找到參考 以防萬一,這裏是我的依賴
compile 'org.apache.tomcat:tomcat-util:8.0.28'
compile 'org.apache.tomcat.embed:tomcat-embed-core:8.0.28'
compile 'org.apache.tomcat.embed:tomcat-embed-jasper:8.0.28'
compile 'org.apache.tomcat.embed:tomcat-embed-logging-juli:8.0.28'
compile 'org.apache.tomcat:tomcat-dbcp:8.0.28'
任何建議gradle這個文件的相關部分不勝感激? 有沒有什麼辦法可以讓tomcat提供更好的反饋意見?