Hi,

I created a osgi bundle with following interface.
public interface IEndPoint
{
public abstract String getName();
}

I created another osgi bundle with following class

public class TeamCenterEndPointImpl implements IEndPoint
{
    public String getName() {
        return "teamcenter";
    }
}

I exposed this class as an OSGI service using following configuration

<bean id="TeamCenterEndPoint"
class="com.altair.hwe.connect.teamcenter.internal.TeamCenterEndPointImpl"/>

<osgi:service ref="TeamCenterEndPoint" 
        interface="com.altair.hwe.connect.endpoint.api.IEndPoint" />

I created one more OSGI bundle with following class which wants to use the
service exposes by previous bundle.
public class PlatformManager implements OsgiServiceLifecycleListener
{
 
    @Override
    public void bind(Object arg0, Map arg1) throws Exception
    {
        registerService(arg0);
        
    }
    @Override
    public void unbind(Object arg0, Map arg1) throws Exception
    {
        unRegisterService(arg0);
        
    }

   public void registerService(Object object) {
        System.out.println("register service what the heck ->
"+object.getClass().getName());
        if(object instanceof IEndPoint) {
            tempEndPoint = (IEndPoint)object;
        }
        tempEndPoint.getName();
        
    }
    
    public void unRegisterService(Object object) {
        System.out.println("unregister service what the heck ->
"+object.getClass().getName());
        if(object instanceof IEndPoint) {
            tempEndPoint = (IEndPoint)object;
        }
        tempEndPoint.getName();    
   }
}

I gave following configuration in spring-xml files

<osgi:list id="EndPointInstance"
interface="com.altair.hwe.connect.endpoint.api.IEndPoint">
                <osgi:listener ref="PlatformManager"/>          
       </osgi:list>

<bean class="com.altair.hwe.connect.platform.management.PlatformManager"
        id="PlatformManager">
    </bean>

When i ran the program using servicemix.
I got following exception
org.springframework.aop.AopInvocationException: AOP configuration seems to
be invalid: tried calling method [public abstract java.lang.String
com.altair.hwe.connect.endpoint.api.IEndPoint.getName()] on target
[com.altair.hwe.connect.teamcenter.internal.teamcenterendpointi...@643b8f];
nested exception is java.lang.IllegalArgumentException: object is not an
instance of declaring class
        at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:315)
        at
org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)

The same way i used in fuse 4.0, and it worked fine.
I have recently switched to fuse 4.2, and i am getting this problem

With Regards
Harbeer Kadian
-- 
View this message in context: 
http://old.nabble.com/org.springframework.aop.AopInvocationException%3A-AOP-configuration-seems-to-be-invalid-tp27790315p27790315.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to