java.lang.InternalError: name is too long to represent

10,125

Solution 1

update The bug mentioned in the original answer below has now been closed!


As noted in the article that you reference, this is a bug in the Sun/Oracle JVM implementation. At the time of writing, it is unresolved.

I can think of three ways to work around the issue:

  1. Don't generate SMAP files at all (eg: don't run with -Xdebug or use suppressSmap-like settings)
  2. Try to make sure that the size of the debug information is small (eg: reduce the size of your code)
  3. Use a different virtual machine implementation.

Solution 2

One work around that worked for me is adding the following entry in the tomcat/conf/web.xml:

<init-param> 
   <param-name>suppressSmap</param-name> 
   <param-value>true</param-value> 
</init-param>

Solution 3

If you can determine the class that is causing the problem you should be able to use Stripper to remove the debug extension information from that one class and still be able to debug the rest.

Share:
10,125
Paolo
Author by

Paolo

Updated on June 06, 2022

Comments

  • Paolo
    Paolo almost 2 years

    I get this error:

    java.lang.InternalError: name is too long to represent
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
            at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:338)
            at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:291)
            at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:259)
    

    Which seems related to some debug functionality (in fact removing -Xdebug command line option the error disappears). I've also found some information in ASF Bugzilla. Is there a way to solve this?

    Possible solutions I can think of are to change the JVM (using JRockit which should't have this issue), but I do not really know if this can solve the issue and if it can break something else.

  • Paolo
    Paolo over 12 years
    Thanks for your answer, just two points: Are you confirming the bug is present in version 5 and 6 Sun JVM? (Please note that Oracle JRockit VM shouldn't have this problem). Can you elaborate a bit on "suppressSmap-like"?
  • Paolo
    Paolo over 12 years
    +1, I will accept this answer, if the details I asked will be provided.
  • Guus
    Guus over 12 years
    I haven't personally reproduced the bugs on both Sun/Oracle 5 and 6, but the bugreport that I linked to remains unresolved. That, combined with ongoing comments in the report, is a good indication that the bug is still present. As for the SuppressSmap-like settings: some implementations work around this bug by providing custom settings to prevent debugging data from being created. See, for example, the 'known issues' section at tomcat.apache.org/tomcat-6.0-doc/jasper-howto.html
  • Syed Ali
    Syed Ali almost 9 years
    Just got hit by the same issue. I was using jdk1.7.0_21 Windows x64 and as described upgrading to latest jdk fixed it.
  • The PowerHouse
    The PowerHouse over 8 years
    how can i apply first work around.I tried @learner solution,but its not working..
  • Guus
    Guus over 8 years
    @mcapatna Your problems will disappear when you start using the latest version of Java. No need for work-arounds!
  • The PowerHouse
    The PowerHouse over 8 years
    @Guus where i have to put the latest version of java.in eclipse build path or while selecting the JRE for web-logic domain