在动作链中怎么注入service ,现在获取的service是null
public class ApiProProcessor extends AbstractProcessor {
private static final Log log = Logs.get();
@Inject
@Reference
private HzzyErrorService hzzyErrorService;
@Override
public void init(NutConfig config, ActionInfo ai) throws Throwable {
}
public void process(ActionContext ac) throws Throwable {
String uri = Mvcs.getRequestPath(ac.getRequest());
Hzzy_error hzzyError = new Hzzy_error();
hzzyError.setErrorContent(ac.getError().getMessage());
hzzyError.setErrorMehond(uri);
hzzyError.setErrorParam(ac.getRequest().getParameterMap().toString());
hzzyError.setErrorType(Hzzy_error.ERRORTYPE_AUTO);
hzzyError.setVisitIp(Lang.getIP(ac.getRequest()));
if (hzzyErrorService == null)
hzzyErrorService = ac.getIoc().get(HzzyErrorService.class,"hzzyErrorService");
hzzyErrorService.insert(hzzyError);
doNext(ac);
}
}
错误信息
[qtp846974653-33] WARN org.eclipse.jetty.server.HttpChannel - /open/api/home/getPickerOrRecomend
org.nutz.ioc.IocException: IocBean[hzzyErrorService] For object [hzzyErrorService] - type:[interface cn.wizzer.app.hzzy.modules.services.HzzyErrorService]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:250)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271)
at cn.wizzer.app.web.commons.processor.ApiProProcessor.process(ApiProProcessor.java:36)
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:49)
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:1610)
at org.nutz.mvc.WhaleFilter.doFilter(WhaleFilter.java:171)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1602)
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:214)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
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:1588)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
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:502)
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.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
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)
Caused by: org.nutz.ioc.ObjectLoadException: Object 'hzzyErrorService' without define!
at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:157)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:195)
... 40 more