Author |
Message
|
chandukumbham |
Posted: Fri Feb 08, 2013 1:28 pm Post subject: WMB 8 Global Cache |
|
|
Newbie
Joined: 17 Dec 2012 Posts: 3
|
I am trying to use global cache i am uisng one execution group and i set the broker cache policy to none and execution group properties i set getting the below error from compute node
com.ibm.broker.plugin.MbRecoverableException class:MbCacheConnection method:getMap source:BIPmsgs key:7165
in the activity log it is showing"
BIP11108E,8-Feb-2013 14:59:47.000 EST, Failed to complete action on map 'MyMap',6520,GlobalCache,SetGlobalCache,WMB,,Java Compute,MyMap,
i have a simple flow MQINPUT-->MQOUTPUT-->JAVACOMPUTENODE
in java compute i have the code "
MbGlobalMap globalMap = MbGlobalMap.getGlobalMap("MyMap");
globalMap.put("tt", "TESTING");
exception trace is showing
"MyMap, WMB, com.ibm.websphere.objectgrid.UndefinedMapException: Exception occurred initializing dynamic map MyMap" |
|
Back to top |
|
 |
lancelotlinc |
Posted: Fri Feb 08, 2013 1:31 pm Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
visasimbu |
Posted: Sat Feb 09, 2013 5:43 am Post subject: |
|
|
 Disciple
Joined: 06 Nov 2009 Posts: 171
|
Did you tried with the default map like below one.
Code: |
MbGlobalMap default = MbGlobalMap.getGlobalMap();
default.put("tt", "TESTING"); |
Last edited by visasimbu on Sat Feb 09, 2013 6:01 am; edited 1 time in total |
|
Back to top |
|
 |
visasimbu |
Posted: Sat Feb 09, 2013 5:50 am Post subject: Re: WMB 8 Global Cache |
|
|
 Disciple
Joined: 06 Nov 2009 Posts: 171
|
Did you restarted after doing the below step ?
chandukumbham wrote: |
i set the broker cache policy to none |
|
|
Back to top |
|
 |
chandukumbham |
Posted: Sat Feb 09, 2013 7:03 pm Post subject: I restarted my broker after setting the cache policy to none |
|
|
Newbie
Joined: 17 Dec 2012 Posts: 3
|
I restarted the broker after setting it to none and i followed the sequence of steps in the tutoiral .. still getting the same error.
Here is my sequence of execution ::
1) stopped the broker and executed the below command :
mqsichangebroker MB8BROKER -b none
2) started the broker
** mqsichangeproperties MB8BROKER -b cachemanager -o CacheManager -n policy,portRange,listenerHost -v none,2800-2819,localhost
**mqsichangeproperties MB8BROKER -e MB8EG -o ComIbmCacheManager -n enableCatalogService -v true
**mqsichangeproperties MB8BROKER -e MB8EG -o ComIbmCacheManager -n enableContainerService -v true
In MQExplorer resourcemanager-->Global Cahce Activity log
i am able to see the container server and catalog servers are up
and Global cache connected to cache name WMB.
In java compute node i am getting exception ::
Failed to get map from grid
com.ibm.websphere.objectgrid.UndefinedMapException: Exception occurred initializing dynamic map MyMap |
|
Back to top |
|
 |
lancelotlinc |
Posted: Sun Feb 10, 2013 1:18 pm Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
chandukumbham |
Posted: Mon Feb 11, 2013 7:29 am Post subject: GLOBAL CACHE |
|
|
Newbie
Joined: 17 Dec 2012 Posts: 3
|
Thank you all for helping me in resolving the issue
I deleted all the quemanagers and brokers in my broker and created again it solved my problem |
|
Back to top |
|
 |
touchofcrypticthunder |
Posted: Fri Jun 21, 2013 7:44 pm Post subject: caching java object as value in Message Broker GlobalCache |
|
|
Apprentice
Joined: 08 Jul 2009 Posts: 30
|
I am facing an issue when caching Java object as value in Message Broker GlobalCache. Key is of type String. I am using cache to store static data called AllergyCode conversion. I am getting following error - "ClassNotFoundException: com.cvs.cache.objects.allergyCode.AllergyCodeDataObject"
Below is the definition of Java object.
public class AllergyCodeDataObject implements Serializable{
/**
*
*/
private static final long serialVersionUID = 5257314174658496636L;
public AllergyCode[] allergyCodeObj;
}
public class AllergyCode implements Serializable{
private static final long serialVersionUID = 1304024649901120514L;
public String mappedAllergyCode;
public String mappedAllergyClass;
}
I have exported this object as jar file and placed the jar file in Broker "shared-classes" directory. Still I am getting the same error. Does GlobalCache supports Java object (other than native and String) as value? If yes, what is the configuration I am missing? Do I need to place the jar file in any other directory? |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Jun 24, 2013 3:08 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Please use code tags when posting code. Its easier to read that way.
Global cache has no preference with regard to the data stored in it. Your class not found error is not because global cache is referring to it.
You have not posted the code and identified the line in the code where the CNF exception occurs.
Shared-classes is the correct directory.
Did you build and deploy the cache sample? What were the results of exercising the sample code?
You should have created a new thread to post in the forum. Your problem is not the same as the OP. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
touchofcrypticthunder |
Posted: Tue Jun 25, 2013 5:29 am Post subject: |
|
|
Apprentice
Joined: 08 Jul 2009 Posts: 30
|
Code: |
public class AllergyCodeCacheLoad extends MbJavaComputeNode {
public void evaluate(MbMessageAssembly assembly) throws MbException {
MbOutputTerminal out = getOutputTerminal("out");
MbOutputTerminal alt = getOutputTerminal("alternate");
MbGlobalMap allergyCodeMap = MbGlobalMap.getGlobalMap("AllergyCodeMap");
MbElement inMsg = assembly.getMessage().getRootElement().getLastChild();
List<MbElement> codeList = (List<MbElement>) inMsg.evaluateXPath("AllergyCode/Code");
try {
for(Iterator<MbElement> codeListIter = codeList.iterator(); codeListIter.hasNext();) {
MbElement code = codeListIter.next();
String srcCode = code.getFirstElementByPath("SourceAllergyCode").getValueAsString();
String srcDesc = code.getFirstElementByPath("SourceAllergyDesc").getValueAsString();
String srcClass = code.getFirstElementByPath("SourceAllergyClass").getValueAsString();
String mapCode = code.getFirstElementByPath("MappedAllergyCode").getValueAsString();
String mapDesc = code.getFirstElementByPath("MappedAllergyDesc").getValueAsString();
String mapClass = code.getFirstElementByPath("MappedAllergyClass").getValueAsString();
if(srcCode.length() > 0 && srcClass.length() > 0) {
String key = srcCode.concat("@#").concat(srcClass);
String val = mapCode.concat("@#").concat(mapClass);
AllergyCodeDataObject allergyCodeArray = new AllergyCodeDataObject();
AllergyCode cacheObj = new AllergyCode();
cacheObj.mappedAllergyCode = (mapCode != "" && mapCode != null) ? mapCode : "";
cacheObj.mappedAllergyClass = (mapClass != "" && mapClass != null) ? mapClass : "";
if(allergyCodeMap.containsKey(key)) {
allergyCodeArray = (AllergyCodeDataObject) allergyCodeMap.get(key);
allergyCodeArray.allergyCodeObj[allergyCodeArray.allergyCodeObj.length] = cacheObj;
[color=blue][b]allergyCodeMap.update(key, allergyCodeArray);[/b][/color]
} else {
allergyCodeArray.allergyCodeObj = new AllergyCode[1];
allergyCodeArray.allergyCodeObj[0] = cacheObj;
[color=blue][b]allergyCodeMap.put(key, allergyCodeArray);[/b][/color]
}
}
}
} catch (MbException e) {
throw e;
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new MbUserException(this, "evaluate()", "", "", e.toString(),
null);
}
out.propagate(assembly);
}
} |
Here is the java code to cache data in GlobalCache. I have highlighted the code which throws CNF exception in Blue.
Here is the definition of java object.
Code: |
package com.cvs.cache.objects.allergyCode;
import java.io.Serializable;
public class AllergyCode implements Serializable{
private static final long serialVersionUID = 1304024649901120514L;
public String mappedAllergyCode;
public String mappedAllergyClass;
} |
Code: |
package com.cvs.cache.objects.allergyCode;
import java.io.Serializable;
public class AllergyCodeDataObject implements Serializable{
/**
*
*/
private static final long serialVersionUID = 5257314174658496636L;
public AllergyCode[] allergyCodeObj;
} |
I have not tried cache sample, I will give it a try.
I have worked on standalone WXS server V7.1 before. We need to add java object jar file to classpath (to put java objects as value) when starting the container as shown in the below shell script.
Code: |
/opt/IBM/WebSphere/eXtremeScale/ObjectGrid/bin/startOgServer.sh c0 -haManagerPort 6600 -catalogserviceendpoints tesoawsxs05:2809,tesoawsxs06:2809,tesoawsxs07:2809,tesoawsxs08:2809 -objectgridFile /home/wasadmin/files/objectgrid.xml -deploymentPolicyFile /home/wasadmin/files/deployment.xml -listenerPort 2801 -jvmArgs -classpath [color=blue][b]/home/wasadmin/files/dataobjects.jar[/b][/color]:/home/wasadmin/files/tbc-cache.jar:/home/wasadmin/files/xmlAgent.jar:/home/wasadmin/files/wxsutils-2.5.0-SNAPSHOT.jar -Xcompressedrefs -Xshareclasses:name=WXS_%g,groupAccess,nonFatal -Xmx2048M -javaagent:/opt/IBM/WebSphere/eXtremeScale/ObjectGrid/lib/wxssizeagent.jar -verbose:gc -Xverbosegclog:logs/c0/verbose_gc.log,5,10000 |
But I don't see this option to set when using GlobalCache. |
|
Back to top |
|
 |
iShakir |
Posted: Wed Jun 26, 2013 12:40 am Post subject: |
|
|
Apprentice
Joined: 07 Mar 2013 Posts: 47
|
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Jun 26, 2013 2:57 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
iShakir wrote: |
http://publib.boulder.ibm.com/infocenter/wmbhelp/v8r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fbc23770_.htm
Referencing bullet point number seven:
"For keys and values, Java primitive types and strings are supported. For the embedded grid only, keys can also be arrays of primitives or strings. "
It would seem sensible to implement a basic toArray and fromArray when interacting with the cache. |
The Global Cache is simply a network-enabled HashMap. Any item you can store in a HashMap, you can store in Global Cache. This statement should clear up any mystery about how it operates.
How would you store any Java class in a HashMap ? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
iShakir |
Posted: Wed Jun 26, 2013 4:34 am Post subject: |
|
|
Apprentice
Joined: 07 Mar 2013 Posts: 47
|
lancelotlinc wrote: |
iShakir wrote: |
http://publib.boulder.ibm.com/infocenter/wmbhelp/v8r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fbc23770_.htm
Referencing bullet point number seven:
"For keys and values, Java primitive types and strings are supported. For the embedded grid only, keys can also be arrays of primitives or strings. "
It would seem sensible to implement a basic toArray and fromArray when interacting with the cache. |
The Global Cache is simply a network-enabled HashMap. Any item you can store in a HashMap, you can store in Global Cache. This statement should clear up any mystery about how it operates.
How would you store any Java class in a HashMap ? |
I wouldn't want to assume any level of function that is not documented. If IBM don't tell us that we specifically can do this, then why should we assume that we could?
Have you got this working? If so, could you inform the OP of how you managed it. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Jun 26, 2013 4:37 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
iShakir wrote: |
lancelotlinc wrote: |
iShakir wrote: |
http://publib.boulder.ibm.com/infocenter/wmbhelp/v8r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fbc23770_.htm
Referencing bullet point number seven:
"For keys and values, Java primitive types and strings are supported. For the embedded grid only, keys can also be arrays of primitives or strings. "
It would seem sensible to implement a basic toArray and fromArray when interacting with the cache. |
The Global Cache is simply a network-enabled HashMap. Any item you can store in a HashMap, you can store in Global Cache. This statement should clear up any mystery about how it operates.
How would you store any Java class in a HashMap ? |
I wouldn't want to assume any level of function that is not documented. If IBM don't tell us that we specifically can do this, then why should we assume that we could?
Have you got this working? If so, could you inform the OP of how you managed it. |
OMG.
http://publib.boulder.ibm.com/infocenter/wmbhelp/v8r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fbn23730_.htm
I use Global Cache in all my flows. Every single message that comes into flows that I write hits the Global Cache.
You seem so helpless.
Read.
Attend the training.
https://www-304.ibm.com/jct03001c/services/learning/us/pdfs/roadmaps/wmb_v8_dev.pdf _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Jun 26, 2013 4:46 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
iShakir wrote: |
arrays of primitives |
For those who seem helpless or are from Rio Linda California, a byte array is an example what is being spoken of here in the documentation. A byte is about as primitive as you can get. Therefore, any class that can be serialized into an array of bytes can be stored in the Global Cache. This includes the payload of an MQ message regardless of CCSID or Code Page. Because MQ messages, especially the payloads of same, are composed of byte + byte + byte + byte + etc. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
|