我想使用 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过滤器。] [完成]