具体情况如下:
在MainLauncher上增加了 @ChainBy(type= LogChainMaker.class, args={})
LogChainMaker.class文件内容如下
public class LogChainMaker implements ActionChainMaker {
@Override
public ActionChain eval(NutConfig config, ActionInfo ai) {
// 提醒: config可以获取ioc等信息, ai可以获取方法上的各种配置及方法本身
// 正常处理的列表
List<Processor> list = new ArrayList<>();
list.add(new LogTimeProcessor()); // 设置日志处理类
list.add(new UpdateRequestAttributesProcessor()); // 设置base/msg等内置属性
list.add(new EncodingProcessor()); // 设置编码信息@Encoding
list.add(new ModuleProcessor()); // 获取入口类的对象,从ioc或直接new
list.add(new ActionFiltersProcessor()); // 处理@Filters
list.add(new AdaptorProcessor()); // 处理@Adaptor
list.add(new MethodInvokeProcessor()); // 执行入口方法
list.add(new ViewProcessor()); // 对入口方法进行渲染@Ok
for (Processor p : list) {
try {
p.init(config, ai);
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
// 最后是专门负责兜底的异常处理器,这个处理器可以认为是全局异常处理器,对应@Fail
Processor error = new FailProcessor();
try {
error.init(config, ai);
} catch (Throwable throwable) {
throwable.printStackTrace();
}
return new NutActionChain(list, error, ai);
}
}
访问页面报错:
VAR_NOT_DEFINED
at org.beetl.core.statement.VarRef.getValue(VarRef.java:198)
at org.beetl.core.statement.VarRef.evaluate(VarRef.java:76)
at org.beetl.core.statement.PlaceholderST.execute(PlaceholderST.java:34)
at org.beetl.core.statement.Program.execute(Program.java:70)
at org.beetl.core.Template.renderTo(Template.java:136)
at org.beetl.core.Template.renderTo(Template.java:102)
at org.beetl.ext.web.WebRender.render(WebRender.java:122)
at org.beetl.ext.nutz.BeetlView.render(BeetlView.java:28)
at org.nutz.mvc.impl.processor.ViewProcessor.process(ViewProcessor.java:66)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:33)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:38)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at com.iptv.ad_auth_manage.telecom.utils.LogTimeProcessor.process(LogTimeProcessor.java:29)
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.nutz.mvc.WhaleFilter.doFilter(WhaleFilter.java:171)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:215)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:503)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:132)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
at java.lang.Thread.run(Thread.java:748)
[DEBUG] 18:10:04.419 org.beetl.ext.nutz.LogErrorHandler.processExcption(LogErrorHandler.java:32) - null
>>06:10:04:变量未定义(VAR_NOT_DEFINED):obj 位于41行 资源:/tml/main.btl
38| <span><img alt="image" src="/img/logo.png" style="width:100%" /></span>
39| <a data-toggle="dropdown" class="dropdown-toggle" href="#">
40| <span class="clear">
41| <span class="block m-t-xs"><strong class="font-bold">${obj.userName}</strong></span>
42| <span class="text-muted text-xs block">${obj.realName}<b class="caret"></b></span>
43| </span>
44| </a>
把 @ChainBy(type= LogChainMaker.class, args={}) 注解去掉,问题就没有了