问题很急,有偿帮我解决问题 最好控评来,具体是
paymentSlipPushService为null 调不到服务方方法,小错误忽略 服务层必备注解serive已加,应该是定时任务导致的错误 apiPost直接访问就可以 但是系统内定时任务执行时bean为null
大佬来帮我已被折磨一天;昨天还行呢
问题很急,有偿帮我解决问题 最好控评来,具体是
大佬来帮我已被折磨一天;昨天还行呢
2024-11-20 15:35:01 [com.ylcloudsoft.quartzmanage.action.TaskManagerAction]-[ERROR] 即时任务运行报错 = paymentSlipPushController
com.byttersoft.framework.exception.BtRuntimeException: 即时任务运行报错 = paymentSlipPushController; cause exception is:
java.lang.NullPointerException
java.lang.NullPointerException
at com.ylcloudsoft.hibernate.erp.shlc.controller.PaymentSlipPushController.pushS(PaymentSlipPushController.java:42)
at com.ylcloudsoft.hibernate.erp.shlc.controller.PaymentSlipPushController.getData(PaymentSlipPushController.java:33)
at com.ylcloudsoft.hibernate.erp.shlc.controller.PaymentSlipPushController.getData(PaymentSlipPushController.java:20)
at com.ylcloudsoft.dataexchange.base.TradeHelper.service(TradeHelper.java:271)
at com.ylcloudsoft.dataexchange.base.TradeHelper.excuteNew(TradeHelper.java:124)
at com.ylcloudsoft.dataexchange.base.TaskBase.processCommonNew(TaskBase.java:97)
at com.ylcloudsoft.quartzmanage.action.TaskManagerAction.runTimeTask(TaskManagerAction.java:201)
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.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
at com.byttersoft.framework.web.action.BaseAction.execute(BaseAction.java:51)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.byttersoft.platform.runtime.monitor.bootstrap.MonitoringFilter.doFilter(MonitoringFilter.java:137)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.ylcloudsoft.framework.web.filter.SessionFilter.doFilter(SessionFilter.java:139)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.byttersoft.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:46)
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:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
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:750)
用bean工厂拿,不要用注入的
定时任务代码贴一下
bean工厂试过了,拿不到 我能感受到是定时任务出了问题,估计没初始上下文 但是这个定时任务代码不是我写的 我他妈太难受了
目前是我手动点的立即执行,但是apipost就行
非常有道理,这个定时任务启动时就会显示 - 新线程: XXX开始执行
启动的时候拿一下你的那个bean
,先确认spring
中有这个bean
take from spring container instead of new.
这都已经自己newInstance()了,不是spring 容器里的bean了吧,自己的实例去拿spring 容器的bean拿不到正常的吧
最好能贴出来报错的上下文, 报错的位置代码和调用处的代码, 最好能打印出来整个调用栈.
看你发的截图, 是通过newInstance实例化的对象, 里面的Field当然是null
尝试一下下面的办法:
第一种方式我试过了,不行
I think you need take it from spring container. not use new
.
套娃了,难搞。