Play + Scala + ScalaSigParser => NullPointerException

112 views
Skip to first unread message

Aaron White

unread,
May 5, 2011, 2:56:57 PM5/5/11
to play-framework
I'm working to debug a compatibility problem between the very useful
Salat library & Play + Scala

The net result is that when trying to use ScalaSigPaser inside of
play, a null pointer exception occurs that does *not* occur outside of
play:

java.lang.NullPointerException
at scala.tools.scalap.scalax.rules.scalasig.ByteCode
$.forClass(ClassFileParser.scala:31)
at scala.tools.scalap.scalax.rules.scalasig.ScalaSigParser
$.parse(ScalaSig.scala:49)

I'm working w/ the Salat developer to figure out a succinct that will
demonstrate this, but if anyone here understands the deep inner
workings of ScalaSigParser & Play and could shed some light on what
could ultimately solve this, that would be *much* appreciated!

Aaron White

unread,
May 5, 2011, 3:29:24 PM5/5/11
to play-framework
Here is a simple spec that demonstrates the issue:

import scala.tools.scalap.scalax.rules.scalasig._

class BasicTests extends UnitFlatSpec with ShouldMatchers {

"ScalaSigParser" should "work" in {
ScalaSigParser.parse(classOf[BasicTests])
}
}

------

You'll notice an NPE, if you wrap the parse line in a try/catch,
you'll get the actual stacktrace (I have no idea why Play is reporting
the NPE where it claims, the catch actually elucidates it

Guillaume Bort

unread,
May 7, 2011, 6:19:51 AM5/7/11
to play-fr...@googlegroups.com
I guess that it is because your lib assume there is a class file on
the filesystem. And it is not really the case currently. However as we
are rethinking the compilation process for Scala, it could be the case
in the future versions.

> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>
>

--
Guillaume Bort, http://guillaume.bort.fr

rktoomey

unread,
May 11, 2011, 10:47:54 AM5/11/11
to play-framework
Hi Guillaume,

I'm library developer - just to clarify, I look first for the
@ScalaSig annotation (which is supposed to be on everything compiled
with scalac post 2.8.0) and only if the annotation is not present then
for the .class file.

Thanks for confirming that the .class file is not present. Working
with Aaron, it doesn't seem that the Scala classes in Play have this
ScalaSig annotation either.

I apologise that I don't know much about the Play framework, but I
would love the chance to work with someone who has a detailed
understanding of Play's Scala support to see if we can't get Salat
working in Play (info on my lib at https://github.com/novus/salat).

Best,
Rose

Guillaume Bort

unread,
May 12, 2011, 4:30:13 PM5/12/11
to play-fr...@googlegroups.com
Can you try with the current master version of the Scala module?

We are now using SBT to handle the compilation process. I don't see
why @ScalaSig annotation would be missing.

Manuel Bernhardt

unread,
Jul 5, 2011, 5:40:54 AM7/5/11
to play-fr...@googlegroups.com
Hi all,

we're looking at using Salat with Play-Scala as well here to ease the
handling of data in mongo.

@Aaron: did you find a solution in the end? I am now starting to look
into telling Salat about Play's classloader, following the thread on
the Salat mailing-list

Manuel

Reply all
Reply to author
Forward
0 new messages