On 1/25/11 14:17, Reto Bachmann-Gmuer wrote:
Hello
When I attempt to load a class with
this.getClass.getClassLoader.load("foo.Hello") this prevents future updates
of the bundle exporting foo from being effective, services in that package
will not be running with the updated class until felix is restarted or
packageAdmin.refreshPackages called.
Is this a known problem?
This is not a "problem", that's how the spec defines it. If an exported
package is being used by some bundle, then an update to the exported
bundle does not take effect until it is refreshed. This allows you to do
multiple updates without having to refresh dependent bundles multiple times.
-> richard
Example clerezza cosnole transcript
zz>val b = bundleContext.getBundle(165)
b: org.osgi.framework.Bundle = tmp.foor [165]
zz>import java.io._
import java.io._
zz>b.update(new FileInputStream("/tmp/last2.jar"))
--> component changed version (looking at webpage generated by the jaxrs
service foo.Service)
zz>b.update(new FileInputStream("/tmp/last1.jar"))
--> component changed version
zz>val cl = this.getClass.getClassLoader()
cl: java.lang.ClassLoader =
scala.tools.nsc.interpreter.AbstractFileClassLoader@748a57a3
zz>cl.loadClass("foo.Hello")
java.lang.ClassNotFoundException: foo.Hello
at
scala.tools.nsc.interpreter.AbstractFileClassLoader.onull$1(AbstractFileClassLoader.scala:21)
at
scala.tools.nsc.interpreter.AbstractFileClassLoader$$anonfun$getBytesForClass$1.apply(AbstractFileClassLoader.scala:26)
at
scala.tools.nsc.interpreter.AbstractFileClassLoader$$anonfun$getBytesForClass$1.apply(AbstractFileClassLoader.scala:25)
at
scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at
scala.tools.nsc.interpreter.AbstractFileClassLoader.getBytesForClass(AbstractFileClassLoader.scala:25)
at
scala.tools.nsc.interpreter.AbstractFileClassLoader.findClass(AbstractFileClassLoader.scala:33)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
...
zz>b.update(new FileInputStream("/tmp/last2.jar"))
--> no effect on component
Cheers,
reto
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]