如何让websphere JVM 参数设置

如何让websphere JVM 参数设置,第1张

应用程序/server1/进程定义/java虚拟机/通用jvm参数设置/ -Duser.language=zh -Duser.region=CN -Ddefault.client.encoding=GBK -Dclient.encoding.override=GBK -Dfile.encoding=GBK另外,遇到websphere打印控制台相差8小时问题,是因为websphere使用jvm参数问题,登录控制台 - 服务器 - 应用服务器(server1) - Java 和进程管理 -进程定义 -java虚拟机 -定制属性 新建: user.timezone = GMT+08 保存后重启即可。

websphere mq : 用于传输信息 具有跨平台的功能。

1 安装websphere mq 并启动

2 websphere mq 建立 queue Manager (如:MQSI_SAMPLE_QM)

3 建立queue 类型选择 Local类型 的 (如lq )

3 建立channels 类型选择Server Connection (如BridgeChannel)

java 代码如下:

package test.mq

import com.ibm.mq.*

/*

* 成功的访问mq 的java 类

*/

public class FirstMqTest {

//public static void main(String[] args[]){

//FirstMqTest first = new FirstMqTest()

//first.test()

//}

public static void main(String args[]){

FirstMqTest first = new FirstMqTest()

first.test()

}

public void test(){

String qManager = "MQSI_SAMPLE_QM"//QueueManager name

String qName = "lq"//Queue Name

try {

//configure connection parameters

MQEnvironment.hostname="172.16.17.123"//MQ Server name or IP

//MQEnvironment.port=1414//listenr port

MQEnvironment.channel="BridgeChannel"//Server-Connection Channel

MQEnvironment.CCSID =1381

// Create a connection to the QueueManager

System.out.println("Connecting to queue manager: "+qManager)

MQQueueManager qMgr = new MQQueueManager(qManager)

// Set up the options on the queue we wish to open

int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT

// Now specify the queue that we wish to open and the open options

System.out.println("Accessing queue: "+qName)

MQQueue queue = qMgr.accessQueue(qName, openOptions)

// Define a simple WebSphere MQ Message ...

MQMessage msg = new MQMessage()

// ... and write some text in UTF8 format

msg.writeUTF("Hello, World!")

// Specify the default put message options

MQPutMessageOptions pmo = new MQPutMessageOptions()

// Put the message to the queue

System.out.println("Sending a message...")

/*

* 在此测试一下 mq 的传输次列

*

*/

for(int j=0j<5j++){

String str ="test11111111111"

str = str+j

msg.writeUTF(str)

queue.put(msg, pmo)

}

queue.put(msg, pmo)

// Now get the message back again. First define a WebSphere MQ message

// to receive the data

MQMessage rcvMessage = new MQMessage()

// Specify default get message options

MQGetMessageOptions gmo = new MQGetMessageOptions()

// Get the message off the queue.

System.out.println("...and getting the message back again")

queue.get(rcvMessage, gmo)

// And display the message text...

String msgText = rcvMessage.readUTF()

System.out.println("The message is: " + msgText)

// Close the queue

System.out.println("Closing the queue")

queue.close()

// Disconnect from the QueueManager

System.out.println("Disconnecting from the Queue Manager")

qMgr.disconnect()

System.out.println("Done!")

}

catch (MQException ex) {

System.out.println("A WebSphere MQ Error occured : Completion Code "

+ ex.completionCode + " Reason Code " + ex.reasonCode)

}

catch (java.io.IOException ex) {

System.out.println("An IOException occured whilst writing to the message buffer: "

+ ex)

}

}

}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/7828465.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-10
下一篇 2023-04-10

发表评论

登录后才能评论

评论列表(0条)

保存