Play Framework - infinite recursion - playframework-1.x

I'm getting the error like on https://bugs.launchpad.net/play/+bug/549439. It seems to be an issue with casting an object to a primitive. Is that correct?
I get the error when trying to display a question with its list of answers:
<ul>
#{list question.answers, as:'answer'}
<li>&{answer.content}</li>
#{/list}
</u1>
I changed to answer.content from answer thinking the issue arose due to casting, but I get the same error.
Here's the stack trace:
Internal Server Error (500) for request GET /showQuestion?qid=1
Execution exception (In /app/controllers/Application.java around line 43)
RuntimeException occured : java.lang.OutOfMemoryError: Java heap space
play.exceptions.JavaExecutionException: java.lang.OutOfMemoryError: Java heap space
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:231)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
at play.templates.BaseTemplate.throwException(BaseTemplate.java:93)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:257)
at play.templates.Template.render(Template.java:26)
at play.templates.GroovyTemplate.render(GroovyTemplate.java:187)
at play.mvc.results.RenderTemplate.(RenderTemplate.java:24)
at play.mvc.Controller.renderTemplate(Controller.java:660)
at play.mvc.Controller.renderTemplate(Controller.java:640)
at play.mvc.Controller.render(Controller.java:695)
at controllers.Application.showQuestion(Application.java:43)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:548)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:502)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
... 1 more
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2882)
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
at java.lang.StringBuilder.append(StringBuilder.java:119)
at play.data.binding.Unbinder.unBind(Unbinder.java:106)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)

No, it's not related to the linked bug, you have a typo in your code. Fix your code to:
... <li>${answer.content}</li> ...
The &{…} syntax is used for fetching translation labels from messages file
BTW Asked you before: try to use tags like playframework-1.x or playframework-2.0 for all questions, it helps a lot for people who wants to help you.

Related

Lack of information when OCaml crashes

I am new to OCaml which I installed via opam. My compiler is dune. Each time I build my project and run it, it crashes but I get no information from where it crashes in the code.
A friend of mine who is doing the same thing get information about the line where it crashes.
If anyone have an idea it will be incredible !
Best regards,
You could add the following in you main, which turns on the recording of exception backtraces:
let main =
record_backtrace true;
...
Alternativelly, you can set the b flag through the OCAMLRUNPARAM variable.
you can try using try\catch, exceptions and printing to find where the problem is at.
in case the exception is something you have raised, you can try to replace it with a costume exception to get the various details.
exception Yourexception of string;;
raise (Yourexception "the problem is here") ;;
if the problem is an OS exception, such as stack overflow, you can try placing prints all over the place, and slowly pinpoint the exact location
print_string( "1\n");
and when all else fail, use try and catch to slowly pinpoint the location (you can google the exception to help pinpoint the cause. for example finding that list raise the exception or something)
try (-your code-)
with exception -> (- print or handle or whatever - );;
these steps help with most of the languages, so its nice to remember them

GATE_Using for Thesis_Run-time Error

When I am trying to run corpus pipeline on language resources. It is throwing the below (even though I follow the order as Document reset, english tokeniser, sentence splitter)
Can someone help me with the process to debug this run-time error
Error:
gate.creole.ExecutionException: No sentences or tokens to process in document Password_Safe-window1.txt_0003E
Please run a sentence splitter and tokeniser first!
at gate.creole.POSTagger.execute(POSTagger.java:257)
at gate.util.Benchmark.executeWithBenchmarking(Benchmark.java:291)
at gate.creole.SerialController.runComponent(SerialController.java:225)
at gate.creole.SerialController.executeImpl(SerialController.java:157)
at gate.creole.SerialAnalyserController.executeImpl(SerialAnalyserController.java:223)
at gate.creole.SerialAnalyserController.execute(SerialAnalyserController.java:126)
at gate.util.Benchmark.executeWithBenchmarking(Benchmark.java:291)
at gate.gui.SerialControllerEditor$RunAction$1.run(SerialControllerEditor.java:1759)
at java.lang.Thread.run(Thread.java:745)
Edit:
The files are not empty. As i tried to implement #dedek's suggestion, it has thrown no errors. But raised one more problem as follows:
Exception in thread "ApplicationViewer1" java.lang.OutOfMemoryError: Java heap space
I think it is because your document is empty.
Can you confirm that?
There is a run-time param failOnMissingInputAnnotations of the POSTagger, set it to false and it should be ok.
See also the docs:
failOnMissingInputAnnotations - if set to false, the PR will not fail with an ExecutionException if no input Annotations are found and instead only log a single warning message per session and a debug message per document that has no input annotations (run-time, default = true).
Concerning the OutOfMemoryError: Java heap space
See following questions:
Getting OOM while using GATE on large data set
GATE PersistenceManager.loadObjectFromFile outofmemory error while loading .gapp files
JAVA PermGem memory

Problems with asynchronous calls using motion-resource and BubbleWrap for Ruby Motion

I'm trying to follow the example from motion-resource
https://github.com/tkadauke/motion-resource. Having difficulty getting the data in the correct format with this asynchronous code:
def all_friends(&block)
Friends.find_all do |friends, response|
if response.ok?
puts friends.inspect
block.call friends
else
App.alert response.error_message
end
end
end
In this implementation I have a user resource that has many friends. I'm trying to find all the friends for this user with User.current.all_friends
I'm getting an error when the data comes back when I try to iterate through it because its coming back as a BubbleWrap HTTP Query.
#<BubbleWrap::HTTP::Query:0xc54c7a0 ...>
I wonder what line number your error is coming from.
" undefined method `each' for # "
Have you tried removing this line?
block.call friends?
Your example appears to come from the docs with this working line of code...
User.find_all do |users, response|
if response.ok?
puts users.inspect
else
App.alert response.error_message
end
end
Hope you figure it out. It would be easier to troubleshoot if the code was executable.
This Stack Stack overflow question addresses the same problems experienced in this question: What is the iOS (or RubyMotion) idiom for waiting on a block that executes asynchronously?

Timed Indexed Color sets in CPN Tools that results in Unhandled Exception Error

I am using CPN Tools to model a distributed system. CPN Tools uses CPN ML an extension of SML. The project homepage is: cpntools.org
I started with a simple model and when I try to make a particular indexed color set timed, I get an "Internal error". There is another indexed colorset within my Petri-net model that is timed and works correctly. I am not sure how I can troubleshoot since I don't understand the error message. Could you help me interpret the error message or give me some hints on what I could be doing wrong?
The model is:
http://imgur.com/JUjPRHK
The declarations of the model are:
http://imgur.com/DvvpyvH
The error message is:
Internal error: Compile error when generating code. Caught error.../compiler/TopLevel/interact/evalloop.sml:296.17-296.20../compiler/TopLevel/interact/evalloop.sml:44.55../compiler/TopLevel/interact/evalloop.sml:66.19-66.27
structure CPN`TransitionID1413873858 = struct ... end (* see simulator debug info for full code *)
simglue.sml:884.12-884.43
"
Thank you~
I know this is an old question, but I run in the same problem and wasted too much time on this, so maybe it will help someone else in the future.
I didn't understand exactly the reason for this, but it seems the problem appears when you play with time values on an arch that ends to a transition (I was updating an integer value to the current time, using IntInf.toInt(time())). Now, if I move the code on the outgoing arch of that transition (that is: the one that ends in a place) there is no error.

Exception when using play framework 1.2.3 on Ubuntu

My instance of play v1.2.3 on Ubuntu was working fine till yesterday. I am not entirely certain if I installed any new packages on Ubuntu in the meanwhile. When I now try running play (run/start), I get the exception copied below. I have tried cleaning the tmp directory but it did not help. Any other thoughts (besides setting up play again) will be greatly appreciated. Thanks
Exception in thread "main" play.exceptions.UnexpectedException: Unexpected Error
at play.vfs.VirtualFile.contentAsString(VirtualFile.java:180)
at play.classloading.hash.ClassStateHashCreator.getClassDefsForFile(ClassStateHashCreator.java:83)
at play.classloading.hash.ClassStateHashCreator.scan(ClassStateHashCreator.java:58)
at play.classloading.hash.ClassStateHashCreator.scan(ClassStateHashCreator.java:63)
at play.classloading.hash.ClassStateHashCreator.scan(ClassStateHashCreator.java:63)
at play.classloading.hash.ClassStateHashCreator.scan(ClassStateHashCreator.java:63)
at play.classloading.hash.ClassStateHashCreator.computePathHash(ClassStateHashCreator.java:48)
at play.classloading.ApplicationClassloader.computePathHash(ApplicationClassloader.java:371)
at play.classloading.ApplicationClassloader.<init>(ApplicationClassloader.java:62)
at play.Play.init(Play.java:272)
at play.server.Server.main(Server.java:158)
Caused by: java.lang.RuntimeException: java.io.IOException: Input/output error
at play.libs.IO.readContentAsString(IO.java:62)
at play.libs.IO.readContentAsString(IO.java:49)
at play.vfs.VirtualFile.contentAsString(VirtualFile.java:178)
... 10 more
Caused by: java.io.IOException: Input/output error
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:220)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.Reader.read(Reader.java:123)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1364)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1340)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1315)
at org.apache.commons.io.IOUtils.toString(IOUtils.java:525)
at play.libs.IO.readContentAsString(IO.java:60)
One of the Java classes in my project somehow got corrupted. I noticed it when I tried copying the whole directory to another location - the copy operation generated an error message specifying the corrupted file (which I'm sure one could have detected through other means as well).
Removing the corrupted file (& replacing with the same code) resulted in normal behavior. Hope this helps others.