从google上下的jfinal_demo,把数据库换成了sql server2008,配置错误

arvin- 发布于 2014/03/28 11:15
阅读 858
收藏 0

把数据库换成了sql server2008

下面是配置代码:

public void configPlugin(Plugins me) {

// 加载少量必要配置,随后可用getProperty(...)获取值
String driver="com.microsoft.jdbc.sqlserver.SQLServerDriver"; 
String jdbcUrl="jdbc:microsoft:sqlserver://localhost:1488;DatabaseName=jfinall"; 
String user="jdbctest"; 
String password="asdfghjkl;10"; 


C3p0Plugin c3p0Plugin = new C3p0Plugin(jdbcUrl,user,password,driver); 
me.add(c3p0Plugin);

// 配置ActiveRecord插件 
ActiveRecordPlugin arp = new ActiveRecordPlugin(c3p0Plugin);

//arp.setDialect(new AnsiSqlDialect()); 

me.add(arp);
arp.addMapping("blog", Blog.class); // 映射blog 表到 Blog模型 

java.sql.Connection DbConn;
 try{ 
  Class.forName(driver); 
  DbConn= DriverManager.getConnection(jdbcUrl, user, password); 
  System.out.println("connection link successful!"); 
  DbConn.close();
  System.out.println(DbConn.isClosed());
 }
 catch(Exception e) 
 { 
  e.printStackTrace();
 }

}


错误提示:

Starting JFinal 1.5
Starting scanner at interval of 5 seconds.
Starting web server on port: 80
2014-03-28 10:56:03.190:WARN:oejuc.AbstractLifeCycle:FAILED jfinal: java.lang.RuntimeException: You must load properties file by invoking loadPropertyFile(String) method in configConstant(Constants) method before.
java.lang.RuntimeException: You must load properties file by invoking loadPropertyFile(String) method in configConstant(Constants) method before.
at com.jfinal.config.JFinalConfig.checkPropertyLoading(JFinalConfig.java:152)
at com.jfinal.config.JFinalConfig.getPropertyToBoolean(JFinalConfig.java:133)
at com.jfinal.config.JFinalConfig.getPropertyToBoolean(JFinalConfig.java:146)
at com.demo.common.DemoConfig.configConstant(DemoConfig.java:26)
at com.jfinal.core.Config.configJFinal(Config.java:46)
at com.jfinal.core.JFinal.init(JFinal.java:68)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.Server.doStart(Server.java:277)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer.doStart(JettyServer.java:120)
at com.jfinal.server.JettyServer.start(JettyServer.java:64)
at com.jfinal.core.JFinal.main(JFinal.java:179)
2014-03-28 10:56:03.191:WARN:oejw.WebAppContext:Failed startup of context o.e.j.w.WebAppContext{/,file:/E:/Eclipse/jfinal_ssms/WebRoot/}
java.lang.RuntimeException: You must load properties file by invoking loadPropertyFile(String) method in configConstant(Constants) method before.
at com.jfinal.config.JFinalConfig.checkPropertyLoading(JFinalConfig.java:152)
at com.jfinal.config.JFinalConfig.getPropertyToBoolean(JFinalConfig.java:133)
at com.jfinal.config.JFinalConfig.getPropertyToBoolean(JFinalConfig.java:146)
at com.demo.common.DemoConfig.configConstant(DemoConfig.java:26)
at com.jfinal.core.Config.configJFinal(Config.java:46)
at com.jfinal.core.JFinal.init(JFinal.java:68)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.Server.doStart(Server.java:277)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer.doStart(JettyServer.java:120)
at com.jfinal.server.JettyServer.start(JettyServer.java:64)
at com.jfinal.core.JFinal.main(JFinal.java:179)
Starting Complete. Welcome To The JFinal World :)


Loading changes ......
2014-03-28 11:01:36.436:WARN:oejuc.AbstractLifeCycle:FAILED jfinal: java.lang.RuntimeException: You must load properties file by invoking loadPropertyFile(String) method in configConstant(Constants) method before.
java.lang.RuntimeException: You must load properties file by invoking loadPropertyFile(String) method in configConstant(Constants) method before.
at com.jfinal.config.JFinalConfig.checkPropertyLoading(JFinalConfig.java:152)
at com.jfinal.config.JFinalConfig.getPropertyToBoolean(JFinalConfig.java:133)
at com.jfinal.config.JFinalConfig.getPropertyToBoolean(JFinalConfig.java:146)
at com.demo.common.DemoConfig.configConstant(DemoConfig.java:26)
at com.jfinal.core.Config.configJFinal(Config.java:46)
at com.jfinal.core.JFinal.init(JFinal.java:68)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer$1.onChange(JettyServer.java:106)
at com.jfinal.server.Scanner.compare(Scanner.java:87)
at com.jfinal.server.Scanner.working(Scanner.java:56)
at com.jfinal.server.Scanner.access$0(Scanner.java:54)
at com.jfinal.server.Scanner$1.run(Scanner.java:93)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
2014-03-28 11:01:36.437:WARN:oejw.WebAppContext:Failed startup of context o.e.j.w.WebAppContext{/,file:/E:/Eclipse/jfinal_ssms/WebRoot/}
java.lang.RuntimeException: You must load properties file by invoking loadPropertyFile(String) method in configConstant(Constants) method before.
at com.jfinal.config.JFinalConfig.checkPropertyLoading(JFinalConfig.java:152)
at com.jfinal.config.JFinalConfig.getPropertyToBoolean(JFinalConfig.java:133)
at com.jfinal.config.JFinalConfig.getPropertyToBoolean(JFinalConfig.java:146)
at com.demo.common.DemoConfig.configConstant(DemoConfig.java:26)
at com.jfinal.core.Config.configJFinal(Config.java:46)
at com.jfinal.core.JFinal.init(JFinal.java:68)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer$1.onChange(JettyServer.java:106)
at com.jfinal.server.Scanner.compare(Scanner.java:87)
at com.jfinal.server.Scanner.working(Scanner.java:56)
at com.jfinal.server.Scanner.access$0(Scanner.java:54)
at com.jfinal.server.Scanner$1.run(Scanner.java:93)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
Loading complete.

加载中
返回顶部
顶部