Typesafe console and OSGI issues

146 views
Skip to first unread message

Stavros Kontopoulos

unread,
Feb 3, 2014, 8:34:06 AM2/3/14
to typesafe...@googlegroups.com

I am trying to create a multiple bundle osgi akka based project and integrate it with typesafe console.


So far i can make it work with one bundle (all dependencies in one jar file (transitive ones) ) but it does not work as expected when i use more than one bundles.

To make things easier i used only two independent bundles each of which has each own set of dependencies resolved within its own jar without importing anything from one  another.

This level of isolation was on purpose to find possible issues, before going too far.

I deployed the bundles and i got this exception error:


aused by: java.lang.ClassCastException: interface akka.actor.Scheduler is not assignable from class akka.actor.LightArrayRevolverScheduler
    at akka.actor.ReflectiveDynamicAccess$$anonfun$getClassFor$1.apply(DynamicAccess.scala:69)[59:com.typesafe.atmos.sample:1.3.1]
    at akka.actor.ReflectiveDynamicAccess$$anonfun$getClassFor$1.apply(DynamicAccess.scala:66)[59:com.typesafe.atmos.sample:1.3.1]
    at scala.util.Try$.apply(Try.scala:161)[59:com.typesafe.atmos.sample:1.3.1]
    at akka.actor.ReflectiveDynamicAccess.getClassFor(DynamicAccess.scala:66)[59:com.typesafe.atmos.sample:1.3.1]
    at akka.actor.ReflectiveDynamicAccess.createInstanceFor(DynamicAccess.scala:84)[59:com.typesafe.atmos.sample:1.3.1]
    at akka.actor.ActorSystemImpl.createScheduler(ActorSystem.scala:618)[59:com.typesafe.atmos.sample:1.3.1]
    at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:541)[59:com.typesafe.atmos.sample:1.3.1]
    at akka.actor.ActorSystem$.apply(ActorSystem.scala:111)[59:com.typesafe.atmos.sample:1.3.1]
    at akka.actor.ActorSystem$.apply(ActorSystem.scala:104)[59:com.typesafe.atmos.sample:1.3.1]
    at com.typesafe.atmos.trace.AtmosSystem$$anon$1.create(AtmosSystem.scala:44)[59:com.typesafe.atmos.sample:1.3.1]
    at com.typesafe.atmos.trace.AtmosSystem$$anon$1.create(AtmosSystem.scala:43)[59:com.typesafe.atmos.sample:1.3.1]
    at com.typesafe.atmos.util.OnDemand.access(OnDemand.scala:18)[59:com.typesafe.atmos.sample:1.3.1]
    at com.typesafe.atmos.trace.AtmosSystem$.create(AtmosSystem.scala:54)[59:com.typesafe.atmos.sample:1.3.1]
    at com.typesafe.atmos.trace.DispatcherTrace.<init>(DispatcherTrace.scala:17)[59:com.typesafe.atmos.sample:1.3.1]
    at com.typesafe.atmos.trace.DefaultActorSystemTracer.<init>(ActorSystemTracer.scala:59)[59:com.typesafe.atmos.sample:1.3.1]
    at com.typesafe.atmos.trace.ActorSystemTracer$.create(ActorSystemTracer.scala:26)[59:com.typesafe.atmos.sample:1.3.1]
    at com.typesafe.atmos.trace.ActorSystemTracer.create(ActorSystemTracer.scala)[59:com.typesafe.atmos.sample:1.3.1]
    at com.typesafe.atmos.trace.ActorTraceAspect.ajc$before$com_typesafe_atmos_trace_ActorTraceAspect$1$dba35327(ActorTraceAspect.aj:80)[59:com.typesafe.atmos.sample:1.3.1]
    at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:460)[59:com.typesafe.atmos.sample:1.3.1]
    at akka.actor.ActorSystem$.apply(ActorSystem.scala:111)[59:com.typesafe.atmos.sample:1.3.1]
    at akka.osgi.OsgiActorSystemFactory.createActorSystem(OsgiActorSystemFactory.scala:34)[59:com.typesafe.atmos.sample:1.3.1]
    at akka.osgi.OsgiActorSystemFactory.createActorSystem(OsgiActorSystemFactory.scala:26)[59:com.typesafe.atmos.sample:1.3.1]
    at com.typesafe.atmos.sample.internal.osgi.Activator.start(Activator.scala:38)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
    at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_45]
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)[osgi-3.8.0.v20120529-1548.jar:]
    ... 26 more

It seems a classloader issue but i dont understand why...


I use:

Karaf 2.2.3:

under karaf system:

org.eclipse.equinox.weaving.aspectj_1.0.300.v20130327-1442.jar
org.eclipse.equinox.weaving.caching_1.0.300.v20130327-1442.jar
sigar folder with dlls packaged within the typesafe console zip file

under karaf lib:

org.eclipse.equinox.weaving.hook_1.0.200.v20130327-1442

in karaf.bat:
set DEFAULT_JAVA_OPTS=%JAVA_MODE% -Xms%JAVA_MIN_MEM% -Xmx%JAVA_MAX_MEM% -Dderby.system.home="%KARAF_DATA%\derby" -Dderby.storage.fileSyncTransactionLog=true -Dcom.sun.management.jmxremote -Dorg.aspectj.tracing.factory=default -Djava.library.path=sigar/

etc/config.properties:

karaf.framework=equinox


Contents of each bundle are as follows


META-INF
sample
akka-osgi_2.10-2.2.1.jar
akka-slf4j_2.10-2.2.1.jar
application.conf
atmos-event_2.10-1.3.1.jar
atmos-trace_2.10-1.3.1.jar
capsule-1.1.0.jar
config-1.0.2.jar
domino-1.0.0.jar
logback-classic-1.0.7.jar
logback-core-1.0.7.jar
logback.xml
netty-3.6.6.Final.jar
org.osgi.compendium-4.3.0.jar
org.osgi.core-4.3.0.jar
protobuf-java-2.4.1.jar
scala-library-2.10.2.jar
scala-logging-1.0.0.jar
scala-osgi-metatype-1.0.0.jar
scala-reflect-2.10.2.jar
scala-stm_2.10-0.7.jar
sigar-1.6.4.jar
slf4j-api-1.6.6.jar
trace-akka-2.2.1_2.10-1.3.1.jar
trace-scala-2.10.2-1.3.1.jar
uncommons-maths-1.2.2a.jar

and

i have for aop.xml (instead of unjar aop.xmls i gethered them together -not perfect but ok ;)):

<aspectj>
    <aspects>

        <!--<aspect name="com.typesafe.atmos.trace.RemoteTraceAspect"/>-->
        <aspect name="com.typesafe.atmos.trace.ActorTraceAspect"/>
        <aspect name="com.typesafe.atmos.trace.FutureTraceAspect"/>
    </aspects>
    <weaver options="-verbose">
        <include within="akka..*"/>
        <!-- Weaving with ByteString included throws a VerifyError -->
        <exclude within="akka.util.ByteString"/>
        <include within="com.typesafe.atmos..*"/>
        <include within="scala.concurrent..*"/>
    </weaver>
</aspectj>

Custom aspects defined by me work fine....

I am thinking of using one bundle as a common bundle to share libraries such as trace-akka-2.2.1... has anyone had success with osgi before?

Any ideas?


Reply all
Reply to author
Forward
0 new messages