[jboss-user] [JBoss AOP] - Re: Unable start AOP services in Jboss

DivyaMan0j do-not-reply at jboss.com
Mon Jun 4 04:46:51 EDT 2007


There are all my source code. Please take some to go through them and help me solve the issue.

The MetadataBean.class (Session bean):
======================
package com.presentation.beans;
public class MetadataBean implements SessionBean
{
  public String insert(String aMetadataName,
                         String aAttributeXML,
                         String aSessionId)
    {
	?.
	?
    }	
  public void ejbCreate() throws CreateException { }
  public void setSessionContext(SessionContext sessionContext) { }
  public void ejbActivate() { }
  public void ejbPassivate() { }
  public void ejbRemove() { }

}
=====================
Here, insert is the method exposed as a webservice and I want to intercept this method.

The Interceptor interface:
============================
package com.presentation.interfaces;
import org.jboss.aop.advice.*;
import org.jboss.aop.joinpoint.Invocation;

public interface Interceptor 
{
    public String getName();
    public Object invoke(Invocation invocation) throws Throwable;
}
==============================

The TracingInterceptor.java class

==============================
package com.presentation.interfaces;

import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.joinpoint.MethodInvocation;
import org.jboss.aop.advice.Interceptor;
import org.jboss.system.*;


public class TracingInterceptor extends org.jboss.ejb.plugins.AbstractInterceptor implements Interceptor {
    public String getName() {
	return "TracingInterceptor";
    }

    public Object invoke(Invocation invocation) throws Throwable
    {
	try {
	    MethodInvocation mi = (MethodInvocation)invocation;
	    System.out.println("<< Entering Method Interceptor for : "
			       + mi.getMethod().toString());
	    return invocation.invokeNext();
	} 
	finally {
	    System.out.println(">> Leaving Method Interceptor");
	}
    }
}
==============================

The MetadataInterface.java

=================================
package com.presentation.interfaces;

public interface MetadataInterface extends java.rmi.Remote
{
    public String insert (String aMetadataName, String aAttributeXML,
                          String aSessionId) throws java.rmi.RemoteException;
}
 =================================

Jboss-aop.xml file. I have placed this in the META-INF directory and also copy it to the server/all/deploy/jboss-aop.deployer folder (by replacing base-aop.xml in the same location with jboss-aop.xml).

===================================
<?xml version="1.0" encoding="UTF-8"><aop><bind pointcut="execution(com.presentation.interfaces.MetadataInterface->insert(String aMetadataName, String aAttributeXML, String aSessionId))"><interceptor  class="com.presentation.interfaces.TracingInterceptor"/></bind></aop>
===================================

The jboss.xml file is here :

  | <jboss>
  |    <enterprise-beans>
  |       <session>
  |          <ejb-name>Metadata</ejb-name>
  |          <local-jndi-name>Metadata</local-jndi-name>
  |           <port-component>
  |             <port-component-name>Metadata</port-component-name>
  |             <port-component-uri>/MyServices/Metadata</port-component-uri>
  |           </port-component>
  |       </session>
  |      <entity>
  |             <ejb-name>MetadataData</ejb-name>
  |             <local-jndi-name>MyMetadataDataBean</local-jndi-name>
  |       </entity>
  | <container-configurations>
  |   <container-configuration extends="Standard Stateless SessionBean">
  | <container-name>My Special Config</container-name>
  |      <call-logging>false</call-logging>
  |       <invoker-proxy-binding-name>stateless-rmi-invoker</invoker-proxy-binding-name>
  | <container-interceptors>
  | <interceptor>com.presentation.interfaces.TracingInterceptor</interceptor>
  |   <interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
  |         <interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
  |         <interceptor>org.jboss.ejb.plugins.SecurityInterceptor</interceptor>
  |         <!-- CMT -->
  |         <interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
  |         <interceptor transaction="Container">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
  |         <interceptor transaction="Container">org.jboss.webservice.server.ServiceEndpointInterceptor</interceptor>
  |         <interceptor transaction="Container">org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor</interceptor>
  |         <!-- BMT -->
  |         <interceptor transaction="Bean">org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor</interceptor>
  |         <interceptor transaction="Bean">org.jboss.ejb.plugins.TxInterceptorBMT</interceptor>
  |         <interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
  |         <interceptor transaction="Bean">org.jboss.webservice.server.ServiceEndpointInterceptor</interceptor>
  |         <interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
  | </container-interceptors>
  | </container-configuration>
  | </container-configurations>
  | </jboss>

I package all of them in a jar with jboss-aop.xml in the META-INF directory. The name of the binary i place in the server/all/deploy location is docman.ear, which has docman.jar with all the class files and descriptors.
Is it mandatory to package the AOP related class file in .aop file ?
Please let me know what is the issue here ?

thanks


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050843#4050843

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050843



More information about the jboss-user mailing list