部署到tomcat时无法启动 Jfinal

问题: 无法启动 Jfinal 

环境: 开发 InteLLij IDEA , 部署: tomcat-9.0.21

现像: 在开发环境中已经完全正常,但是部署在tomcat时,无法启动JFinal

Tomcat启动提示如下:

NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED

09-Feb-2020 17:31:54.133 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server.服务器版本:        Apache Tomcat/9.0.21

09-Feb-2020 17:31:54.138 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server.构建:          Jun 4 2019 20:19:36 UTC

09-Feb-2020 17:31:54.139 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.21.0

09-Feb-2020 17:31:54.140 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 7

09-Feb-2020 17:31:54.141 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS.版本:            6.1

09-Feb-2020 17:31:54.142 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 结.造:          amd64

09-Feb-2020 17:31:54.143 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java 环境变量:             D:\java\jdk-12.0.1_x64

09-Feb-2020 17:31:54.144 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM 版本:           12.0.1+12

09-Feb-2020 17:31:54.144 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM.供应商:            Oracle Corporation

09-Feb-2020 17:31:54.145 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         D:\payment_server\tomcat-9.0.21

09-Feb-2020 17:31:54.146 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         D:\payment_server\tomcat-9.0.21

09-Feb-2020 17:31:54.152 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED

09-Feb-2020 17:31:54.153 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED

09-Feb-2020 17:31:54.154 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED

09-Feb-2020 17:31:54.154 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=D:\payment_server\tomcat-9.0.21\conf\logging.properties

09-Feb-2020 17:31:54.155 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager

09-Feb-2020 17:31:54.156 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048

09-Feb-2020 17:31:54.156 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources

09-Feb-2020 17:31:54.157 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=

09-Feb-2020 17:31:54.158 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=D:\payment_server\tomcat-9.0.21

09-Feb-2020 17:31:54.159 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=D:\payment_server\tomcat-9.0.21

09-Feb-2020 17:31:54.159 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=D:\payment_server\tomcat-9.0.21\temp

09-Feb-2020 17:31:54.160 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.21] using APR version [1.6.5].

09-Feb-2020 17:31:54.161 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].

09-Feb-2020 17:31:54.161 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]

09-Feb-2020 17:31:54.173 信息 [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1a  20 Nov 2018]

09-Feb-2020 17:31:54.404 信息 [main] org.apache.coyote.AbstractProtocol.init 初始化协议处理器 ["http-nio-8080"]

09-Feb-2020 17:31:54.657 信息 [main] org.apache.coyote.AbstractProtocol.init 初始化协议处理器 ["ajp-nio-8009"]

09-Feb-2020 17:31:54.662 信息 [main] org.apache.catalina.startup.Catalina.load 服务器在[727]毫秒内初始化

09-Feb-2020 17:31:54.697 信息 [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]

09-Feb-2020 17:31:54.699 信息 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.21]

09-Feb-2020 17:31:55.935 信息 [main] org.apache.jasper.servlet.TldScanner.scanJars 至少有一个JAR被扫描用于TLD但尚未包含TLD。 为此记录器启用调试日志记录,以获取已扫描但未在其中找到TLD的完整JAR列表。 在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间。

09-Feb-2020 17:31:56.161 警告 [main] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [209] milliseconds.

09-Feb-2020 17:31:56.199 严重 [main] org.apache.catalina.core.StandardContext.startInternal One or more Filters failed to start. Full details will be found in the appropriate container log file

09-Feb-2020 17:31:56.200 严重 [main] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors

09-Feb-2020 17:31:56.209 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [D:\payment_server\tomcat-9.0.21\webapps\docs]

09-Feb-2020 17:31:56.246 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\payment_server\tomcat-9.0.21\webapps\docs] has finished in [37] ms

09-Feb-2020 17:31:56.247 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [D:\payment_server\tomcat-9.0.21\webapps\examples]

09-Feb-2020 17:31:56.651 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\payment_server\tomcat-9.0.21\webapps\examples] has finished in [404] ms

09-Feb-2020 17:31:56.658 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [D:\payment_server\tomcat-9.0.21\webapps\host-manager]

09-Feb-2020 17:31:56.694 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\payment_server\tomcat-9.0.21\webapps\host-manager] has finished in [36] ms

09-Feb-2020 17:31:56.695 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [D:\payment_server\tomcat-9.0.21\webapps\manager]

09-Feb-2020 17:31:56.726 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\payment_server\tomcat-9.0.21\webapps\manager] has finished in [31] ms

09-Feb-2020 17:31:56.731 信息 [main] org.apache.coyote.AbstractProtocol.start 开始协议处理句柄["http-nio-8080"]

09-Feb-2020 17:31:56.812 信息 [main] org.apache.coyote.AbstractProtocol.start 开始协议处理句柄["ajp-nio-8009"]

09-Feb-2020 17:31:56.846 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in [2,183] milliseconds



Tomcat 参数修改: \conf\server.xml 

      <Host name="localhost"  appBase="webapps"

            unpackWARs="true" autoDeploy="true">

仅增加下面这行,其它参数未修改

        <Context path="" docBase="D:/payment_server/tomcat-9.0.21/www/PaymentServices_war" reloadable="false" />

    ...

      </Host>



web.xml 配置


<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"

         version="4.0">

    <filter>

        <filter-name>jfinal</filter-name>

        <filter-class>com.jfinal.core.JFinalFilter</filter-class>

        <init-param>

            <param-name>configClass</param-name>

            <param-value>com.base.MainConfig</param-value>

        </init-param>

    </filter>

    <filter-mapping>

        <filter-name>jfinal</filter-name>

        <url-pattern>/*</url-pattern>

    </filter-mapping>

</web-app>



com.base.MainConfig 代码如下:


package com.base;

import com.jfinal.config.*;

import com.jfinal.core.JFinal;

import com.jfinal.template.Engine;

import com.weixin.wxPayment;


public class MainConfig  extends JFinalConfig {

    @Override

    public void configConstant(Constants me) {

        me.setMaxPostSize(1073741824);

        me.setDevMode(true);

        me.setInjectDependency(true);

        // 配置对超类中的属性进行注入

        me.setInjectSuperClass(true);

    }

    /**

     * 启动入口,运行此 main 方法可以启动项目,此 main 方法可以放置在任意的 Class 类定义中,不一定要放于此

     * 只有单独调用时会用上此方法

     */

    public static void main(String[] args) {

        //JFinal.start("WebRoot", 80, "/", 5);

        JFinal.start("web", 80, "/");

    }

    @Override

    public void configRoute(Routes me) {

        System.out.println("启动路由");

        me.add("/", helpdefault.class,"index");

        me.add("/wxpayment", wxPayment.class,"index");

    }

    @Override

    public void configEngine(Engine me) {

    }

    @Override

    public void configPlugin(Plugins me) {

    }

    @Override

    public void configInterceptor(Interceptors me) {

    }

    @Override

    public void configHandler(Handlers me) {

    }

}

评论区

lhl_yn_km

2020-02-09 17:42

public void configRoute(Routes me) {

System.out.println("启动路由");

me.add("/", helpdefault.class,"index");

me.add("/wxpayment", wxPayment.class,"index");

}

TOMCAT 启动时 ,没出现上面调试信息,因此断定没有启动 Jfinal

JFinal

2020-02-09 18:05

关键信息是这句:
09-Feb-2020 17:31:56.199 严重 [main] org.apache.catalina.core.StandardContext.startInternal One or more Filters failed to start. Full details will be found in the appropriate container log file

注意去 tomcat 自身的 log file 中去找错误,现有异常并不明确。从代码上看没有什么问题

此外,建议使用 jfinal undertow 开发,而不是 JFinal.start(...) 使用的 jetty

说到 jetty ,我估计是你 jetty 的 jar 包没删干净,从而与 tomcat 的 jar 包相关冲突,注意看文档中的有关说明,注意看第二小节的内容:
https://jfinal.com/doc/1-7

lhl_yn_km

2020-02-09 20:56

09-Feb-2020 20:54:42.871 严重 [main] org.apache.catalina.core.StandardContext.filterStart 启动过滤器异常
java.lang.UnsupportedClassVersionError: Preview features are not enabled for com/base/MainConfig (class file version 56.65535). Try running with '--enable-preview' (无法载入的.类 [com.base.MainConfig])
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2424)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:865)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1334)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:332)
at com.jfinal.core.JFinalFilter.createJFinalConfig(JFinalFilter.java:119)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:60)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:270)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:251)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:102)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4530)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5169)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:932)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475)
09-Feb-2020 20:54:43.249 信息 [main] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
09-Feb-2020 20:54:43.249 信息 [main] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
09-Feb-2020 20:54:43.251 信息 [main] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('StockTicker', 'async.Stockticker@9e30f9a')
09-Feb-2020 20:55:09.235 信息 [Thread-4] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
09-Feb-2020 20:55:09.235 信息 [Thread-4] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()

lhl_yn_km

2020-02-09 20:57

09-Feb-2020 20:54:40.851 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server.服务器版本: Apache Tomcat/9.0.21
09-Feb-2020 20:54:40.855 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server.构建: Jun 4 2019 20:19:36 UTC
09-Feb-2020 20:54:40.856 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.21.0
09-Feb-2020 20:54:40.857 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 7
09-Feb-2020 20:54:40.857 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS.版本: 6.1
09-Feb-2020 20:54:40.858 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 结.造: amd64
09-Feb-2020 20:54:40.859 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java 环境变量: D:\java\jdk-12.0.1_x64
09-Feb-2020 20:54:40.859 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM 版本: 12.0.1+12
09-Feb-2020 20:54:40.860 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM.供应商: Oracle Corporation
09-Feb-2020 20:54:40.861 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: D:\payment_server\tomcat-9.0.21
09-Feb-2020 20:54:40.862 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: D:\payment_server\tomcat-9.0.21
09-Feb-2020 20:54:40.871 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
09-Feb-2020 20:54:40.871 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
09-Feb-2020 20:54:40.872 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
09-Feb-2020 20:54:40.874 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=D:\payment_server\tomcat-9.0.21\conf\logging.properties
09-Feb-2020 20:54:40.874 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
09-Feb-2020 20:54:40.875 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
09-Feb-2020 20:54:40.876 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
09-Feb-2020 20:54:40.877 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
09-Feb-2020 20:54:40.878 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=D:\payment_server\tomcat-9.0.21
09-Feb-2020 20:54:40.879 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=D:\payment_server\tomcat-9.0.21
09-Feb-2020 20:54:40.880 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=D:\payment_server\tomcat-9.0.21\temp
09-Feb-2020 20:54:40.881 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.21] using APR version [1.6.5].
09-Feb-2020 20:54:40.882 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
09-Feb-2020 20:54:40.883 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
09-Feb-2020 20:54:40.896 信息 [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1a 20 Nov 2018]
09-Feb-2020 20:54:41.125 信息 [main] org.apache.coyote.AbstractProtocol.init 初始化协议处理器 ["http-nio-8080"]
09-Feb-2020 20:54:41.360 信息 [main] org.apache.coyote.AbstractProtocol.init 初始化协议处理器 ["ajp-nio-8009"]
09-Feb-2020 20:54:41.365 信息 [main] org.apache.catalina.startup.Catalina.load 服务器在[719]毫秒内初始化
09-Feb-2020 20:54:41.403 信息 [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
09-Feb-2020 20:54:41.404 信息 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.21]
09-Feb-2020 20:54:42.600 信息 [main] org.apache.jasper.servlet.TldScanner.scanJars 至少有一个JAR被扫描用于TLD但尚未包含TLD。 为此记录器启用调试日志记录,以获取已扫描但未在其中找到TLD的完整JAR列表。 在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间。
09-Feb-2020 20:54:42.830 警告 [main] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [214] milliseconds.
09-Feb-2020 20:54:42.871 严重 [main] org.apache.catalina.core.StandardContext.startInternal One or more Filters failed to start. Full details will be found in the appropriate container log file
09-Feb-2020 20:54:42.872 严重 [main] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
09-Feb-2020 20:54:42.880 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [D:\payment_server\tomcat-9.0.21\webapps\docs]
09-Feb-2020 20:54:42.915 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\payment_server\tomcat-9.0.21\webapps\docs] has finished in [34] ms
09-Feb-2020 20:54:42.916 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [D:\payment_server\tomcat-9.0.21\webapps\examples]
09-Feb-2020 20:54:43.257 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\payment_server\tomcat-9.0.21\webapps\examples] has finished in [341] ms
09-Feb-2020 20:54:43.258 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [D:\payment_server\tomcat-9.0.21\webapps\host-manager]
09-Feb-2020 20:54:43.291 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\payment_server\tomcat-9.0.21\webapps\host-manager] has finished in [33] ms
09-Feb-2020 20:54:43.292 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [D:\payment_server\tomcat-9.0.21\webapps\manager]
09-Feb-2020 20:54:43.323 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\payment_server\tomcat-9.0.21\webapps\manager] has finished in [31] ms
09-Feb-2020 20:54:43.328 信息 [main] org.apache.coyote.AbstractProtocol.start 开始协议处理句柄["http-nio-8080"]
09-Feb-2020 20:54:43.339 信息 [main] org.apache.coyote.AbstractProtocol.start 开始协议处理句柄["ajp-nio-8009"]
09-Feb-2020 20:54:43.344 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in [1,977] milliseconds
09-Feb-2020 20:55:08.839 信息 [Thread-4] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]
09-Feb-2020 20:55:09.053 信息 [Thread-4] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
09-Feb-2020 20:55:09.228 信息 [Thread-4] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
09-Feb-2020 20:55:09.250 信息 [Thread-4] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
09-Feb-2020 20:55:09.253 信息 [Thread-4] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
09-Feb-2020 20:55:09.256 信息 [Thread-4] org.apache.coyote.AbstractProtocol.destroy 正在摧毁协议处理器 ["http-nio-8080"]
09-Feb-2020 20:55:09.257 信息 [Thread-4] org.apache.coyote.AbstractProtocol.destroy 正在摧毁协议处理器 ["ajp-nio-8009"]

lhl_yn_km

2020-02-09 20:58

@JFinal 以上是tomcat 的两个日志文件

JFinal

2020-02-09 21:01

@lhl_yn_km 异常已经很清楚了:
java.lang.UnsupportedClassVersionError: Preview features are not enabled for com/base/MainConfig (class file version 56.65535). Try running with '--enable-preview' (无法载入的.类 [com.base.MainConfig])

关键一句:ava.lang.UnsupportedClassVersionError

你部署环境境无法运行你编译出来的 .class 文件而已,注意编译时与部署时的 JDK 版本,同时也注意它的提示信息中的建议:
Try running with '--enable-preview'

lhl_yn_km

2020-02-09 21:55

@JFinal 感谢波总,换成jdk 1.8 编译就可以了,原来是jdk 12 ,先这样吧,有可能我引用的jar包部分不支持jdk 12

热门反馈

扫码入社