]
Dan Berindei updated ISPN-11898:
--------------------------------
Status: Pull Request Sent (was: Open)
Git Pull Request:
Missing transcoder for user marshaller's media type
---------------------------------------------------
Key: ISPN-11898
URL:
https://issues.redhat.com/browse/ISPN-11898
Project: Infinispan
Issue Type: Bug
Components: Core
Affects Versions: 11.0.0.Dev05
Reporter: Dan Berindei
Assignee: Dan Berindei
Priority: Major
Fix For: 11.0.0.Final
When the user configures a custom marshaller like {{JavaSerializationMarshaller}}, the
cache needs a transcoder to wrap the user marshaller and convert between Java objects and
the storage media type. Of course, if the cache's storage media type is not the same
as the user marshaller's media type, another transcoder will be used, but the user
marshaller transcoder needs to be available.
Currently {{EncoderRegistryFactory}} registers a transcoder wrapping the global
marshaller instead, and the cache won't start:
{code:java}
GlobalConfigurationBuilder gcb = new GlobalConfigurationBuilder();
gcb.serialization().marshaller(new JavaSerializationMarshaller());
DefaultCacheManager manager = new DefaultCacheManager(gcb.build());
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.encoding().mediaType(MediaType.APPLICATION_SERIALIZED_OBJECT_TYPE);
manager.createCache("cache", builder.build());
{code}
{noformat}
org.infinispan.commons.CacheConfigurationException: Unable to inject dependencies for
component class org.infinispan.encoding.DataConversion, path org.infinispan.AdvancedCache
(a org.infinispan.cache.impl.EncoderCache)
Caused by: org.infinispan.commons.dataconversion.EncodingException: ISPN000492: Cannot
find transcoder between 'application/x-java-object' to
'application/x-java-serialized-object'
at
org.infinispan.marshall.core.EncoderRegistryImpl.getTranscoder(EncoderRegistryImpl.java:64)
at org.infinispan.encoding.DataConversion.lookupTranscoder(DataConversion.java:210)
at org.infinispan.encoding.DataConversion.injectDependencies(DataConversion.java:185)
at org.infinispan.encoding.CorePackageImpl$1.wire(CorePackageImpl.java:29)
at org.infinispan.encoding.CorePackageImpl$1.wire(CorePackageImpl.java:27)
at
org.infinispan.factories.impl.BasicComponentRegistryImpl.invokeInjection(BasicComponentRegistryImpl.java:339)
... 45 more
{noformat}