com.mongodb.BasicDBObject cannot be cast to [B

After an upgrade from 3.3 to 4.0 I get the following error in the log after trying to login in the webgui:

2021-09-18T14:24:00.946+02:00 ERROR [ExecutorServiceSessionValidationScheduler] Error while validating the session
java.lang.ClassCastException: com.mongodb.BasicDBObject cannot be cast to [B at org.graylog2.security.MongoDbSession.getAttributes(MongoDbSession.java:68) ~[graylog.jar:?]
at org.graylog2.security.MongoDbSessionDAO.getSimpleSession(MongoDbSessionDAO.java:92) ~[graylog.jar:?]
at org.graylog2.security.MongoDbSessionDAO.getActiveSessions(MongoDbSessionDAO.java:156) ~[graylog.jar:?]
at org.apache.shiro.session.mgt.DefaultSessionManager.getActiveSessions(DefaultSessionManager.java:244) ~[graylog.jar:?]
at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.validateSessions(AbstractValidatingSessionManager.java:280) ~[graylog.jar:?]
at org.apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler.run(ExecutorServiceSessionValidationScheduler.java:120) [graylog.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_292]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_292]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_292]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_292]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_292]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_292]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]

How can I solve this issue?

Kind regards.

Michiel Piscaer

Hi there, this sounds like a corrupted session in MongoDB. You could try dropping the documents in the sessions collection to see if that does the trick.

Also, I want to mention this particular article: How to Post a Question in the Community that Gets Responses. We’ve put that together to make the process of asking and answering questions a bit less onerous for forum users. In the future, it would help if you can do things like:

  • Tell us how you upgraded, or provide steps for us to try and retrace
  • Surround your output with ``` to make it easier to read

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.