maven 项目下报错: 500, java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.index_j

来源:互联网 发布:核酸数据库中国 编辑:程序博客网 时间:2024/05/29 03:37

maven 项目,通过 Spring MVC 4 + Hibernate 4 构建web项目,完成部署后访问报错为 java. lang. ClassNotFoundException :org.apache.jsp. WEB_002dINF. classes.views.index_jsp

错误原因

错误原因是由于在项目jsp页面中引用了jstl 标签库,但是在maven的配置文件中错误的添加了其他的jstl包,修改后问题解决。
正确的jstl maven 包依赖
        <!--jstl-->        <!-- https: //mvnrepository.com/ artifact/ javax. servlet. jsp. jstl/jstl -->        <dependency>            <groupId>org.glassfish.web</groupId>            <artifactId>javax.servlet.jsp.jstl</artifactId>            <version>1.2.4</version>        </dependency>        <dependency>            <groupId>javax.servlet.jsp.jstl</groupId>            <artifactId>javax.servlet.jsp.jstl-api</artifactId>            <version>1.2.1</version>        </dependency>

附加信息: maven 使用tomcat 相关jar 包

maven 项目添加 tomcat jar 包依赖,但是不在发布时引用

        <!-- 注意 artifactid  不是 javaee-api -->        <dependency>            <groupId>javax</groupId>            <artifactId>javaee-web-api</artifactId>            <version>8.0</version>            <scope>provided</scope>        </dependency>

附件: 全部 pom.xml

<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/maven-v4_0_0.xsd">    <modelVersion>4.0.0</modelVersion>    <groupId>jz</groupId>    <artifactId>pt</artifactId>    <packaging>war</packaging>    <version>1.0-SNAPSHOT</version>    <name>webapp simple</name>    <url>http://maven.apache.org</url>    <properties>        <maven.compiler.source>1.8</maven.compiler.source>        <maven.compiler.target>1.8</maven.compiler.target>    </properties>    <dependencies>        <dependency>            <groupId>junit</groupId>            <artifactId>junit</artifactId>            <version>3.8.1</version>            <scope>test</scope>        </dependency>        <dependency>            <groupId>javax</groupId>            <artifactId>javaee-web-api</artifactId>            <version>8.0</version>            <scope>provided</scope>        </dependency>        <!-- https://mvnrepository.com/artifact/aopalliance/aopalliance -->        <dependency>            <groupId>aopalliance</groupId>            <artifactId>aopalliance</artifactId>            <version>1.0</version>        </dependency>        <!--https://mvnrepository.com/artifact/commons-logging/commons-logging-->        <dependency>            <groupId>commons-logging</groupId>            <artifactId>commons-logging</artifactId>            <version>1.2</version>        </dependency>        <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->        <dependency>            <groupId>commons-io</groupId>            <artifactId>commons-io</artifactId>            <version>2.4</version>        </dependency>        <!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->        <dependency>            <groupId>commons-fileupload</groupId>            <artifactId>commons-fileupload</artifactId>            <version>1.3.1</version>        </dependency>        <!-- database connection pool library -->        <!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->        <dependency>            <groupId>com.microsoft.sqlserver</groupId>            <artifactId>sqljdbc4</artifactId>            <version>4.0</version>        </dependency>        <!-- https://mvnrepository.com/artifact/com.mchange/c3p0 -->        <dependency>            <groupId>com.mchange</groupId>            <artifactId>c3p0</artifactId>            <version>0.9.5.2</version>        </dependency>        <!--jstl-->        <!-- https://mvnrepository.com/artifact/javax.servlet.jsp.jstl/jstl -->        <dependency>            <groupId>org.glassfish.web</groupId>            <artifactId>javax.servlet.jsp.jstl</artifactId>            <version>1.2.4</version>        </dependency>        <dependency>            <groupId>javax.servlet.jsp.jstl</groupId>            <artifactId>javax.servlet.jsp.jstl-api</artifactId>            <version>1.2.1</version>        </dependency>        <!-- spring framework core start-->        <!--https://mvnrepository.com/artifact/org.springframework/spring-core-->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-core</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-beans</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.springframework/spring-aop -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-aop</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-context</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.springframework/spring-context-support -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-context-support</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.springframework/spring-aspects -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-aspects</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.springframework/spring-expression -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-expression</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.springframework/spring-instrument -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-instrument</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.springframework/spring-instrument-tomcat -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-instrument-tomcat</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-jdbc</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.springframework/spring-jms -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-jms</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.springframework/spring-messaging -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-messaging</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-orm</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-oxm</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-test</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-tx</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- spring framework core end-->        <!-- spring framework mvc start-->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-web</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-webmvc</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-webmvc-portlet</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-websocket</artifactId>            <version>4.3.11.RELEASE</version>        </dependency>        <!-- spring framework mvc end-->        <!-- hibernate core start-->        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->        <!-- https://mvnrepository.com/artifact/antlr/antlr -->        <dependency>            <groupId>antlr</groupId>            <artifactId>antlr</artifactId>            <version>2.7.7</version>        </dependency>        <!-- https://mvnrepository.com/artifact/dom4j/dom4j -->        <dependency>            <groupId>dom4j</groupId>            <artifactId>dom4j</artifactId>            <version>1.6.1</version>        </dependency>        <dependency>            <groupId>org.hibernate</groupId>            <artifactId>hibernate-core</artifactId>            <version>4.3.11.Final</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.hibernate.common/hibernate-commons-annotations -->        <dependency>            <groupId>org.hibernate.common</groupId>            <artifactId>hibernate-commons-annotations</artifactId>            <version>4.0.5.Final</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.hibernate.javax.persistence/hibernate-jpa-2.1-api -->        <dependency>            <groupId>org.hibernate.javax.persistence</groupId>            <artifactId>hibernate-jpa-2.1-api</artifactId>            <version>1.0.0.Final</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.javassist/javassist -->        <dependency>            <groupId>org.javassist</groupId>            <artifactId>javassist</artifactId>            <version>3.20.0-GA</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.jboss.logging/jboss-logging -->        <dependency>            <groupId>org.jboss.logging</groupId>            <artifactId>jboss-logging</artifactId>            <version>3.1.4.GA</version>        </dependency>        <!-- https://mvnrepository.com/artifact/org.jboss.spec.javax.transaction/jboss-transaction-api_1.1_spec -->        <dependency>            <groupId>org.jboss.spec.javax.transaction</groupId>            <artifactId>jboss-transaction-api_1.1_spec</artifactId>            <version>1.0.1.Final</version>        </dependency>        <!-- hibernate core end-->    </dependencies>    <build>        <finalName>ProvinceTrace</finalName>    </build></project>
阅读全文
0 0