i am implementing caching solution in ibm integration bus
using java
inside the message flows and the logic is implemented like the following :
I built the base class
: Deparment
:
public class Department implements Serializable { // the members with setters and getters }
I built a Wrapper class
that defines an ArrayList<Department>
public class CachedDepartment implements Serializable { private ArrayList departments; // with setters and getters .... }
I created class that implements the cache
solution to set
new value
and to get
the value
to set
:
MbGlobalMap globalMap = MbGlobalMap.getGlobalMap(globalMapName);
globalMap.put(key, value);
to get
:
CachedDepartment cacheddept = null;
MbGlobalMap globalMap = MbGlobalMap.getGlobalMap(globalMapName);
cacheddept = (CachedDepartment) globalMap.get(key);
i created jar
file and put it on classLoader
directory and its run when setting cache
, the problem is when running the get functionality.
java.lang.ClassCastException: cache.entities.CachedDepartment incompatible with cache.entities.CachedDepartment
I read this link ClassCastException when casting to the same class but still i don't know how to solve it in IBM Integration bus
that run on JDK 1.7
any ideas ???
I think the problem is that the project containing the CachedDepartment and Department classes is still in the Project References of your IIB Java project, what makes the Toolkit deploy that to the integration server, but that project should only be deployed to the shared-classes directory.
So remove the project containing the cached entities from the Project references and the Java Build Path of your IIB Java project, and add it as an external JAR to the Libraries under Java Build Path.
More details here: