can not be cast to net.sf.ehcache.Element,这个错误是否也与Jfinal-undertow有关系

这个错误是否也与Jfinal-undertow有关系呢:


    [ERROR] [11:40:28] io.undertow.request - UT005023: Exception handling request to /product/list/2
    javax.servlet.ServletException: Filtered request failed.
......
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.shiro.cache.CacheException: java.lang.ClassCastException: net.sf.ehcache.Element cannot be cast to net.sf.ehcache.Element
at org.apache.shiro.cache.ehcache.EhCache.get(EhCache.java:85)
at org.apache.shiro.session.mgt.eis.CachingSessionDAO.getCachedSession(CachingSessionDAO.java:217)
at org.apache.shiro.session.mgt.eis.CachingSessionDAO.getCachedSession(CachingSessionDAO.java:202)
at org.apache.shiro.session.mgt.eis.CachingSessionDAO.readSession(CachingSessionDAO.java:259)
at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSessionFromDataSource(DefaultSessionManager.java:236)
at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSession(DefaultSessionManager.java:222)
at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.java:118)
at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.java:148)
at org.apache.shiro.session.mgt.AbstractNativeSessionManager.getSession(AbstractNativeSessionManager.java:140)
at org.apache.shiro.mgt.SessionsSecurityManager.getSession(SessionsSecurityManager.java:156)
at org.apache.shiro.mgt.DefaultSecurityManager.resolveContextSession(DefaultSecurityManager.java:456)
at org.apache.shiro.mgt.DefaultSecurityManager.resolveSession(DefaultSecurityManager.java:442)
at org.apache.shiro.mgt.DefaultSecurityManager.createSubject(DefaultSecurityManager.java:338)
at org.apache.shiro.subject.Subject$Builder.buildSubject(Subject.java:846)
at org.apache.shiro.web.subject.WebSubject$Builder.buildWebSubject(WebSubject.java:148)
at org.apache.shiro.web.servlet.AbstractShiroFilter.createSubject(AbstractShiroFilter.java:292)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:359)
... 31 more
Caused by: java.lang.ClassCastException: net.sf.ehcache.Element cannot be cast to net.sf.ehcache.Element
at net.sf.ehcache.store.disk.DiskStorageFactory.read(DiskStorageFactory.java:371)
at net.sf.ehcache.store.disk.DiskStorageFactory.retrieve(DiskStorageFactory.java:887)
at net.sf.ehcache.store.disk.Segment.decodeHit(Segment.java:182)
at net.sf.ehcache.store.disk.Segment.get(Segment.java:225)
at net.sf.ehcache.store.disk.DiskStore.fault(DiskStore.java:210)
at net.sf.ehcache.store.CacheStore$4.call(CacheStore.java:198)
at net.sf.ehcache.store.CacheStore$4.call(CacheStore.java:192)
at net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault.get(OnHeapCachingTier.java:334)
at net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault.access$200(OnHeapCachingTier.java:311)
at net.sf.ehcache.store.cachingtier.OnHeapCachingTier.get(OnHeapCachingTier.java:175)
at net.sf.ehcache.store.CacheStore.get(CacheStore.java:192)
at net.sf.ehcache.Cache.get(Cache.java:1751)
at org.apache.shiro.cache.ehcache.EhCache.get(EhCache.java:73)
... 47 more



评论区

JFinal

2018-12-06 11:53

添加下面的一行代码:
UndertowServer.create(...)
.addHotSwapClassPrefix("org.apache.shiro.")
.start();

如果不行的话,再试一下
UndertowServer.create(...)
.addHotSwapClassPrefix("org.apache.")
.start();

shiro 的支持确实有几个人反馈

it1728166827

2018-12-06 13:02

.addHotSwapClassPrefix("org.apache.shiro.")加了这行问题解决了。感谢指导!

热门反馈

扫码入社