Too many constants, the constant pool for "MyPage.jsf" exceed 65536 entries

Too many constants, the constant pool for "MyPage.jsf" exceed 65536 entries

I have an web screen with several webblocks inside it. When we include a piece of new "code", we receive this error in ServiceCenter Error Log: "Too many constants, the constant pool for "MyPage.jsf" exceed 65536 entries"
When we remove the new piece of "code" the error stops.
No clue, better call the support-forces, aka "submit feedback"..

It's too much of a coincidence... 65536 entries... is the maximum number of rows in an Excel spreadsheet, for some versions (Excel 97 up to Excel 2003). For sure it's related.

Which means also that if you're not using Excel... then you are reaching the limit of some 16 bit element somewhere... I'm pretty sure.
I'm interested in this problem, please let us know if you figure out what the issue is.

What was the new piece of code?
The error occurs in a page that contains a few webblocks, and inside each one we have a lot of stuff (other webblocks, screen actions, page elements, etc.). Each one of these webblocks is inside an 'If' control that is triggered by a parameter in the URL.
After I have added a new webblock to this page, when I try to publish from Service Studio, the Error Log gets this error.
After some googling, I see that It's related with the limit of objects (constantes, methods, variables, etc.) inside a jsp page. The only logical conclusion is that the final jsp generated by the platform has reached this limit.
For now I'm refactoring this huge WebScreen, creating smaller pages and changing the method of calling these pages.
The limit you reached is related with the constants per class, limited by the 16-bit constant pool.
The exact limitation as per official documentation is:
  • The per-class or per-interface constant pool is limited to 65535 entries by the 16-bit constant_pool_count field of the ClassFile structure (§4.1). This acts as an internal limit on the total complexity of a single class or interface.

You can read more on class limitations here:


I'm interested to know what constitutes a 'constant' in the OutSystems->Java code compilation.  Does each "thing" (e.g.  web screen, perparation, web clock, container, button, link) create 1 constant?  If I had a web block with 4 buttons, does that mean I have 5 total constants?

And how are the classes broken up?  Can you have a maximum of 65535 constants period in OutSystems, or is it something more like 65535 constants per web block?
guesses guesses guesses :)

show us the oml! :)

That's not my turf. ;)
Only an OS staff can give an insight on how is the class build up
The class build up process is a really interesting thing to know...

Unfortunately I can't share the oml, becasue of privacy issues.

Does anyone know somebody in the Outsystems team that could help us? I'm waiting a support reply.
I made an empty project and created 70,000 containers, and I got this error.  It happens in a class, so I assume this is violating the per-class limit on constants.

From the erorr message:

[javac] public class ScrnWebScreen1 extends WebPage {
[javac]                     ^^^^^^^^^^^^^^
[javac] Too many methods for type ScrnWebScreen1. Maximum is 65535
So I can conclude that if a page has W webblocks inside it, when the platform compiles the application, if each webblock has N elements, the generated jsp will have W x N constants... Easy like this?
We'll have to wait for an OutSystems support person to come along.  You might be able to file a support ticket directly?

Anyways, I made 2 web screens, put 40k containers in the first and 30k containers in the second, tried to compile, and it still returned with the error.
Hello Guys,
I see emotions are running high on this and that you have been testing that limit of the 16-bit constant_pool_count per class.
Just be patient, OutSystems will give some feedback.
Taking aside OutSystems Platform and how is the class build up, from Java side the constant pool works this way:

The constant_pool is a table of structures representing various string constants, class and interface names, field names, and other constants that are referred to within the ClassFile structure and its substructures. The format of each constant_pool table entry is indicated by its first "tag" byte.

The constant_pool table is indexed from 1 to constant_pool_count - 1.


The value of the constant_pool_count item is equal to the number of entries in the constant_pool table plus one. A constant_pool index is considered valid if it is greater than zero and less than constant_pool_count, with the exception for constants of type long and double.

Hi all, as pointed out, this is a JVM limitation if you write too many code in a single class.
You've guys already nailed the technical details and found out what is happening, but I'll confirm some of the doubts.
The error suggests that the error occurred while trying to compile the jsp for the page.
JSP pages are compiled and generate roughly 1 method per widget, our widgets have a 1-1 match to the jsp widgets.
I can only assume that your webpage has a lot of controls.
For the error that Michael Deroche reproduced:
"[javac] Too many methods for type ScrnWebScreen1. Maximum is 65535"
This is the Java bean code-behind for the page. 
There is 1 class per Screen / Block, and each widget roughly generates about 3-6 methods, depending on the widget and its properties.
This explains why it still crashes with 30k containers.
Hope this clarified some of the doubts about the internals. 
To the original poster, if this is impacting you, as said previously
you should contact support, so we can give you advice, doing an analysis on your application.
Best Regards
There you go guys.
You've nailed it Luís. Now you know how it's handled on OutSystems side.