项目在weblogic10下功能正常 在weblogic8下报错
报错方法
private VoucherGenerate getVoucherGenerate()
{
return (VoucherGenerate)ApplusContext.getBean("voucherGenerate");
}
指向的接口
package com.anyi.gp.context;
import java.util.Properties;
import javax.servlet.ServletContext;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.interceptor.TransactionProxyFactoryBean;
import org.springframework.web.context.WebApplicationContext;
public class ApplusContext
{
private static WebApplicationContext webApplicationContext = null;
public static EnvironmentConfig getEnvironmentConfig()
{
return (EnvironmentConfig)webApplicationContext.getBean("environmentConfig");
}
public static ServletContext getServletContext() {
return getWebApplicationContext().getServletContext();
}
public static WebApplicationContext getWebApplicationContext() {
return webApplicationContext;
}
public static void setWebApplicationContext(WebApplicationContext webApplicationContext)
{
webApplicationContext = webApplicationContext;
}
public static Object getBean(String beanName) {
return webApplicationContext.getBean(beanName);
}
public static Object getTransactionBean(Class cls)
{
Object target = null;
try {
target = cls.newInstance();
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
PlatformTransactionManager tran = null;
try {
tran = (PlatformTransactionManager)getBean("currentTransactionManager");
}
catch (RuntimeException e) {
}
if (null == tran) {
throw new RuntimeException("Error_1005: 找不到名为 currentTransactionManager 的事务管理器!");
}
Properties properties = new Properties();
properties.setProperty("*", "PROPAGATION_REQUIRED,-Exception");
TransactionProxyFactoryBean proxyFactory = new TransactionProxyFactoryBean();
proxyFactory.setTarget(target);
proxyFactory.setTransactionManager(tran);
proxyFactory.setTransactionAttributes(properties);
proxyFactory.afterPropertiesSet();
return proxyFactory.getObject();
}
}
xml配置
<bean id="voucherGenerate" class="com.anyi.gk.core.PrGbVoucherGenerate" scope="prototype">
<constructor-arg index="0">
<ref bean="myDataSource"/>
</constructor-arg>
</bean>