关于weblogic版本问题引起的错误

shl0128 2018-04-23 11:47:43
项目在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>
...全文
689 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
shl0128 2018-04-23
  • 打赏
  • 举报
回复

67,515

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧