You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Guillaume Yziquel <gu...@crossing-tech.com> on 2012/03/08 11:38:54 UTC

Scala protocol for Slang

Hi.

(Cross-posting to user@karaf.apache.org, as I suspect the
slang-dev@fusesource.org mailing to have low activity).

I've just tried out the Scala Slang Deployer for Karaf

	http://fusesource.com/forge/git/slang.git/

but scala files do not get deployed.

> class ScalaDeploymentListener extends ArtifactUrlTransformer {
> 
>   val LOG = LogFactory.getLog(classOf[ScalaDeploymentListener])
> 
>   def canHandle(artifact: File) = {
>     artifact.isFile() && artifact.getName().endsWith(".scala")
>   }
> 
>   def transform(artifact: URL) : URL = {
>     try {
>         new URL("scala", null, artifact.toString());
>     } catch {
>       case e: Exception => {
>         LOG.error("Unable to build scala bundle", e);
>         return null;
>       }
>     }
>   }
> }

It fails in 'new URL("scala", null, artifact.toString())' as there are
no 'scala' protocol:

> 10:07:42,262 | ERROR | Framework/deploy | ScalaDeploymentListener | ?                                   ? | 258 - org.fusesource.slang.scala.deployer - 1.0.0.SNAPSHOT | Unable to build scala bundle
> java.net.MalformedURLException: unknown protocol: scala
> 	at java.net.URL.<init>(URL.java:395)[:1.6.0_29]
> 	at java.net.URL.<init>(URL.java:283)[:1.6.0_29]
> 	at java.net.URL.<init>(URL.java:306)[:1.6.0_29]
> 	at org.fusesource.slang.scala.deployer.ScalaDeploymentListener.transform(ScalaDeploymentListener.scala:38)[258:org.fusesource.slang.scala.deployer:1.0.0.SNAPSHOT]
> 	at org.apache.felix.fileinstall.internal.DirectoryWatcher.transformArtifact(DirectoryWatcher.java:501)[6:org.apache.felix.fileinstall:3.1.10]
> 	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:430)[6:org.apache.felix.fileinstall:3.1.10]
> 	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:263)[6:org.apache.felix.fileinstall:3.1.10]

Anybody recently tried out the Slang deployer?

-- 
Guillaume Yziquel
Crossing-Tech
Parc Scientifique EPFL

Re: Scala protocol for Slang

Posted by Guillaume Yziquel <gu...@crossing-tech.com>.
Le Monday 12 Mar 2012 à 13:48:22 (+0100), Guillaume Yziquel a écrit :
> Le Monday 12 Mar 2012 à 12:51:17 (+0100), Gert Vanthienen a écrit :
> 
> For now, I managed to get it working for 2.8 (which is not the case for
> the master branch), and I'm currently working on porting to 2.9, though
> I do not expect to have too much the same kind of issues you experienced
> for Scalate / Guggla.

It works quite nicely with Scala 2.9, now.

-- 
Guillaume Yziquel
Crossing-Tech
Parc Scientifique EPFL

Re: Scala protocol for Slang

Posted by Raman Gupta <ro...@gmail.com>.
On 03/12/2012 12:52 PM, Guillaume Yziquel wrote:
> Le Monday 12 Mar 2012 à 09:14:50 (-0400), Raman Gupta a écrit :
>> On 03/12/2012 08:48 AM, Guillaume Yziquel wrote:
>>
>> My team has gotten Scalate 1.6.0-SNAPSHOT working on Scala 2.9.1 on
>> Karaf. See this stackoverflow posting for details and links to the
>> Scalate patches we created (though our Github pull requests have
>> essentially been ignored by the Scalate team):
>>
>> http://stackoverflow.com/questions/8935796/getting-the-scala-compiler-to-work-inside-an-osgi-runtime/9048302#9048302
> 
> Yes. Your post has been very useful in the past to get into the topic of
> osgified Scala compiler bundles.
> 
> I currently prefer creating OSGi bundles on the fly rather than purely
> compiling Scala code into ad-hoc instances. The main reason is that when
> I generate bundles, I do know where they fit in the OSGi hierarchy. If I
> generate instances via Guggla or the Scalate scripting engine, I wonder
> where these instances fit in the OSGi hierarchy, and specifically I do
> not know how safe it is to access other bundles from the compiled code.
> 
> You perhaps have valuable insight on this topic. Please feel free to
> share it.

Yes, I think the approach of generating bundles makes a lot of sense
for running dynamically compiled code via a tool like Slang.

The only insight I can provide is the approach we took to avoid
needing an OSGi dynamic import for the generated code. Since our
requirements are related to templates only, we didn't generate new
OSGi bundles for every template, but we still wanted to be able to run
services provided by other bundles without knowing upfront what those
services would be.

To solve this, other bundles expose an OSGi service implementing a
"TemplateCollaborator" interface with a generic "invoke" method
(another method on the interface is a String uniquely identifying the
underlying function to allow the template to call the correct
collaborator).

In our Scalate patch, we configured Scalate to use the TCCL when in an
OSGi environment, and so we set the TCCL to the bundle that loads the
templates so that classloading is relative to that bundle and not the
Scalate bundle.

The end result is that the dynamically compiled templates have access
to any TemplateCollaborator without needing to dynamically import the
underlying classes (and so collaborators and templates can be
added/changed at runtime without changing the template bundle code).

-- 
Raman
Principal
VIVO Systems

Re: Scala protocol for Slang

Posted by Guillaume Yziquel <gu...@crossing-tech.com>.
Le Monday 12 Mar 2012 à 09:14:50 (-0400), Raman Gupta a écrit :
> On 03/12/2012 08:48 AM, Guillaume Yziquel wrote:
> 
> My team has gotten Scalate 1.6.0-SNAPSHOT working on Scala 2.9.1 on
> Karaf. See this stackoverflow posting for details and links to the
> Scalate patches we created (though our Github pull requests have
> essentially been ignored by the Scalate team):
> 
> http://stackoverflow.com/questions/8935796/getting-the-scala-compiler-to-work-inside-an-osgi-runtime/9048302#9048302

Yes. Your post has been very useful in the past to get into the topic of
osgified Scala compiler bundles.

I currently prefer creating OSGi bundles on the fly rather than purely
compiling Scala code into ad-hoc instances. The main reason is that when
I generate bundles, I do know where they fit in the OSGi hierarchy. If I
generate instances via Guggla or the Scalate scripting engine, I wonder
where these instances fit in the OSGi hierarchy, and specifically I do
not know how safe it is to access other bundles from the compiled code.

You perhaps have valuable insight on this topic. Please feel free to
share it.

-- 
Guillaume Yziquel
Crossing-Tech
Parc Scientifique EPFL

Re: Scala protocol for Slang

Posted by Raman Gupta <ro...@gmail.com>.
On 03/12/2012 08:48 AM, Guillaume Yziquel wrote:
> Le Monday 12 Mar 2012 à 12:51:17 (+0100), Gert Vanthienen a écrit :
>>    L.S.,
> 
> Hi.
> 
>>    The Slang project is something I started quite a while ago, but that
>>    hasn't been developed any further.  The goal was not only to support
>>    Slang, but also other languages for the JVM.  Apart from updating the
>>    POMs, it probably needs a bit more work for get the Scala compiler to
>>    work properly again with the OSGi bundles once we upgrade from Scala
>>    2.8 to 2.9 - we had some work to do there for Scalate as well when we
>>    upgraded.
> 
> For now, I managed to get it working for 2.8 (which is not the case for
> the master branch), and I'm currently working on porting to 2.9, though
> I do not expect to have too much the same kind of issues you experienced
> for Scalate / Guggla.

My team has gotten Scalate 1.6.0-SNAPSHOT working on Scala 2.9.1 on
Karaf. See this stackoverflow posting for details and links to the
Scalate patches we created (though our Github pull requests have
essentially been ignored by the Scalate team):

http://stackoverflow.com/questions/8935796/getting-the-scala-compiler-to-work-inside-an-osgi-runtime/9048302#9048302

Regards,
Raman
Principal
VIVO Systems

Re: Scala protocol for Slang

Posted by Guillaume Yziquel <gu...@crossing-tech.com>.
Le Monday 12 Mar 2012 à 12:51:17 (+0100), Gert Vanthienen a écrit :
>    L.S.,

Hi.

>    The Slang project is something I started quite a while ago, but that
>    hasn't been developed any further.  The goal was not only to support
>    Slang, but also other languages for the JVM.  Apart from updating the
>    POMs, it probably needs a bit more work for get the Scala compiler to
>    work properly again with the OSGi bundles once we upgrade from Scala
>    2.8 to 2.9 - we had some work to do there for Scalate as well when we
>    upgraded.

For now, I managed to get it working for 2.8 (which is not the case for
the master branch), and I'm currently working on porting to 2.9, though
I do not expect to have too much the same kind of issues you experienced
for Scalate / Guggla.

>    It looks like I wasn't even subscribed to the dev list for Slang myself
>    - anyway, if your interested in working on Slang, just get in touch and
>    I'll gladly team up and spend some time in getting this project going
>    (again).

Yes, that'd be nice.

>    Regards,
>    Gert Vanthienen
>    ------------------------
>    FuseSource

-- 
Guillaume Yziquel
Crossing-Tech
Parc Scientifique EPFL

Re: Scala protocol for Slang

Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,

The Slang project is something I started quite a while ago, but that hasn't
been developed any further.  The goal was not only to support Slang, but
also other languages for the JVM.  Apart from updating the POMs, it
probably needs a bit more work for get the Scala compiler to work properly
again with the OSGi bundles once we upgrade from Scala 2.8 to 2.9 - we had
some work to do there for Scalate as well when we upgraded.

It looks like I wasn't even subscribed to the dev list for Slang myself -
anyway, if your interested in working on Slang, just get in touch and I'll
gladly team up and spend some time in getting this project going (again).

Regards,

Gert Vanthienen
------------------------
FuseSource
Web: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/


On Fri, Mar 9, 2012 at 11:04 AM, Guillaume Yziquel <
guillaume.yziquel@crossing-tech.com> wrote:

> Hi.
>
> Le Thursday 08 Mar 2012 à 15:35:03 (+0100), Guillaume Yziquel a écrit :
> > Le Thursday 08 Mar 2012 à 14:56:39 (+0100), Andreas Pieber a écrit :
> > > Hey, OK, this will be some more work somewhere to make this work with
> > > 2.2.5... first of all I corrected the versions of karaf and slf4j in
> > > the root pom.xml and features.xml; In addition I needed to remove the
> > > -SNAPSHOT attribute in the features/src/main/features.xml. then I was
> > > able to build the entire thing and deploy it on karaf. Though, after
> > > I've tried to deploy the actor example from [1] I get a warning in log
> > > from the scalaplugin:
> > >
> > > 2012-03-08 14:48:35,164 | WARN  | raf-2.2.5/deploy | ScalaCompiler
> > >                | r.compiler.ScalaCompiler$$anon$2   60 | 51 -
> > > org.fusesource.slang.scala.deployer - 1.0.0.SNAPSHOT |
> > > NoPosition:[Classpath =
> > >
> /home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/system/org/apache/felix/org.apache.felix.framework/3.0.9/org.apache.felix.framework-3.0.9.jar:/home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/lib/endorsed/org.apache.karaf.exception-2.2.5.jar:/opt/java/jre/lib/resources.jar:/opt/java/jre/lib/rt.jar:/opt/java/jre/lib/jsse.jar:/opt/java/jre/lib/jce.jar:/opt/java/jre/lib/charsets.jar:/opt/java/jre/lib/ext/sunec.jar:/opt/java/jre/lib/ext/sunjce_provider.jar:/opt/java/jre/lib/ext/zipfs.jar:/opt/java/jre/lib/ext/sunpkcs11.jar:/opt/java/jre/lib/ext/localedata.jar:/opt/java/jre/lib/ext/dnsns.jar:/opt/java/jre/lib/ext/bcprov-jdk16-1.45.jar:/home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/lib/karaf-jaas-boot.jar:/home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/lib/karaf.jar:.]
> > > 2012-03-08 14:48:35,737 | WARN  | raf-2.2.5/deploy | ScalaCompiler
> > >                | r.compiler.ScalaCompiler$$anon$2   60 | 51 -
> > > org.fusesource.slang.scala.deployer - 1.0.0.SNAPSHOT |
> > > NoPosition:[loaded package loader org.apache.karaf.exception-2.2.5.jar
> > > in 527ms]
> > >
> > > At least this is definitely nothing in karaf but rather in the usage
> > > of the scala compiler, a version conflict between JRE version & scala
> > > version or something else...
> > >
> > > Kind regards,
> > > Andreas
>
> I indeed get something similar:
>
> > 10:31:27,297 | WARN  | Framework/deploy | ScalaCompiler | ?
>                       ? | 212 - org.fusesource.slang.scala.deployer -
> 1.0.0.SNAPSHOT | NoPosition:[Classpath =
> /home/yziquel/ConnectivityFactory/Framework/system/org/eclipse/osgi/3.6.0.v20100517/osgi-3.6.0.v20100517.jar:/home/yziquel/ConnectivityFactory/Framework/lib/endorsed/jaxp-ri-1.4.4.jar:/home/yziquel/ConnectivityFactory/Framework/lib/endorsed/org.apache.karaf.exception-2.1.4-fuse-00-15.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/resources.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/rt.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/jsse.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/jce.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/charsets.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/dnsns.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/sunpkcs11.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/localedata.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/sunjce_provider.jar:/home/yziquel/ConnectivityFactory/Framework/lib/karaf-jaas-boot.jar:/home/yziquel/ConnectivityFactory/Framework/lib/karaf.jar:/home/yziquel/ConnectivityFactory/Framework/lib/servicemix-version.jar:.]
> > 10:31:27,439 | WARN  | Framework/deploy | ScalaCompiler | ?
>                       ? | 212 - org.fusesource.slang.scala.deployer -
> 1.0.0.SNAPSHOT | NoPosition:[loaded package loader jaxp-ri-1.4.4.jar in
> 140ms]
>
> However, I do not thing that this is an issue of the Scala compiler.
> When you run the test suite of Slang, you get stuff like that:
>
> >Running org.fusesource.slang.scala.deployer.ScalaTransformerTest
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : Compiling
> List(/home/yziquel/code/git/slang/scala/deployer/target/test-classes/SimpleTest.scala)
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[Classpath =
> /home/yziquel/.m2/repository/org/scala-lang/scala-library/2.8.0/scala-library-2.8.0.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/resources.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/rt.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/jsse.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/jce.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/charsets.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/dnsns.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/sunpkcs11.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/localedata.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/sunjce_provider.jar:/home/yziquel/code/git/slang/scala/deployer/target/test-classes:/home/yziquel/code/git/slang/scala/deployer/target/classes:/home/yziquel/.m2/repository/org/apache/felix/org.osgi.core/1.4.0/org.osgi.core-1.4.0.jar:/home/yziquel/.m2/repository/org/scala-lang/scala-library/2.8.0/scala-library-2.8.0.jar:/home/yziquel/.m2/repository/org/ops4j/pax/logging/pax-logging-api/1.5.2/pax-logging-api-1.5.2.jar:/home/yziquel/.m2/repository/org/apache/felix/org.apache.felix.fileinstall/3.0.0/org.apache.felix.fileinstall-3.0.0.jar:/home/yziquel/.m2/repository/org/osgi/org.osgi.core/4.2.0/org.osgi.core-4.2.0.jar:/home/yziquel/.m2/repository/org/osgi/org.osgi.compendium/4.1.0/org.osgi.compendium-4.1.0.jar:/home/yziquel/.m2/repository/org/ops4j/pax/swissbox/pax-swissbox-bnd/1.2.0/pax-swissbox-bnd-1.2.0.jar:/home/yziquel/.m2/repository/biz/aQute/bndlib/0.0.313/bndlib-0.0.313.jar:/home/yziquel/.m2/repository/org/ops4j/base/ops4j-base-lang/1.2.1/ops4j-base-lang-1.2.1.jar:/home/yziquel/.m2/repository/junit/junit/4.8.1/junit-4.8.1.jar:/home/yziquel/.m2/repository/org/scala-lang/scala-compiler/2.8.0/scala-compiler-2.8.0.jar:/home/yziquel/opt/jdk1.6.0_29/lib/tools.jar]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded package loader resources.jar in 701ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded package loader java in 1ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded package loader lang in 8ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded package loader reflect in 6ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded class file
> /home/yziquel/.m2/repository/org/scala-lang/scala-library/2.8.0/scala-library-2.8.0.jar(scala/package.class)
> in 77ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded package loader scala in 185ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded package loader runtime in 8ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded class file
> /home/yziquel/opt/jdk1.6.0_29/jre/lib/rt.jar(java/lang/Object.class) in 9ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded package loader io in 5ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded package loader util in 11ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded package loader nio in 3ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded package loader charset in 1ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded class file
> /home/yziquel/opt/jdk1.6.0_29/jre/lib/rt.jar(java/lang/String.class) in
> 41ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded class file
> /home/yziquel/.m2/repository/org/scala-lang/scala-library/2.8.0/scala-library-2.8.0.jar(scala/collection/package.class)
> in 1ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded package loader collection in 18ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[dropping dependency on node with no phase object: msil]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[promote the dependency of explicitouter: tailcalls =>
> specialize]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[parsing SimpleTest.scala]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[parser in 45ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded package loader annotation in 0ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded class file
> /home/yziquel/.m2/repository/org/scala-lang/scala-library/2.8.0/scala-library-2.8.0.jar(scala/Predef.class)
> in 13ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[loaded package loader org in 1ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[namer in 48ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[packageobjects in 0ms]
>
> It's simply the regular way that the scala compiler provides information
> about its progress. And its ends up like that in the test suite.
>
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[wrote memory/org/test/AnotherSimpleTest.class]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[wrote memory/SimpleTest.class]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[jvm in 17ms]
> > [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] :
> NoPosition:[total in 779ms]
> > [org.fusesource.slang.scala.deployer.archiver.ScalaArchiver] :
> ScalaArchiver - archive - starting
> > [org.ops4j.pax.swissbox.bnd.BndUtils] : Creating bundle for
> [home.yziquel.code.git.slang.scala.deployer.target.test-classes.SimpleTest]
> > [org.ops4j.pax.swissbox.bnd.BndUtils] : Overwrite mode: KEEP
> > [org.fusesource.slang.scala.deployer.archiver.ScalaArchiver] :
> ScalaArchiver - archive - bundle created
>
> Somehow, when deployed in a Karaf container, the scala compiler tries to
> start up some bundles, and then stops. In your case, it's
> org.apache.karaf.exception-2.2.5.jar, and in my case, it's
> jaxp-ri-1.4.4.jar.
>
> Just to follow up on that.
>
> --
> Guillaume Yziquel
> Crossing-Tech
> Parc Scientifique EPFL
>

Re: Scala protocol for Slang

Posted by Guillaume Yziquel <gu...@crossing-tech.com>.
Hi.

Le Thursday 08 Mar 2012 à 15:35:03 (+0100), Guillaume Yziquel a écrit :
> Le Thursday 08 Mar 2012 à 14:56:39 (+0100), Andreas Pieber a écrit :
> > Hey, OK, this will be some more work somewhere to make this work with
> > 2.2.5... first of all I corrected the versions of karaf and slf4j in
> > the root pom.xml and features.xml; In addition I needed to remove the
> > -SNAPSHOT attribute in the features/src/main/features.xml. then I was
> > able to build the entire thing and deploy it on karaf. Though, after
> > I've tried to deploy the actor example from [1] I get a warning in log
> > from the scalaplugin:
> > 
> > 2012-03-08 14:48:35,164 | WARN  | raf-2.2.5/deploy | ScalaCompiler
> >                | r.compiler.ScalaCompiler$$anon$2   60 | 51 -
> > org.fusesource.slang.scala.deployer - 1.0.0.SNAPSHOT |
> > NoPosition:[Classpath =
> > /home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/system/org/apache/felix/org.apache.felix.framework/3.0.9/org.apache.felix.framework-3.0.9.jar:/home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/lib/endorsed/org.apache.karaf.exception-2.2.5.jar:/opt/java/jre/lib/resources.jar:/opt/java/jre/lib/rt.jar:/opt/java/jre/lib/jsse.jar:/opt/java/jre/lib/jce.jar:/opt/java/jre/lib/charsets.jar:/opt/java/jre/lib/ext/sunec.jar:/opt/java/jre/lib/ext/sunjce_provider.jar:/opt/java/jre/lib/ext/zipfs.jar:/opt/java/jre/lib/ext/sunpkcs11.jar:/opt/java/jre/lib/ext/localedata.jar:/opt/java/jre/lib/ext/dnsns.jar:/opt/java/jre/lib/ext/bcprov-jdk16-1.45.jar:/home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/lib/karaf-jaas-boot.jar:/home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/lib/karaf.jar:.]
> > 2012-03-08 14:48:35,737 | WARN  | raf-2.2.5/deploy | ScalaCompiler
> >                | r.compiler.ScalaCompiler$$anon$2   60 | 51 -
> > org.fusesource.slang.scala.deployer - 1.0.0.SNAPSHOT |
> > NoPosition:[loaded package loader org.apache.karaf.exception-2.2.5.jar
> > in 527ms]
> > 
> > At least this is definitely nothing in karaf but rather in the usage
> > of the scala compiler, a version conflict between JRE version & scala
> > version or something else...
> > 
> > Kind regards,
> > Andreas

I indeed get something similar:

> 10:31:27,297 | WARN  | Framework/deploy | ScalaCompiler | ?                                   ? | 212 - org.fusesource.slang.scala.deployer - 1.0.0.SNAPSHOT | NoPosition:[Classpath = /home/yziquel/ConnectivityFactory/Framework/system/org/eclipse/osgi/3.6.0.v20100517/osgi-3.6.0.v20100517.jar:/home/yziquel/ConnectivityFactory/Framework/lib/endorsed/jaxp-ri-1.4.4.jar:/home/yziquel/ConnectivityFactory/Framework/lib/endorsed/org.apache.karaf.exception-2.1.4-fuse-00-15.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/resources.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/rt.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/jsse.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/jce.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/charsets.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/dnsns.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/sunpkcs11.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/localedata.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/sunjce_provider.jar:/home/yziquel/ConnectivityFactory/Framework/lib/karaf-jaas-boot.jar:/home/yziquel/ConnectivityFactory/Framework/lib/karaf.jar:/home/yziquel/ConnectivityFactory/Framework/lib/servicemix-version.jar:.]
> 10:31:27,439 | WARN  | Framework/deploy | ScalaCompiler | ?                                   ? | 212 - org.fusesource.slang.scala.deployer - 1.0.0.SNAPSHOT | NoPosition:[loaded package loader jaxp-ri-1.4.4.jar in 140ms]

However, I do not thing that this is an issue of the Scala compiler.
When you run the test suite of Slang, you get stuff like that:

>Running org.fusesource.slang.scala.deployer.ScalaTransformerTest
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : Compiling List(/home/yziquel/code/git/slang/scala/deployer/target/test-classes/SimpleTest.scala)
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[Classpath = /home/yziquel/.m2/repository/org/scala-lang/scala-library/2.8.0/scala-library-2.8.0.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/resources.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/rt.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/jsse.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/jce.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/charsets.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/dnsns.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/sunpkcs11.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/localedata.jar:/home/yziquel/opt/jdk1.6.0_29/jre/lib/ext/sunjce_provider.jar:/home/yziquel/code/git/slang/scala/deployer/target/test-classes:/home/yziquel/code/git/slang/scala/deployer/target/classes:/home/yziquel/.m2/repository/org/apache/felix/org.osgi.core/1.4.0/org.osgi.core-1.4.0.jar:/home/yziquel/.m2/repository/org/scala-lang/scala-library/2.8.0/scala-library-2.8.0.jar:/home/yziquel/.m2/repository/org/ops4j/pax/logging/pax-logging-api/1.5.2/pax-logging-api-1.5.2.jar:/home/yziquel/.m2/repository/org/apache/felix/org.apache.felix.fileinstall/3.0.0/org.apache.felix.fileinstall-3.0.0.jar:/home/yziquel/.m2/repository/org/osgi/org.osgi.core/4.2.0/org.osgi.core-4.2.0.jar:/home/yziquel/.m2/repository/org/osgi/org.osgi.compendium/4.1.0/org.osgi.compendium-4.1.0.jar:/home/yziquel/.m2/repository/org/ops4j/pax/swissbox/pax-swissbox-bnd/1.2.0/pax-swissbox-bnd-1.2.0.jar:/home/yziquel/.m2/repository/biz/aQute/bndlib/0.0.313/bndlib-0.0.313.jar:/home/yziquel/.m2/repository/org/ops4j/base/ops4j-base-lang/1.2.1/ops4j-base-lang-1.2.1.jar:/home/yziquel/.m2/repository/junit/junit/4.8.1/junit-4.8.1.jar:/home/yziquel/.m2/repository/org/scala-lang/scala-compiler/2.8.0/scala-compiler-2.8.0.jar:/home/yziquel/opt/jdk1.6.0_29/lib/tools.jar]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded package loader resources.jar in 701ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded package loader java in 1ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded package loader lang in 8ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded package loader reflect in 6ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded class file /home/yziquel/.m2/repository/org/scala-lang/scala-library/2.8.0/scala-library-2.8.0.jar(scala/package.class) in 77ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded package loader scala in 185ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded package loader runtime in 8ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded class file /home/yziquel/opt/jdk1.6.0_29/jre/lib/rt.jar(java/lang/Object.class) in 9ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded package loader io in 5ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded package loader util in 11ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded package loader nio in 3ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded package loader charset in 1ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded class file /home/yziquel/opt/jdk1.6.0_29/jre/lib/rt.jar(java/lang/String.class) in 41ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded class file /home/yziquel/.m2/repository/org/scala-lang/scala-library/2.8.0/scala-library-2.8.0.jar(scala/collection/package.class) in 1ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded package loader collection in 18ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[dropping dependency on node with no phase object: msil]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[promote the dependency of explicitouter: tailcalls => specialize]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[parsing SimpleTest.scala]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[parser in 45ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded package loader annotation in 0ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded class file /home/yziquel/.m2/repository/org/scala-lang/scala-library/2.8.0/scala-library-2.8.0.jar(scala/Predef.class) in 13ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[loaded package loader org in 1ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[namer in 48ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[packageobjects in 0ms]

It's simply the regular way that the scala compiler provides information
about its progress. And its ends up like that in the test suite.

> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[wrote memory/org/test/AnotherSimpleTest.class]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[wrote memory/SimpleTest.class]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[jvm in 17ms]
> [org.fusesource.slang.scala.deployer.compiler.ScalaCompiler] : NoPosition:[total in 779ms]
> [org.fusesource.slang.scala.deployer.archiver.ScalaArchiver] : ScalaArchiver - archive - starting
> [org.ops4j.pax.swissbox.bnd.BndUtils] : Creating bundle for [home.yziquel.code.git.slang.scala.deployer.target.test-classes.SimpleTest]
> [org.ops4j.pax.swissbox.bnd.BndUtils] : Overwrite mode: KEEP
> [org.fusesource.slang.scala.deployer.archiver.ScalaArchiver] : ScalaArchiver - archive - bundle created

Somehow, when deployed in a Karaf container, the scala compiler tries to
start up some bundles, and then stops. In your case, it's
org.apache.karaf.exception-2.2.5.jar, and in my case, it's
jaxp-ri-1.4.4.jar.

Just to follow up on that.

-- 
Guillaume Yziquel
Crossing-Tech
Parc Scientifique EPFL

Re: Scala protocol for Slang

Posted by Guillaume Yziquel <gu...@crossing-tech.com>.
Le Thursday 08 Mar 2012 à 14:56:39 (+0100), Andreas Pieber a écrit :
> Hey, OK, this will be some more work somewhere to make this work with
> 2.2.5... first of all I corrected the versions of karaf and slf4j in
> the root pom.xml and features.xml; In addition I needed to remove the
> -SNAPSHOT attribute in the features/src/main/features.xml. then I was
> able to build the entire thing and deploy it on karaf. Though, after
> I've tried to deploy the actor example from [1] I get a warning in log
> from the scalaplugin:
> 
> 2012-03-08 14:48:35,164 | WARN  | raf-2.2.5/deploy | ScalaCompiler
>                | r.compiler.ScalaCompiler$$anon$2   60 | 51 -
> org.fusesource.slang.scala.deployer - 1.0.0.SNAPSHOT |
> NoPosition:[Classpath =
> /home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/system/org/apache/felix/org.apache.felix.framework/3.0.9/org.apache.felix.framework-3.0.9.jar:/home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/lib/endorsed/org.apache.karaf.exception-2.2.5.jar:/opt/java/jre/lib/resources.jar:/opt/java/jre/lib/rt.jar:/opt/java/jre/lib/jsse.jar:/opt/java/jre/lib/jce.jar:/opt/java/jre/lib/charsets.jar:/opt/java/jre/lib/ext/sunec.jar:/opt/java/jre/lib/ext/sunjce_provider.jar:/opt/java/jre/lib/ext/zipfs.jar:/opt/java/jre/lib/ext/sunpkcs11.jar:/opt/java/jre/lib/ext/localedata.jar:/opt/java/jre/lib/ext/dnsns.jar:/opt/java/jre/lib/ext/bcprov-jdk16-1.45.jar:/home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/lib/karaf-jaas-boot.jar:/home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/lib/karaf.jar:.]
> 2012-03-08 14:48:35,737 | WARN  | raf-2.2.5/deploy | ScalaCompiler
>                | r.compiler.ScalaCompiler$$anon$2   60 | 51 -
> org.fusesource.slang.scala.deployer - 1.0.0.SNAPSHOT |
> NoPosition:[loaded package loader org.apache.karaf.exception-2.2.5.jar
> in 527ms]
> 
> At least this is definitely nothing in karaf but rather in the usage
> of the scala compiler, a version conflict between JRE version & scala
> version or something else...
> 
> Kind regards,
> Andreas
> 
> [1] http://slang.fusesource.org/documentation/scala/index.html

Yes, I also get something similar. Somewhat disappointed to see warnings
instead of errors, but still, same problem.

--
Guillaume Yziquel
Crossing-Tech
Parc Scientifique ÉPFL

Re: Scala protocol for Slang

Posted by Andreas Pieber <an...@gmail.com>.
Hey, OK, this will be some more work somewhere to make this work with
2.2.5... first of all I corrected the versions of karaf and slf4j in
the root pom.xml and features.xml; In addition I needed to remove the
-SNAPSHOT attribute in the features/src/main/features.xml. then I was
able to build the entire thing and deploy it on karaf. Though, after
I've tried to deploy the actor example from [1] I get a warning in log
from the scalaplugin:

2012-03-08 14:48:35,164 | WARN  | raf-2.2.5/deploy | ScalaCompiler
               | r.compiler.ScalaCompiler$$anon$2   60 | 51 -
org.fusesource.slang.scala.deployer - 1.0.0.SNAPSHOT |
NoPosition:[Classpath =
/home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/system/org/apache/felix/org.apache.felix.framework/3.0.9/org.apache.felix.framework-3.0.9.jar:/home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/lib/endorsed/org.apache.karaf.exception-2.2.5.jar:/opt/java/jre/lib/resources.jar:/opt/java/jre/lib/rt.jar:/opt/java/jre/lib/jsse.jar:/opt/java/jre/lib/jce.jar:/opt/java/jre/lib/charsets.jar:/opt/java/jre/lib/ext/sunec.jar:/opt/java/jre/lib/ext/sunjce_provider.jar:/opt/java/jre/lib/ext/zipfs.jar:/opt/java/jre/lib/ext/sunpkcs11.jar:/opt/java/jre/lib/ext/localedata.jar:/opt/java/jre/lib/ext/dnsns.jar:/opt/java/jre/lib/ext/bcprov-jdk16-1.45.jar:/home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/lib/karaf-jaas-boot.jar:/home/pieber/.m2/repository/org/apache/karaf/apache-karaf/2.2.5/apache-karaf-2.2.5/lib/karaf.jar:.]
2012-03-08 14:48:35,737 | WARN  | raf-2.2.5/deploy | ScalaCompiler
               | r.compiler.ScalaCompiler$$anon$2   60 | 51 -
org.fusesource.slang.scala.deployer - 1.0.0.SNAPSHOT |
NoPosition:[loaded package loader org.apache.karaf.exception-2.2.5.jar
in 527ms]

At least this is definitely nothing in karaf but rather in the usage
of the scala compiler, a version conflict between JRE version & scala
version or something else...

Kind regards,
Andreas

[1] http://slang.fusesource.org/documentation/scala/index.html

On Thu, Mar 8, 2012 at 13:33, Guillaume Yziquel
<gu...@crossing-tech.com> wrote:
> Le Thursday 08 Mar 2012 à 12:45:38 (+0100), Andreas Pieber a écrit :
>> with absolutely no idea about slang...
>>
>> have you install slang-scala feature  or just the deploy bundle? This
>> one sounds that all bundles need to be available for slang to
>> correctly install url handlers, compilers, ...
>>
>> Kind regards,
>> Andreas
>>
>> [1] http://fusesource.com/forge/git/slang.git/?p=slang.git;a=blob;f=features/src/main/resources/features.xml;h=f244b8ac42963c7560e08ea142765f31a9a1c427;hb=HEAD
>
> I have not installed the feature because the maven target didn't work,
> so I installed the bundles manually. But I did install all the bundles
> mentionned in the link above.
>
> --
> Guillaume Yziquel
> Crossing-Tech
> Parc Scientifique EPFL

Re: Scala protocol for Slang

Posted by Guillaume Yziquel <gu...@crossing-tech.com>.
Le Thursday 08 Mar 2012 à 12:45:38 (+0100), Andreas Pieber a écrit :
> with absolutely no idea about slang...
> 
> have you install slang-scala feature  or just the deploy bundle? This
> one sounds that all bundles need to be available for slang to
> correctly install url handlers, compilers, ...
> 
> Kind regards,
> Andreas
> 
> [1] http://fusesource.com/forge/git/slang.git/?p=slang.git;a=blob;f=features/src/main/resources/features.xml;h=f244b8ac42963c7560e08ea142765f31a9a1c427;hb=HEAD

I have not installed the feature because the maven target didn't work,
so I installed the bundles manually. But I did install all the bundles
mentionned in the link above.

-- 
Guillaume Yziquel
Crossing-Tech
Parc Scientifique EPFL

Re: Scala protocol for Slang

Posted by Andreas Pieber <an...@gmail.com>.
with absolutely no idea about slang...

have you install slang-scala feature  or just the deploy bundle? This
one sounds that all bundles need to be available for slang to
correctly install url handlers, compilers, ...

Kind regards,
Andreas

[1] http://fusesource.com/forge/git/slang.git/?p=slang.git;a=blob;f=features/src/main/resources/features.xml;h=f244b8ac42963c7560e08ea142765f31a9a1c427;hb=HEAD

On Thu, Mar 8, 2012 at 11:38, Guillaume Yziquel
<gu...@crossing-tech.com> wrote:
> Hi.
>
> (Cross-posting to user@karaf.apache.org, as I suspect the
> slang-dev@fusesource.org mailing to have low activity).
>
> I've just tried out the Scala Slang Deployer for Karaf
>
>        http://fusesource.com/forge/git/slang.git/
>
> but scala files do not get deployed.
>
>> class ScalaDeploymentListener extends ArtifactUrlTransformer {
>>
>>   val LOG = LogFactory.getLog(classOf[ScalaDeploymentListener])
>>
>>   def canHandle(artifact: File) = {
>>     artifact.isFile() && artifact.getName().endsWith(".scala")
>>   }
>>
>>   def transform(artifact: URL) : URL = {
>>     try {
>>         new URL("scala", null, artifact.toString());
>>     } catch {
>>       case e: Exception => {
>>         LOG.error("Unable to build scala bundle", e);
>>         return null;
>>       }
>>     }
>>   }
>> }
>
> It fails in 'new URL("scala", null, artifact.toString())' as there are
> no 'scala' protocol:
>
>> 10:07:42,262 | ERROR | Framework/deploy | ScalaDeploymentListener | ?                                   ? | 258 - org.fusesource.slang.scala.deployer - 1.0.0.SNAPSHOT | Unable to build scala bundle
>> java.net.MalformedURLException: unknown protocol: scala
>>       at java.net.URL.<init>(URL.java:395)[:1.6.0_29]
>>       at java.net.URL.<init>(URL.java:283)[:1.6.0_29]
>>       at java.net.URL.<init>(URL.java:306)[:1.6.0_29]
>>       at org.fusesource.slang.scala.deployer.ScalaDeploymentListener.transform(ScalaDeploymentListener.scala:38)[258:org.fusesource.slang.scala.deployer:1.0.0.SNAPSHOT]
>>       at org.apache.felix.fileinstall.internal.DirectoryWatcher.transformArtifact(DirectoryWatcher.java:501)[6:org.apache.felix.fileinstall:3.1.10]
>>       at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:430)[6:org.apache.felix.fileinstall:3.1.10]
>>       at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:263)[6:org.apache.felix.fileinstall:3.1.10]
>
> Anybody recently tried out the Slang deployer?
>
> --
> Guillaume Yziquel
> Crossing-Tech
> Parc Scientifique EPFL