gpt4 book ai didi

java.lang.AbstractMethodError : javax. servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)

转载 作者:行者123 更新时间:2023-11-28 22:53:55 31 4
gpt4 key购买 nike

java.lang.AbstractMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;

你好,我正在 vaadin 中开发一个网络服务器。我的应用程序运行良好,但现在当我启动它时,出现以下错误

java.lang.AbstractMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;
at org.apache.jasper.compiler.Validator$ValidateVisitor.<init>(Validator.java:515) ~[jasper.jar:7.0.55]
at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1845) ~[jasper.jar:7.0.55]
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:217) ~[jasper.jar:7.0.55]
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373) ~[jasper.jar:7.0.55]
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353) ~[jasper.jar:7.0.55]
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) ~[jasper.jar:7.0.55]
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657) ~[jasper.jar:7.0.55]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) ~[jasper.jar:7.0.55]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) ~[jasper.jar:7.0.55]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) ~[jasper.jar:7.0.55]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) ~[servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) ~[catalina.jar:7.0.55]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) ~[catalina.jar:7.0.55]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) ~[catalina.jar:7.0.55]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [catalina.jar:7.0.55]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) [catalina.jar:7.0.55]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:7.0.55]
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:312) [catalina.jar:7.0.55]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.55]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) [catalina.jar:7.0.55]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) [tomcat-coyote.jar:7.0.55]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) [tomcat-coyote.jar:7.0.55]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736) [tomcat-coyote.jar:7.0.55]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695) [tomcat-coyote.jar:7.0.55]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_25]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-coyote.jar:7.0.55]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25]

对于依赖项,我使用的是 maven,我的 pom 是

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ContestiOpenDataJungle</groupId>
<artifactId>ContestiOpenDataJungle</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
</parent>

<properties>
<vaadin.version>7.4.4</vaadin.version>
<java.version>1.7</java.version>
<tomcat.version>7.0.59</tomcat.version>
</properties>

<repositories>
<repository>
<id>eXo-pub-repo</id>
<name>eXoPlatform public repo</name>
<url>http://repository.exoplatform.org/public</url>
</repository>

<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
</repositories>

<dependencies>
<!-- The core server part of Vaadin -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>${vaadin.version}</version>
</dependency>

<!-- Vaadin themes -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>${vaadin.version}</version>
</dependency>

<!-- Push support -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
<version>${vaadin.version}</version>
</dependency>
<!-- Precompiled DefaultWidgetSet -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<version>${vaadin.version}</version>
</dependency>

<!-- Compiler for custom widget sets. Should not be deployed -->
<!-- <dependency> -->
<!-- <groupId>com.vaadin</groupId> -->
<!-- <artifactId>vaadin-client-compiler</artifactId> -->
<!-- <version>${vaadin.version}</version> -->
<!-- </dependency> -->

<!-- Vaadin client side, needed for widget set compilation -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<version>${vaadin.version}</version>
<exclusions>
<exclusion>
<artifactId>validation-api</artifactId>
<groupId>javax.validation</groupId>
</exclusion>
</exclusions>
</dependency>

<!-- Compiler for custom widget sets. Should not be deployed -->
<dependency>
<groupId>org.exoplatform.core</groupId>
<artifactId>exo.core.component.security.core</artifactId>
<version>2.5.12-GA</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>

<dependency>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/WebContent/WEB-INF/lib/TagCloud.jar</systemPath>
</dependency>

<dependency>
<groupId>eu.exeura</groupId>
<artifactId>DBSQLContesti2</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>


<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot</artifactId>
<version>1.0.0.beta2</version>
</dependency>

<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>ru.xpoft.vaadin</groupId>
<artifactId>spring-vaadin-integration</artifactId>
<version>3.1</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
</dependency>

<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring</artifactId>
<version>1.0.0.beta1</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
</exclusion>
<exclusion>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-shared</artifactId>
</exclusion>
</exclusions>
</dependency>


<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>

</dependencies>

<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>ContestiOpenDataJungle</warName>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>

服务器是 Tomcat 版本 7.0.59。版本java是1.7。我发现错误可能是针对以下 jar 的:

servlet.jar
servlet-api.jar
j2ee.jar

因为他们有文件javax.servlet,而我没有。 https://community.oracle.com/thread/1397338?start=0

感谢帮助

最佳答案

您的项目缺少以下依赖项:

<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>7.0.59</version>
</dependency>

关于java.lang.AbstractMethodError : javax. servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32456291/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com