java.lang.ClassFormatError: Absent Code attribute in method

行测资料分析实战心法:从算不完到算得快的系统技巧 资料分析作为行测考试的核心模块,考察的是在高压环境下快速、精准处理信息的能力,而非复杂的数学计算。其底层原理在于通过选项导向、材料预读和估算技巧,将计算过程极大简化,从而提升解题效率。从技术价值看,掌握截位直除、百化分等速算方法,能有效将理论公式转化为实战工具,直接提升答题速度和正确率。在应用场景上,这些技巧尤其适用于增长率比较、比重计算和平均数求解等高频题型。本文聚焦行测资料分析实战,系统分享了从思维重建到题型破解的完整心法,帮助考生将这一模块从“时间黑洞”转变为“得分利器”。 阅读详情

1.  <dependency>

           <groupId>javax</groupId>

           <artifactId>javaee-api</artifactId>

           <version>6.0</version>

       </dependency>

由于在pom文件中添加了上面的内容导致一个异常:  删除这个依赖之后, 问题就没有了

java.lang.ClassFormatError: Absent Codeattribute in method that is not native or abstract in class filejavax/servlet/ServletInputStream

       atjava.lang.ClassLoader.defineClass1(Native Method)

       atjava.lang.ClassLoader.defineClassCond(ClassLoader.java:632)

       atjava.lang.ClassLoader.defineClass(ClassLoader.java:616)

       atjava.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)

       atjava.net.URLClassLoader.defineClass(URLClassLoader.java:283)

       atjava.net.URLClassLoader.access$000(URLClassLoader.java:58)

       atjava.net.URLClassLoader$1.run(URLClassLoader.java:197)

       atjava.security.AccessController.doPrivileged(Native Method)

       atjava.net.URLClassLoader.findClass(URLClassLoader.java:190)

       atjava.lang.ClassLoader.loadClass(ClassLoader.java:307)

       atsun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

       atjava.lang.ClassLoader.loadClass(ClassLoader.java:248)

       at

       atorg.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)


下面是我在网络找到的一篇分析这个异常的文章:

What's the cause of this exception:java.lang.ClassFormatError: Absent Code?

版本 6  

创建于:2010-3-21 上午12:57作者 Dan Allen - 最后修改:  2010-6-11 上午10:46 作者 Dan Allen

When running a test suite that includes Arquillian test cases,you may be encountering the following exception:

 

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file [Fully-qualified class name]    at java.lang.ClassLoader.defineClass1(Native Method)    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

 

This problem is likely the result of having the javax:javeee-api(or javax:javaee-web-api) library on your test classpath. If you have a Mavenproject, you likely have the following dependency in your POM file:

 

<dependency>   <groupId>javax </groupId>   <artifactId>javaee-api </artifactId>   <version>6.0 </version></dependency>

 

This dependency provides you with the Java EE APIs, not theimplementations. While this dependency works for compiling, it cannot be usedfor executing code (that includes tests).

 

Background

 

When these artifacts were published to the Maven repository, Sunstripped out the code from classes that are classified as"implementations". So all the interfaces are code complete, yet anyabstract class or implementation class has no code in it. Any attempt to usethat class will likely blow up. That's why Arquillian is failing.

 

Here's an excerpt from the argument as to why Sun did this:

When one compiles, they want to run as well. By the way, we havebeen promoting full set of Java EE APIs which can only be used for compilation- they are stripped off method details. That way, user can't take thoseartifacts and try to use it in runtime.

The workaround is to not use javax.javaee-api but rather use theindividual, "real" artifacts that you need. Unfortunately, there isno Maven scope available that will exclude a dependency from the testclasspath.

 

There are two solutions to this problem.

 

Solution #1: Maven profiles

 

If you writing tests for an embedded Java EE container, then thecontainer is going to be on your test classpath. That container will have allthe APIs you need to compile. Therefore, you use the Java EE API for yourdefault profile, but then replace it with the target container JAR in theprofile you are using to run the tests. You can see an example of this setup inthe JUnit or TestNG Arquilian example POMs.

 

Solution #2: JBoss Java EE Spec Artifact

 

The other solution, which actually applies in both cases, is touse the Java EE spec artifact provided by JBoss, which does not reference anystripped classes.

 

<dependency>   <groupId>org.jboss.spec </groupId>   <artifactId>jboss-javaee-6.0 </artifactId>   <version>1.0.0.Beta4 </version>   <type>pom </type>   <scope>provided </scope></dependency>
双向全桥隔离dc-dc变换器(DAB) 在全功率范围内,零电压开通优化调制方法能够实现双向全桥隔离dc-dc变换器所有开关的零电压开通,来提升变换器的效率,但其调制模式不连续。当变换器两端电压不匹配时,变换器的电流应力和回流功率将增加,软开关范围将变窄,变换器的效率显著降低。在轻载时,这两种电流优化调制方法采用相同的调制模式;在重载时,最小电流有效值调制方法具有两种调制模式,而最小电流应力调制方法只有一种。双向全桥隔离dc-dc变换器(DAB)和Buck/Boost不同,该变换器通过交流电感进行功率传输,其调制和控制不适合直接借鉴已有的研究。 阅读详情

相关推荐

稀疏变分高斯过程【超简单,全流程解析,案例应用,简单代码】

稀疏变分高斯过程(Sparse Variational Gaussian Processes, SVGP)是一种高效的高斯过程(GP)近似方法,它使用一组称为引入点的固定数据点来近似整个数据集。这种方法大大减少了高斯过程模型的计算复杂度,使其能够适用于大数据集。下面是SVGP的详细数学过程。在标准高斯过程中,给定数据集xiyii1N{(xi​yi​i1N​,目标是学习一个映射fff,其中f∼GPmkf∼GPmkmmm是均值函数,kkk。

刘文凯的博客 3657

Absent Code attribute in method that is not native or abstract in class file jav

在使用springmvc的时候出的错误。 在网上查了一下, 最后发现可能是我使用的javaee的包有问题。 原来使用的是 [code="xml"] org.hibernate hibernate-core 4.2.2.Final [/code] 改成hibernate之后恢复正常。 这个问题应...

···· 4432

BIOS更新后PIN不可用怎么办?从原理到实操的完整修复指南

在计算机维护中,BIOS更新是常见的固件升级操作,但其引发的登录异常却常让用户措手不及。Windows Hello PIN并非传统密码,它通过TPM芯片与设备启动环境(PCR状态)强绑定,一旦主板固件或安全启动配置改变,TPM便会拒绝释放密钥,导致“由于此设备上的更改,你的PIN不再可用”。理解这一原理后,恢复路径清晰可控:优先尝试密码登录,或通过WinRE替换utilman.exe创建临时管理员,必要时还需处理BitLocker恢复密钥。本文面向系统维护与数据安全场景,系统梳理PIN失效的恢复流程与避坑方

weixin_31364787的博客 354

异常:Absent Code attribute in method that is not native or abstract in class

背景: maven项目中使用了 Bean Validation (JSR-303),来对 Bean 进行验证。 文档:http://docs.oracle.com/javaee/6/tutorial/doc/gircz.html 比如: public class User implements Serializable { int id; @NotNu

usedtolove的专栏 1万+

海光(hygon)CPU ESXI vSphere 紫屏问题修复记录

海光服务器ESXI 紫屏问题修复

edison202302的博客 3551

GD32_ADC采样+DMA多通道扫描传输

所使用的MCU 片上集成了 12 位逐次逼近式模数转换器模块(ADC),可以采样来自于 16 个外部通道和 2 个内部通道上的模拟信号。这 18 个 ADC 采样通道都支持多种运行模式,采样转换后,转换结果可以按照最低有效位对齐或最高有效位对齐的方式保存在相应的数据寄存器中。我们主要介绍其多通道扫描转换和DMA传输功能,在多个通道轮询采集ad数据,并使用DMA分别保存各个数据值,其能大大提高ADC的工作效率。以下为ADC 模块框图:

Yin_w的博客 8159

Android com.android.tools.r8.internal.Ub: Absent Code attribute in method that is not native or abst

Android 项目导入 framework.jar编译报错 com.android.tools.r8.internal.Ub: Absent Code attribute in method that is not native or abstract。implementation files 修改为 compileOnly files。

人生只是一种体验,不必用来演绎完美。 2651

AI医疗影像诊断工具2025 完整教程

本教程所述工具均为辅助诊断设备,不可替代执业医师判断。部署使用需遵守当地医疗器械管理法规。推荐开源框架组合:代码太多打包上传网盘了 自行下载。2025年的AI医疗影像诊断工具将以。

m0_60084632的博客 2027

Absent Code attribute in method that is not native or abstract in class file android/app/Application

解决不了呐

。 917

因素空间与可拓学的互补性分析及问题处理融合模型

随着知识与信息数量的快速增长以及信息获取便利性的增加,企事业组织所面临的内外部环境更加复杂,业务问题呈现非线性、不确定性、多维化和实时交互性等特点。业务环境的高度不确定性和面临问题的开放性,人工智能与问题处理的深入研究迫切需要有一种自觉地为信息科学与智能科学服务的定性定量相结合的智能数学模型。经典数学适于描述物质世界的数量与空间关系,智能数学必须能描述信息拓展与智能机理。

weixin_70923796的博客 260

使用CUDA进行按流排序的内存分配的示例程序

在GPU编程中,按流排序的内存分配是一种常见的优化技术,它可以提高内存访问的效率。通过将内存分配与特定的CUDA流相关联,可以确保在GPU上的并发操作期间,内存分配操作与其他GPU计算操作同时进行,从而减少了潜在的内存访问延迟。请注意,上述示例中的代码仅供参考,并可能需要根据实际需求进行修改和调整。此外,为了完整性,我们省略了一些细节,例如主机指针的分配和释放,以及错误处理和错误检查等。在该示例中,我们创建了4个CUDA流,并使用内存池进行内存分配。然后,我们在每个流上执行了相应的内存访问操作,并使用。

Byte_O_O的博客 281

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class

jetty和调试带有jstl时,报如下错误: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/annotation/Resource$AuthenticationType  at java.lang.ClassLoad

1557

华为OD机试真题 新系统 2026-06-10 C++ 实现【设备重排SN】

通信设备SN一般是包含:字母、数字,用'-'(破折号)进行分组分割,例如:8F-3T-1G-2n是一个有效的SN地址。 现在要对已经存在的SN 按照新的规则进行重排:

MISAYAONE的博客 129

java.lang.ClassFormatError : Absent Code attribute in method that is not native or abstract in class

出自:http://www.mkyong.com/hibernate/java-lang-classformaterror-absent-code-attribute-in-method-that-is-not-native-or-abstract-in-class-file/ Problem java.lang.ClassFormatError: Absent Code attrib

1635

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

【java.lang.ClassFormatError】

classformaterror 报错

weixin_44754118的博客 2004

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

java.lang.ClassFormatError: Absent Code attribute...javax/xml/rpc/ServiceException

    javax    javaee-web-api    provided    解决方式:由于在pom文件中添加了上面的内容导致一个异常:  删除这个依赖之后, 问题就没有了, 下面是我在网络找到的一篇分析这个异常的文章: What's the cause of this exception:java.lang.ClassFormatError: Absen

lydmtkl的专栏 922

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

java.lang.ClassFormatError

这个错误很奇怪,查了很久终于找到了,在这里整理一下: Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/GenerationType at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.de

m0_67402236的博客 840

spring运行时没有问题,在单元测试时,出现java.lang.ClassFormatError错误

Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/PersistenceContextType 出现这个问题,找了半天是javaee-api.jar引入导致了这...

baimo7074的博客 793

java.lang.ClassFormatError:类文件中不是本机或抽象的方法中的缺少Code属性…

问题 JPA或Hibernate开发中发生了一个非常奇怪且罕见的问题。 Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/GenerationType ...

一名可爱的技术搬运工 1771

Absent Code attribute in method that is not native or abstract in class file javax/mail/Session 问题

在用maven做项目时遇到这个问题。 解决:将 javaee-api-5.jar 删除 jar包冲突的问题 这个包只是个空壳,没有真正实现功能,为了用于开发时web应用的编译,不能用于程序运行。 ...

qq_41688883的博客 2763

resin版本低报错:Absent Code attribute in method that is not native or abstract in class file javax/valida

问题日志: log4j:WARN No appenders could be found for logger (net.sf.ehcache.CacheManager). log4j:WARN Please initialize the log4j system properly. [09:33:34.615] {main} WebApp[http://admp.21cn.com/admp

慕客丁元英专栏 1069

maven 单元测试 Absent Code attribute in method that is not native or abstract in cl

错误信息: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [H:\mavenWork\worksSpace\bbs_service\target\classes\com\framework\app\entity\Abc.c...

623

Android Studio报错 com.android.tools.r8.internal.Hc: Absent Code attribute in method that is not nativ

Android Studio报错 com.android.tools.r8.internal.Hc: Absent Code attribute in method that is not nativ

Android应用开发工程师 597
上一篇: Publish failed using Ant publisher Resource is out of sync
下一篇: Spring框架中获得DataSource对象的方法
beyond667
博客等级 码龄15年 41粉丝 30原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值