JFinal

登录 注册
  • 认真看完了,也懂了,就是没思路,准备动手copy代码来测试看,感谢分享
    03-12 12:25 回复
  • 同问一下,事务应该怎么办?
    03-09 14:27 回复
  • @JFinal 我没改ClientAbortException 有关信息,也不知道怎么改动;在开发环境还会报错,但是我代码拿到生产环境和测试环境都不报错了;
    07-02 08:43 回复
  • @JFinal 感谢波总指点,问题已经解决了;tomcat的版本是一个问题,其中还有一个问题是在报错之前有一句提示我给忽略了:Cannot forward to error page for request [/] as the response has already been committed. As a result, the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve this problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false
    只需要在springboot的启动类Application中加入:setRegisterErrorPageFilter(false);就可以了;我的项目是springboot+jfinal+dubbo的架构;
    06-29 10:31 回复
  • @JFinal 谢谢指导,换了8.5.32还是不得行,换了9.0.10还是不得行;继续研究中....
    06-28 09:45 回复
  • @JFinal 我替换到了3.4的版本还是报以下异常,当用户在页面狂按F5刷新的时候报这个,其他都正常:
    java.lang.RuntimeException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: 您的主机中的软件中止了一个已建立的连接。
    at com.jfinal.template.io.ByteWriter.close(ByteWriter.java:54) ~[jfinal-3.4.jar:na]
    at com.jfinal.template.Template.render(Template.java:61) ~[jfinal-3.4.jar:na]
    at com.jfinal.template.ext.spring.JFinalView.renderMergedTemplateModel(JFinalView.java:60) ~[jfinal-3.4.jar:na]
    at org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:167) ~[spring-webmvc-4.3.14.RELEASE.jar:na]
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) ~[spring-webmvc-4.3.14.RELEASE.jar:na]
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1286) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1041) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:984) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) ~[servlet-api.jar:na]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) ~[servlet-api.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) [catalina.jar:8.0.24]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.24]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-websocket.jar:8.0.24]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.24]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.24]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.3.14.RELEASE.jar:na]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.14.RELEASE.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.24]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.24]
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108) ~[spring-web-4.3.14.RELEASE.jar:na]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.14.RELEASE.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.24]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.24]
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) ~[spring-web-4.3.14.RELEASE.jar:na]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.14.RELEASE.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.24]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.24]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.14.RELEASE.jar:na]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.14.RELEASE.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.24]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.24]
    at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:115) [spring-boot-1.5.10.RELEASE.jar:na]
    at org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter.java:59) [spring-boot-1.5.10.RELEASE.jar:na]
    at org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:90) [spring-boot-1.5.10.RELEASE.jar:na]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.14.RELEASE.jar:na]
    at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:108) [spring-boot-1.5.10.RELEASE.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.24]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.24]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) [catalina.jar:8.0.24]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [catalina.jar:8.0.24]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [catalina.jar:8.0.24]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) [catalina.jar:8.0.24]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:8.0.24]
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617) [catalina.jar:8.0.24]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [catalina.jar:8.0.24]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) [catalina.jar:8.0.24]
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) [tomcat-coyote.jar:8.0.24]
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668) [tomcat-coyote.jar:8.0.24]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1527) [tomcat-coyote.jar:8.0.24]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1484) [tomcat-coyote.jar:8.0.24]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_25]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_25]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.24]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_25]
    Caused by: org.apache.catalina.connector.ClientAbortException: java.io.IOException: 您的主机中的软件中止了一个已建立的连接。
    at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:393) ~[catalina.jar:8.0.24]
    at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:426) ~[tomcat-util.jar:8.0.24]
    at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:342) ~[catalina.jar:8.0.24]
    at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:317) ~[catalina.jar:8.0.24]
    at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:110) ~[catalina.jar:8.0.24]
    at com.jfinal.template.io.ByteWriter.close(ByteWriter.java:51) ~[jfinal-3.4.jar:na]
    ... 57 common frames omitted
    Caused by: java.io.IOException: 您的主机中的软件中止了一个已建立的连接。
    at sun.nio.ch.SocketDispatcher.write0(Native Method) ~[na:1.8.0_25]
    at sun.nio.ch.SocketDispatcher.write(Unknown Source) ~[na:1.8.0_25]
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source) ~[na:1.8.0_25]
    at sun.nio.ch.IOUtil.write(Unknown Source) ~[na:1.8.0_25]
    at sun.nio.ch.SocketChannelImpl.write(Unknown Source) ~[na:1.8.0_25]
    at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:127) ~[tomcat-coyote.jar:8.0.24]
    at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101) ~[tomcat-coyote.jar:8.0.24]
    at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:173) ~[tomcat-coyote.jar:8.0.24]
    at org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket(InternalNioOutputBuffer.java:139) ~[tomcat-coyote.jar:8.0.24]
    at org.apache.coyote.http11.InternalNioOutputBuffer.flushBuffer(InternalNioOutputBuffer.java:244) ~[tomcat-coyote.jar:8.0.24]
    at org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer.java:189) ~[tomcat-coyote.jar:8.0.24]
    at org.apache.coyote.http11.InternalNioOutputBuffer.access$000(InternalNioOutputBuffer.java:41) ~[tomcat-coyote.jar:8.0.24]
    at org.apache.coyote.http11.InternalNioOutputBuffer$SocketOutputBuffer.doWrite(InternalNioOutputBuffer.java:320) ~[tomcat-coyote.jar:8.0.24]
    at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:116) ~[tomcat-coyote.jar:8.0.24]
    at org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer.java:256) ~[tomcat-coyote.jar:8.0.24]
    at org.apache.coyote.Response.doWrite(Response.java:503) ~[tomcat-coyote.jar:8.0.24]
    at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:388) ~[catalina.jar:8.0.24]
    ... 62 common frames omitted
    06-27 15:47 回复
  • @JFinal 波总什么时候给jfinal集成一下这样的插件吧;我想加一个就是没思路,像spring那样用注解对应每一个queue或者topic;求指点;
    06-07 18:09 回复
  • @fmpoffice
    #Cron表达式范例:
    # 每隔5秒执行一次:*/5 * * * * ?
    # 每隔1分钟执行一次:0 */1 * * * ?
    # 每天23点执行一次:0 0 23 * * ?
    # 每天凌晨1点执行一次:0 0 1 * * ?
    # 每月1号凌晨1点执行一次:0 0 1 1 * ?
    # 每月最后一天23点执行一次:0 0 23 L * ?
    # 每周星期天凌晨1点实行一次:0 0 1 ? * L
    # 在26分、29分、33分执行一次:0 26,29,33 * * * ?
    # 每天的0点、13点、18点、21点都执行一次:0 0 0,13,18,21 * * ?
    06-05 15:07 回复
  • @sphsyv 你好,请问一下你的这种配置方式,只可以配置一个queue。如何才能配置多个queue(qa,qb,qc),让消费者a去收qa,消费者b收qb,消费者c收qc。求指点。。。。。。
    06-04 14:13 回复
  • @bussanq 谢谢指导,顺便提醒一下如果页面要取session的话需要设置: jfr.setSessionInView(true);//是否支持以 #(session.value) 的方式访问 session
    05-02 10:02 回复
  • @walking_ 谢谢,问题已经解决了,参考的这篇文章http://www.jfinal.com/share/531 只需要在EnjoyConfig 中设置session就OK了,比如:jfr.setSessionInView(true);//是否支持以 #(session.value) 的方式访问 session
    05-02 10:01 回复
  • @walking_ 非常感谢你,不过我遇到了新的问题,就是在保存session的时候,在页面怎么也取不到;对于jfinal 的 me.add(new SessionInViewInterceptor()); 这句代码应该怎么使用呢?
    04-26 13:35 回复
  • @JFinal 在BaseConfig里面配置好了的,正常的从浏览器请求过去经过路由然后到controller操作数据库是可以正常使用增删改查的;但是MQ接受到消息进行数据库操作就报数据操作config为null;
    一下是我的配置文件代码:
    /**
    * 本 demo 仅表达最为粗浅的 jfinal 用法,更为有价值的实用的企业级用法 详见 JFinal 俱乐部:
    * http://jfinal.com/club
    *
    * API引导式配置
    */
    public class BaseConfig extends JFinalConfig {

    /**
    * 配置常量
    */
    public void configConstant(Constants me) {
    // 加载少量必要配置,随后可用PropKit.get(...)获取值
    PropKit.use("config.txt");
    }

    /**
    * 配置路由
    */
    public void configRoute(Routes me) {
    // me.setBaseViewPath("/views");
    me.add("/", IndexController.class);
    }

    public void configEngine(Engine me) {// 定义通用的模板
    }

    public static DruidPlugin createDruidPlugin() {
    DruidPlugin dp = new DruidPlugin(PropKit.get("jdbcUrl"), PropKit.get("user"), PropKit.get("password").trim());
    WallFilter wall = new WallFilter();
    wall.setDbType("mysql");
    dp.addFilter(wall);
    return dp;
    }

    /**
    * 配置插件
    */
    public void configPlugin(Plugins me) {
    // 配置C3p0数据库连接池插件
    DruidPlugin druidPlugin = createDruidPlugin();
    me.add(druidPlugin);
    // 配置ActiveRecord插件
    ActiveRecordPlugin arp = new ActiveRecordPlugin(druidPlugin);
    // 所有映射在 MappingKit 中自动化搞定
    _MappingKit.mapping(arp);
    arp.setShowSql(true);// 控制台显示sql
    me.add(arp);

    }

    /**
    * 配置全局拦截器
    */
    public void configInterceptor(Interceptors me) {
    me.add(new SessionInViewInterceptor());
    // 事务控制器
    me.add(new TxByActionKeyRegex("(.*save.*|.*update.*|.*del.*|.*add.*)", true));
    me.add(new TxByMethodRegex("(.*save.*|.*update.*)"));
    me.add(new TxByMethods("save", "update"));
    me.add(new TxByActionKeys("/tx/save", "/tx/update"));
    }

    /**
    * 配置处理器
    */
    public void configHandler(Handlers me) {
    me.add(new ContextPathHandler("contextPath"));
    }
    }
    03-22 09:02 回复