[Play-1.2.4] An unexpected error occured caused by exception UnexpectedException: While applying class play.classloading.enhancers.ContinuationEnhancer on controllers.Hit

1,319 views
Skip to first unread message

Manobal Jain

unread,
Jan 4, 2012, 9:07:27 PM1/4/12
to play-framework
I am getting using the PlayFramework async feature. Here is my
controller code:

public static void continuation()
{
Promise<HttpResponse> remoteCall1 = WS.url("http://
www.google.com").getAsync();

Promise<List<HttpResponse>> promises =
Promise.waitAll(remoteCall1);

List<HttpResponse> httpResponses = await(promises); // request
gets suspended here
String message = "Success";
render(message);
}

I am getting following cryptic exception. Not sure why. Please help.

Thanks,
Manobal

Oops: UnexpectedException
An unexpected error occured caused by exception UnexpectedException:
While applying class play.classloading.enhancers.ContinuationEnhancer
on controllers.Hit

play.exceptions.UnexpectedException: While applying
play.CorePlugin@76a2f910 on controllers.Hit
at play.plugins.PluginCollection.enhance(PluginCollection.java:
511)
at play.classloading.ApplicationClasses
$ApplicationClass.enhance(ApplicationClasses.java:235)
at
play.classloading.ApplicationClassloader.detectChanges(ApplicationClassloader.java:
327)
at play.Play.detectChanges(Play.java:614)
at play.Invoker$Invocation.init(Invoker.java:198)
at Invocation.HTTP Request(Play!)
Caused by: play.exceptions.UnexpectedException: While applying class
play.classloading.enhancers.ContinuationEnhancer on controllers.Hit
at play.CorePlugin.enhance(CorePlugin.java:302)
at play.plugins.PluginCollection.enhance(PluginCollection.java:
506)
... 5 more
Caused by: java.lang.IllegalArgumentException: Invalid operand (must
be a signed byte): 128
at
org.objectweb.asm.util.CheckMethodAdapter.checkSignedByte(Unknown
Source)
at
org.objectweb.asm.util.CheckMethodAdapter.visitIntInsn(Unknown Source)
at
org.apache.commons.javaflow.bytecode.transformation.asm.ContinuationMethodAdapter.visitMethodInsn(ContinuationMethodAdapter.java:
279)
at org.objectweb.asm.tree.MethodInsnNode.accept(Unknown
Source)
at org.objectweb.asm.tree.InsnList.accept(Unknown Source)
at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
at
org.apache.commons.javaflow.bytecode.transformation.asm.ContinuationMethodAnalyzer.visitEnd(ContinuationMethodAnalyzer.java:
140)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at
org.apache.commons.javaflow.bytecode.transformation.asm.AsmClassTransformer.transform(AsmClassTransformer.java:
49)
at
org.apache.commons.javaflow.bytecode.transformation.asm.AsmClassTransformer.transform(AsmClassTransformer.java:
41)
at
play.classloading.enhancers.ContinuationEnhancer.enhanceThisClass(ContinuationEnhancer.java:
74)
at play.CorePlugin.enhance(CorePlugin.java:297)
... 6 more

Manobal Jain

unread,
Jan 4, 2012, 7:10:16 PM1/4/12
to play-framework
Hi All,

I am currently using play 1.2.4. Here is my controller code.

public static void continuation()
{
Promise<HttpResponse> remoteCall1 = WS.url("http://
www.google.com").getAsync();

Promise<List<HttpResponse>> promises =
Promise.waitAll(remoteCall1);

List<HttpResponse> httpResponses = await(promises); // request
gets suspended here
String message = "Success";
render(message);
}

I am getting following cryptic exception when I run the code. I am not
sure how to fix this. Please help.

Thanks,
Manobal

Morten Kjetland

unread,
Jan 5, 2012, 4:40:37 AM1/5/12
to play-fr...@googlegroups.com
We have fixed multiple enhancer/continuations problems just after the 1.2.4-release.

Please try with 1.2.x-branch or choose this one to download a built version of play based on 1.2.4 but with enhancher fixes:  https://github.com/mbknor/play/tree/1.2.4-mbknor-custom-release 

-Morten

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


Alexander Reelsen

unread,
Jan 5, 2012, 8:12:06 AM1/5/12
to play-fr...@googlegroups.com
Hey Morten

Morten Kjetland wrote:
> We have fixed multiple enhancer/continuations problems just after the
> 1.2.4-release.

Hm. Interesting. I am currently facing the problem that a code snippet
like this

Promise<BookSearchResult> promise =
Promise.waitAny(BookSearch.searchAsync(q));

BookSearchResult searchResult = promise.getOrNull();

Just does not seem to wait until the searchAsync() method is really
finished and then the promise directly returns null (which is not
possible from my code). I am creating a job in the searchAsync() method,
which is started via BookSearchJob().now(), so this should not be really
a problem...

Might this be a similar problem?

> Please try with 1.2.x-branch or choose this one to download a built
> version of play based on 1.2.4 but with enhancher fixes:

Will do, thanks for the hint.


--Alexander

Morten Kjetland

unread,
Jan 5, 2012, 8:21:42 AM1/5/12
to play-fr...@googlegroups.com
I think promise.getOrNull() will return the result if present (done) or return null if not ready.

You must call await(promise) for the request thread to be suspended until the promise is done.. then you can call  promise.get() or  promise.getOrNull() which will always return the result since it is done..

I hope this was clarifying.

-morten

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To post to this group, send email to play-framework@googlegroups.com.
To unsubscribe from this group, send email to play-framework+unsubscribe@googlegroups.com.

Manobal Jain

unread,
Jan 5, 2012, 3:02:07 PM1/5/12
to play-framework
Fixed my issue.

Thanks,
Manobal

Ahmet Alp Balkan

unread,
Mar 17, 2012, 3:38:45 PM3/17/12
to play-fr...@googlegroups.com
This issue is still present on 1.2.4. Should we get mbknor's custom release? https://github.com/mbknor/play/tree/1.2.4-mbknor-custom-release
> > To post to this group, send email to play-framework@googlegroups.com.
> > To unsubscribe from this group, send email to
> > play-framework+unsubscribe@googlegroups.com.

Joseph Burns

unread,
Apr 20, 2012, 3:56:46 PM4/20/12
to play-fr...@googlegroups.com
I am curious about this as well, I have been using 1.2.4-mbknor-custom-release to avoid this issue, will these fixes be integrated into 1.2.5?

Are there certain strategies/idioms that anyone has found which helps avoid this?  I seem to be running into it a lot with seemingly valid controller code.

Morten Kjetland

unread,
Apr 20, 2012, 4:17:38 PM4/20/12
to play-fr...@googlegroups.com

1.2.4-mbknor-custom is basicaly 1.2.4 pluss some commits added to 1.2.x after 1.2.4 was released. All this pluss more is in the upcomming 1.2.5 release.

[...lots of versions and branches to type on my galaxy s II :) ]

To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/TBqCgliFa5gJ.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages