VerifyError when using await(job.now())

471 views
Skip to first unread message

hugo

unread,
Oct 21, 2011, 4:57:37 PM10/21/11
to play-framework
Hi,

I'm trying to use asynchronous programmation with play 1.2.3 as
described in play documentation (http://www.playframework.org/
documentation/1.2.3/asynchronous)

However, if I try the following code :

for (ImportBean importBean : results)
{
ImportBundleJob job = new
ImportBundleJob(importBean,project,importer,uuid,duplicates);
nbNewMessage += await(job.now());
}


I have a VerifyError on every page of the application (not only on the
page with this controller)

ClassCastException occured : java.lang.VerifyError cannot be cast to
java.lang.Exception

If I comment this line :

nbNewMessage += await(job.now());

The site works again.

Any idea ?

hugo

unread,
Oct 21, 2011, 5:48:04 PM10/21/11
to play-framework
In debug mode I have more informations


java.lang.VerifyError: (class: controllers/FileImporters, method:
doimport signature: (Ljava/lang/Long;Ljava/lang/String;Ljava/lang/
String;Ljava/util/List;)V) Expecting to find array of objects or
arrays on stack

it seems I can't use a List in my method signature when I use the
await method in the same method ?!?

For information, this method worked before I tried to use
continuations.

hugo

unread,
Oct 21, 2011, 6:00:02 PM10/21/11
to play-framework
Ok, wrong track.

Indeed, it was because I had


...
await("1s");
...
int nbNewMessage=0;
...
render(duplicates, project,nbNewMessage);


If I comment await, it works
If I change int nbNewMessage=0; to Integer nbNewMessage=0; it works

otherwise, I have a VerifyError

Execution exception (In /app/controllers/Projects.java around line 46)
ClassCastException occured : java.lang.VerifyError cannot be cast to
java.lang.Exception

play.exceptions.JavaExecutionException: java.lang.VerifyError cannot
be cast to java.lang.Exception
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:229)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.ClassCastException: java.lang.VerifyError cannot
be cast to java.lang.Exception
at
play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:245)
at play.templates.Template.render(Template.java:26)
at play.templates.GroovyTemplate.render(GroovyTemplate.java:
184)
at play.mvc.results.RenderTemplate.<init>(RenderTemplate.java:
24)
at play.mvc.Controller.renderTemplate(Controller.java:659)
at play.mvc.Controller.renderTemplate(Controller.java:639)
at play.mvc.Controller.render(Controller.java:694)
at controllers.Projects.index(Projects.java:46)
at
play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:546)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:500)
at
play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:476)
at
play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:471)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:159)
... 1 more



So, the problem is solved for me. But that's quite a weird error and I
guess it's not an expected behaviour no ?

Guillaume Bort

unread,
Oct 22, 2011, 9:28:24 AM10/22/11
to play-fr...@googlegroups.com
Which version are you using? 1.2.3 or from the master trunk?

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

Hugo Lassiège

unread,
Oct 23, 2011, 6:44:09 AM10/23/11
to play-fr...@googlegroups.com, Guillaume Bort
I've tried with 1.2 and 1.2.3

Le 22/10/2011 15:28, Guillaume Bort a �crit :


> Which version are you using? 1.2.3 or from the master trunk?
>

> Le 22 oct. 2011 � 00:00, hugo<hlas...@gmail.com> a �crit :

Saurav

unread,
Nov 6, 2011, 3:48:35 AM11/6/11
to play-fr...@googlegroups.com, Guillaume Bort
I am facing the same issue. On commenting the await statement it goes away. Please suggest a fix.

An unexpected error occured caused by exception VerifyError:
(class: controllers/User, method: showCreate signature: ()V) Expecting to find array of objects or arrays on stack

 @68am2mphi
Internal Server Error (500) for request GET /home

Oops: VerifyError
An unexpected error occured caused by exception VerifyError: (class: controllers/User, method: showCreate signature: ()V) Expecting to find array of objects or arrays on stack

play.exceptions.UnexpectedException: Unexpected Error
at play.Invoker$Invocation.onException(Invoker.java:232)
at play.Invoker$Invocation.run(Invoker.java:273)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.VerifyError: (class: controllers/User, method: showCreate signature: ()V) Expecting to find array of objects or arrays on stack
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.getDeclaredFields(Class.java:1743)
at play.inject.Injector.inject(Injector.java:22)
at play.modules.guice.GuicePlugin.onApplicationStart(GuicePlugin.java:46)
at play.plugins.PluginCollection.onApplicationStart(PluginCollection.java:425)
at play.Play.start(Play.java:495)
at play.Play.detectChanges(Play.java:599)
at play.Invoker$Invocation.init(Invoker.java:186)
... 1 more
14:15:18,385 ERROR ~ 

Nicolas Leroux

unread,
Nov 6, 2011, 3:51:50 AM11/6/11
to play-fr...@googlegroups.com
Without a code example we cannot help you. Which play version are you using? What is your controller and what is your model?

Nicolas

Nicolas Leroux

unread,
Nov 6, 2011, 3:53:04 AM11/6/11
to play-fr...@googlegroups.com, Guillaume Bort
And it might really be related to the guice module from the stack I am reading…

Nicolas
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/9HSvVoKD9NUJ.

Saurav

unread,
Nov 6, 2011, 3:59:07 AM11/6/11
to play-fr...@googlegroups.com
I am using play 1.2.3

   
Controller:
public static void showCreate() {
        Map facebookCookie = FbGraph.getFacebookCookie();
        boolean showForm = false;
        boolean showHelloMessage = false;

        if (facebookCookie != null) {
            showForm = true;
            String uid = (String) facebookCookie.get("uid");
            UserEntity user = userManager.getUserByFbId(uid);
            if (user != null) {
                showHelloMessage = true;
            }
        }

        render(showForm, showHelloMessage);
    }

    public static void create(Long qrcodeId) {
        F.Promise<UserEntity> userEntityPromise = new CreateUserJob(FbGraph.getAccessToken(), qrcodeId).now();
        await(userEntityPromise);
        showCreate();
    }

The UserEntity is a simple model class using Morphia.

I thought it might be related to the guice module as well, but it works when I comment the await line. 

Saurav

unread,
Nov 6, 2011, 4:01:23 AM11/6/11
to play-fr...@googlegroups.com
Oh and the exception keeps changing on every alternate request to

@68am2mphn
Internal Server Error (500) for request GET /

Oops: ObjectExistsException
An unexpected error occured caused by exception ObjectExistsException: Cache play already exists

play.exceptions.UnexpectedException: Unexpected Error
at play.Play.start(Play.java:525)
at play.Play.detectChanges(Play.java:599)
at play.Invoker$Invocation.init(Invoker.java:186)
at Invocation.HTTP Request(Play!)
Caused by: net.sf.ehcache.ObjectExistsException: Cache play already exists
at net.sf.ehcache.CacheManager.addCache(CacheManager.java:859)
at play.cache.EhCacheImpl.<init>(EhCacheImpl.java:32)
at play.cache.EhCacheImpl.newInstance(EhCacheImpl.java:41)
at play.cache.Cache.init(Cache.java:241)
at play.Play.start(Play.java:491)
... 3 more
14:30:30,273 INFO  ~ MorphiaPlugin-1.2.3beta1> initialized
14:30:30,273 INFO  ~ MorphiaPlugin-1.2.3beta1> loaded
14:30:30,285 INFO  ~ Guice injector created: inject.STGuiceSupport
14:30:30,366 ERROR ~ 

Hugo Lassiège

unread,
Nov 6, 2011, 4:04:27 AM11/6/11
to play-fr...@googlegroups.com

I know it looks like a voodoo approach but could you replace every boolean by Boolean ? Ok it s strange but that s how i solved my problem.

--

You received this message because you are subscribed to the Google Groups "play-framework" group.

To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/eWjO0BCVM2EJ.

Saurav

unread,
Nov 6, 2011, 4:08:04 AM11/6/11
to play-fr...@googlegroups.com
Wow, that works. Thanks!

Definitely a bug in play?
Reply all
Reply to author
Forward
0 new messages