actframework / act-aaa-plugin

Use OSGL aaa library to mange Authentication/Authorization/Accounting for ActFramework Application
Apache License 2.0
6 stars 2 forks source link

IllegalArgumentException triggered in auditing upon hotreload #36

Closed greenlaw110 closed 5 years ago

greenlaw110 commented 5 years ago

Error stack:

java.lang.IllegalArgumentException: Can not set java.util.Date field cc.topush.model.Audit.createdAt to cc.topush.model.Audit
    at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
    at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
    at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:58)
    at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:75)
    at java.lang.reflect.Field.set(Field.java:764)
    at act.db.util.AuditHelper$TimestampFieldVisitor.visit(AuditHelper.java:235)
    at act.db.util.AuditHelper.apply(AuditHelper.java:205)
    at act.db.util.AuditHelper.prePersist(AuditHelper.java:65)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.hibernate.jpa.event.internal.jpa.ListenerCallback.performCallback(ListenerCallback.java:35)
    at org.hibernate.jpa.event.internal.jpa.CallbackRegistryImpl.callback(CallbackRegistryImpl.java:94)
    at org.hibernate.jpa.event.internal.jpa.CallbackRegistryImpl.preCreate(CallbackRegistryImpl.java:54)
    at org.hibernate.jpa.event.internal.core.JpaPersistEventListener.saveWithGeneratedId(JpaPersistEventListener.java:66)
    at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:189)
    at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:132)
    at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:58)
    at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:778)
    at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:751)
    at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:756)
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1146)
    at act.db.jpa.JPADao._save(JPADao.java:146)
    at act.db.jpa.JPADao.save(JPADao.java:140)
    at act.aaa.DefaultAuditor.audit(DefaultAuditor.java:98)
    at org.osgl.aaa.AAA.requirePermission(AAA.java:864)
    at org.osgl.aaa.AAA.requirePermission(AAA.java:887)
    at org.osgl.aaa.AAA.requirePermission(AAA.java:822)
    at org.osgl.aaa.AAA.requirePermission(AAA.java:461)
    at cc.topush.service.v1.UserService.list(UserService.java:37)
    at cc.topush.service.v1.UserServiceMethodAccess.invoke(Unknown Source)
    at act.handler.builtin.controller.impl.ReflectedHandlerInvoker.invoke(ReflectedHandlerInvoker.java:1042)
    at act.handler.builtin.controller.impl.ReflectedHandlerInvoker.invoke(ReflectedHandlerInvoker.java:1028)
    at act.handler.builtin.controller.impl.ReflectedHandlerInvoker.handle(ReflectedHandlerInvoker.java:663)
    at act.handler.builtin.controller.ControllerAction.handle(ControllerAction.java:49)
    at act.handler.builtin.controller.RequestHandlerProxy._handle(RequestHandlerProxy.java:558)
    at act.handler.builtin.controller.RequestHandlerProxy.handle(RequestHandlerProxy.java:210)
    at act.app.ActionContext.proceedWithHandler(ActionContext.java:1326)
    at act.route.Router$ContextualHandler.handle(Router.java:1714)
    at act.xio.NetworkHandler$3.run(NetworkHandler.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
greenlaw110 commented 5 years ago

Clearly the Field referenced was loaded by the old class loader: image

greenlaw110 commented 5 years ago

Root cause is in ActFramework: https://github.com/actframework/actframework/issues/1098