File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Illegal UTF8 string in constant pool? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Illegal UTF8 string in constant pool?" Watch "Illegal UTF8 string in constant pool?" New topic
Author

Illegal UTF8 string in constant pool?

James wu
Greenhorn

Joined: Feb 20, 2001
Posts: 5
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

Joined: Jan 30, 2000
Posts: 18671
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.


"I'm not back." - Bill Harding, Twister
Zoran Nikolovski
Greenhorn

Joined: Jan 12, 2006
Posts: 1
>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

Joined: Jun 11, 2006
Posts: 2
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

Joined: Nov 09, 2009
Posts: 2
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

Joined: Oct 13, 2005
Posts: 40061
    
  28
Welcome to JavaRanch ankit kinra

Please consider how useful a reply is when the thread is nearly 9 years old.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19792
    
  20

I'd say it was 2 years old; the last reply was from 2007. The link remains valid though.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40061
    
  28
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

Joined: Nov 09, 2009
Posts: 2
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

Joined: Oct 13, 2005
Posts: 40061
    
  28
I think you are right. Maybe we ought to give up the FAQ about old threads.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Illegal UTF8 string in constant pool?