用Java代码迁移Spring 从版本2添加Spring版本4.0.3之后,在所有数据类型查询语句都被调用的地方,对querytoObject进行了更改,添加了石英2.2.1版本,并将该类更改为应用程序上下文中的JobDetailFactoryBean,以安排作业 应用程序在Eclipse中运行,未记录任何错误。 通过提供用户名和密码登录URL。得到下面的空指针错误 在调试类AbstractPlatformTransactionManager .logger受保护的瞬态Log logger = LogFactory.getLog(getClass());显示空值。
java.lang.NullPointerException
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:340)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:426)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:275)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy68.auditOperation(Unknown Source)
at com.logicacmg.hotscan.action.LoginAction.executeAction(LoginAction.java:259)
at com.logicacmg.hotscan.action.HotscanBaseAction.execute(HotscanBaseAction.java:66)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
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.logicacmg.hotscan.helper.CheckLoginFilter.doFilter(CheckLoginFilter.java:257)
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:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
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:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
这些是根据需要添加到项目中的新jars。
Jars replaced :
aopalliance-1.0
commons-logging
log4j-1.2.17
quartz-2.2.3
spring-aop-4.3.2.RELEASE
spring-beans-4.3.2.RELEASE
spring-boot-test-1.5.9.RELEASE
spring-context-4.3.2.RELEASE
spring-context-support-4.3.2.RELEASE
spring-core-4.3.2.RELEASE
spring-expression-4.3.2.RELEASE
spring-jdbc-4.3.2.RELEASE
spring-jms-5.0.7.RELEASE
spring-ldap-core-2.1.0.RELEASE
spring-ldap-core-tiger-2.1.0.RELEASE
spring-security-acl-4.1.3.RELEASE
spring-security-cas-client-3.0.8.RELEASE
spring-security-core-4.1.3.RELEASE
spring-security-core-tiger-2.0.8.RELEASE
spring-security-ldap-4.1.3.RELEASE
spring-security-ntlm-2.0.8.RELEASE
spring-security-openid-4.1.3.RELEASE
spring-security-taglibs-4.1.3.RELEASE
spring-security-web-4.1.3.RELEASE
spring-test-5.0.7.RELEASE
spring-tx-4.3.2.RELEASE
spring-web-4.3.2.RELEASE
spring-webmvc-4.3.2.RELEASE
应用程序上下文:Spring对我的项目进行的xml更改
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-integration-jms-2.0.xsd
">
应用程序上下文已更改为4.1版本。
在代码中添加了transactionManager。<bean id="hotscanServices"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref bean="hotscanServicesTarget" />
</property>
</bean>
请让我知道发生错误的解决方法,找不到确切原因