I am writing a web application which needs to dynamically load various plugins at runtime. After hacking around with nastiness in classpath loading I came across OSGi, which seems like a great fit. However, I am having a few problems and questions.
1) I got the sample app from https://scm.ops4j.org/repos/ops4j/laboratory/users/adreghiciu/spring-dm I am able to build this (via mvn clean install) after adding the following to the main pom.xml: <repository> <id>ops4j.snapshots</id> <name>The OPS4J Snapshot Repository</name> <url>http://repository.ops4j.org/mvn-snapshots/</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> However, when I try to start it (with either pax-run --args=file:spring-dm.args or mvn pax:provision) I get the following error and the web app is not available: [FelixDispatchQueue] INFO org.springframework.bundle.osgi.extender - FrameworkEvent ERROR org.osgi.framework.BundleException: Activator start error. at org.apache.felix.framework.Felix._startBundle(Felix.java:1629) at org.apache.felix.framework.Felix.startBundle(Felix.java:1519) at org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1104) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:258) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.springframework.core.CollectionFactory.<clinit>(CollectionFactory.java:64) at org.springframework.osgi.extender.internal.ContextLoaderListener.<init>(ContextLoaderListener.java:319) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308) at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3486) at org.apache.felix.framework.Felix._startBundle(Felix.java:1580) ... 4 more [FelixStartLevel] ERROR System Bundle - Error starting file:/home/johnca/code/spring-osgi/pax-test/spring-dm/runner/bundles/org.springframework.bundle.osgi.extender_1.0.2.jar org.osgi.framework.BundleException: Activator start error. at org.apache.felix.framework.Felix._startBundle(Felix.java:1629) at org.apache.felix.framework.Felix.startBundle(Felix.java:1519) at org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1104) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:258) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.springframework.core.CollectionFactory.<clinit>(CollectionFactory.java:64) at org.springframework.osgi.extender.internal.ContextLoaderListener.<init>(ContextLoaderListener.java:319) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308) at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3486) at org.apache.felix.framework.Felix._startBundle(Felix.java:1580) ... 4 more [FelixDispatchQueue] INFO org.springframework.bundle.osgi.io - BundleEvent STARTED I can't seem to find the problem. I am using maven 2.0.7, java 1.6, and pax-runner 0.8.0. Let me know if I should provide more detail about my setup. 2) Finally, just a philosophical question: how do people tend to deploy and maintain these apps? Do you use pax-run with the --noConsole flag to start a daemon process and just let it run? How do you handle undeploying and redeploying your bundles? The big advantage I see for using OSGi at all is updating code without taking down the entire system, but I haven't yet found a good guide on how to set up a production-quality web server using this. Any help would be appreciated. Thanks! katre _______________________________________________ general mailing list general@lists.ops4j.org http://lists.ops4j.org/mailman/listinfo/general