#number使用问题

image.png

这里是为什么 直接不能使用#number 版本用的3.2

评论区

JFinal

2018-06-04 20:56

升级到 jfinal 3.3 或者 3.4 即可,如果不想升级,可以拿到 jfinal 3.4 中的 NumberDirective 源代码放到你的项目中,最后配置一下:
engine.addDirective("number", NumberDirective.class);

万恶码农

2018-06-05 09:34

@JFinal 在idea,maven项目当中,应该如何正确的升级版本呀?需要注意什么呢?

JFinal

2018-06-05 09:38

@万恶码农 改一下版本号就可以了,将原来的 3.2 改成 3.4 升级完成

万恶码农

2018-06-05 09:42

@JFinal 我改了版本号,看的jar包也是3.4的了,但是报错和上面这个截图还是一样的

JFinal

2018-06-05 09:44

@万恶码农 那必定是老版本的依赖还没有去除,仔细排查一下

还有一个就是你项目中的其它 dependency 中是否对老版本的 jfinal 有依赖造成了多个 jfinal 版本的存在

万恶码农

2018-06-05 09:45

@JFinal 会不会是我少了什么东西了,导致这个不可以用了呀?

万恶码农

2018-06-05 09:45

@JFinal 恩恩,我先去排查一下,谢谢

万恶码农

2018-06-05 10:12

@JFinal java.lang.NoClassDefFoundError: com/jfinal/aop/Interceptor
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2320)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:816)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1261)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1121)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:540)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:521)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:150)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4549)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5091)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:742)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:718)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1737)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:456)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:405)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:835)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: com.jfinal.aop.Interceptor
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1292)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1121)
... 55 more

05-Jun-2018 09:57:24.867 严重 [RMI TCP Connection(7)-127.0.0.1] org.apache.catalina.core.StandardContext.listenerStart Skipped installing application listeners due to previous error(s)

波哥,这个是因为我的依赖包没清除干净吗?

JFinal

2018-06-05 10:58

@万恶码农 出现 NoClassDefFoundError 的异常就好办了,只需要删除你本地 maven 库中的 jfinal 目录,然后让 maven 重新下载一次即可

原因是: maven 下载 jfinal 的时候出现数据错误,需删掉重新下载一次

万恶码农

2018-06-05 11:00

@JFinal 谢谢波哥!

万恶码农

2018-06-05 11:48

@JFinal 波哥,更新到3.4以后还是报错,说#number这个问题
com.jfinal.render.RenderException: com.jfinal.template.stat.ParseException: Directive not found: #number
Template: "/page/member/index.html". Line: 158
at com.jfinal.render.TemplateRender.render(TemplateRender.java:63)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:99)
at com.jcdfkj.baobao.common.handler.UrlHandler.handle(UrlHandler.java:61)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)
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:494)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)
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:412)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1385)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.jfinal.template.stat.ParseException: Directive not found: #number
Template: "/page/member/index.html". Line: 158
at com.jfinal.template.stat.Parser.stat(Parser.java:211)
at com.jfinal.template.stat.Parser.statList(Parser.java:100)
at com.jfinal.template.stat.Parser.stat(Parser.java:138)
at com.jfinal.template.stat.Parser.statList(Parser.java:100)
at com.jfinal.template.stat.Parser.parse(Parser.java:90)
at com.jfinal.template.Engine.buildTemplateBySourceFactory(Engine.java:157)
at com.jfinal.template.Engine.getTemplate(Engine.java:138)
at com.jfinal.render.TemplateRender.render(TemplateRender.java:60)
... 22 more

05-Jun-2018 11:46:56.685 严重 [http-nio-8080-exec-10] com.jfinal.core.ActionHandler.error /Backend/Member/index
com.jfinal.render.RenderException: com.jfinal.template.stat.ParseException: Directive not found: #number
Template: "/page/member/index.html". Line: 158
at com.jfinal.render.TemplateRender.render(TemplateRender.java:63)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:99)
at com.jcdfkj.baobao.common.handler.UrlHandler.handle(UrlHandler.java:61)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)
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:494)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)
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:412)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1385)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.jfinal.template.stat.ParseException: Directive not found: #number
Template: "/page/member/index.html". Line: 158
at com.jfinal.template.stat.Parser.stat(Parser.java:211)
at com.jfinal.template.stat.Parser.statList(Parser.java:100)
at com.jfinal.template.stat.Parser.stat(Parser.java:138)
at com.jfinal.template.stat.Parser.statList(Parser.java:100)
at com.jfinal.template.stat.Parser.parse(Parser.java:90)
at com.jfinal.template.Engine.buildTemplateBySourceFactory(Engine.java:157)
at com.jfinal.template.Engine.getTemplate(Engine.java:138)
at com.jfinal.render.TemplateRender.render(TemplateRender.java:60)
... 22 more

JFinal

2018-06-05 11:53

这肯定是没更新到 jfinal 3.4, 或者是有老版本 jfinal 同时被引入了

可以通过下载首页的 jfinal demo,然后在页面中试用 #number 指令得到证实

热门反馈

扫码入社