user1365732
user1365732

Reputation: 1131

Error Building Grails Application

When I am building my application, I am getting the following error please help.

| Error Compilation error: startup failed:
General error during class generation: Method code too large!
java.lang.RuntimeException: Method code too large!

No error while running application,error on making war.


Upvotes: 0

Views: 2505

Answers (4)

Swaprks
Swaprks

Reputation: 1653

I figured out the solution to this. The Java class files are created during the compile process. Whereas the JSP/GSP class files are created during runtime. So, while compiling a JSP/GSP file, a class file is created having the a single method which will contain the code within the JSP/GSP page. If the size of this method exceeds 65k then you will get this error. In order to avoid this, I recommend that you break down your JSP/GSP pages into various JSP/GSP pages and use <@include> OR to include them. By doing this, each JSP/GSP will be treated as a different method and the size will not exceed 65k. This helped me. Hope it does in your case as well.

Upvotes: 1

Swaprks
Swaprks

Reputation: 1653

The JVM has a limitation on the method size which cannot be greater than 65536 bytes. In order to avoid this error you can split the method into smaller methods. It is also a good practice to write small piece of code as it is easy to understand and debug the code. Mean while you can see the post "Method Size Limit in Java".

Upvotes: 0

Đinh Hồng Ch&#226;u
Đinh Hồng Ch&#226;u

Reputation: 5440

I have met this issue before. And one of problems causes this error may come from the method "Eval" in your source codes. You can try to use another alternative method to avoid this compilation error. I tried and it worked perfectly.

Upvotes: 0

Ashfak Balooch
Ashfak Balooch

Reputation: 1879

http://jira.grails.org/browse/GRAILS-10246

Please look at the jira bug reported for the same. You need to divide your method into some smaller methods.

Hope this helps.

Upvotes: 1

Related Questions