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

孤街浪徒 提交于 2019-12-23 06:51:17

问题


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.


回答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.



回答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>



回答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.




回答4:


I faced exactly the same error. This error will be reported only when I start Tomcat in debug mode, and for certain JSP file (large size). When I start Tomcat in normal mode (not using Debug) then the error is cleared. This error started to show recently, after the JSP file increased in size over time.

The only way I was able to resolve this error is to upgrade Tomcat from version 5.5 to version 7.0, and JRE to jdk1.7.

See the snapshot below to help you get the picture.

Also, don't forget to add the needed libraries required for Tomcat 7 and the new JRE.

Initially, updating the file web.xml to include the following section would solve the problem, but recently it is no longer working:

    <init-param>
            <param-name>mappedfile</param-name>
            <param-value>false</param-value>
    </init-param>


来源:https://stackoverflow.com/questions/8209718/java-lang-internalerror-name-is-too-long-to-represent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!