ysc / APDPlat

APDPlat是Application Product Development Platform的缩写,即应用级产品开发平台。
http://apdplat.org
GNU General Public License v3.0
521 stars 1.08k forks source link

生成代码解析模型文件时报javax/persistence/CascadeType的错误。 #21

Closed fujw closed 11 years ago

fujw commented 11 years ago

请问生成代码解析模型文件时报javax/persistence/CascadeType错误(JDK是1.7)原因还有什么可能,错误信息: Exception in thread "main" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/CascadeType at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:791) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2451) at java.lang.Class.getDeclaredMethods(Class.java:1810) at sun.reflect.annotation.AnnotationType$1.run(AnnotationType.java:104) at sun.reflect.annotation.AnnotationType$1.run(AnnotationType.java:101) at java.security.AccessController.doPrivileged(Native Method) at sun.reflect.annotation.AnnotationType.(AnnotationType.java:100) at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:84) at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:221) at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88) at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70) at java.lang.reflect.Field.declaredAnnotations(Field.java:1033) at java.lang.reflect.Field.getDeclaredAnnotations(Field.java:1026) at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:196) at com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader.getAllFieldAnnotations(RuntimeInlineAnnotationReader.java:73) at com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader.getAllFieldAnnotations(RuntimeInlineAnnotationReader.java:57) at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.findFieldProperties(ClassInfoImpl.java:381) at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:311) at com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.getProperties(RuntimeClassInfoImpl.java:186) at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:248) at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:104) at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:85) at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:214) at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:99) at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:85) at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:320) at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:335) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:465) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:303) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:142) at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1174) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:162) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:248) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:235) at javax.xml.bind.ContextFinder.find(ContextFinder.java:432) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:637) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:584) at com.apdplat.platform.util.XMLFactory.(XMLFactory.java:48) at com.apdplat.module.module.service.ModuleParser.parseModule(ModuleParser.java:107) at com.apdplat.module.module.service.ModuleParser.getRootModule(ModuleParser.java:99) at com.apdplat.platform.generator.ActionGenerator.generateFromModule(ActionGenerator.java:98) at com.apdplat.platform.generator.ActionGenerator.generate(ActionGenerator.java:83) at generator.DocumentsGenerator.main(DocumentsGenerator.java:178)错误信息: Exception in thread "main" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/CascadeType at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java

fujw commented 11 years ago

问题好了,自动下载的javaee-api-6.0缺少实现,需要引用完整的javaee6.jar。

kevintop commented 11 years ago

javaee-api-6.0不是maven中定义的嘛,需要另外下载javaee6.jar?

kevintop commented 11 years ago

我换成7.0,可以正常生成。

ysc commented 11 years ago

已解决,参看commit:https://github.com/ysc/APDPlat/commit/224ea0498242cc71f471aa43b12af987808f87a2 如果之前已经建立好了eclipse开发环境,那么只是更新代码是不够的,需要注意 如何在eclipse下开发 中的第10步骤:https://github.com/ysc/APDPlat/wiki/%E5%A6%82%E4%BD%95%E5%9C%A8eclipse%E4%B8%8B%E5%BC%80%E5%8F%91