简体   繁体   English

Elastic Beanstalk Servlet过滤器上的AWS Tomcat

[英]AWS Tomcat on Elastic Beanstalk servlet Filter

I'm trying to launch my web application for the first time on AWS Elastic Beanstalk (platform: Tomcat 8 with Java 8 running on 64bit Amazon Linux/3.0.0). 我试图首次在AWS Elastic Beanstalk(平台:在64位Amazon Linux / 3.0.0上运行Java 8的Tomcat 8)上启动Web应用程序。

It succeeds in creating the application in beanstalk but when it tries to launch my application (uploaded with a war) it throws an error: 它成功地在beantalk中创建了应用程序,但是当它尝试启动我的应用程序(加载了战争)时,抛出了错误:

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)

The SecurePathFilter is a javax.servlet.Filter class so I'm thinking it might be that jsp and servlet api jars are missing on the tomcat (or perhaps some other version of what I used locally) but how can I check this? SecurePathFilter是一个javax.servlet.Filter类,因此我想这可能是tomcat上缺少了jsp和servlet api罐(或者可能是我在本地使用的其他版本),但是如何检查呢? And how could I add/change them? 以及如何添加/更改它们?

Edit: As requested, the relevant pieces of my web.xml: 编辑:根据要求,我的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>

and my SecurePathFilter class is roughly: 而我的SecurePathFilter类大致是:

public class SecurePathFilter implements Filter {

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
        ...

        filterChain.doFilter(request, response);
    }
}

@jontro led me in the right direction of the solution to my problem. @jontro引导我朝着解决问题的正确方向发展。 I was building my application locally with the latest version of javax.servlet-api (4.0.1), where the Tomcat8.5 auto deployed on AWS uses an older version (3.1.0). 我使用最新版本的javax.servlet-api(4.0.1)在本地构建应用程序,其中自动部署在AWS上的Tomcat8.5使用较旧版本(3.1.0)。

I changed the version in my pom, added some missing methods, rebuilt and uploaded my war and eureka! 我在pom中更改了版本,添加了一些缺少的方法,重建并上传了war和eureka!

Thanks for the guidance! 感谢您的指导!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM