问题: 无法启动 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) {
}
}
System.out.println("启动路由");
me.add("/", helpdefault.class,"index");
me.add("/wxpayment", wxPayment.class,"index");
}
TOMCAT 启动时 ,没出现上面调试信息,因此断定没有启动 Jfinal