Scala support

35 views
Skip to first unread message

Baldur Norddahl

unread,
Mar 13, 2010, 11:09:43 AM3/13/10
to play-framework
I am trying out the Scala support. The basic application provided by
"play new x -with scala" works. But changing "def index = render()" to
either "def index = <h1>test</h1>" or "def index = "hi"" fails with:

An unexpected error occured caused by exception VerifyError:
(class: controllers/Application$, method: index signature: ()Ljava/
lang/String;) Wrong return type in function

or

An unexpected error occured caused by exception VerifyError:
(class: controllers/Application$, method: index signature: ()Lscala/
xml/Elem;) Inconsistent stack height 1 != 0

I tried different versions of play and scala module but with no luck.

Am I doing something wrong here?

Dustin Whitney

unread,
Mar 13, 2010, 12:01:22 PM3/13/10
to play-fr...@googlegroups.com
Sounds right to me.  You're using play 1.1, right?

D


--
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.


Mario Gutierrez

unread,
Mar 13, 2010, 12:43:24 PM3/13/10
to play-fr...@googlegroups.com
Are you using the 1.1  bzr branch? I had the same issues.

Try the github branch http://github.com/pk11/play-1.1-mirror

phausel

unread,
Mar 13, 2010, 12:47:18 PM3/13/10
to play-framework
hi, the scala module requires a fairly new version of play, the
minimum requirement is mentioned here:
http://www.playframework.org/modules/scala-0.1/home

HTH
peter


On Mar 13, 12:43 pm, Mario Gutierrez <mario.l.gutier...@gmail.com>
wrote:


> Are you using the 1.1  bzr branch? I had the same issues.
>

> Try the github branchhttp://github.com/pk11/play-1.1-mirror


>
> On Sat, Mar 13, 2010 at 8:09 AM, Baldur Norddahl

> <baldur.nordd...@gmail.com>wrote:


>
>
>
> > I am trying out the Scala support. The basic application provided by
> > "play new x -with scala" works. But changing "def index = render()" to
> > either "def index = <h1>test</h1>" or "def index = "hi"" fails with:
>
> > An unexpected error occured caused by exception VerifyError:
> > (class: controllers/Application$, method: index signature: ()Ljava/
> > lang/String;) Wrong return type in function
>
> > or
>
> > An unexpected error occured caused by exception VerifyError:
> > (class: controllers/Application$, method: index signature: ()Lscala/
> > xml/Elem;) Inconsistent stack height 1 != 0
>
> > I tried different versions of play and scala module but with no luck.
>
> > Am I doing something wrong here?
>
> > --
> > 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<play-framework%2Bunsubscribe@go oglegroups.com>

Baldur Norddahl

unread,
Mar 14, 2010, 12:18:18 PM3/14/10
to play-fr...@googlegroups.com
I tried both the version mentioned in the documentation (bzr branch -r812 lp:play/1.1 play) and the most recent version:

baldur@baldur-laptop:~/play$ bzr pull
baldur@baldur-laptop:~/play$ bzr update
Tree is up to date at revision 820.

I also tried the git version of the scala module:

baldur@baldur-laptop:~$ git clone git://github.com/guillaumebort/play-scala.git

Still the feature fails.

Baldur

2010/3/13 phausel <peter....@gmail.com>
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.

Chris Reeves

unread,
Mar 14, 2010, 1:08:52 PM3/14/10
to play-fr...@googlegroups.com
Just asking because you didn't mention it, but after you did the bzr
pull, you did 'cd framework' and 'ant' right? Also, once you do that
you will have to rebuild any non-core modules that aren't binary
compatible (probably all of them) by changing to each module's
directory and running 'play build-module'.

Thanks, Chris

Baldur Norddahl

unread,
Mar 14, 2010, 2:37:10 PM3/14/10
to play-fr...@googlegroups.com
Ok, starting from scratch, these are the complete commands executed:

baldur@baldur-laptop:~$ java -version
java version "1.6.0_16"
baldur@baldur-laptop:~$ bzr branch lp:play/1.1 play
Branched 820 revision(s).
baldur@baldur-laptop:~$ export PATH=$PATH:~/play
baldur@baldur-laptop:~$ cd play/framework/
baldur@baldur-laptop:~/play/framework$ ant
...
BUILD SUCCESSFUL
Total time: 6 seconds
baldur@baldur-laptop:~/play$ cd modules/crud/
baldur@baldur-laptop:~/play/modules/crud$ play build-module
(replying 820 to each question)
baldur@baldur-laptop:~/play/modules/crud$ cd ../docviewer/
baldur@baldur-laptop:~/play/modules/docviewer$ play build-module
baldur@baldur-laptop:~/play/modules/docviewer$ cd ../secure/
baldur@baldur-laptop:~/play/modules/secure$ play build-module
baldur@baldur-laptop:~/play/modules/secure$ cd ../test-runner/
baldur@baldur-laptop:~/play/modules/test-runner$ play build-module
baldur@baldur-laptop:~/play/modules/test-runner$ cd ..
baldur@baldur-laptop:~/play/modules$ git clone git://github.com/guillaumebort/play-scala.git scala
baldur@baldur-laptop:~/play/modules$ cd scala/
baldur@baldur-laptop:~/play/modules/scala$ play build-module
baldur@baldur-laptop:~/play/modules/scala$ cd
baldur@baldur-laptop:~$ play new scala-test --with scala
baldur@baldur-laptop:~$ play run scala-test/
accessing http://localhost:9000/ works.
baldur@baldur-laptop:~$ gedit scala-test/app/controllers/Application.scala 
change def index = render() to def index = <h1>hello</h1>
accessing http://localhost:9000/ now gives:
Oops: VerifyError
An unexpected error occured caused by exception VerifyError:
(class: controllers/Application$, method: index signature: ()Lscala/xml/Elem;) Inconsistent stack height 1 != 0
change to def index = "hello"
accessing http://localhost:9000/ now gives:
Oops: VerifyError
An unexpected error occured caused by exception VerifyError:
(class: controllers/Application$, method: index signature: ()Ljava/lang/String;) Wrong return type in function

Baldur

2010/3/14 Chris Reeves <ch...@ev-soft.net>

phausel

unread,
Mar 14, 2010, 3:01:37 PM3/14/10
to play-framework
I think the recent compiler change may broke that particular example,
I will look into it.

> accessinghttp://localhost:9000/now gives:


> Oops: VerifyError
> An unexpected error occured caused by exception VerifyError:
> (class: controllers/Application$, method: index signature:
> ()Lscala/xml/Elem;) Inconsistent stack height 1 != 0
> change to def index = "hello"

> accessinghttp://localhost:9000/now gives:

> > > 2010/3/13 phausel <peter.hau...@gmail.com>

phausel

unread,
Mar 14, 2010, 4:20:33 PM3/14/10
to play-framework
the fix should be available in the next version.

Guillaume Bort

unread,
Mar 14, 2010, 5:57:35 PM3/14/10
to play-fr...@googlegroups.com
Ok it was a bug in the current 1.1 trunk, fixed in the revision 821.
Thank you for the report.

> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.

Baldur Norddahl

unread,
Mar 14, 2010, 7:16:17 PM3/14/10
to play-fr...@googlegroups.com
Thanks, I got it working now.

Baldur

2010/3/14 Guillaume Bort <guillau...@gmail.com>

ngocdaothanh

unread,
Mar 16, 2010, 11:07:46 AM3/16/10
to play-framework
Thanks a lot. I had the same problem.

However, "bzr pull" from r820 to r825 takes over a minute! When will
Play officially move to GitHub?


On Mar 15, 8:16 am, Baldur Norddahl <baldur.nordd...@gmail.com> wrote:
> Thanks, I got it working now.
>
> Baldur
>

> 2010/3/14 Guillaume Bort <guillaume.b...@gmail.com>


>
>
>
> > Ok it was a bug in the current 1.1 trunk, fixed in the revision 821.
> > Thank you for the report.
>

Guillaume Bort

unread,
Mar 16, 2010, 12:14:11 PM3/16/10
to play-fr...@googlegroups.com
What is your bzr client version? 2a is pretty fast

> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.

ngocdaothanh

unread,
Mar 16, 2010, 1:02:53 PM3/16/10
to play-framework
> What is your bzr client version? 2a is pretty fast

Mine is 2.0.1, from MacPorts.

I have not been able to follow the example from:
http://www.playframework.org/documentation/1.1-trunk/scguide1

Error:
value QueryFunctions is not a member of package play.db.jpa
import play.db.jpa.QueryFunctions._

I think it should be:
import play.db.jpa.QueryOn._
but don't know how to proceed because I'm new to Scala.

Another typo at scguide3: Bootstrap.java should be Bootstrap.scala?

peter hausel

unread,
Mar 16, 2010, 1:09:57 PM3/16/10
to play-framework
Not sure how you got to that page, but that's a really old document,
the scala module now lives here:
http://www.playframework.org/modules/scala

ngocdaothanh

unread,
Mar 16, 2010, 1:16:18 PM3/16/10
to play-framework
I think I figured out.

Wrong:
import play.db.jpa.QueryFunctions._
find[Post]("order by postedAt desc").first

Right:
import play.db.jpa._
QueryOn[Post].find("order by postedAt desc").first

peter hausel

unread,
Mar 16, 2010, 1:12:28 PM3/16/10
to play-framework
no sure how you got to that document but that page is obsolete. The
separate scala module (plus the new doc) now lives here:
http://www.playframework.org/modules/scala

On Mar 16, 1:02 pm, ngocdaothanh <ngocdaoth...@gmail.com> wrote:

ngocdaothanh

unread,
Mar 16, 2010, 1:44:05 PM3/16/10
to play-framework
I got it from the scala-user mailing list:
http://permalink.gmane.org/gmane.comp.lang.scala.user/24610

> that page is obsolete

The file scguide2 in the latest source code still has this line:
import play.db.jpa.QueryFunctions._

Maybe the doc should be fixed?

peter hausel

unread,
Mar 16, 2010, 1:56:07 PM3/16/10
to play-framework
Sorry about the trouble but as I mentioned that document is obsolete
right now. The guide will be rewritten for the new standalone module
once the API is finalized (we are close now). For the up-to-date
documentation, please see http://www.playframework.org/modules/scala
. thanks peter

ngocdaothanh

unread,
Mar 20, 2010, 9:36:56 AM3/20/10
to play-framework
1.

I use the latest trunk versions of Play and the Scala plugin. The
first request to "yabe-with-scala" sample gives:

RuntimeException occured : Cannot load fixture initial-data.yml: null
Fixtures load "initial-data.yml"

2.

I'm new to Scala. Looking at the source of the Scala plugin, I see
that 4 spaces are used to indent at many files. Shouldn't Scala source
code be indented by 2 spaces?

peter hausel

unread,
Mar 20, 2010, 11:43:10 AM3/20/10
to play-framework
sorry about that, there is a pending patch against play's core. Once
that gets merged, the error will go away. I will keep you posted.

Guillaume Bort

unread,
Mar 21, 2010, 2:52:58 PM3/21/10
to play-fr...@googlegroups.com
The latest scala head in now coherent with play 1.1-r838

Reply all
Reply to author
Forward
0 new messages