java.io.NotSerializableException: org.hibernate.validator.DigitsValidator

Hibernate JIRA | benoit heinrich | 8 years ago
  1. 0

    Hi all, If you try to serialize a DigitsValidator and EANValidator validator class instance, then you get a nice: java.io.NotSerializableException: org.hibernate.validator.DigitsValidator at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079) An easy way to reproduce it is to run the following unit test: public class ValidatorTest { @Test(dataProvider = "getValidators") public void testValidatorSerialization(Validator<?> validator) throws IOException { OutputStream os = new ByteArrayOutputStream(); new ObjectOutputStream(os).writeObject(validator); } @DataProvider(name = "getValidators") public Object[][] getValidators() { return new Object[][] { {new AssertFalseValidator()}, {new AssertTrueValidator()}, {new CreditCardNumberValidator()}, {new DigitsValidator()}, {new EANValidator()}, {new EmailValidator()}, {new FutureValidator()}, {new LengthValidator()}, {new MaxValidator()}, {new MinValidator()}, {new NotEmptyValidator()}, {new NotNullValidator()}, {new PastValidator()}, {new PatternValidator()}, {new RangeValidator()}, {new SizeValidator()}, }; } } To fix it you should simply make the two classes implementing Serializable.

    Hibernate JIRA | 8 years ago | benoit heinrich
    java.io.NotSerializableException: org.hibernate.validator.DigitsValidator
  2. 0

    Hi all, If you try to serialize a DigitsValidator and EANValidator validator class instance, then you get a nice: java.io.NotSerializableException: org.hibernate.validator.DigitsValidator at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079) An easy way to reproduce it is to run the following unit test: public class ValidatorTest { @Test(dataProvider = "getValidators") public void testValidatorSerialization(Validator<?> validator) throws IOException { OutputStream os = new ByteArrayOutputStream(); new ObjectOutputStream(os).writeObject(validator); } @DataProvider(name = "getValidators") public Object[][] getValidators() { return new Object[][] { {new AssertFalseValidator()}, {new AssertTrueValidator()}, {new CreditCardNumberValidator()}, {new DigitsValidator()}, {new EANValidator()}, {new EmailValidator()}, {new FutureValidator()}, {new LengthValidator()}, {new MaxValidator()}, {new MinValidator()}, {new NotEmptyValidator()}, {new NotNullValidator()}, {new PastValidator()}, {new PatternValidator()}, {new RangeValidator()}, {new SizeValidator()}, }; } } To fix it you should simply make the two classes implementing Serializable.

    Hibernate JIRA | 8 years ago | benoit heinrich
    java.io.NotSerializableException: org.hibernate.validator.DigitsValidator
  3. 0

    ADF11g app cluster runtime Not Serializable Exception

    Oracle Community | 6 years ago | 807463
    java.io.NotSerializableException: oracle.adf.view.rich.component.rich.input.RichInputText
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Not Serializable Exception - Group Layout

    Stack Overflow | 2 years ago | bSky
    java.io.NotSerializableException: javax.swing.GroupLayout
  6. 0

    java.io.NotSerializableException when implementing UserDetailsService

    Stack Overflow | 4 years ago | chaldaean
    java.io.NotSerializableException: com.samsung.diary.security.UserDetailsServiceImpl

    5 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.io.NotSerializableException

      org.hibernate.validator.DigitsValidator

      at java.io.ObjectOutputStream.writeObject0()
    2. Java RT
      ObjectOutputStream.writeObject0
      1. java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
      2. java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
      3. java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
      4. java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
      5. java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
      5 frames