|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
  |
|
Possible to change JVM for WMB? |
View previous topic :: View next topic |
Author |
Message
|
4integration |
Posted: Wed May 06, 2009 8:44 am Post subject: Possible to change JVM for WMB? |
|
|
 Disciple
Joined: 04 Sep 2006 Posts: 197 Location: Gothenburg, Sweden
|
Due to some suspected problems with IBM's JVM, bundled with WMB 6.1.0.2 I would like to test with Sun's 1.5 JVM to verify.
Is it possible to change to another JVM?
If yes, how? (pointer to documentation etc) _________________ Best regards
4 Integration |
|
Back to top |
|
 |
Vitor |
Posted: Wed May 06, 2009 9:39 am Post subject: Re: Possible to change JVM for WMB? |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
4integration wrote: |
Is it possible to change to another JVM?
|
AFAIK no _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Gaya3 |
Posted: Wed May 06, 2009 10:15 pm Post subject: Re: Possible to change JVM for WMB? |
|
|
 Jedi
Joined: 12 Sep 2006 Posts: 2493 Location: Boston, US
|
4integration wrote: |
Due to some suspected problems with IBM's JVM, bundled with WMB 6.1.0.2 I would like to test with Sun's 1.5 JVM to verify.
|
would you mind to elaborate this suspected problems what you are facing with MB JVM _________________ Regards
Gayathri
-----------------------------------------------
Do Something Before you Die |
|
Back to top |
|
 |
ovasquez |
Posted: Wed May 06, 2009 10:28 pm Post subject: |
|
|
 Centurion
Joined: 09 Dec 2005 Posts: 141 Location: Lima, Peru
|
Why do you need change JVM?....  _________________ Oscar Vásquez Flores |
|
Back to top |
|
 |
4integration |
Posted: Wed May 06, 2009 10:46 pm Post subject: |
|
|
 Disciple
Joined: 04 Sep 2006 Posts: 197 Location: Gothenburg, Sweden
|
Sure, in one of our integrations we have a mainframe system sending messages that are encoded Cp278 but one field in the message have UTF-8 encoding (message MQMD.CodedCharSetId=278).
This is a special case and the mainframe side can not switch to UTF-8. Therefore the approach is to consume the message in WMB as Cp278 and then encode the specific field to UTF-8 (with code similar to below):
Code: |
String partNameout = null;
Charset charSet1143 = Charset.forName("1143");
CharBuffer cb = CharBuffer.wrap(inBEARTEXT_UTF8.toCharArray());
partNameout = new String(charSet1143.encode(cb).array()); |
The case is also descibed by one of our consultants at: http://www.mqseries.net/phpBB2/viewtopic.php?t=48988
It works fine but when it comes to percentage characters it fails.
Therefore I made some simulation tests in plain Java/Eclipse and trying different approaches. The conclusion is that IBM's JVM has a different behaviour (i.e. not working). Sun's JVM are working if we encode with 1143 (as shown in the code below). 1143 is an extension of Cp278.
So the simulation class:
Code: |
package com.company.it.test;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
public class Test2 {
/**
* @param args
*/
public static void main(String[] args) {
try {
System.out.println("JVM: " + System.getProperty("java.home"));
System.out.println("JVM: " + System.getProperty("java.vm.vendor"));
System.out.println("JVM: " + System.getProperty("java.vm.version"));
System.out.println("JVM: " + System.getProperty("java.version"));
// Simulate the Cp278 String
String expected = new String("dekal,oljebland.6%");
String expectedCp278 = new String(expected.getBytes("UTF-8"), "Cp278");
System.out.println("-----------------");
System.out.println(expectedCp278);
// Encode the String
Charset charSet1143 = Charset.forName("1143");
CharBuffer cb = CharBuffer.wrap(expectedCp278.toCharArray());
String unicodeStr = new String(charSet1143.encode(cb).array());
System.out.println("-----------------");
System.out.println(new String(unicodeStr));
System.out.println("-----------------");
System.out.println(stringToHex(unicodeStr));
System.out.println("-----------------");
} catch (Exception e) {
System.err.println("EXCEPTION");
e.printStackTrace();
}
}
/**
* encodes a unicode string to a string of 4-digit hex numbers
* <br />
* Note: this method is slower than stringToHex(String,StringBuffer)
* @param java normal java string
* @return string of 4-digit hex numbers
*/
public static final String stringToHex ( String java ) {
if ( java == null ) return "";
int length = java.length();
StringBuffer result = new StringBuffer( length*4);
stringToHex( java, result);
return result.toString();
}
/**
* encodes a unicode string to a string of 4-digit hex numbers
* @param java normal java string
* @param out string of 4-digit hex numbers
* @todo to improve performance, implement a table-lookup instead of if/then cases
*/
public static final void stringToHex ( String java, StringBuffer out ) {
if ( java == null ) return;
int length = java.length();
for ( int pos=0; pos < length; pos ++) {
int this_char = (int) java.charAt( pos);
for ( int digit = 0; digit < 4; digit ++ ) {
int this_digit = this_char & 0xf000;
this_char = this_char << 4;
this_digit = (this_digit >> 12);
if ( this_digit >= 10 )
out.append ( (char)( this_digit+87));
else
out.append ( (char)( this_digit+48));
}
}
}
}
|
Then I tested with Sun's 1.5 and 1.6 JVM and IBM's 1.5 (bundled with WMBToolkit 6.1) with the following result/output:
Sun 1.5 JVM working (encodes the % character as 0x25)
Code: |
JVM: C:\v008789\Apps\Java\jdk1.5.0_17\jre
JVM: Sun Microsystems Inc.
JVM: 1.5.0_17-b04
JVM: 1.5.0_17
-----------------
ÀÁ,/%??%öÁÂ%/>À?
-----------------
dekal,oljebland.6%
-----------------
00640065006b0061006c002c006f006c006a00650062006c0061006e0064002e00360025
----------------- |
Sun 1.6 JVM working (encodes the % character as 0x25)
Code: |
JVM: C:\v008789\Apps\Java\jdk1.6.0_12\jre
JVM: Sun Microsystems Inc.
JVM: 11.2-b01
JVM: 1.6.0_12
-----------------
ÀÁ,/%??%öÁÂ%/>À?
-----------------
dekal,oljebland.6%
-----------------
00640065006b0061006c002c006f006c006a00650062006c0061006e0064002e00360025
-----------------
|
IBM 1.5 JVM NOT working (encodes the % character as 0x15)
Code: |
JVM: C:\Program Files\IBM\WMBT610\jdk\jre
JVM: IBM Corporation
JVM: 2.3
JVM: 1.5.0
-----------------
ÀÁ,/%??%öÁÂ%/>À?
-----------------
dekal,oljebland.6
-----------------
00640065006b0061006c002c006f006c006a00650062006c0061006e0064002e00360015
-----------------
|
So it would be good to test the scenario in WMB. However it seems not be possible and therefore I think it will be a PMR. _________________ Best regards
4 Integration |
|
Back to top |
|
 |
|
|
  |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|