If I add org.w3c.dom as a required import, I get an exception complaining about there not being a
satisfying match in another bundle.
Now, there's a sample at http://groovy.codehaus.org/OSGi+and+Groovy which shows a BundleActivator,
and it actually jacks the context classloader (basically promoting itself up a notch). Why does it
have to do this? Is this to address some underlying problem with Groovy? Does it do some kind of
ClassLoader manipulation stunt which breaks within OSGi?
Here's the exception, should you be curious:
[java] Exception in thread "main" org.osgi.framework.BundleException: Activator start error in
bundle groovy16 [3].
[java] at org.apache.felix.framework.Felix.startBundle(Felix.java:1506)
[java] at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:779)
[java] at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:760)
[java] at eg.OSGiRuntime.loadBundleFile(Unknown Source)
[java] at eg.Driver.main(Unknown Source)
[java] Caused by: java.lang.NoClassDefFoundError: org/w3c/dom/NodeList
[java] at java.lang.Class.getDeclaredMethods0(Native Method)
[java] at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
[java] at java.lang.Class.getDeclaredMethods(Class.java:1763)
[java] at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:83)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:80)
[java] at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:78)
[java] at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:33)
[java] at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:20)
[java] at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:252)
[java] at
org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerMethods(MetaClassRegistryImpl.java:138)
[java] at
org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:87)
[java] at
org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:65)
[java] at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:28)
[java] at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:151)
[java] at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:170)
[java] at
eg.impl.groovy16.Groovy16HelloWorldBundle.$getStaticMetaClass(Groovy16HelloWorldBundle.groovy)
[java] at eg.impl.groovy16.Groovy16HelloWorldBundle.<init>(Groovy16HelloWorldBundle.groovy)
[java] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[java] at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
[java] at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
[java] at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
[java] at java.lang.Class.newInstance0(Class.java:350)
[java] at java.lang.Class.newInstance(Class.java:303)
[java] at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3350)
[java] at org.apache.felix.framework.Felix.startBundle(Felix.java:1453)
~~ Robert Fischer, Smokejumper IT Consulting.
Enfranchised Mind Blog http://EnfranchisedMind.com/blog
Check out my book, "Grails Persistence with GORM and GSQL"!
http://www.smokejumperit.com/gormbook
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
1) The classloader stunt outlined on the wiki doesn't seem to solve anything. The problem is when
my Groovy Activator class is being loaded, so the code that'd mangle the class path never even gets
a chance to execute.
2) The system bundle can load the NodeList class just fine.
3) Adding org.w3c.dom as an Import-Package gives an "Unresolved constraint" in org.w3c.dom
~~ Robert.
1) The classloader stunt outlined on the wiki doesn't seem to solve anything. The problem is when
my Groovy Activator class is being loaded, so the code that'd mangle the class path never even gets
a chance to execute.
2) The system bundle can load the NodeList class just fine.
3) Adding org.w3c.dom as an Import-Package gives an "Unresolved constraint" in org.w3c.dom
~~ Robert.
You must need to tell your container to expose that package as part of
the system bundle.
Something like this in config.ini:
org.osgi.framework.system.packages=org.w3c.dom,org.w3c.dom.traversal,
org.w3c.dom.ls, javax.sql, javax.transaction
Check out these directions:
http://docs.codehaus.org/display/JETTY/OSGi+Tips
--
Hamlet D'Arcy
haml...@gmail.com
I think it's slightly different for each container. Equinox specifies
a config.ini that you put this in:
org.osgi.framework.system.packages=org.w3c.dom,org.w3c.dom.traversal,
org.w3c.dom.ls, javax.sql, javax.transaction
But I'm guessing that isn't part of the OSGi spec and just part of
Equinox. I don't know though.
--
Hamlet D'Arcy
haml...@gmail.com
---------------------------------------------------------------------
~~ Robert.