Akka OSGi sample error.

34 views
Skip to first unread message

pantstx

unread,
Oct 11, 2010, 2:46:49 PM10/11/10
to Akka User List
When attempting to run the OSGi sample, I'm hitting a NoClassDefFound
for multiverse classes. I'm not sure how to fix this- I've attempted
to explicitly import the multiverse package into the sample OSGi
project, to no avail. Any suggestions? Thanks!

INF [20101011-13:42:19.351] api: Failed to initialize
GlobalStmInstance through System property
'org.multiverse.api.GlobalStmInstance.factoryMethod' with value
'org.multiverse.stms.alpha.AlphaStm'.'org.multiverse.stms.alpha.AlphaStm.createFast'
is not an existing class (it can't be found using the
Thread.currentThread.getContextClassLoader).
ERROR: Error starting file:bundles/
se.scalablesolutions.akka.sample.osgi_0.10.jar
(org.osgi.framework.BundleException: Activator start error in bundle
se.scalablesolutions.akka.sample.osgi [35].)
java.lang.ExceptionInInitializerError
at
se.scalablesolutions.akka.stm.TransactionFactory.<init>(TransactionFactory.scala:
178)
at se.scalablesolutions.akka.stm.TransactionFactory
$.apply(TransactionFactory.scala:127)
at se.scalablesolutions.akka.stm.GlobalStm.<init>(GlobalStm.scala:29)
at se.scalablesolutions.akka.stm.global.package$.<init>(package.scala:
10)
at se.scalablesolutions.akka.stm.global.package
$.<clinit>(package.scala)
at se.scalablesolutions.akka.actor.ActorRef$class.$init$
(ActorRef.scala:197)
at
se.scalablesolutions.akka.actor.LocalActorRef.<init>(ActorRef.scala:
660)
at
se.scalablesolutions.akka.actor.LocalActorRef.<init>(ActorRef.scala:
683)
at se.scalablesolutions.akka.actor.Actor$.actorOf(Actor.scala:124)
at se.scalablesolutions.akka.actor.Actor$.actorOf(Actor.scala:108)
at
se.scalablesolutions.akka.sample.osgi.Activator.start(osgiExample.scala:
17)
at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:
633)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1822)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1739)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:
1143)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:
264)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalArgumentException: Failed to initialize
GlobalStmInstance through System property
'org.multiverse.api.GlobalStmInstance.factoryMethod' with value
'org.multiverse.stms.alpha.AlphaStm'.'org.multiverse.stms.alpha.AlphaStm.createFast'
is not an existing class (it can't be found using the
Thread.currentThread.getContextClassLoader).
at
org.multiverse.api.GlobalStmInstance.getMethod(GlobalStmInstance.java:
82)
at
org.multiverse.api.GlobalStmInstance.<clinit>(GlobalStmInstance.java:
38)
... 17 more
Caused by: java.lang.ClassNotFoundException:
org.multiverse.stms.alpha.AlphaStm
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at
org.multiverse.api.GlobalStmInstance.getMethod(GlobalStmInstance.java:
76)
... 18 more

Heiko Seeberger

unread,
Oct 12, 2010, 3:58:03 AM10/12/10
to akka...@googlegroups.com
Thanks for reporting this error. I will look into it this week, but I am traveling today and tomorrow.

Heiko


--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.




--
Heiko Seeberger

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Akka - Simpler Scalability, Fault-Tolerance, Concurrency & Remoting through Actors: akkasource.org

pantstx

unread,
Oct 22, 2010, 1:53:21 PM10/22/10
to Akka User List
Did you make any progress on the osgi sample issue? Thanks!

On Oct 12, 2:58 am, Heiko Seeberger <heiko.seeber...@googlemail.com>
wrote:
> Thanks for reporting this error. I will look into it this week, but I am
> traveling today and tomorrow.
>
> Heiko
>
> > akka-user+...@googlegroups.com<akka-user%2Bunsubscribe@googlegroups .com>
> > .

Robert Wills

unread,
Feb 12, 2011, 2:19:11 AM2/12/11
to akka...@googlegroups.com, pan...@gmail.com
Hello,

I just ran int this same problem.

INFO: Failed to initialize GlobalStmInstance through System property


'org.multiverse.api.GlobalStmInstance.factoryMethod' with value
'org.multiverse.stms.alpha.AlphaStm'.'org.multiverse.stms.alpha.AlphaStm.createFast'
is not an existing class (it can't be found using the
Thread.currentThread.getContextClassLoader).

973 [akka:event-driven:dispatcher:global-3] ERROR akka.actor.Actor$ -
Exception when invoking
actor [Actor[com.moixa.pachube.PachubeActor:c5b3d1b0-3673-11e0-bcdb-0015f219e7d8]]
with message [AddSwitch(gx1,ControlSwitch(10,Switch
10,0,2011-02-12T06:46:08.782Z))]
973 [akka:event-driven:dispatcher:global-3] ERROR akka.actor.Actor$ - Problem
java.lang.ExceptionInInitializerError
at akka.stm.TransactionFactory.<init>(TransactionFactory.scala:178)
at akka.stm.TransactionFactory$.apply(TransactionFactory.scala:127)
at akka.stm.Stm$class.$init$(Stm.scala:44)
at akka.stm.package$.<init>(package.scala:10)

I guess the problem was fixed for the osgi sample because in that case
the exception
was thrown when trying to start the actor. I was able to get the
osgi-sample running fine inside
felix but I was able to reproduce the problem by changing the start method:

def start(context: BundleContext) {
println("Starting the OSGi example ...")
val echo = actorOf[EchoActor].start
val answer = (echo !! "OSGi example")
println(answer getOrElse "No answer!")
atomic { myMap.put("foo", "bar") }
println(myMap)
}

INFO: Failed to initialize GlobalStmInstance through System property


'org.multiverse.api.GlobalStmInstance.factoryMethod' with value
'org.multiverse.stms.alpha.AlphaStm'.'org.multiverse.stms.alpha.AlphaStm.createFast'
is not an existing class (it can't be found using the
Thread.currentThread.getContextClassLoader).
ERROR: Error starting

file:/home/rob/moixa/felix-framework-3.0.7/bundle/akka-sample-osgi-1.0-RC6.jar


(org.osgi.framework.BundleException: Activator start error in bundle

se.scalablesolutions.akka.sample.osgi [12].)
java.lang.ExceptionInInitializerError
at akka.stm.TransactionFactory.<init>(TransactionFactory.scala:178)
at akka.stm.TransactionFactory$.apply(TransactionFactory.scala:127)
at akka.stm.Stm$class.$init$(Stm.scala:44)
at akka.stm.package$.<init>(package.scala:10)
at akka.stm.package$.<clinit>(package.scala)
at akka.sample.osgi.Activator.start(osgiExample.scala:25)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:629)

Any thoughts?

Thanks,
Rob

> To unsubscribe from this group, send email to akka-user+...@googlegroups.com.

AndrewC

unread,
Mar 23, 2011, 3:02:40 PM3/23/11
to Akka User List
The Thread.currentThread.getContextClassLoader method doesn't work in
OSGi bundles, because each bundle has its own ClassLoader. So
akka.stm.TransactionFactory defined in the akka-stm bundle doesn't
have visibility to org.multiverse* classes loaded by the OSGi
dependencies bundle.


-Andrew


On Feb 12, 2:19 am, Robert Wills <wrwi...@gmail.com> wrote:
> Hello,
>
> I just ran int this same problem.
>
> INFO: Failed to initialize GlobalStmInstance through System property
> 'org.multiverse.api.GlobalStmInstance.factoryMethod' with value
> 'org.multiverse.stms.alpha.AlphaStm'.'org.multiverse.stms.alpha.AlphaStm.cr eateFast'
> is not an existing class (it can't be found using the
> Thread.currentThread.getContextClassLoader).
> 973 [akka:event-driven:dispatcher:global-3] ERROR akka.actor.Actor$ -
> Exception when invoking
>         actor [Actor[com.moixa.pachube.PachubeActor:c5b3d1b0-3673-11e0-bcdb-0015f219e7d8] ]
>         with message [AddSwitch(gx1,ControlSwitch(10,Switch
> 10,0,2011-02-12T06:46:08.782Z))]
> 973 [akka:event-driven:dispatcher:global-3] ERROR akka.actor.Actor$ - Problem
> java.lang.ExceptionInInitializerError
>         at akka.stm.TransactionFactory.<init>(TransactionFactory.scala:178)
>         at akka.stm.TransactionFactory$.apply(TransactionFactory.scala:127)
>         at akka.stm.Stm$class.$init$(Stm.scala:44)
>         at akka.stm.package$.<init>(package.scala:10)
>
> I guess the problem was fixed for theosgisample because in that case
> the exception
> was thrown when trying to start the actor.  I was able to get theosgi-sample running fine inside
> felix but I was able to reproduce the problem by changing the start method:
>
>   def start(context: BundleContext) {
>     println("Starting theOSGiexample ...")
>     val echo = actorOf[EchoActor].start
>     val answer = (echo !! "OSGiexample")
>     println(answer getOrElse "No answer!")
>     atomic { myMap.put("foo", "bar") }
>     println(myMap)
>   }
>
> INFO: Failed to initialize GlobalStmInstance through System property
> 'org.multiverse.api.GlobalStmInstance.factoryMethod' with value
> 'org.multiverse.stms.alpha.AlphaStm'.'org.multiverse.stms.alpha.AlphaStm.cr eateFast'
> is not an existing class (it can't be found using the
> Thread.currentThread.getContextClassLoader).
> ERROR: Error starting
> file:/home/rob/moixa/felix-framework-3.0.7/bundle/akka-sample-osgi-1.0-RC6. jar
> (org.osgi.framework.BundleException: Activator start error in bundle
> se.scalablesolutions.akka.sample.osgi[12].)
> java.lang.ExceptionInInitializerError
>         at akka.stm.TransactionFactory.<init>(TransactionFactory.scala:178)
>         at akka.stm.TransactionFactory$.apply(TransactionFactory.scala:127)
>         at akka.stm.Stm$class.$init$(Stm.scala:44)
>         at akka.stm.package$.<init>(package.scala:10)
>         at akka.stm.package$.<clinit>(package.scala)
>         at akka.sample.osgi.Activator.start(osgiExample.scala:25)
>         at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.ja va:629)
>
> Any thoughts?
>
> Thanks,
> Rob
>
>
>
>
>
>
>
> On Fri, Oct 22, 2010 at 6:53 PM, pantstx <pant...@gmail.com> wrote:
> > Did you make any progress on theosgisample issue?  Thanks!
>
> > On Oct 12, 2:58 am, Heiko Seeberger <heiko.seeber...@googlemail.com>
> > wrote:
> >> Thanks for reporting this error. I will look into it this week, but I am
> >> traveling today and tomorrow.
>
> >> Heiko
>
> >> On 11 October 2010 20:46, pantstx <pant...@gmail.com> wrote:
>
> >> > When attempting to run theOSGisample, I'm hitting a NoClassDefFound
> >>OSGion Scala: scalamodules.org
Reply all
Reply to author
Forward
0 new messages