NutzCN Logo
短点 在重建表的时候出现如此问题,请指导_37701f61
发布于 3146天前 作者 明天会吹什么风 1892 次浏览 复制 上一个帖子 下一个帖子
标签:

查看完整内容

2016-05-12 12:38:41,053 [main] ERROR org.nutz.mvc.impl.NutLoading - Error happend during start serivce!
java.lang.NullPointerException
	at org.nutz.dao.impl.EntityHolder.makeEntity(EntityHolder.java:152)
	at org.nutz.dao.impl.link.DoInsertRelationLinkVisitor.visit(DoInsertRelationLinkVisitor.java:45)
	at org.nutz.dao.impl.entity.LinkFieldSet.visit(LinkFieldSet.java:41)
	at org.nutz.dao.impl.entity.NutEntity.visitManyMany(NutEntity.java:341)
	at org.nutz.dao.impl.NutDao.insertWith(NutDao.java:228)
	at com.jack.khmis.MvcSetup.init(MvcSetup.java:95)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:276)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:120)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
	at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:713)
	at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
	at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)
	at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
	at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
	at org.mortbay.jetty.Server.doStart(Server.java:224)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at runjettyrun.Bootstrap.main(Bootstrap.java:97)
2016-05-12 12:38:41,053 [main] ERROR org.nutz.mvc.impl.NutLoading - try to depose ioc
9 回复

什么版本? 换上最新版吧

刚刚检查了一下代码

// org.nutz.dao.impl.EntityHolder.makeEntity(EntityHolder.java:152)
if (!check)
     check = mirror.isEnum();

而mirror为null的情况, 只能是该字段的值是null了, 把Pojo贴一下吧

public class Role implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    private Long              id;
    @Column
    @ColDefine(type = ColType.VARCHAR, width = 200)
    private String            name;
    @Column
    @ColDefine(type = ColType.VARCHAR, width = 500)
    private String            description;
    @Column("is_locked")
    @ColDefine(type = ColType.BOOLEAN, width = 2)
    private Boolean           locked;

    @ManyMany(target = Account.class, relation = "system_user_role", from = "roleid", to = "userid")
    private List<Account>     users;
    @ManyMany(target = Permission.class, relation = "system_role_permission", from = "roleid", to = "permissionid")
    private List<Permission>  permissions;

@wendal 是最新版本的!

1.r.56

是不是users和permissions是null? 赋值个new ArrayList<> 试试

@wendal 两个都不为空的!

 // account
            Account user = new Account();
            user.setRealeName("超级管理员");
            user.setUserName("admin");
            RandomNumberGenerator rng = new SecureRandomNumberGenerator();
            String salt = rng.nextBytes().toBase64();
            String hashedPasswordBase64 = new Sha256Hash("123456", salt, 1024).toBase64();
            user.setSalt(salt);
            user.setPassWord(hashedPasswordBase64);
            user.setCreateTime(Times.now());

            // Permission
            Permission perm = new Permission();
            perm.setName("*:*");
            perm.setDescription("全部权限");

            // role
            Role role = new Role();
            role.setId(1L);
            role.setName("superAdmin");
            role.setDescription("超级管理员");
            List<Permission> perms = Lists.newArrayList();
            perms.add(perm);
            role.setPermissions(perms);
            List<Account> users = Lists.newArrayList();
            users.add(user);
            role.setUsers(users);
            dao.insertWith(role, null);

晚上更新一版

1.r.56.r2

添加回复
请先登陆
回到顶部