Aspectwerkz undeploy not working

View: New views
1 Messages — Rating Filter:   Alert me  

Aspectwerkz undeploy not working

by shamik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

   I'm using Aspectwerkz for the first time for a hot deploy / undeploy. The hot deploy is working fine and my aspect is getting
deployed. But, whenever I perform undeploy, the deployed aspects don't revert back. Not sure what the issue is since I don't see any error. Here's the code snippet I'm using :

private static Map<String, DeploymentHandle> aopHandlerMap = new HashMap<String, DeploymentHandle>();

public void deployAOP(String scopeName){
                try{
                        SystemDefinition sysDef = SystemDefinitionContainer.getDefinitionFor(this.getClass().getClassLoader(),"eeonline");
                        DeploymentScope scope = sysDef.getDeploymentScope(scopeName);
                        DeploymentHandle handle = Deployer.deploy(com.ee.ApiAspect.class, "<aspect name='SystemdomainAO'>" + " "
                                        + " <pointcut name='methodExecution'"
                                        + " expression='execution(public * com.ee.systemdomainao*..*(..))'/>"
                                        + " <advice name='collectMetrics(StaticJoinPoint sjp)'" + " type='around'" + " bind-to='methodExecution'/>"
                                        + " </aspect>" , scope);
                        m_logger.debug("Got handle in deploy..........."+handle.toString());
                        aopHandlerMap.put(scopeName , handle);
                }catch(Exception ex){
                        ex.printStackTrace();
                }
        }

        /**
         * @param scopeName
         */
        public void undeployAOP(String scopeName){
                try{
                        if(aopHandlerMap!=null){
                                m_logger.debug("Inside undeployAOP scopeName..........."+scopeName);
                                m_logger.debug("Got handle in undeploy..........."+aopHandlerMap.get(scopeName).toString());
                                Deployer.undeploy(aopHandlerMap.get(scopeName));
                                m_logger.debug("Done with undeployAOP ...........");
                        }
                }catch(Exception ex){
                        ex.printStackTrace();
                }
        }

        public void undeployAOP(){
                try{
                        if(aopHandlerMap!=null){
                                Deployer.undeploy(com.ee.ApiAspect.class, this.getClass().getClassLoader());
                                m_logger.debug("Done with undeployAOP ...........");
                        }
                }catch(Exception ex){
                        ex.printStackTrace();
                }
        }

Here's the deployment scope :

<system id="eeonline">
        <deployment-scope name="systemdomainao" expression="execution(public * com.ee.systemdomainao*..*(..))"/>
   </system>

=============== deploy log ================
Deployer::INFO - deploying aspect [com.ee.ApiAspect] in class loader [WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@1326484
]

================ Undeploy Log =================
Deployer::INFO - undeploying aspect [com.ee.ApiAspect]] from class loader [WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@1326484
]

I'm using Tomcat 5 and JDK 1.5 . I verified the handler, its the same one during deploy and undeploy. I've also tried the undeploy API w/o using the handler, rather using the aspect class directly. It didn't work either.

Any pointer will be highly appreciated .

Thanks