You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by JP <jo...@gmail.com> on 2017/10/05 11:56:14 UTC
BinaryInvalidTypeException: Due to usage of Cross Platform Java and
.Net
I have one java server node and c# client node.
From the csharp client, I am trying to send data(Using POJO class) to the
server node.
In both server and client node started with same configuraions.
<property name="binaryConfiguration">
<bean class="org.apache.ignite.configuration.BinaryConfiguration">
<property name="compactFooter" value="false"/>
<property name="nameMapper">
<bean
class="org.apache.ignite.binary.BinaryBasicNameMapper">
<property name="simpleName" value="true"/>
</bean>
</property>
<property name="IdMapper">
<bean class="org.apache.ignite.binary.BinaryBasicIdMapper">
<property name="lowerCase" value="true"/>
</bean>
</property>
</bean>
</property>
*But I am getting this exception:
*
Caused by: class org.apache.ignite.binary.BinaryInvalidTypeException:
Unknown pair [platformId=0, typeId=-417099649]
at
org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:695)
at
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1755)
at
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1714)
at
org.apache.ignite.internal.binary.BinaryObjectImpl.deserializeValue(BinaryObjectImpl.java:797)
at
org.apache.ignite.internal.binary.BinaryObjectImpl.value(BinaryObjectImpl.java:143)
at
org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinary(CacheObjectUtils.java:161)
at
org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinaryIfNeeded(CacheObjectUtils.java:41)
at
org.apache.ignite.internal.processors.cache.CacheObjectContext.unwrapBinaryIfNeeded(CacheObjectContext.java:125)
at
org.apache.ignite.internal.processors.cache.GridCacheContext.unwrapBinaryIfNeeded(GridCacheContext.java:1734)
at
org.apache.ignite.internal.processors.cache.GridCacheContext.unwrapBinaryIfNeeded(GridCacheContext.java:1722)
at
org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.put(GridCacheStoreManagerAdapter.java:557)
at
org.apache.ignite.internal.processors.cache.GridCacheMapEntry$AtomicCacheUpdateClosure.update(GridCacheMapEntry.java:4352)
at
org.apache.ignite.internal.processors.cache.GridCacheMapEntry$AtomicCacheUpdateClosure.call(GridCacheMapEntry.java:4172)
at
org.apache.ignite.internal.processors.cache.GridCacheMapEntry$AtomicCacheUpdateClosure.call(GridCacheMapEntry.java:3906)
at
org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Invoke.invokeClosure(BPlusTree.java:2988)
at
org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Invoke.access$6200(BPlusTree.java:2882)
at
org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.invokeDown(BPlusTree.java:1713)
at
org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.invoke(BPlusTree.java:1602)
... 22 more
Caused by: java.lang.ClassNotFoundException: Unknown pair [platformId=0,
typeId=-417099649]
at
org.apache.ignite.internal.MarshallerContextImpl.getClassName(MarshallerContextImpl.java:392)
at
org.apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:342)
at
org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:686)
... 39 more
*
I have added the same model class in c# and java.
I understand that there is some conflict happening in serialization and
deserialization.
Any hints on configuring c# client node and server node(java)
*
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: BinaryInvalidTypeException: Due to usage of Cross Platform Java
and .Net
Posted by Pavel Tupitsyn <pt...@apache.org>.
Can you try with keepBinaryInStore? It is also more efficient.
On Thu, Oct 5, 2017 at 6:09 PM, JP <jo...@gmail.com> wrote:
> Even I have tried in java also.
> *Same exception*
>
> Maybe I was thinking the problem in ignite version(I am using 2.2)...?
> or any configuration missed..?
>
> I am stuck on this...
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
Re: BinaryInvalidTypeException: Due to usage of Cross Platform Java
and .Net
Posted by JP <jo...@gmail.com>.
Even I have tried in java also.
*Same exception*
Maybe I was thinking the problem in ignite version(I am using 2.2)...?
or any configuration missed..?
I am stuck on this...
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: BinaryInvalidTypeException: Due to usage of Cross Platform Java
and .Net
Posted by Pavel Tupitsyn <pt...@apache.org>.
I'm talking about Java side - toBinary has to be called there to associate
the class with type name.
Yes, you could also work in binary mode by setting keepBinaryInStore to
true and changing cache store implementation accordingly.
On Thu, Oct 5, 2017 at 5:39 PM, JP <jo...@gmail.com> wrote:
> I have tried like this from c# api,
>
> IIgnite ignite = Ignition.Start("default-config.xml");
> ignite.GetBinary().ToBinary<IBinary>(new CustomerInfo());
>
>
> Still, I am getting the same issue.
>
> As per your reply: I have understood that while sending a message from the
> client(c#) to server(java), convert it to the binary object. Is that
> true..?
>
> If so are you suggesting me to follow this:
> https://apacheignite.readme.io/docs/binary-marshaller#
> section-binaryobject-cache-api
> instead of
> https://apacheignite-net.readme.io/v2.2/docs/platform-interoperability.
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
Re: BinaryInvalidTypeException: Due to usage of Cross Platform Java
and .Net
Posted by JP <jo...@gmail.com>.
I have tried like this from c# api,
IIgnite ignite = Ignition.Start("default-config.xml");
ignite.GetBinary().ToBinary<IBinary>(new CustomerInfo());
Still, I am getting the same issue.
As per your reply: I have understood that while sending a message from the
client(c#) to server(java), convert it to the binary object. Is that true..?
If so are you suggesting me to follow this:
https://apacheignite.readme.io/docs/binary-marshaller#section-binaryobject-cache-api
instead of
https://apacheignite-net.readme.io/v2.2/docs/platform-interoperability.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: BinaryInvalidTypeException: Due to usage of Cross Platform Java
and .Net
Posted by Pavel Tupitsyn <pt...@apache.org>.
Yep, I was wrong. This is not enough.
There is no explicit type registration API, so, as a workaround,
call to IgniteBinary.toBinary(new CustomerInfo()) right after start, before
using the cache store, may help.
BinaryTypeConfiguration can be removed in this case.
On Thu, Oct 5, 2017 at 4:42 PM, JP <jo...@gmail.com> wrote:
> I have added that in configuration.
>
> Still same exception.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
Re: BinaryInvalidTypeException: Due to usage of Cross Platform Java
and .Net
Posted by JP <jo...@gmail.com>.
I have added that in configuration.
Still same exception.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: BinaryInvalidTypeException: Due to usage of Cross Platform Java
and .Net
Posted by Pavel Tupitsyn <pt...@apache.org>.
So you put data from C# and have a non-binary CacheStore implementation in
Java.
The reason of failure is that Ignite on Java side is not aware of your
CustomerInfo class.
You can fix that by registering the type in config file:
<property name="binaryConfiguration">
<bean class="org.apache.ignite.configuration.BinaryConfiguration">
...
<property name="typeConfigurations">
<list>
<bean
class="org.apache.ignite.binary.BinaryTypeConfiguration">
<property name="typeName"
value="com.cachestore.CustomerInfo
"/>
</bean>
</list>
</property>
</bean>
</property>
Let me know if this helps.
Thanks,
Pavel
On Thu, Oct 5, 2017 at 3:26 PM, JP <jo...@gmail.com> wrote:
> I am using Apache Ignite 2.2 Version
>
> Java as server
> -----------------------
> CustomerCacheStore.java
> <http://apache-ignite-users.70518.x6.nabble.com/file/
> t1355/CustomerCacheStore.java>
> CustomerInfo.java
> <http://apache-ignite-users.70518.x6.nabble.com/file/
> t1355/CustomerInfo.java>
> SQLServerTest.java
> <http://apache-ignite-users.70518.x6.nabble.com/file/
> t1355/SQLServerTest.java>
>
>
> c# program as client
> --------------------------------=
> CustomerInfo.cs
> <http://apache-ignite-users.70518.x6.nabble.com/file/t1355/CustomerInfo.cs
> >
> Program.cs
> <http://apache-ignite-users.70518.x6.nabble.com/file/t1355/Program.cs>
>
> Both using same configuration file
> --------------------------------------
> default-config.xml
> <http://apache-ignite-users.70518.x6.nabble.com/file/
> t1355/default-config.xml>
>
>
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
Re: BinaryInvalidTypeException: Due to usage of Cross Platform Java
and .Net
Posted by JP <jo...@gmail.com>.
I am using Apache Ignite 2.2 Version
Java as server
-----------------------
CustomerCacheStore.java
<http://apache-ignite-users.70518.x6.nabble.com/file/t1355/CustomerCacheStore.java>
CustomerInfo.java
<http://apache-ignite-users.70518.x6.nabble.com/file/t1355/CustomerInfo.java>
SQLServerTest.java
<http://apache-ignite-users.70518.x6.nabble.com/file/t1355/SQLServerTest.java>
c# program as client
--------------------------------=
CustomerInfo.cs
<http://apache-ignite-users.70518.x6.nabble.com/file/t1355/CustomerInfo.cs>
Program.cs
<http://apache-ignite-users.70518.x6.nabble.com/file/t1355/Program.cs>
Both using same configuration file
--------------------------------------
default-config.xml
<http://apache-ignite-users.70518.x6.nabble.com/file/t1355/default-config.xml>
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: BinaryInvalidTypeException: Due to usage of Cross Platform Java
and .Net
Posted by Pavel Tupitsyn <pt...@apache.org>.
Hi,
1) Can you attach the code that causes this exception?
2) Which version do you use?
Thanks,
Pavel
On Thu, Oct 5, 2017 at 2:56 PM, JP <jo...@gmail.com> wrote:
> I have one java server node and c# client node.
>
> From the csharp client, I am trying to send data(Using POJO class) to the
> server node.
>
> In both server and client node started with same configuraions.
> <property name="binaryConfiguration">
> <bean class="org.apache.ignite.configuration.BinaryConfiguration">
> <property name="compactFooter" value="false"/>
> <property name="nameMapper">
> <bean
> class="org.apache.ignite.binary.BinaryBasicNameMapper">
> <property name="simpleName" value="true"/>
> </bean>
> </property>
> <property name="IdMapper">
> <bean class="org.apache.ignite.
> binary.BinaryBasicIdMapper">
> <property name="lowerCase" value="true"/>
> </bean>
> </property>
> </bean>
> </property>
>
>
> *But I am getting this exception:
> *
> Caused by: class org.apache.ignite.binary.BinaryInvalidTypeException:
> Unknown pair [platformId=0, typeId=-417099649]
> at
> org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(
> BinaryContext.java:695)
> at
> org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(
> BinaryReaderExImpl.java:1755)
> at
> org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(
> BinaryReaderExImpl.java:1714)
> at
> org.apache.ignite.internal.binary.BinaryObjectImpl.deserializeValue(
> BinaryObjectImpl.java:797)
> at
> org.apache.ignite.internal.binary.BinaryObjectImpl.value(
> BinaryObjectImpl.java:143)
> at
> org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinary(
> CacheObjectUtils.java:161)
> at
> org.apache.ignite.internal.processors.cache.CacheObjectUtils.
> unwrapBinaryIfNeeded(CacheObjectUtils.java:41)
> at
> org.apache.ignite.internal.processors.cache.CacheObjectContext.
> unwrapBinaryIfNeeded(CacheObjectContext.java:125)
> at
> org.apache.ignite.internal.processors.cache.GridCacheContext.
> unwrapBinaryIfNeeded(GridCacheContext.java:1734)
> at
> org.apache.ignite.internal.processors.cache.GridCacheContext.
> unwrapBinaryIfNeeded(GridCacheContext.java:1722)
> at
> org.apache.ignite.internal.processors.cache.store.
> GridCacheStoreManagerAdapter.put(GridCacheStoreManagerAdapter.java:557)
> at
> org.apache.ignite.internal.processors.cache.GridCacheMapEntry$
> AtomicCacheUpdateClosure.update(GridCacheMapEntry.java:4352)
> at
> org.apache.ignite.internal.processors.cache.GridCacheMapEntry$
> AtomicCacheUpdateClosure.call(GridCacheMapEntry.java:4172)
> at
> org.apache.ignite.internal.processors.cache.GridCacheMapEntry$
> AtomicCacheUpdateClosure.call(GridCacheMapEntry.java:3906)
> at
> org.apache.ignite.internal.processors.cache.persistence.
> tree.BPlusTree$Invoke.invokeClosure(BPlusTree.java:2988)
> at
> org.apache.ignite.internal.processors.cache.persistence.
> tree.BPlusTree$Invoke.access$6200(BPlusTree.java:2882)
> at
> org.apache.ignite.internal.processors.cache.persistence.
> tree.BPlusTree.invokeDown(BPlusTree.java:1713)
> at
> org.apache.ignite.internal.processors.cache.persistence.
> tree.BPlusTree.invoke(BPlusTree.java:1602)
> ... 22 more
> Caused by: java.lang.ClassNotFoundException: Unknown pair [platformId=0,
> typeId=-417099649]
> at
> org.apache.ignite.internal.MarshallerContextImpl.getClassName(
> MarshallerContextImpl.java:392)
> at
> org.apache.ignite.internal.MarshallerContextImpl.getClass(
> MarshallerContextImpl.java:342)
> at
> org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(
> BinaryContext.java:686)
> ... 39 more
>
> *
> I have added the same model class in c# and java.
> I understand that there is some conflict happening in serialization and
> deserialization.
>
> Any hints on configuring c# client node and server node(java)
> *
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>