PDA

View Full Version : simple bean integration test


jaco
May 5th, 2008, 04:13 AM
Hi,

I created a sample project using the archetype as described in the docs.

mvn archetype:create \
-DarchetypeGroupId=org.springframework.osgi \
-DarchetypeArtifactId=spring-osgi-bundle-archetype \
-DarchetypeVersion=1.1.0-m2 \
-DgroupId=<your-project-groupId> \
-DartifactId=<your-project-artifactId> \
-Dversion=<your-project-version>

Running 'mvn package' for the created project fails with the following exception.

Caused by: java.lang.NoClassDefFoundError: org.osgi.vendor.framework property not set
at org.osgi.framework.FrameworkUtil$1.run(FrameworkUt il.java:54)
at java.security.AccessController.doPrivileged(Native Method)
at org.osgi.framework.FrameworkUtil.<clinit>(FrameworkUtil.java:49)
at org.springframework.osgi.util.OsgiFilterUtils.crea teFilter(OsgiFilterUtils.java:233)
at org.springframework.osgi.service.importer.support. AbstractOsgiServiceImportFactoryBean.getUnifiedFil ter(AbstractOsgiServiceImportFactoryBean.java:159)
at org.springframework.osgi.service.importer.support. AbstractOsgiServiceImportFactoryBean.afterProperti esSet(AbstractOsgiServiceImportFactoryBean.java:12 4)
at org.springframework.osgi.service.importer.support. OsgiServiceCollectionProxyFactoryBean.afterPropert iesSet(OsgiServiceCollectionProxyFactoryBean.java: 126)
at org.springframework.osgi.extender.internal.activat or.ContextLoaderListener.createListenersList(Conte xtLoaderListener.java:794)
at org.springframework.osgi.extender.internal.activat or.ContextLoaderListener.initListenerService(Conte xtLoaderListener.java:748)
at org.springframework.osgi.extender.internal.activat or.ContextLoaderListener.start(ContextLoaderListen er.java:385)
at org.eclipse.osgi.framework.internal.core.BundleCon textImpl$2.run(BundleContextImpl.java:991)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleCon textImpl.startActivator(BundleContextImpl.java:985 )

However changing 'spring.osgi.version' in the generated pom to '1.0.2' works fine.

Thanks Jaco

Costin Leau
May 12th, 2008, 03:20 AM
Jaco, the problem is that osgi.jar that gets read before the actual OSGi platform and plugs its own FrameworkUtil which throws the exception above.
To solve this, upgrade to the latest maven or make sure the osgi.jar is read last.
I've raised an issue about this - see OSGI-482.

P.S. Jaco, consider using the [ c o d e ] tags next time to make the post more readable.

jaco
May 12th, 2008, 05:58 AM
Thanks a lot. I will give it a try.