异常:Absent Code attribute in method that is not native or abstract in class
来源:互联网 发布:女生喜欢多大尺寸 知乎 编辑:程序博客网 时间:2024/06/04 19:19
背景:
maven项目中使用了 Bean Validation (JSR-303),来对 Bean 进行验证。
文档:http://docs.oracle.com/javaee/6/tutorial/doc/gircz.html
比如:
public class User implements Serializable { int id; @NotNull//非空 @Size(min = 2,max = 50)//长度在2~50 String name; @NotNull//非空 @Min(1)//最小值1 @Max(200)//最大值200 int age; //....}如果为编译通过,直接引入依赖如下:
<dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> </dependency>
则会报出如题所示错误。
原因:
javaee-api 中仅给出了规范,没有具体的实现。
解决方案:
改为一个实现了JSR-303规范的jar,比如hibernate:
<!--<dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> </dependency>--> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>4.3.1.Final</version> </dependency>
重新运行,问题解决。
- 异常:Absent Code attribute in method that is not native or abstract in class
- java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class
- resin版本低报错:Absent Code attribute in method that is not native or abstract in class file javax/valida
- Absent Code attribute in method that is not native or abstract in class file javax/mail/Session 解决方式
- Absent Code attribute in method that is not native or abstract in class file javax/mail/MessagingExc
- java.lang.ClassFormatError: Absent Code attribute in method
- error: DynamicDataSource is not abstract and does not override abstract method getParentLogger() in
- is not abstract and does not override abstract method getIncludes() in org.apache.jasper.runtime.HttpJspBase 问题
- The method load(Class, Serializable) in the type Session is not applicable for the arguments (Class<
- The file is absent or does not have execute permission 启动tomcat异常
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions异常原因及解决方法
- Could not find method update(View) in a parent or ancestor Context for android:onClick attribute def
- he method get(Class, Serializable) in the type HibernateTemplate is not applicable for the arguments
- The method setClass(Context, Class<?>) in the type Intent is not applicable for the arguments (GameV
- The method setClass(Context, Class<?>) in the type Intent is not applicable for the问题
- The proof is in the code. That is all.
- The file is absent or does not have execute permission
- According to TLD or attribute directive in tag file异常
- 开发流程总结
- 16进制、中文转换
- OpenGL 基础图形绘制与投影变换
- 九度OJ 教程81 拓扑排序——确立比赛名次
- xml 笔记三 XML 解析器
- 异常:Absent Code attribute in method that is not native or abstract in class
- Flex + Hessian 学习笔记(一)
- Flex + Hessian 学习笔记(二)
- VC++中如何获取本地IP地址
- Spring初学
- Flex + Hessian 学习笔记(三)
- spring开发_Spring+Hibernate_HibernateDaoSupport
- 初学spring mvc
- spring开发_Annotation_AOP_Before增强处理