Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Illegal UTF8 string in constant pool?

 
James wu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I want to run my progam I got this error message:
> Exception in thread "main" java.lang.ClassFormatError:
scuserapp/report/SCReport (Illegal UTF8 string in constant pool)
> at java.lang.ClassLoader.defineClass0(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
> at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
> at java.lang.ClassLoader.defineClass0(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
> at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
I have no idea about what is "Illegal UTF8 string in constant pool". I think I need somebody's help.
Thanks,
James
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very strange. I'm guessing it's a compiler bug of some sort. At the very least, it's a bug that it doesn't give you better info than this, such as which line of your code is creating the error. Try deleting all your .class files, and recompiling. If the bug is still there, try to figure out which part of your program is confusing the compiler. First copy all your files to a backup somewhere. Are there any really long string constants in your program, or string constantss with really unusual characters in them? Try replacing these (temporarily) with short, simple strings, and see it compilation works. Then try deleting some of your files one at a time - you'll have to modify the remaining files to remove all references to classes in the deleted files. Recompile frequently - if the error goes away, then the section you just deleted is most likely the cause. Restore it using your backups, and try compiling that part by itself. Hopefully in this manner you can figure out where the error is coming from. If you get more info, be sure to post here to let us know what the cause was. Good luck.
 
Zoran Nikolovski
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>Exception in thread "main" java.lang.ClassFormatError:
scuserapp/report/SCReport (Illegal UTF8 string in constant pool)

This can occur when the JDK version that you have does not match or it is older than the JDK version that the project has been developed on. Try traversing trough the imports within the class and check wheather they have some significant differences.
 
Alvaro Guerrero
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had the same msg with de cglib-2.1.3 and Eclipse 3.3 when i deployed my app to Tomcat 5.5. I downloaded the sources of cglib and recompiled the .jar myself and solve the problem.
 
ankit kinra
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I had a similar problem ,and in my case i was pushing the .class file to the server and complete file was not copied on the server due to "no space on device"
When the .class file was fully copied the problem got solved.



 
Campbell Ritchie
Sheriff
Posts: 48917
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch ankit kinra

Please consider how useful a reply is when the thread is nearly 9 years old.
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say it was 2 years old; the last reply was from 2007. The link remains valid though.
 
Campbell Ritchie
Sheriff
Posts: 48917
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I misread the first date. I thought it was January and it's July. So only a bit over 8 years old.
 
ankit kinra
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Had the same problem yesterday. So came looking for a solution via "The Google" , after getting the solution though just might post it . It may save someone's half an hour and 2-3 webserver restarts... But will keep an eye for the "Thread staleness".
 
Campbell Ritchie
Sheriff
Posts: 48917
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are right. Maybe we ought to give up the FAQ about old threads.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic