我正在尝试首次在AWS Elastic Beanstalk上启动我的Web应用程序(平台:Tomcat 8,其中Java 8在64位Amazon Linux / 3.0.0上运行)。
它成功地在beanstalk中创建应用程序但是当它尝试启动我的应用程序(上传了一个战争)时它会抛出一个错误:
04-Jun-2018 20:44:02.060 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.filterStart Exception starting filter SecurePathFilter
java.lang.AbstractMethodError
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4708)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5348)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1126)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1868)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
SecurePathFilter是一个javax.servlet.Filter类,所以我想可能是tomcat上缺少jsp和servlet api jar(或者我在本地使用的其他版本)但是如何检查这个?我怎么能添加/更改它们?
编辑: 根据要求,我的web.xml的相关部分:
<filter>
<filter-name>SecurePathFilter</filter-name>
<filter-class>be.qsds.sade.filters.SecurePathFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SecurePathFilter</filter-name>
<url-pattern>/secure/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
我的SecurePathFilter类大致是:
public class SecurePathFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
...
filterChain.doFilter(request, response);
}
}
答案 0 :(得分:0)
@jontro带领我找到解决问题的正确方向。我在本地使用最新版本的javax.servlet-api(4.0.1)构建我的应用程序,其中在AWS上自动部署的Tomcat8.5使用旧版本(3.1.0)。
我改变了我的pom中的版本,添加了一些缺失的方法,重建并上传了我的战争和尤里卡!
感谢您的指导!