@Clear @Before(RequestInterceptor.class) public void addChat(){ //json数组字符串 String strJson = getPara("chatList",""); if (!avatarService.isJSONArray(strJson) || StringUtils.isEmpty(strJson)){ log.info("批量保存聊天数据错误。{}:不是JSONArray字符串或者为null", strJson); renderJson(new ResultJson<>(Global.FAIL, "批量保存聊天数据错误")); return; } try{ service.bathList(strJson); }catch (Exception e){ log.info("保存聊天记录异常!错误信息:" + e.getMessage()); renderJson(new ResultJson<>(Global.FAIL, "批量保存聊天数据失败")); } renderJson(new ResultJson<>(Global.OK, "批量保存聊天数据成功")); }
报错:
2021-06-01 10:02:12,023 [INFO] [http-nio-30005-exec-1] RequestInterceptor.intercept - 请求: /chat/addChat, 参数: {"chatList":"[{"channel":10000,"content":"sdgd","createTime":1622512931838,"groupId":1000016,"groupName":"武汉加油","id":43621,"money":2982.0,"sendAccount":"000001","sendAid":1003632,"sendName":"车赏","sid":1,"type":2,"vip":5}]"}, 返回值:,cost:1ms 2021-06-01 10:02:12,025 [INFO] [http-nio-30005-exec-1] RequestInterceptor.intercept - 电脑设备访问... 2021-06-01 10:02:12,078 [ERROR] [http-nio-30005-exec-1] ActionHandler.handle - /chat/addChat com.jfinal.render.RenderException: Example : error : cannot find template /WEB-INF/template/chat/addChat.html at com.jfinal.render.VelocityRender.render(VelocityRender.java:126) at com.jfinal.core.ActionHandler.handle(ActionHandler.java:97) at com.jfinal.ext.handler.UrlSkipHandler.handle(UrlSkipHandler.java:45) at com.jfinal.ext.handler.ContextPathHandler.handle(ContextPathHandler.java:47) at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '/WEB-INF/template/chat/addChat.html' at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:474) at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:352) at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533) at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1514) at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:299) at org.apache.velocity.app.Velocity.getTemplate(Velocity.java:358) at com.jfinal.render.VelocityRender.render(VelocityRender.java:112) ... 23 more
看不出是什么问题,别的项目访问这个接口是没有问题的,就其中一个项目出了这个报错。
项目:JFinal