JFinal多数数据源报错

觅食者 发布于 2014/01/21 12:27
阅读 727
收藏 0

 

@玛雅牛 你好,想跟你请教个问题:JFinal 多数据源怎么总是报错啊java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.jfinal.core.ActionInvocation.invoke(ActionInvocation.java:65)
at com.xhis.common.BlogInterceptor.intercept(BlogInterceptor.java:14)
at com.jfinal.core.ActionInvocation.invoke(ActionInvocation.java:55)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:73)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:54)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1548)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:524)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:568)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1110)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:453)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1044)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:459)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:280)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229)
at org.eclipse.jetty.io.AbstractConnection$1.run(AbstractConnection.java:505)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.jfinal.core.ActionInvocation.invoke(ActionInvocation.java:59)
... 22 more
Caused by: java.lang.ExceptionInInitializerError
at com.xhis.common.BlogController.index(BlogController.java:14)
... 27 more
Caused by: java.lang.RuntimeException: The group: null not exists.
at com.jfinal.plugin.activerecord.TableInfoMapping.getTableInfo(TableInfoMapping.java:43)
at com.jfinal.plugin.activerecord.Model.<init>(Model.java:68)
 ... 28 more
After invoking /blog
一月 21, 2014 12:20:14 下午 org.apache.jasper.servlet.JspServlet serviceJspFile
SEVERE: PWC6117: File "D%3A%5Cworkbase%5Cjfinal%5CWebRoot%5Cblog%5Cindex.jsp" not found

加载中
1
玛雅牛
玛雅牛

请参考:
http://my.oschina.net/myaniu/blog/185331
多数据源情况下分组信息必须添加才行。
ActiveRecordPlugin aArp = new
 ActiveRecordPlugin("aGroup",aDruidPlugin);
从日志信息看,分组信息为null。

觅食者
大哥,口口号,有问题直接远程帮我看看,这样更好啊
0
觅食者

引用来自“玛雅牛”的答案

请参考:
http://my.oschina.net/myaniu/blog/185331
多数据源情况下分组信息必须添加才行。
ActiveRecordPlugin aArp = new
 ActiveRecordPlugin("aGroup",aDruidPlugin);
从日志信息看,分组信息为null。

我就是按照你上面说的做的啊,但是就是报错;

    DruidPlugin bDruidPlugin = new DruidPlugin(
      getProperty("jdbcUrl"),
      getProperty("user"),
      getProperty("password").trim(),
         getProperty("driverClass"));
        bDruidPlugin.setInitialSize(3).setMaxActive(10);
  ActiveRecordPlugin brp = new ActiveRecordPlugin("bGroup",bDruidPlugin);
  me.add(bDruidPlugin);
  brp.setDialect(new MysqlDialect());
  brp.setShowSql(true);
  
  brp.addMapping("blog", Blog.class);//  映射blog 表到 Blog模型

 

 

 

 

/**
  * 配置路由
  */
 public void configRoute(Routes me) {
  me.addWithGroup("bGroup","/", CommonController.class);
  me.addWithGroup("bGroup","/blog", BlogController.class);
 // me.add("/", CommonController.class);
 // me.add("/blog", BlogController.class);
 }

 

返回顶部
顶部