日志如下,没有进入相关config,昨晚还是ok的,不清楚是不是jfinal的类加载机制
Mac OS X
/Users/manyu/code/mingjingtai/mingjingtai_api/target/classes
Starting JFinal 3.5
2018-11-20 16:49:43.916 [main] INFO o.e.j.util.log - Logging initialized @469ms to org.eclipse.jetty.util.log.Slf4jLog
Starting scanner at interval of 5 seconds
Starting Jetty Server 9.4.12.v20180830 on port: 8080
2018-11-20 16:49:44.142 [main] INFO o.e.j.s.Server - jetty-9.4.12.v20180830; built: 2018-08-30T13:59:14.071Z; git: 27208684755d94a92186989f695db2d7b21ebc51; jvm 1.8.0_161-b12
2018-11-20 16:49:44.261 [main] INFO o.e.j.s.session - DefaultSessionIdManager workerName=node0
2018-11-20 16:49:44.262 [main] INFO o.e.j.s.session - No SessionScavenger set, using defaults
2018-11-20 16:49:44.265 [main] INFO o.e.j.s.session - node0 Scavenging every 660000ms
2018-11-20 16:49:44.323 [main] INFO o.e.j.s.h.ContextHandler - Started o.e.j.w.WebAppContext@143640d5{/,file:///src/main/resources,AVAILABLE}
2018-11-20 16:49:44.380 [main] INFO o.e.j.s.AbstractConnector - Started ServerConnector@11dc3715{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2018-11-20 16:49:44.381 [main] INFO o.e.j.s.Server - Started @938ms
Starting Complete. Welcome To The JFinal World (^_^)环境:maven+idea+mac
问题:debug没有进入config的配置,表面上启动成功,但接口都404
启动类如下(上面一堆乱七八糟是为了在linux自动部署jar包启动,本地mac启动走的是
JFinal.start("/src/main/resources", 8080, "/",5);
public static void main(String[] args) throws Exception {
startByJar();
}
public static void startByJar(){
String baseBath = String.valueOf(JFinalStarter.class.getProtectionDomain().getCodeSource().getLocation());
String classPath, webRootPath, jarPath;
if (StrKit.notBlank(baseBath) && baseBath.contains("file:/")) {
// 获取运行操作系统的运行方式 window和linux的细微区别
String os = System.getProperties().getProperty("os.name");
System.out.println(os);
if (!os.contains("Mac")) {
baseBath = baseBath.substring("file:".length());
System.out.println("baseBath:" + baseBath);
if (baseBath.contains("mingjingtai.jar")) {
jarPath = baseBath;
classPath = baseBath.replace("mingjingtai.jar","classes");
} else {
jarPath = baseBath.replace("classes/","mingjingtai.jar");
classPath = baseBath;
}
System.out.println("jarPath:" + jarPath);
System.out.println("classPath:" + classPath);
webRootPath = classPath;
ZipUtil.unzip(jarPath, classPath);
// 这两步是核心指定 webapp目录和classpath目录
PathKit.setWebRootPath(webRootPath);
PathKit.setRootClassPath(classPath);
JFinal.start(webRootPath, 8080, "/",5);
} else {
System.out.println(PathKit.getRootClassPath());
JFinal.start("/src/main/resources", 8080, "/",5);
System.out.println(PathKit.getRootClassPath());
}
}
}
项目:JFinal