本文介绍了无法使activejdbc工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下课程:
package models;
public class Test extends activejdbc.Model
{
}
:和:
import activejdbc.*;
import models.Test;
public class ActiveJdbc
{
public static void main(String args []) throws Exception
{
System.out.println("starting...");
test();
}
public static void test() throws Exception
{
activejdbc.Base.open("org.h2.Driver", "jdbc:h2:tcp://localhost/~/test", "sa", "");
models.Test t = models.Test.findFirst("id = ??",1);
String s = t.get("name").toString();
System.out.println(s);
}
}
:但是当我使用:
java -cp .;../lib/h2.jar;../lib/activejdbc.jar;../lib/slf4j-simple.jar;../lib/javalite.jar ActiveJdbc
:错误:
starting...
Exception in thread "main" activejdbc.DBException: failed to determine Model class name, are you sure models have been instrumented?
at activejdbc.Model$ClassGetter.getClassName(Model.java:1577)
at activejdbc.Model.getClassName(Model.java:1546)
at activejdbc.Model.getDaClass(Model.java:1538)
at activejdbc.Model.getTableName(Model.java:1550)
at activejdbc.Model.getMetaModel(Model.java:58)
at activejdbc.Model.findFirst(Model.java:1073)
at ActiveJdbc.test(ActiveJdbc.java:17)
at ActiveJdbc.main(ActiveJdbc.java:9)
Caused by: java.lang.RuntimeException: failed to determine Model class name, are you sure models have been instrumented?
:有人可以阐明这一点吗?
: Can anyone shed some light on this?
推荐答案
此后我就知道了。您需要先运行:
I have since figured this out. You need to first run:
java -DoutputDirectory =。 -cp。; activejdbc-instrumentation.jar; javassist.jar; activejdbc.jar; activejdbc.instrumentation.Main
java -DoutputDirectory=. -cp .;activejdbc-instrumentation.jar;javassist.jar;activejdbc.jar;activejdbc.instrumentation.Main
这篇关于无法使activejdbc工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!