Google App Engine + Siena leads to a SienaException

21 views
Skip to first unread message

Nicolas GIRARDIN

unread,
Mar 13, 2011, 5:11:51 AM3/13/11
to play-fr...@googlegroups.com
Hi Players!

I'm stuck from hours on a strange exception, maybe one of you could help?  I'm using the Google App Engine and Siena modules to store simple "City" objects and retrieve them.

My models/City.java looks like this:

package models;

import siena.Generator;
import siena.Id;
import siena.Model;
import siena.Query;

public class City extends Model {

@Id(Generator.AUTO_INCREMENT)
public Long id;

public String name;

public String code;

public City(String name, String code) {
this.name = name;
this.code = code;
}

public static Query<City> all() {
return Model.all(City.class);
}
}

My controller is as simple as the model:

package controllers;

import models.City;
import play.mvc.Controller;

public class Application extends Controller {

public static void index() {

City strasbourg = new City("Strasbourg", "SXB");
City dubai = new City("Dubai", "DXB");

strasbourg.insert();
dubai.insert();

renderJSON(City.all().fetch());
}
}

Launching "play run" and going to "http://localhost:9000/", leads to the given error:

Internal Server Error (500) for request GET /

Execution exception (In /app/controllers/Application.java around line 16)
SienaException occured : java.lang.IllegalAccessException: Class siena.gae.GaePersistenceManager can not access a member of class models.City with modifiers "private"

play.exceptions.JavaExecutionException: java.lang.IllegalAccessException: Class siena.gae.GaePersistenceManager can not access a member of class models.City with modifiers "private"
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:225)
at Invocation.HTTP Request(Play!)
Caused by: siena.SienaException: java.lang.IllegalAccessException: Class siena.gae.GaePersistenceManager can not access a member of class models.City with modifiers "private"
at siena.gae.GaePersistenceManager.mapEntities(GaePersistenceManager.java:220)
at siena.gae.GaeQuery.map(GaeQuery.java:79)
at siena.gae.GaeQuery.fetch(GaeQuery.java:85)
at controllers.Application.index(Application.java:16)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:432)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:427)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:155)
... 1 more
Caused by: java.lang.IllegalAccessException: Class siena.gae.GaePersistenceManager can not access a member of class models.City with modifiers "private"
at java.lang.Class.newInstance0(Class.java:349)
at java.lang.Class.newInstance(Class.java:308)
at siena.gae.GaePersistenceManager.mapEntities(GaePersistenceManager.java:213)
... 7 more

Replacing "renderJSON(City.all().fetch());" by "renderJSON(City.all().count());" works as exepected and no exception is thrown...

Any idea? :)

Nicolas GIRARDIN


Pascal Voitot Dev

unread,
Mar 13, 2011, 7:58:45 AM3/13/11
to play-fr...@googlegroups.com, Nicolas GIRARDIN
you are the second one to report this kind of problem that never appeared before...

What version of Play do you use?
Is it a recent one?

Pascal



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

Pascal Voitot Dev

unread,
Mar 13, 2011, 8:29:07 AM3/13/11
to play-fr...@googlegroups.com, Nicolas GIRARDIN
if you could give me a small project example so that I can reproduce the problem, it would be great!

Pascal

David González

unread,
Mar 13, 2011, 3:29:55 PM3/13/11
to play-fr...@googlegroups.com
> can not access a member of class models.City with modifiers "private"

I think the fields are supposed to be public if I'm not mistaken.. try it out 
--
Best wishes,
David

David González

unread,
Mar 13, 2011, 3:31:06 PM3/13/11
to play-fr...@googlegroups.com
Opps, they are public.... ignore my previous comment then !
--
Best wishes,
David

Pascal Voitot Dev

unread,
Mar 13, 2011, 3:46:27 PM3/13/11
to play-fr...@googlegroups.com, David González
I think something has changed in play because I use siena quite often with Play and doesn't have any problem.
But I'm still using Play 1.1... not a very recent version!
anyway as I'm trying to finalize Siena 1.0, it's the right time to correct such things ;)

Nicolas Girardin

unread,
Mar 13, 2011, 6:57:28 PM3/13/11
to play-fr...@googlegroups.com
Hi all,

David, I found this error on a bigger project, so I started a new one,
to be sure that no private fields appears anywhere.

Pascal, I'm using play-1.2-preview, downloaded from the
http://download.playframework.org/releases/ page. I can't find any
github 1.2 repo, to test with an much up-to-date version.
I added Siena in the dependencies.yaml and used "play dependencies".
Are you a Siena commiter?

I won't try to join my project to this message as it weight 14 MB, but
you can download it from http://dl.free.fr/lVoqWbkWY (let me know if
you're experiencing very slow downloads). It's eclipsified so an
import should do the job.

Thanks for taking time to inverstigate my issue! :)

Nicolas


2011/3/13 Pascal Voitot Dev <pascal.v...@gmail.com>:

Pascal Voitot Dev

unread,
Mar 13, 2011, 7:08:03 PM3/13/11
to play-fr...@googlegroups.com
Thank you!
I'm going to investigate this problem tomorrow if I can!
apparently something has changed somewhere in Play! and the class siena.Model becomes a problem...

Thank for your patience, I hope to find the problem quickly!

pascal

Pascal Voitot Dev

unread,
Mar 13, 2011, 7:45:40 PM3/13/11
to play-fr...@googlegroups.com, Nicolas Girardin
On Sun, Mar 13, 2011 at 11:57 PM, Nicolas Girardin <ngir...@gmail.com> wrote:
Hi all,

David, I found this error on a bigger project, so I started a new one,
to be sure that no private fields appears anywhere.

Pascal, I'm using play-1.2-preview, downloaded from the
http://download.playframework.org/releases/ page. I can't find any
github 1.2 repo, to test with an much up-to-date version.
I added Siena in the dependencies.yaml and used "play dependencies".
Are you a Siena commiter?


yes I am a siena committer
 

Pascal Voitot Dev

unread,
Mar 14, 2011, 4:13:09 AM3/14/11
to play-fr...@googlegroups.com
please see my last mail, it explains the reason of this exception and gives a workaround

niiamon

unread,
Mar 14, 2011, 6:48:22 AM3/14/11
to play-framework
What mail would that be Pascal? I saw this Exception sporadically
appear for a different model this morning :)

On Mar 14, 8:13 am, Pascal Voitot Dev <pascal.voitot....@gmail.com>
wrote:
> please see my last mail, it explains the reason of this exception and gives
> a workaround
>
> On Mon, Mar 14, 2011 at 12:45 AM, Pascal Voitot Dev <
>
>
>
>
>
>
>
> pascal.voitot....@gmail.com> wrote:
>
> > On Sun, Mar 13, 2011 at 11:57 PM, Nicolas Girardin <ngirar...@gmail.com>wrote:
>
> >> Hi all,
>
> >> David, I found this error on a bigger project, so I started a new one,
> >> to be sure that no private fields appears anywhere.
>
> >> Pascal, I'm using play-1.2-preview, downloaded from the
> >>http://download.playframework.org/releases/page. I can't find any
> >> github 1.2 repo, to test with an much up-to-date version.
> >> I added Siena in the dependencies.yaml and used "play dependencies".
> >> Are you a Siena commiter?
>
> > yes I am a siena committer
>
> >> I won't try to join my project to this message as it weight 14 MB, but
> >> you can download it fromhttp://dl.free.fr/lVoqWbkWY(let me know if
> >> you're experiencing very slow downloads). It's eclipsified so an
> >> import should do the job.
>
> >> Thanks for taking time to inverstigate my issue! :)
>
> >> Nicolas
>
> >> 2011/3/13 Pascal Voitot Dev <pascal.voitot....@gmail.com>:
> >> > I think something has changed in play because I use siena quite often
> >> with
> >> > Play and doesn't have any problem.
> >> > But I'm still using Play 1.1... not a very recent version!
> >> > anyway as I'm trying to finalize Siena 1.0, it's the right time to
> >> correct
> >> > such things ;)
>
> >> > On Sun, Mar 13, 2011 at 8:31 PM, David González <allen...@gmail.com>
> >> wrote:
>
> >> >> Opps, they are public.... ignore my previous comment then !
>
> >> >> On Sun, Mar 13, 2011 at 3:29 PM, David González <allen...@gmail.com>

Pascal Voitot Dev

unread,
Mar 14, 2011, 6:56:00 AM3/14/11
to play-fr...@googlegroups.com
a mail with this title:"[play-framework] GAE + Siena leads to IllegalArg on private fields : workaround + explanation + Play interrogation on the private default constructor created behind the scene"

the temporary workaround is : create a default constructor in your model

Pascal

Nicolas Girardin

unread,
Mar 14, 2011, 4:43:03 PM3/14/11
to play-fr...@googlegroups.com
Thank you very much Pascal for your help!

I've created a public empty constructor and it works like a charm!

Will you provide a patch for this issue?

Nicolas


2011/3/14 Pascal Voitot Dev <pascal.v...@gmail.com>:

Pascal Voitot Dev

unread,
Mar 14, 2011, 5:39:43 PM3/14/11
to play-fr...@googlegroups.com, Nicolas Girardin
On Mon, Mar 14, 2011 at 9:43 PM, Nicolas Girardin <ngir...@gmail.com> wrote:
Thank you very much Pascal for your help!

I've created a public empty constructor and it works like a charm!

Will you provide a patch for this issue?


it depends on comments by people from play about this private default constructor... I'm still weighing the possible drawbacks...
anyway the code of 0.7.6 is a bit old now and as I'm trying to finish Siena v1.0 which refactors and enhances lots of things, I don't know if I will patch old version or wait for the new one...
need some more reflexion ;)

 

Nicolas Girardin

unread,
Mar 15, 2011, 4:52:57 AM3/15/11
to Pascal Voitot Dev, play-fr...@googlegroups.com
Thanks you very much, it works like a charm!
Reply all
Reply to author
Forward
0 new messages