schemacrawler / SchemaCrawler

Free database schema discovery and comprehension tool
http://www.schemacrawler.com/
Other
1.62k stars 200 forks source link

Schema serialization seems to be broken since transition to FST #237

Closed patric-r closed 5 years ago

patric-r commented 5 years ago

I'm using most recent schemacrawler release. When invoking schema serialization using the following code:

          final XmlSerializedCatalog xmlDatabase = new XmlSerializedCatalog(
              catalog_);

          try (FileOutputStream out = new FileOutputStream(
              serializedDatabaseFile))
          {
            xmlDatabase.save(out);
          }

... will result into throwing an exception:

java.lang.RuntimeException: Class schemacrawler.schema.JavaSqlType$1 does not implement Serializable or externalizable
    at org.nustaq.serialization.FSTClazzInfo.<init>(FSTClazzInfo.java:142) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTClazzInfoRegistry.getCLInfo(FSTClazzInfoRegistry.java:129) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.getFstClazzInfo(FSTObjectOutput.java:534) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectWithContext(FSTObjectOutput.java:416) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectWithContext(FSTObjectOutput.java:369) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectFields(FSTObjectOutput.java:664) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.defaultWriteObject(FSTObjectOutput.java:546) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectWithContext(FSTObjectOutput.java:458) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectWithContext(FSTObjectOutput.java:369) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectFields(FSTObjectOutput.java:664) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.defaultWriteObject(FSTObjectOutput.java:546) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectWithContext(FSTObjectOutput.java:458) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectInternal(FSTObjectOutput.java:327) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.serializers.FSTMapSerializer.writeObject(FSTMapSerializer.java:49) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectWithContext(FSTObjectOutput.java:476) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectWithContext(FSTObjectOutput.java:369) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectFields(FSTObjectOutput.java:664) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.defaultWriteObject(FSTObjectOutput.java:546) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectWithContext(FSTObjectOutput.java:458) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectWithContext(FSTObjectOutput.java:369) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectFields(FSTObjectOutput.java:664) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.defaultWriteObject(FSTObjectOutput.java:546) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectWithContext(FSTObjectOutput.java:458) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObjectInternal(FSTObjectOutput.java:327) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObject(FSTObjectOutput.java:294) ~[fst-2.56.jar:?]
    at org.nustaq.serialization.FSTObjectOutput.writeObject(FSTObjectOutput.java:204) ~[fst-2.56.jar:?]
    at schemacrawler.tools.integration.serialization.XmlSerializedCatalog.save(XmlSerializedCatalog.java:115) ~[schemacrawler-15.03.01.jar:?]
patric-r commented 5 years ago

It looks like the schemacrawler.schema.JavaSqlType source file contains an anonymous class which indeed does not implement the required interface(s)

sualeh commented 5 years ago

Thanks for reporting this. I will fix it soon.

sualeh commented 5 years ago

Please use SchemaCrawler 15.03.02