该死的 java.lang.ClassFormatError: Illegal method name "<init>$" 错误
来源:互联网 发布:java输出后buffered 编辑:程序博客网 时间:2024/05/29 10:48
最近写了一个GWT类,出现了这个错误。
java.lang.ClassFormatError: Illegal method name "<init>$"
丈二和尚摸不着头脑,都些什么鬼提示啊!谷歌了一下发现有人重现了这个错误:
Main:
import com.google.gwt.core.client.EntryPoint;import com.google.gwt.core.client.JavaScriptObject;import com.google.gwt.core.client.JsonUtils;import com.google.gwt.user.client.Window;import com.google.gwt.user.client.ui.Label;import com.google.gwt.user.client.ui.RootPanel;public class _37_OverLayStackOverfflowQuestion implements EntryPoint { String jsonS = "{\"hello\":\"world\"}"; public void onModuleLoad() { JavaScriptObject jso = JsonUtils.safeEval(jsonS); DataUtil overlayEr = jso.cast(); OtherOverlay wellwell = jso.cast(); overlayEr.test(wellwell); Window.alert("works"); }}
First overlay:
import java.util.List;import com.google.gwt.core.client.JavaScriptObject;import com.google.gwt.core.client.JsArrayString;public final class DataUtil extends JavaScriptObject { protected DataUtil() { } public final native void test(OtherOverlay json) /*-{ return; }-*/;}
Second Overlay:
import com.google.gwt.core.client.JavaScriptObject;public class OtherOverlay extends JavaScriptObject { protected OtherOverlay() { } public final native void someFkt()/*-{ alert('hello'); }-*/; int i = 0;}
The error is in the last page in of the second Overlay class: int i = 0;
.
However the error message comes up in DataUtil.
java.lang.ClassFormatError: Illegal method name "<init>$" in class stefan/client/DataUtil at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at com.google.gwt.dev.shell.CompilingClassLoader.findClass(CompilingClassLoader.java:1085)
I guess your error ocures in one of your overlay classes. Check if each of those works alone!
提示说 int i = 0报错。然后看看自己的类,提示一点帮助也没有。仔细再看一下,恍然大悟,原来重点在这里:I guess your error ocures in one of your overlay classes. Check if each of those works alone!
意思说这个错误是它引入的某个类编译失败了,而怎么失败的,GWT只追踪到了java.lang.ClassFormatError。只能由自己仔细检查了,仔细一看原来引入的类我在JavaScriptObject继承类忘记写protected的构造方法了。而GWT的编译,就挂在前一个类这里了,还报了这么奇怪个错误!
0 0
- 该死的 java.lang.ClassFormatError: Illegal method name "<init>$" 错误
- 错误 java.lang.ClassFormatError: Invalid method Code length 的解决办法
- 【java】 java.lang.ClassFormatError: Invalid method Code length 错误
- java.lang.ClassFormatError: Absent Code attribute in method
- java.lang.ClassFormatError: JVMCFRE068 class name is invalid
- 该死的错误,http500--java.lang.reflect.InvocationTargetException
- java.lang.ClassFormatError翻译
- java.lang.ClassFormatError
- J2ME(ALERT: java/lang/ClassFormatError: Bad version information.)错误的解决
- java.lang.ClassFormatError: Illegal UTF8 string in constant pool in class file Server/Request
- J2ME错误处理: ALERT: java/lang/ClassFormatError: Bad version information
- 有关java.lang.ClassFormatError: Truncated class file错误
- java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class
- java.lang.ClassFormatError Duplicate field name&signature in class file XXXXXX
- spring sessionfactory错误 nvocation of init method failed; nested exception is java.lang.NoSuchMethod
- invalid LOC header (bad signature)错误与 java.lang.ClassFormatError: com/mysql/jdbc错误
- JBuilder2006开发j2me错误(java/lang/ClassFormatError: Bad version information)
- ALERT: java/lang/ClassFormatError: Bad version information.
- 蓝桥杯 BASIC-18 基础练习 矩形面积交
- coordinate descent
- 蓝桥杯 BASIC-17 基础练习 矩阵乘法
- line-height ~ text-align 文本居中与垂直居中
- Java 9 - 比 Java 8 更接地气:定制最小化的rt.jar, REPL脚本化执行,原生json处理,支持HTTP 2.0,新的锁机制
- 该死的 java.lang.ClassFormatError: Illegal method name "<init>$" 错误
- fragment简介
- 蓝桥杯 BASIC-16 基础练习 分解质因数
- 蓝桥杯 BASIC-20 基础练习 数的读法 问题
- 远程代理漏洞:httpoxy
- mmap函数创建进程 linux
- Add Digits
- IMS网络基本概念
- 蓝桥杯 BASIC-21 基础练习 Sine之舞