美文网首页
maven web项目部署问题 严重: Error filter

maven web项目部署问题 严重: Error filter

作者: 丹丹十个胆小鬼 | 来源:发表于2019-11-14 17:29 被阅读0次
十一月 14, 2019 10:48:56 下午 org.apache.catalina.startup.HostConfig undeploy
信息: Undeploying context [/bookstore]
十一月 14, 2019 10:49:06 下午 org.apache.catalina.startup.HostConfig deployWAR
信息: Deploying web application archive /usr/local/tomcat/apache-tomcat-7.0.57/webapps/bookstore.war
十一月 14, 2019 10:49:09 下午 org.apache.catalina.core.StandardContext startInternal
严重: Error filterStart
十一月 14, 2019 10:49:09 下午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/bookstore] startup failed due to previous errors
十一月 14, 2019 10:49:09 下午 org.apache.catalina.startup.HostConfig deployWAR
信息: Deployment of web application archive /usr/local/tomcat/apache-tomcat-7.0.57/webapps/bookstore.war has finished in 2,822 ms

引起问题的原因:打包的jdk 和部署的jdk版本不一致

pom.xml配置文件内的配置,只负责编译,并不负责打包,pom.xml配置的jdk版本并不负责打包
pom.xml文件:

<plugins>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                    <port>80</port>
                    <!-- 项目访问路径  本例:localhost:9090,  如果配置的aa, 则访问路径为localhost:9090/aa-->
                    <path>/bookstore</path>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>

这里配置的是编译的JDK版本,真正打包的JDK版本需要到maven安装目录下的conf/settings.xml文件中修改,添加如下内容(服务器上安装的JDK是1.7版本):

    <profile>
        <id>jdk-1.7</id>
        <activation>
            <activeByDefault>true</activeByDefault>
            <jdk>1.7</jdk>
        </activation>
        <properties>
            <maven.compiler.source>1.7</maven.compiler.source>
            <maven.compiler.target>1.7</maven.compiler.target>
            <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
        </properties>
    </profile>  
  </profiles>

在解决这个问题的同时也发现一个问题:pom.xml配置Tomcat端口是80,但是部署在服务器以后,访问却要通过8080端口。
其实pom.xml的Tomcat配置只是用maven启动的配置,用Tomcat启动的话还是8080,需要如果想要改端口,需要另外在Tomcat上来配置。

相关文章

网友评论

      本文标题:maven web项目部署问题 严重: Error filter

      本文链接:https://www.haomeiwen.com/subject/lrorictx.html