Aspectj在WebSphere也 load time weaving

安装依赖包

把如下两个包

aspectjweaver.jar

aspectjrt.jar

放在如下目录

${WAS_INSTALL_ROOT}/java/jre/lib/ext

${WAS_INSTALL_ROOT}是Websphere按照目录(例如/usr/IBM/WebSphere/AppServer)

配置WebSphere

登录WebSphere管理控制台http://ip:9060/ibm/console

 

左边菜单 服务器 ==> 应用程序服务器 ==》 右边窗口点击你的服务器

服务器基础结构 ==》进程定义 ==》Java 虚拟机 

 

Java 虚拟机 输入框中 输入

-javaagent:${WAS_INSTALL_ROOT}/java/jre/lib/ext/aspectjweaver.jar

(例如-javaagent:/usr/IBM/WebSphere/AppServer/java/jre/lib/ext/aspectjweaver.jar

 

然后在Web应用中的jar文件META-INF/aop.xml或 classes/META-INF/aop.xml中配置要weaving的类

 

例如:

<?xml version="1.0"?>
<!DOCTYPE aspectj PUBLIC    
  "-//AspectJ//DTD//EN"    "http://www.eclipse.org/aspectj/dtd/aspectj.dtd"> 
<aspectj>
	<weaver options="-showWeaveInfo -XmessageHandlerClass:org.springframework.aop.aspectj.AspectJWeaverMessageHandler">
    	<exclude within="org.ofbiz.entity.OpensessionAspect"/>
    	<exclude within="com.jeyo.workflow.JbpmContextAspect"/>
    	<exclude within="(@org.aspectj.lang.annotation.Aspect *)"/>
    	<exclude within="(!@com.achievo.framework.aspectj.annotation.WithAspectJWeave org..*) AND org..*"/>
    	<include within="com.achievo..*"/>
    	<include within="com.jeyo..*"/>
    	<include within="org.ofbiz..*"/>
    	<!-- 
    	<include within="org.ofbiz..*"/>
    	<include within="org.ofbiz.entity.datasource.InitClcPlugin"/>
    	<include within="org.ofbiz.base.util.LogToDB"/>
    	<include within="org.ofbiz.content.webapp.control.*"/>
    	 -->
    	<exclude within="java..*"/>
    	<exclude within="org.aspectj..*"/>
    	<exclude within="sun..*"/>
    	<exclude within="com.ibm..*"/>
    	<exclude within="org.eclipse..*"/>
    	<exclude within="javax..*"/>
    	
    	<!-- <exclude within="(!@WithAspectJWeave org..*) AND org..*"/>-->
    	<exclude within="org.hibernate..*"/>
    	<exclude within="org.apache..*"/>
    	<exclude within="org.quartz..*"/>
    	
    </weaver>
	<aspects>
		<aspect name="com.achievo.framework.aspectj.AchievoAdviceOrderAspect"/>
		<aspect name="org.ofbiz.entity.OpensessionAspect"/>
		<aspect name="com.jeyo.workflow.JbpmContextAspect"/>
		<aspect name="org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect"/>
		<aspect name="com.achievo.framework.transaction.aspectj.AchievoTransactionAspect"/>
		<!-- <aspect name="org.springframework.transaction.aspectj.AnnotationTransactionAspect"/> -->
	</aspects>
</aspectj>

 

 重启应用服务器

 web控制台 左边菜单 服务器 ==> 应用程序服务器 ==》 选中你的服务器

点击上面的重新启动

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值