Starting JFinal 3.2 Starting scanner at interval of 5 seconds. Starting web server on port: 80 2017-11-03 11:01:57 [ERROR]-[Thread: main]-[com.alibaba.druid.pool.DruidDataSource.init()]: init datasource error, url: jdbc:mysql://localhost:3306/testdb java.sql.SQLException: java.lang.IllegalAccessError: class sun.reflect.GeneratedConstructorAccessor1 cannot access its superclass sun.reflect.ConstructorAccessorImpl at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927) at com.mysql.jdbc.Util.handleNewInstance(Util.java:435) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1461) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1525) at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:734) at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1060) at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1056) at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:104) at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:43) at com.jfinal.plugin.activerecord.ActiveRecordPlugin.start(ActiveRecordPlugin.java:226) at com.jfinal.core.Config.startPlugins(Config.java:107) at com.jfinal.core.Config.configJFinal(Config.java:53) at com.jfinal.core.JFinal.init(JFinal.java:63) 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:131) at com.jfinal.server.JettyServer.start(JettyServer.java:70) at com.jfinal.core.JFinal.main(JFinal.java:184) Can not create Table object, maybe the table user is not exists.
public static DruidPlugin createDruidPlugin() { return new DruidPlugin(PropKit.get("jdbcUrl"), PropKit.get("user"), PropKit.get("password").trim()); } /* 配置插件 按Demo的 */ public void configPlugin(Plugins me) { DruidPlugin dp = createDruidPlugin(); me.add(dp); // 配置ActiveRecord插件 ActiveRecordPlugin arp = new ActiveRecordPlugin(dp); // 所有映射在 MappingKit 中进行映射 _MappingKit.mapping(arp); //连接数据库报错点 , 注释掉可以运行,但不能访问数据库 me.add(arp); }
使用jfinal版本:3.2
当我换成1.8版本就正常。
问下各位前辈,以上问题我该怎么解决呀? 刚接触jfinal,能帮我回答详细点吗? 谢谢各位了!
如果用的是 eclipse,使用eclipse 4.6 就好了,4.7 也是ok的,4.7.1a不行