當前位置:首頁 » 編程語言 » webspherejava

webspherejava

發布時間: 2022-09-24 13:09:13

『壹』 如何在java中使用WebSphere MQ

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=0;j< 5;j++){
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);
}
}
}

『貳』 如何分析websphere中間件生成的javacore文件

在was啟動前設置下面環境變數(可以加在啟動腳本中)
export IBM_HEAPDUMP=true
export IBM_HEAP_DUMP=true
export IBM_HEAPDUMP_OUTOFMEMORY=true
export IBM_HEAPDUMPDIR=<directory path>
2.2please use set command to make sure you do not have DISABLE_JAVADUMP parameter
then start this cluster member.
用set命令檢查參數設置,確保沒有設置DISABLE_JAVADUMP,然後啟動server
2.3when you find free memory < 50% when no heavy access, please run kill -3 <pid>
執行kill -3 <pid>命令可以生成javacore文件和heapmp文件(pid為was java進程的id號,可以用ps -ef|grep java 查到),可以多執行幾次,按照下面操作進行
ps -ef > psef1.txt
ps aux > psaux1.txt
vmstat 5 10 > vmstat.txt
kill -3 <app server id>
wait for 2 mins
kill -3 <app server id>
wait for 2 mins
kill -3 <app server id>
netstat -an> netstat2.txt
ps -ef > psef2.txt
ps aux > psaux2.txt
將上面產生的 txt 文件和/usr/WebSphere/AppServer/javacore*文件和heapmp文件拷貝到本地,然後刪除這些文件,因為這些文件會佔用較大的文件系統空間。

『叄』 websphere編譯jsp生成的java類放在哪個目錄

放在WebRoot\WEB-INF\classes\包名 文件夾下,建議樓主用那個MyEclipse寫jsp,它會自己編譯好了放在相應的文件夾下,不需要自己手動編譯。 你那裡再在classes下加個包名的文件夾,然後放進去吧

『肆』 [Websphere]如何產生javacore文件和heapmp文件

在was啟動前設置下面環境變數(可以加在啟動腳本中) export IBM_HEAPDUMP=true export IBM_HEAP_DUMP=true export IBM_HEAPDUMP_OUTOFMEMORY=true export IBM_HEAPDUMPDIR=<directory path> 2.2please use set command to make sure you do not have DISABLE_JAVADUMP parameter then start this cluster member. 用set命令檢查參數設置,確保沒有設置DISABLE_JAVADUMP,然後啟動server 2.3when you find free memory < 50% when no heavy access, please run kill -3 <pid> 執行kill -3 <pid>命令可以生成javacore文件和heapmp文件(pid為was java進程的id號,可以用ps -ef|grep java 查到),可以多執行幾次,按照下面操作進行 ps -ef > psef1.txt ps aux > psaux1.txt vmstat 5 10 > vmstat.txt kill -3 <app server id> wait for 2 mins kill -3 <app server id> wait for 2 mins kill -3 <app server id> netstat -an> netstat2.txt ps -ef > psef2.txt ps aux > psaux2.txt 將上面產生的 txt 文件和/usr/WebSphere/AppServer/javacore*文件和heapmp文件拷貝到本地,然後刪除這些文件,因為這些文件會佔用較大的文件系統空間。

『伍』 在WebSphere中怎麼在Java Library path中添加目錄

當我們想為自己的應用程序添加庫時,可以考慮從 WebSphere Admin Console 進行創建一個 Shared Library 並添加 jar 列表進去,以後在其它的 EAR (J2EE Application) 中選用這個 Shared Library (共享庫)。

如果你的庫是 JDBC 驅動程序,那可以在 JDBC Provider 中指定這些 jar 路徑,不需要用 Shared Library 配置。

還有一種情況,如果你這些 jar 本身也是你們公司的產品並且是與當前正在部署的 ear 應用程序一起部署的,那麼你可以用 WinRAR 這樣的工具打開這個 ear 並把你的其它 jar 添加到這個 ear 文件中。然後重新部署這個 ear 文件,這個步驟要求你的 ejb-jar 中的 META-INF/MANIFEST.MF 中有 Class-Path 後面已經添加了這幾個 jar 文件名字(短名,不需要目錄前綴)。

『陸』 如何用java 監控websphere是否正常運行

告訴你一個簡單的辦法,你先看看你websphere的埠是多少,然後寫幾行代碼,也去償試監聽這個埠,因為這個埠已經被佔用了,會報異常,這時候說明websphere是正常的,只要你的這個小程序埠監聽成功了,你就可以理解為websphere掛了

『柒』 websphere打開java文件時候,中文亂碼

原因是你的websphere默認打開的編碼格式,和java文件的不一樣
你配置一下websphere,改為utf-8,不行的話再改為其它的

熱點內容
android通訊錄源碼 發布:2024-04-25 06:04:10 瀏覽:159
白平衡演算法 發布:2024-04-25 06:04:10 瀏覽:388
手機版如何下載gmc伺服器 發布:2024-04-25 05:56:30 瀏覽:170
哈夫曼c語言編譯 發布:2024-04-25 05:43:20 瀏覽:663
贖回清演算法 發布:2024-04-25 05:33:00 瀏覽:677
mysql安裝圖解linux 發布:2024-04-25 05:18:59 瀏覽:605
有哪些配置中心的框架 發布:2024-04-25 05:11:37 瀏覽:829
進程的調度演算法代碼 發布:2024-04-25 04:25:20 瀏覽:588
maven編譯scala 發布:2024-04-25 04:25:11 瀏覽:110
手機存儲空間里的其他 發布:2024-04-25 04:10:42 瀏覽:27