gpt4 book ai didi

java - 简单测试中的 NoClassDefFoundError

转载 作者:行者123 更新时间:2023-12-02 06:54:42 30 4
gpt4 key购买 nike

我想使用 moo 进行 dto- 实体转换。但测试它我得到这个异常

    Exception in thread "main" java.lang.NoClassDefFoundError: org/mvel2/PropertyAccessException
at com.codiform.moo.configuration.Configuration.getTranslator(Configuration.java:62)
at com.codiform.moo.session.TranslationSession.getTranslator(TranslationSession.java:131)
at com.codiform.moo.session.TranslationSession.translate(TranslationSession.java:122)
at com.codiform.moo.session.TranslationSession.getTranslation(TranslationSession.java:64)
at com.codiform.moo.curry.Translate.from(Translate.java:63)
at Main.main(Main.java:15)
Caused by: java.lang.ClassNotFoundException: org.mvel2.PropertyAccessException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 6 more

是不是因为我做错了什么?这是我的代码:

import com.codiform.moo.curry.Translate;


public class Main {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Guld guld1=new Guld("string from guld", "muck around", 5);
GuldDTO guld1DTO;
GuldDTO testclassload = new GuldDTO("ruks","halim",3);

guld1DTO=Translate.to(GuldDTO.class).from(guld1);
//Beca beca1 = new Beca ()

System.out.println(guld1);
System.out.println(guld1DTO);
}

}
<小时/>
public class Guld {

private String fielk1;
private String rupo;
private Integer higs;
public Guld(){

}
public Guld(String fielk1, String rupo, Integer higs) {

this.fielk1 = fielk1;
this.rupo = rupo;
this.higs = higs;
}
public String getFielk1() {
return fielk1;
}
public void setFielk1(String fielk1) {
this.fielk1 = fielk1;
}
public String getRupo() {
return rupo;
}
public void setRupo(String rupo) {
this.rupo = rupo;
}
public Integer getHigs() {
return higs;
}
public void setHigs(Integer higs) {
this.higs = higs;
}


}
<小时/>
public class GuldDTO {
private String fielk1;
private String rupo;
private Integer higs;
public GuldDTO (){

}
public GuldDTO(String fielk1, String rupo, Integer higs) {

this.fielk1 = fielk1;
this.rupo = rupo;
this.higs = higs;
}
public String getFielk1() {
return fielk1;
}
public void setFielk1(String fielk1) {
this.fielk1 = fielk1;
}
public String getRupo() {
return rupo;
}
public void setRupo(String rupo) {
this.rupo = rupo;
}
public Integer getHigs() {
return higs;
}
public void setHigs(Integer higs) {
this.higs = higs;
}

}

如果我需要提供任何其他详细信息,请告知。 [显然我无法通过检查代码与文本比率的 stackoverflow 过滤器。][完成]

最佳答案

ClassNotFoundException异常表示类缺少为该类添加库并再次运行。首先检查您的应用程序是否有此类,否则添加 mvel lib。

可访问:http://grepcode.com/snapshot/repo1.maven.org/maven2/org.mvel/mvel2/2.1.4.Final/

关于java - 简单测试中的 NoClassDefFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17518815/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com