You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Jason Chaffee <jc...@ebates.com> on 2010/04/17 01:21:22 UTC

Spring AOP / AspectJ / CXF issues (the latest)

Here is a summary of the problems I have had and their resolution.  I am
stuck with an issue of CXF not working when I enable aspect.  Details
below:

 

1.       NoClassDefFoundError:
org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException

a.       This was resolved by installing the aspect bundles and
refreshing Spring AOP after they were installed.  The key here was to
refresh the Spring AOP bundle.

2.       Dynamic proxy issue

a.       Resolved by using <aop:aspectj-autoproxy
proxy-target-class="true"/> before doing (1), but the issue didn't
appear after (1) and I was able to remove that configuration.

3.       Any bundle that uses the org.apache.cxf.bundle now fails after
doing step (1) with the following error: NoClassDefFoundError:
org/springframework/beans/factory/support/ManagedSet.  This happens when
loading the META-INF/cxf/cxf.xml file.

 

I removed the jaxrs code from my hibernate/aop code and deployed them in
different bundles.  Once I did this, I got the hibernate/aop code
working right away after doing step (1).  Of course, this same step then
broke my jaxrs bundle.

 

I am stuck because I need to both and I can't get them working together.
The org.apache.cxf.bundle has org.springframework.beans.factory.support
as optional in the manifest, so I tried to refresh it, but to no avail.
It did not resolve all of the optional packages and put them in
import-package.  I even tried to building the cxf bundle myself and
changing the import-package logic in the pom.xml.  This didn't work
either, but I might have done something wrong.

 

Does anyone have any other ideas?  I am stuck on this one. 

 

Thanks,

 

Jason


RE: Spring AOP / AspectJ / CXF issues (the latest)

Posted by Jason Chaffee <jc...@ebates.com>.
This didn't work for me at all.  

Again, I had to refresh Spring AOP to get aspects working.  Otherwise, NoClassDefFound.  Once I do that, ALL bundles that rely on CXF break, not just mine, but a couple of servicemix bundles too.


-----Original Message-----
From: Johan Edstrom on behalf of Johan Edstrom
Sent: Sun 4/18/2010 8:15 PM
To: users@servicemix.apache.org
Subject: Re: Spring AOP / AspectJ / CXF issues (the latest)
 
No, and If you do what I said, in the bean thing, you will get it working.,..

This is a good read : http://gnodet.blogspot.com/2010/03/spring-dm-aries-blueprint-and-custom.html

You are right that the import with resolution:=optional is dangerous.


On Apr 18, 2010, at 8:51 PM, Jason Chaffee wrote:

> I have not problem with CXF working, if I don't refresh Spring AOP bundle after installing the aspectj bundles.  The problem is that all bundles that import META-INF/cxf/cxf.xml stop working after the Spring AOP refresh.  It is a catcth 22, I can get CXF working without AOP and I can't AOP working without CXF, but I can't get them both working at the same time.
> 
> 
> -----Original Message-----
> From: Johan Edstrom on behalf of Johan Edstrom
> Sent: Fri 4/16/2010 6:15 PM
> To: users@servicemix.apache.org
> Subject: Re: Spring AOP / AspectJ / CXF issues (the latest)
> 
> Here are two approaches that has worked.
> 
> -- I'm not entirely sure you'll wing it with aop as well int he spring approach - but here is a sample bundle manifest that I used to get it 
> working from a feature installed via -r (Don't refresh)
> 
> This is using jaxws:endpoints and httpsj configs.
> 
> <plugin>
>                <groupId>org.apache.felix</groupId>
>                <artifactId>maven-bundle-plugin</artifactId>
>                <extensions>true</extensions>
>                <configuration>
>                    <manifestLocation>${project.build.directory}/META-INF</manifestLocation>
>                    <instructions>
>                        <Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
>                        <Bundle-Name>${pom.artifactId}</Bundle-Name>
>                        <Import-Package>
> 
>                            com.sun.org.apache.xerces.internal.jaxp.datatype;resolution:=optional,
>                            org.apache.felix.karaf.jaas.boot,
>                            org.apache.ws.security.processor,
>                            org.apache.ws.security.transform,
>                            org.apache.ws.security.handler,
>                            javax.xml.soap,
>                            javax.xml,
>                            com.sun.xml.messaging.saaj,
>                            META-INF.cxf,
>                            javax.jws,
>                            javax.wsdl,
>                            org.apache.cxf.bus,
>                            org.apache.cxf.bus.resource,
>                            org.apache.cxf.bus.spring,
>                            org.apache.cxf.configuration.spring,
>                            org.apache.cxf.binding.soap.spring,
>                            org.apache.cxf.transport.http_osgi,
>                            org.apache.cxf.resource,
>                            org.springframework.beans.factory.config,
>                            org.springframework.context.annotation,
>                            *
>                        </Import-Package>
>                      <DynamicImport-Package>*</DynamicImport-Package>
>                        <Spring-Context>
>                            *;publish-context:=false;create-asynchronously:=true;wait-for-dependencies:=true;
>                        </Spring-Context>
>                        <Bundle-ClassPath>.</Bundle-ClassPath>
>                    <Include-Resource>src/main/resources</Include-Resource>
>                        <Embed-Dependency>cxf-rt-transports-http-jetty,org.apache.servicemix.bundles.jetty-bundle,cxf-ws-security</Embed-Dependency>
>                    </instructions>
>                </configuration>
>            </plugin>
> 
> 
> 2: Do it in a 'Normal' bean for a bundle like :
> 
> public class SimpleServer {
> 
>    JaxWsServerFactoryBean svrFactory;
>    Server srv;
>    SubscribeToNotifications subscriber;
> 
>    Logger logger = LoggerFactory.getLogger(SimpleServer.class);
> 
>    public void startServer() {
> 
>        svrFactory = new JaxWsServerFactoryBean();
> 
>        String busFactory = System.getProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME);
>        System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, "org.apache.cxf.bus.CXFBusFactory");
> 
>        JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
>        svrFactory.setServiceClass(NotificationProducer.class);
>        svrFactory.setAddress("http://localhost:9009/NotificationProducer");
>        svrFactory.setServiceBean(subscriber);
>        svrFactory.getInInterceptors().add(new LoggingInInterceptor());
>        svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
> 
>        srv = svrFactory.create();
>        logger.info("Started blueprint context, notification service started ");
> 
>    }
> 
>    public SimpleServer() {
>        // Not  until injection....
>    }
> 
>    public void shutDown() {
>        srv.stop();
>    }
> 
> 	public SubscribeToNotifications getSubscriber() {
> 		return subscriber;
> 	}
> 
> 	public void setSubscriber(SubscribeToNotifications subscriber) {
> 		this.subscriber = subscriber;
> 	}
> 
> }
> 
> 
> On Apr 16, 2010, at 5:21 PM, Jason Chaffee wrote:
> 
>> Here is a summary of the problems I have had and their resolution.  I am
>> stuck with an issue of CXF not working when I enable aspect.  Details
>> below:
>> 
>> 
>> 
>> 1.       NoClassDefFoundError:
>> org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
>> 
>> a.       This was resolved by installing the aspect bundles and
>> refreshing Spring AOP after they were installed.  The key here was to
>> refresh the Spring AOP bundle.
>> 
>> 2.       Dynamic proxy issue
>> 
>> a.       Resolved by using <aop:aspectj-autoproxy
>> proxy-target-class="true"/> before doing (1), but the issue didn't
>> appear after (1) and I was able to remove that configuration.
>> 
>> 3.       Any bundle that uses the org.apache.cxf.bundle now fails after
>> doing step (1) with the following error: NoClassDefFoundError:
>> org/springframework/beans/factory/support/ManagedSet.  This happens when
>> loading the META-INF/cxf/cxf.xml file.
>> 
>> 
>> 
>> I removed the jaxrs code from my hibernate/aop code and deployed them in
>> different bundles.  Once I did this, I got the hibernate/aop code
>> working right away after doing step (1).  Of course, this same step then
>> broke my jaxrs bundle.
>> 
>> 
>> 
>> I am stuck because I need to both and I can't get them working together.
>> The org.apache.cxf.bundle has org.springframework.beans.factory.support
>> as optional in the manifest, so I tried to refresh it, but to no avail.
>> It did not resolve all of the optional packages and put them in
>> import-package.  I even tried to building the cxf bundle myself and
>> changing the import-package logic in the pom.xml.  This didn't work
>> either, but I might have done something wrong.
>> 
>> 
>> 
>> Does anyone have any other ideas?  I am stuck on this one. 
>> 
>> 
>> 
>> Thanks,
>> 
>> 
>> 
>> Jason
>> 
> 
> Johan Edstrom
> 
> joed@opennms.org
> 
> They that can give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.
> 
> Benjamin Franklin, Historical Review of Pennsylvania, 1759
> 
> 
> 
> 
> 
> 

Johan Edstrom

joed@opennms.org

They that can give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.

Benjamin Franklin, Historical Review of Pennsylvania, 1759







Re: Spring AOP / AspectJ / CXF issues (the latest)

Posted by Johan Edstrom <jo...@opennms.org>.
No, and If you do what I said, in the bean thing, you will get it working.,..

This is a good read : http://gnodet.blogspot.com/2010/03/spring-dm-aries-blueprint-and-custom.html

You are right that the import with resolution:=optional is dangerous.


On Apr 18, 2010, at 8:51 PM, Jason Chaffee wrote:

> I have not problem with CXF working, if I don't refresh Spring AOP bundle after installing the aspectj bundles.  The problem is that all bundles that import META-INF/cxf/cxf.xml stop working after the Spring AOP refresh.  It is a catcth 22, I can get CXF working without AOP and I can't AOP working without CXF, but I can't get them both working at the same time.
> 
> 
> -----Original Message-----
> From: Johan Edstrom on behalf of Johan Edstrom
> Sent: Fri 4/16/2010 6:15 PM
> To: users@servicemix.apache.org
> Subject: Re: Spring AOP / AspectJ / CXF issues (the latest)
> 
> Here are two approaches that has worked.
> 
> -- I'm not entirely sure you'll wing it with aop as well int he spring approach - but here is a sample bundle manifest that I used to get it 
> working from a feature installed via -r (Don't refresh)
> 
> This is using jaxws:endpoints and httpsj configs.
> 
> <plugin>
>                <groupId>org.apache.felix</groupId>
>                <artifactId>maven-bundle-plugin</artifactId>
>                <extensions>true</extensions>
>                <configuration>
>                    <manifestLocation>${project.build.directory}/META-INF</manifestLocation>
>                    <instructions>
>                        <Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
>                        <Bundle-Name>${pom.artifactId}</Bundle-Name>
>                        <Import-Package>
> 
>                            com.sun.org.apache.xerces.internal.jaxp.datatype;resolution:=optional,
>                            org.apache.felix.karaf.jaas.boot,
>                            org.apache.ws.security.processor,
>                            org.apache.ws.security.transform,
>                            org.apache.ws.security.handler,
>                            javax.xml.soap,
>                            javax.xml,
>                            com.sun.xml.messaging.saaj,
>                            META-INF.cxf,
>                            javax.jws,
>                            javax.wsdl,
>                            org.apache.cxf.bus,
>                            org.apache.cxf.bus.resource,
>                            org.apache.cxf.bus.spring,
>                            org.apache.cxf.configuration.spring,
>                            org.apache.cxf.binding.soap.spring,
>                            org.apache.cxf.transport.http_osgi,
>                            org.apache.cxf.resource,
>                            org.springframework.beans.factory.config,
>                            org.springframework.context.annotation,
>                            *
>                        </Import-Package>
>                      <DynamicImport-Package>*</DynamicImport-Package>
>                        <Spring-Context>
>                            *;publish-context:=false;create-asynchronously:=true;wait-for-dependencies:=true;
>                        </Spring-Context>
>                        <Bundle-ClassPath>.</Bundle-ClassPath>
>                    <Include-Resource>src/main/resources</Include-Resource>
>                        <Embed-Dependency>cxf-rt-transports-http-jetty,org.apache.servicemix.bundles.jetty-bundle,cxf-ws-security</Embed-Dependency>
>                    </instructions>
>                </configuration>
>            </plugin>
> 
> 
> 2: Do it in a 'Normal' bean for a bundle like :
> 
> public class SimpleServer {
> 
>    JaxWsServerFactoryBean svrFactory;
>    Server srv;
>    SubscribeToNotifications subscriber;
> 
>    Logger logger = LoggerFactory.getLogger(SimpleServer.class);
> 
>    public void startServer() {
> 
>        svrFactory = new JaxWsServerFactoryBean();
> 
>        String busFactory = System.getProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME);
>        System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, "org.apache.cxf.bus.CXFBusFactory");
> 
>        JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
>        svrFactory.setServiceClass(NotificationProducer.class);
>        svrFactory.setAddress("http://localhost:9009/NotificationProducer");
>        svrFactory.setServiceBean(subscriber);
>        svrFactory.getInInterceptors().add(new LoggingInInterceptor());
>        svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
> 
>        srv = svrFactory.create();
>        logger.info("Started blueprint context, notification service started ");
> 
>    }
> 
>    public SimpleServer() {
>        // Not  until injection....
>    }
> 
>    public void shutDown() {
>        srv.stop();
>    }
> 
> 	public SubscribeToNotifications getSubscriber() {
> 		return subscriber;
> 	}
> 
> 	public void setSubscriber(SubscribeToNotifications subscriber) {
> 		this.subscriber = subscriber;
> 	}
> 
> }
> 
> 
> On Apr 16, 2010, at 5:21 PM, Jason Chaffee wrote:
> 
>> Here is a summary of the problems I have had and their resolution.  I am
>> stuck with an issue of CXF not working when I enable aspect.  Details
>> below:
>> 
>> 
>> 
>> 1.       NoClassDefFoundError:
>> org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
>> 
>> a.       This was resolved by installing the aspect bundles and
>> refreshing Spring AOP after they were installed.  The key here was to
>> refresh the Spring AOP bundle.
>> 
>> 2.       Dynamic proxy issue
>> 
>> a.       Resolved by using <aop:aspectj-autoproxy
>> proxy-target-class="true"/> before doing (1), but the issue didn't
>> appear after (1) and I was able to remove that configuration.
>> 
>> 3.       Any bundle that uses the org.apache.cxf.bundle now fails after
>> doing step (1) with the following error: NoClassDefFoundError:
>> org/springframework/beans/factory/support/ManagedSet.  This happens when
>> loading the META-INF/cxf/cxf.xml file.
>> 
>> 
>> 
>> I removed the jaxrs code from my hibernate/aop code and deployed them in
>> different bundles.  Once I did this, I got the hibernate/aop code
>> working right away after doing step (1).  Of course, this same step then
>> broke my jaxrs bundle.
>> 
>> 
>> 
>> I am stuck because I need to both and I can't get them working together.
>> The org.apache.cxf.bundle has org.springframework.beans.factory.support
>> as optional in the manifest, so I tried to refresh it, but to no avail.
>> It did not resolve all of the optional packages and put them in
>> import-package.  I even tried to building the cxf bundle myself and
>> changing the import-package logic in the pom.xml.  This didn't work
>> either, but I might have done something wrong.
>> 
>> 
>> 
>> Does anyone have any other ideas?  I am stuck on this one. 
>> 
>> 
>> 
>> Thanks,
>> 
>> 
>> 
>> Jason
>> 
> 
> Johan Edstrom
> 
> joed@opennms.org
> 
> They that can give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.
> 
> Benjamin Franklin, Historical Review of Pennsylvania, 1759
> 
> 
> 
> 
> 
> 

Johan Edstrom

joed@opennms.org

They that can give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.

Benjamin Franklin, Historical Review of Pennsylvania, 1759






RE: Spring AOP / AspectJ / CXF issues (the latest)

Posted by Jason Chaffee <jc...@ebates.com>.
I have not problem with CXF working, if I don't refresh Spring AOP bundle after installing the aspectj bundles.  The problem is that all bundles that import META-INF/cxf/cxf.xml stop working after the Spring AOP refresh.  It is a catcth 22, I can get CXF working without AOP and I can't AOP working without CXF, but I can't get them both working at the same time.


-----Original Message-----
From: Johan Edstrom on behalf of Johan Edstrom
Sent: Fri 4/16/2010 6:15 PM
To: users@servicemix.apache.org
Subject: Re: Spring AOP / AspectJ / CXF issues (the latest)
 
Here are two approaches that has worked.

-- I'm not entirely sure you'll wing it with aop as well int he spring approach - but here is a sample bundle manifest that I used to get it 
working from a feature installed via -r (Don't refresh)

This is using jaxws:endpoints and httpsj configs.

<plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <manifestLocation>${project.build.directory}/META-INF</manifestLocation>
                    <instructions>
                        <Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>${pom.artifactId}</Bundle-Name>
                        <Import-Package>
                            
                            com.sun.org.apache.xerces.internal.jaxp.datatype;resolution:=optional,
                            org.apache.felix.karaf.jaas.boot,
                            org.apache.ws.security.processor,
                            org.apache.ws.security.transform,
                            org.apache.ws.security.handler,
                            javax.xml.soap,
                            javax.xml,
                            com.sun.xml.messaging.saaj,
                            META-INF.cxf,
                            javax.jws,
                            javax.wsdl,
                            org.apache.cxf.bus,
                            org.apache.cxf.bus.resource,
                            org.apache.cxf.bus.spring,
                            org.apache.cxf.configuration.spring,
                            org.apache.cxf.binding.soap.spring,
                            org.apache.cxf.transport.http_osgi,
                            org.apache.cxf.resource,
                            org.springframework.beans.factory.config,
                            org.springframework.context.annotation,
                            *
                        </Import-Package>
                      <DynamicImport-Package>*</DynamicImport-Package>
                        <Spring-Context>
                            *;publish-context:=false;create-asynchronously:=true;wait-for-dependencies:=true;
                        </Spring-Context>
                        <Bundle-ClassPath>.</Bundle-ClassPath>
                    <Include-Resource>src/main/resources</Include-Resource>
                        <Embed-Dependency>cxf-rt-transports-http-jetty,org.apache.servicemix.bundles.jetty-bundle,cxf-ws-security</Embed-Dependency>
                    </instructions>
                </configuration>
            </plugin>


2: Do it in a 'Normal' bean for a bundle like :

public class SimpleServer {

    JaxWsServerFactoryBean svrFactory;
    Server srv;
    SubscribeToNotifications subscriber;

    Logger logger = LoggerFactory.getLogger(SimpleServer.class);

    public void startServer() {
       
        svrFactory = new JaxWsServerFactoryBean();

        String busFactory = System.getProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME);
        System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, "org.apache.cxf.bus.CXFBusFactory");

        JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
        svrFactory.setServiceClass(NotificationProducer.class);
        svrFactory.setAddress("http://localhost:9009/NotificationProducer");
        svrFactory.setServiceBean(subscriber);
        svrFactory.getInInterceptors().add(new LoggingInInterceptor());
        svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());

        srv = svrFactory.create();
        logger.info("Started blueprint context, notification service started ");

    }

    public SimpleServer() {
        // Not  until injection....
    }

    public void shutDown() {
        srv.stop();
    }

	public SubscribeToNotifications getSubscriber() {
		return subscriber;
	}

	public void setSubscriber(SubscribeToNotifications subscriber) {
		this.subscriber = subscriber;
	}
   
}


On Apr 16, 2010, at 5:21 PM, Jason Chaffee wrote:

> Here is a summary of the problems I have had and their resolution.  I am
> stuck with an issue of CXF not working when I enable aspect.  Details
> below:
> 
> 
> 
> 1.       NoClassDefFoundError:
> org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
> 
> a.       This was resolved by installing the aspect bundles and
> refreshing Spring AOP after they were installed.  The key here was to
> refresh the Spring AOP bundle.
> 
> 2.       Dynamic proxy issue
> 
> a.       Resolved by using <aop:aspectj-autoproxy
> proxy-target-class="true"/> before doing (1), but the issue didn't
> appear after (1) and I was able to remove that configuration.
> 
> 3.       Any bundle that uses the org.apache.cxf.bundle now fails after
> doing step (1) with the following error: NoClassDefFoundError:
> org/springframework/beans/factory/support/ManagedSet.  This happens when
> loading the META-INF/cxf/cxf.xml file.
> 
> 
> 
> I removed the jaxrs code from my hibernate/aop code and deployed them in
> different bundles.  Once I did this, I got the hibernate/aop code
> working right away after doing step (1).  Of course, this same step then
> broke my jaxrs bundle.
> 
> 
> 
> I am stuck because I need to both and I can't get them working together.
> The org.apache.cxf.bundle has org.springframework.beans.factory.support
> as optional in the manifest, so I tried to refresh it, but to no avail.
> It did not resolve all of the optional packages and put them in
> import-package.  I even tried to building the cxf bundle myself and
> changing the import-package logic in the pom.xml.  This didn't work
> either, but I might have done something wrong.
> 
> 
> 
> Does anyone have any other ideas?  I am stuck on this one. 
> 
> 
> 
> Thanks,
> 
> 
> 
> Jason
> 

Johan Edstrom

joed@opennms.org

They that can give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.

Benjamin Franklin, Historical Review of Pennsylvania, 1759







Re: Spring AOP / AspectJ / CXF issues (the latest)

Posted by Johan Edstrom <jo...@opennms.org>.
Here are two approaches that has worked.

-- I'm not entirely sure you'll wing it with aop as well int he spring approach - but here is a sample bundle manifest that I used to get it 
working from a feature installed via -r (Don't refresh)

This is using jaxws:endpoints and httpsj configs.

<plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <manifestLocation>${project.build.directory}/META-INF</manifestLocation>
                    <instructions>
                        <Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>${pom.artifactId}</Bundle-Name>
                        <Import-Package>
                            
                            com.sun.org.apache.xerces.internal.jaxp.datatype;resolution:=optional,
                            org.apache.felix.karaf.jaas.boot,
                            org.apache.ws.security.processor,
                            org.apache.ws.security.transform,
                            org.apache.ws.security.handler,
                            javax.xml.soap,
                            javax.xml,
                            com.sun.xml.messaging.saaj,
                            META-INF.cxf,
                            javax.jws,
                            javax.wsdl,
                            org.apache.cxf.bus,
                            org.apache.cxf.bus.resource,
                            org.apache.cxf.bus.spring,
                            org.apache.cxf.configuration.spring,
                            org.apache.cxf.binding.soap.spring,
                            org.apache.cxf.transport.http_osgi,
                            org.apache.cxf.resource,
                            org.springframework.beans.factory.config,
                            org.springframework.context.annotation,
                            *
                        </Import-Package>
                      <DynamicImport-Package>*</DynamicImport-Package>
                        <Spring-Context>
                            *;publish-context:=false;create-asynchronously:=true;wait-for-dependencies:=true;
                        </Spring-Context>
                        <Bundle-ClassPath>.</Bundle-ClassPath>
                    <Include-Resource>src/main/resources</Include-Resource>
                        <Embed-Dependency>cxf-rt-transports-http-jetty,org.apache.servicemix.bundles.jetty-bundle,cxf-ws-security</Embed-Dependency>
                    </instructions>
                </configuration>
            </plugin>


2: Do it in a 'Normal' bean for a bundle like :

public class SimpleServer {

    JaxWsServerFactoryBean svrFactory;
    Server srv;
    SubscribeToNotifications subscriber;

    Logger logger = LoggerFactory.getLogger(SimpleServer.class);

    public void startServer() {
       
        svrFactory = new JaxWsServerFactoryBean();

        String busFactory = System.getProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME);
        System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, "org.apache.cxf.bus.CXFBusFactory");

        JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
        svrFactory.setServiceClass(NotificationProducer.class);
        svrFactory.setAddress("http://localhost:9009/NotificationProducer");
        svrFactory.setServiceBean(subscriber);
        svrFactory.getInInterceptors().add(new LoggingInInterceptor());
        svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());

        srv = svrFactory.create();
        logger.info("Started blueprint context, notification service started ");

    }

    public SimpleServer() {
        // Not  until injection....
    }

    public void shutDown() {
        srv.stop();
    }

	public SubscribeToNotifications getSubscriber() {
		return subscriber;
	}

	public void setSubscriber(SubscribeToNotifications subscriber) {
		this.subscriber = subscriber;
	}
   
}


On Apr 16, 2010, at 5:21 PM, Jason Chaffee wrote:

> Here is a summary of the problems I have had and their resolution.  I am
> stuck with an issue of CXF not working when I enable aspect.  Details
> below:
> 
> 
> 
> 1.       NoClassDefFoundError:
> org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
> 
> a.       This was resolved by installing the aspect bundles and
> refreshing Spring AOP after they were installed.  The key here was to
> refresh the Spring AOP bundle.
> 
> 2.       Dynamic proxy issue
> 
> a.       Resolved by using <aop:aspectj-autoproxy
> proxy-target-class="true"/> before doing (1), but the issue didn't
> appear after (1) and I was able to remove that configuration.
> 
> 3.       Any bundle that uses the org.apache.cxf.bundle now fails after
> doing step (1) with the following error: NoClassDefFoundError:
> org/springframework/beans/factory/support/ManagedSet.  This happens when
> loading the META-INF/cxf/cxf.xml file.
> 
> 
> 
> I removed the jaxrs code from my hibernate/aop code and deployed them in
> different bundles.  Once I did this, I got the hibernate/aop code
> working right away after doing step (1).  Of course, this same step then
> broke my jaxrs bundle.
> 
> 
> 
> I am stuck because I need to both and I can't get them working together.
> The org.apache.cxf.bundle has org.springframework.beans.factory.support
> as optional in the manifest, so I tried to refresh it, but to no avail.
> It did not resolve all of the optional packages and put them in
> import-package.  I even tried to building the cxf bundle myself and
> changing the import-package logic in the pom.xml.  This didn't work
> either, but I might have done something wrong.
> 
> 
> 
> Does anyone have any other ideas?  I am stuck on this one. 
> 
> 
> 
> Thanks,
> 
> 
> 
> Jason
> 

Johan Edstrom

joed@opennms.org

They that can give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.

Benjamin Franklin, Historical Review of Pennsylvania, 1759