MessageIterator1498469983691.java:1: error: constant string too long
See original GitHub issueWhen trying to use a 114k Json Schema Template and the “Pepper-Box Plaintext Config” I get an exception
2017-06-26 03:39:44,266 ERROR o.a.j.JMeter: Uncaught exception:
java.lang.ClassFormatError: Truncated class file
at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_91]
at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:1.8.0_91]
at java.lang.ClassLoader.defineClass(ClassLoader.java:642) ~[?:1.8.0_91]
at com.gslab.pepper.input.compile.DynamicClassLoader.findClass(DynamicClassLoader.java:59) ~[pepper-box-1.0.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_91]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_91]
at com.gslab.pepper.input.compile.InMemoryJavaCompiler.compileSchemaClass(InMemoryJavaCompiler.java:46) ~[pepper-box-1.0.jar:?]
at com.gslab.pepper.input.SchemaTranslator.getPlainTextMsgIterator(SchemaTranslator.java:47) ~[pepper-box-1.0.jar:?]
at com.gslab.pepper.input.SchemaProcessor.getPlainTextMessageIterator(SchemaProcessor.java:36) ~[pepper-box-1.0.jar:?]
at com.gslab.pepper.loadgen.impl.PlaintTextLoadGenerator.<init>(PlaintTextLoadGenerator.java:34) ~[pepper-box-1.0.jar:?]
at com.gslab.pepper.config.plaintext.PlainTextConfigElement.iterationStart(PlainTextConfigElement.java:53) ~[pepper-box-1.0.jar:?]
at org.apache.jmeter.control.GenericController.fireIterationStart(GenericController.java:393) ~[ApacheJMeter_core.jar:3.2 r1790748]
at org.apache.jmeter.control.GenericController.fireIterEvents(GenericController.java:385) ~[ApacheJMeter_core.jar:3.2 r1790748]
at org.apache.jmeter.control.GenericController.next(GenericController.java:158) ~[ApacheJMeter_core.jar:3.2 r1790748]
at org.apache.jmeter.control.LoopController.next(LoopController.java:123) ~[ApacheJMeter_core.jar:3.2 r1790748]
at org.apache.jmeter.threads.AbstractThreadGroup.next(AbstractThreadGroup.java:87) ~[ApacheJMeter_core.jar:3.2 r1790748]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:252) ~[ApacheJMeter_core.jar:3.2 r1790748]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]
2017-06-26 03:39:44,270 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test
2017-06-26 03:39:44,270 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, *local*)
and the following goes to the Jmeter Console
/MessageIterator1498469983691.java:1: error: constant string too long
import java.util.Iterator;import static com.gslab.pepper.input.FieldDataFunctions.*;import static com.gslab.pepper.input.CustomFunctions.*;public class MessageIterator1498469983691
...
maybe this is an issue with InMemoryJavaCompiler but that isn’t that large a message especially when trying to test larger messages.
any thoughts would be appreciated before I start digging through source code.
thank you
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Fixing “constant string too long” Build Error | Baeldung
Learn to fix the "constant string too long" build error in Java.
Read more >Java "constant string too long" compile error. Only happens ...
Someone is trying to send you a message :-) In the time you've spend fiddling with compiler versions you could have loaded the...
Read more >constant string too long - Oracle Communities
Is there a limitation on the length of a java.lang.String object ? ... but when I specify a very long String in my...
Read more >Getting "constant string too long" error in the scirpt with Java ...
Compiling a java vuser script returns "constant string too long" error . Answer. This is a limitation of the Sun Java compiler. The...
Read more >Error: constant string too long - Help/Discuss - Gradle Forums
When run "gradlew build", I encountered "error: constant string too long" for one of my java Class A.java. A.java is my Unit Test...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Here is the result of one of the messages I am trying to load when it is trying dynamically create the class: https://gist.github.com/petergdoyle/afa447290ff591de5fb11cfd6fb63099
Maybe even try to optimize the initialization of the StringBuilder and break it into chunks and you might get away with it. Still think you might want to keep it in pre-allocated memory but I haven’t dug too deep into the code.
Thanks for your quick response.
Yes the approach taken to build a java class using the contents of the Kafka message and apparently declare a constant has hit a limit in terms of Java the way it is coded.
Any thoughts about refactoring to load this value into a memory Buffer rather than building a String?
http://howtodoinjava.com/java-7/nio/java-nio-2-0-working-with-buffers/
it seems like a great plugin and much needed.