项目启动的 main 函数如下
public static void main(String[] args) { String webAppDir=Server.class.getResource("/").getPath().replace("/WEB-INF/classes/", ""); int port=8066; String content="/transfer"; if(args!=null&&args.length>0){ try{ port=Integer.parseInt(args[0]); content=args[1]; }catch(Exception e){} } try{ JFinal.start(webAppDir.substring(1), port,content, 10); }catch(Exception e){e.printStackTrace();} }
在启动后,本地项目是不可以连接已经配置的数据库的,但是启动的日志没有报错,直接是:
Starting JFinal 1.9
Starting scanner at interval of 10 seconds.
Starting web server on port: 8066
Starting Complete. Welcome To The JFinal World :)
启动的类如下:
private void doStart() { if (!available(port)) throw new IllegalStateException("port: " + port + " already in use!"); deleteSessionData(); System.out.println("Starting JFinal " + Const.JFINAL_VERSION); server = new Server(); SelectChannelConnector connector = new SelectChannelConnector(); connector.setPort(port); server.addConnector(connector); webApp = new WebAppContext(); webApp.setContextPath(context); webApp.setResourceBase(webAppDir); // webApp.setWar(webAppDir); webApp.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false"); webApp.setInitParameter("org.eclipse.jetty.servlet.Default.useFileMappedBuffer", "false"); // webApp.setInitParams(Collections.singletonMap("org.mortbay.jetty.servlet.Default.useFileMappedBuffer", "false")); persistSession(webApp); server.setHandler(webApp); changeClassLoader(webApp); // configureScanner if (scanIntervalSeconds > 0) { Scanner scanner = new Scanner(PathKit.getRootClassPath(), scanIntervalSeconds) { public void onChange() { try { System.err.println("\nLoading changes ......"); webApp.stop(); JFinalClassLoader loader = new JFinalClassLoader(webApp, getClassPath()); webApp.setClassLoader(loader); webApp.start(); System.err.println("Loading complete."); } catch (Exception e) { System.err.println("Error reconfiguring/restarting webapp after change in watched files"); e.printStackTrace(); } } }; System.out.println("Starting scanner at interval of " + scanIntervalSeconds + " seconds."); scanner.start(); } try { System.out.println("Starting web server on port: " + port); server.start(); System.out.println("Starting Complete. Welcome To The JFinal World :)"); server.join(); } catch (Exception e) { e.printStackTrace(); System.exit(100); } return; }
不清楚是为什么?
项目:JFinal
问题是什么,要解决什么问题?
这句话是什么意思: 在启动后,本地项目是不可以连接已经配置的数据库的