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
[email protected]
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