java.lang.IllegalArgumentException: can't serialize class java.math.BigInteger

JIRA | Gina Chen | 4 years ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to poroszd . Or join the community to write better ones.
  1. 0

    While doing some load test, I got this exception from mongodb. {noformat} 2012-11-16 16:09:41.031 [WARN] org.springframework.jms.listener.DefaultMessageListenerContainer - Execution of JMS message listener failed, and no ErrorHandler has been set. java.lang.IllegalArgumentException: can't serialize class java.math.BigInteger at org.bson.BasicBSONEncoder.putNumber(BasicBSONEncoder.java:373) at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:218) at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174) at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:120) at com.mongodb.DefaultDBEncoder.writeObject(DefaultDBEncoder.java:27) at com.mongodb.OutMessage.putObject(OutMessage.java:267) at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:240) at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:205) at com.mongodb.DBCollection.insert(DBCollection.java:57) at com.mongodb.DBCollection.insert(DBCollection.java:100) at com.dreamworks.pam.logging.dao.mongodb.LogEntryDAOImpl.createLogEntry(LogEntryDAOImpl.java:88) at com.dreamworks.pam.logging.services.impl.LogEntryServiceImpl.createLogEntry(LogEntryServiceImpl.java:85) at com.dreamworks.pam.logging.services.jms.LogEntryMessageListener.onMessage(LogEntryMessageListener.java:67) at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562) at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500) at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:326) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:264) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1071) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:965) at java.lang.Thread.run(Thread.java:619) {noformat} Our script generated the same data with different "_id", "id" and "created" and most of them were inserted into database fine. This exception only happened sporadically.

    JIRA | 4 years ago | Gina Chen
    java.lang.IllegalArgumentException: can't serialize class java.math.BigInteger
  2. 0
    samebug tip
    This happened when I tried to insert an empty list of elements to a collection.
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Insert error on Mongo Java driver 3.x ... "IllegalArgumentException ... cluster can not be null"

    GitHub | 2 years ago | colmmcdonnell
    java.lang.IllegalArgumentException: cluster can not be null
  5. 0

    Store multiple JSON documents (in row arrays format with nested JSON key-value objects) in MongoDB

    Stack Overflow | 3 years ago | user1264304
    java.lang.IllegalArgumentException: BasicBSONList can only work with numeric keys, not: [_id]

  1. poroszd 3 times, last 8 months ago
  2. rp 1 times, last 9 months ago
3 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalArgumentException

    can't serialize class java.math.BigInteger

    at org.bson.BasicBSONEncoder.putNumber()
  2. MongoDB Java Driver
    DBCollection.insert
    1. org.bson.BasicBSONEncoder.putNumber(BasicBSONEncoder.java:373)
    2. org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:218)
    3. org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174)
    4. org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:120)
    5. com.mongodb.DefaultDBEncoder.writeObject(DefaultDBEncoder.java:27)
    6. com.mongodb.OutMessage.putObject(OutMessage.java:267)
    7. com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:240)
    8. com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:205)
    9. com.mongodb.DBCollection.insert(DBCollection.java:57)
    10. com.mongodb.DBCollection.insert(DBCollection.java:100)
    10 frames
  3. com.dreamworks.pam
    LogEntryMessageListener.onMessage
    1. com.dreamworks.pam.logging.dao.mongodb.LogEntryDAOImpl.createLogEntry(LogEntryDAOImpl.java:88)
    2. com.dreamworks.pam.logging.services.impl.LogEntryServiceImpl.createLogEntry(LogEntryServiceImpl.java:85)
    3. com.dreamworks.pam.logging.services.jms.LogEntryMessageListener.onMessage(LogEntryMessageListener.java:67)
    3 frames
  4. Spring Framework
    DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run
    1. org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)
    2. org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)
    3. org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)
    4. org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:326)
    5. org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:264)
    6. org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1071)
    7. org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:965)
    7 frames
  5. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:619)
    1 frame