On analysing further it seems the field id indicated as “marker” below is 
actually a member of one of the class instances used inside the service 
classes. Is there anything restriction as such about using custom classes in a 
service implementation ?

Sent from my iPhone

> On 4 Apr 2018, at 15:06, Neeraj Vaidya <[email protected]> wrote:
> 
> Hi, 
> 
> I am trying to deploy a service during ignite node startup. But I noticed 2 
> peculiar behaviours. I am loading the class using 
> Note that I am using a single-node cluster. Thus, the service class is 
> present on the classpath of the node where I am trying to deploy this 
> service. 
> 
> Observation-1
> ---------------------
> When the service class is part of the same (scala) package as the class which 
> contains the main method and also starts the ignite cluster, the service gets 
> deployed successfully.
> 
> Observation-2
> -------------------
> However, when the service class is NOT part of the same (scala) package as 
> the class which contains the main method and also starts the ignite cluster, 
> the service DOES NOT deployed successfully. 
> 
> I am providing the user the ability to configure the Service class via a 
> configuration file i.e. the configuration file will contain an entry which 
> will contain a key :
> serviceClass = "org.hypercomp.axlrate.charging.loader.AxlRateChargingService"
> serviceName = "AXLRATE_CHARGING_MODULE"
> ...
> ...
> 
> Then in the scala code, I am instantiating the service class above using 
> Class.forName(serviceClass).newInstance.asInstanceOf[....] Not sure if this 
> is a great idea, but it works when the class is part of the same package as 
> the class containing the main(args: Array[String]) method.
> 
> The stack trace I see is as follows [Note all classes prefixed with 
> org.hypercomp are my custom classes].  :
> 
> [14:12:54,906][SEVERE][main][GridServiceProcessor] Failed to marshal service 
> with configured marshaller [name=AXLRATE_CHARGING_MODULE, 
> srvc=org.hypercomp.axlrate.charging.loader.AxlRateChargingService@b91d8c4, 
> marsh=o.a.i.i.binary.BinaryMarshaller@6ea1bcdc]
> class org.apache.ignite.IgniteCheckedException: Duplicate field ID: marker
>        at 
> org.apache.ignite.internal.util.IgniteUtils.marshal(IgniteUtils.java:9883)
>        at 
> org.apache.ignite.internal.processors.service.GridServiceProcessor.prepareServiceConfigurations(GridServiceProcessor.java:534)
>        at 
> org.apache.ignite.internal.processors.service.GridServiceProcessor.deployAll(GridServiceProcessor.java:568)
>        at 
> org.apache.ignite.internal.IgniteServicesImpl.deployAll(IgniteServicesImpl.java:238)
>        at 
> org.apache.ignite.internal.IgniteServicesImpl.deploy(IgniteServicesImpl.java:221)
>        at 
> org.hypercomp.axlrate.utils.imdg.AxlRateImdgManager$AxlRateIgniteImdgManager$.$anonfun$startNode$1(AxlRateImdgManager.scala:80)
>        at 
> org.hypercomp.axlrate.utils.imdg.AxlRateImdgManager$AxlRateIgniteImdgManager$.$anonfun$startNode$1$adapted(AxlRateImdgManager.scala:80)
>        at scala.collection.immutable.List.foreach(List.scala:389)
>        at 
> org.hypercomp.axlrate.utils.imdg.AxlRateImdgManager$AxlRateIgniteImdgManager$.startNode(AxlRateImdgManager.scala:80)
>        at 
> org.hypercomp.axlrate.utils.imdg.AxlRateImdgManager$.startNode(AxlRateImdgManager.scala:115)
>        at 
> org.hypercomp.axlrate.core.loader.AxlRateBoot$.main(AxlRateBoot.scala:92)
>        at 
> org.hypercomp.axlrate.core.loader.AxlRateBoot.main(AxlRateBoot.scala)
> Caused by: class org.apache.ignite.binary.BinaryObjectException: Duplicate 
> field ID: marker
>        at 
> org.apache.ignite.internal.binary.BinaryClassDescriptor.<init>(BinaryClassDescriptor.java:312)
>        at 
> org.apache.ignite.internal.binary.BinaryContext.registerUserClassDescriptor(BinaryContext.java:780)
>        at 
> org.apache.ignite.internal.binary.BinaryContext.registerClassDescriptor(BinaryContext.java:752)
>        at 
> org.apache.ignite.internal.binary.BinaryContext.descriptorForClass(BinaryContext.java:623)
>        at 
> org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal0(BinaryWriterExImpl.java:164)
>        at 
> org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal(BinaryWriterExImpl.java:147)
>        at 
> org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal(BinaryWriterExImpl.java:134)
>        at 
> org.apache.ignite.internal.binary.BinaryWriterExImpl.doWriteObject(BinaryWriterExImpl.java:496)
>        at 
> org.apache.ignite.internal.binary.BinaryWriterExImpl.writeObjectField(BinaryWriterExImpl.java:1160)
>        at 
> org.apache.ignite.internal.binary.BinaryFieldAccessor$DefaultFinalClassAccessor.write(BinaryFieldAccessor.java:663)
>        at 
> org.apache.ignite.internal.binary.BinaryClassDescriptor.write(BinaryClassDescriptor.java:793)

Reply via email to