代码之家  ›  专栏  ›  技术社区  ›  yazz.com

不能让activejdbc工作吗?

  •  1
  • yazz.com  · 技术社区  · 14 年前

    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?
    

    :有人能解释一下吗?

    1 回复  |  直到 14 年前
        1
  •  2
  •   yazz.com    14 年前

    java-DoutputDirectory=。-活动JDBC-仪器.jar;javassist.jar文件;activejdbc.jar文件;activejdbc.instrumentation.Main