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 是最新版本的!
@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);
@wendal 神速啊
添加回复
请先登陆