开发者社区> 问答> 正文

Jfinal Weixin调用接口报错?报错

在处理菜单点击事件的方法里 WeixinMsgController.processInMenuEvent ,调用CustomServiceApi.sendMpNews,发送图文消息报下面的错误,信息能正常接收到,什么原因

 

SEVERE: /jwx/msg?signature=d8e707c605aa05633ae508908527749f2e65e180&timestamp=1537689035&nonce=1093934862&openid=o6fbwt0kWHoj4qYaq8I8YsP5ACI8
java.lang.RuntimeException: File not found : /var/www/ryj/tomcat7/webapps/ROOT/jwx/msg/index.html
        at com.jfinal.template.source.FileSource.getContent(FileSource.java:70)
        at com.jfinal.template.Engine.buildTemplateBySourceFactory(Engine.java:154)
        at com.jfinal.template.Engine.getTemplate(Engine.java:139)
        at com.jfinal.render.TemplateRender.render(TemplateRender.java:61)
        at com.jfinal.core.ActionHandler.handle(ActionHandler.java:103)
        at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)

Sep 23, 2018 3:50:35 PM com.jfinal.core.JFinalFilter error
SEVERE: /jwx/msg?signature=d8e707c605aa05633ae508908527749f2e65e180&timestamp=1537689035&nonce=1093934862&openid=o6fbwt0kWHoj4qYaq8I8YsP5ACI8
java.lang.IllegalStateException: getOutputStream() has already been called for this response
        at org.apache.catalina.connector.Response.getWriter(Response.java:636)
        at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:213)
        at com.jfinal.render.ErrorRender.render(ErrorRender.java:59)
        at com.jfinal.core.ActionHandler.handle(ActionHandler.java:141)
        at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)

展开
收起
爱吃鱼的程序员 2020-06-06 15:08:54 486 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
                        <p>报错已经提示了一切 </p>
    
                    
    
                        <p>报错都看不懂 写代码干嘛呢</p>
    
                    
    
                        <p>controller 中调用完 CustomServiceApi.sendMpNews(...) 这个方法后,里面再加个  renderNull() 或者共它类型的 render 系的方法都可以</p> 
    

     

    如果你的 contoller 继承了 MsgController,里面一些抽象方法是会接收到一些微信客户端的一些事件的,而这些方法内部你没有调用过任何 render 系的方法,那么 jfinal 会默认帮你调用一个 render(view) 规则如下:

    String view = baseViewPath + basePath + methodName + ".html";
    render(view);

       其中 baseViewPath 是通过routes.setBaseViewPath(...) 配置的,如果不配置则默认为项目 webapp 根目录。而 basePath 是映射 controller 时配置的,如果不配置默认为 controllerKey

     

        如果你的 controller 继承的 ApiController,那么在你的 action 中没有调用任何 render 系的方法也会出现上面一样的情况,只不过这种情况更好去发现

        解决办法极其简单,找到这些地方,调用任何一个 render 系的方法即可,如果不需要返回值,则调用  renderNull()

    2020-06-08 11:22:22
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载