Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
621 views
in Technique[技术] by (71.8m points)

java - Apache Ignite throws Failed to deserialize object with given class loader on startup ( Client - Server )

I am trying to use custom transaction manager with ignite however it causes Failed to deserialize object with given class loader on startup. The Transaction Manager Factory is implemented as

public class TransactionManagerFactory implements Factory<TransactionManager> {
private static final long serialVersionUID = 1L;

private TransactionManager txMgr;

public TransactionManagerFactory(TransactionManager txMgr) {
    this.txMgr=txMgr;
}

@Override
public TransactionManager create() {
    return this.txMgr;
}
}

The Factory is attached to client config as following:

TransactionConfiguration txConfiguration=new TransactionConfiguration();
txConfiguration.setDeadlockTimeout(acquireTimeout);
txConfiguration.setDefaultTxIsolation(TransactionIsolation.READ_COMMITTED);
txConfiguration.setDefaultTxConcurrency(TransactionConcurrency.PESSIMISTIC);
txConfiguration.setTxManagerFactory(new TransactionManagerFactory(txMgr));           
this.clientConfig.setTransactionConfiguration(txConfiguration);

The Error says the transaction Manager itself passed to Factory is not serializable: Caused by: java.io.NotSerializableException: org.infinispan.transaction.tm.EmbeddedBaseTransactionManager

However the Transaction Manager itself should not be serializable. How can we pass existing Transaction Manager to ignite client?

BR Yulian Oifa

question from:https://stackoverflow.com/questions/66062372/apache-ignite-throws-failed-to-deserialize-object-with-given-class-loader-on-sta

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Your transaction manager factory holds on to a transaction manager instance instead of creating it in create() method on a remote node. This is how it should work.

All non-transient fields of a serializable object must be serializable too.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...