weblogic JMX 中遇到的问题

通过JMX操作来监控weblogic jdbcpool实例如下
package weblogic;
import java.util.*;
import javax.management.*;
import weblogic.management.*;
import weblogic.management.configuration.*;
import weblogic.management.runtime.ServerRuntimeMBean;
import weblogic.management.runtime.JDBCConnectionPoolRuntimeMBean;

public class TestJMX {

/**取得当前weblogic server 的jdbcconnectionPool
* @param args
*/

public MBeanHome localHome;
public MBeanHome adminHome;
public Stack stack;
public static String SERVER_NAME="myserver";
public Stack find()
{
stack=new Stack();
String url="t3://130.30.15.44:8080";
//其中t3 是protocol
localHome = (MBeanHome)Helper.getMBeanHome("weblogic","weblogic",url,SERVER_NAME);
adminHome = (MBeanHome)Helper.getAdminMBeanHome("weblogic","weblogic",url);
Set set1 =adminHome.getMBeansByType("JDBCTxDataSource");
Set set2 =adminHome.getMBeansByType("JDBCDataSource");
Iterator it1 = set1.iterator();
while(it1.hasNext()){
JDBCTxDataSourceMBean dm1 = (JDBCTxDataSourceMBean)it1.next();
System.out.println("%%%%%%%%%%%"+dm1.getJNDIName());
stack.add(dm1.getJNDIName());
}

Iterator it2 = set2.iterator();
while(it2.hasNext()){
JDBCDataSourceMBean dm2 = (JDBCDataSourceMBean)it2.next();
System.out.println("%%%%%%%%%%%"+dm2.getJNDIName());
stack.add(dm2.getJNDIName());
}

return stack;

}

public static void main(String[] args ) {
TestJMX test=new TestJMX();
test.find();
}
}
我访问的是weblogic 8 我的jdk 是1.6
[color=red]附:请导入weblogic.jar[/color]编译出错如下
<2008-5-8 上午10时28分11秒 CST> <Error> <RJVM> <BEA-000503> <Incoming message header or abbreviation processing failed
java.io.InvalidClassException: javax.management.ObjectName; local class incompatible: stream classdesc serialVersionUID = -5467795090068647408, local class serialVersionUID = 1081892073854801359
java.io.InvalidClassException: javax.management.ObjectName; local class incompatible: stream classdesc serialVersionUID = -5467795090068647408, local class serialVersionUID = 1081892073854801359
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1316)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at weblogic.rjvm.ClassTableEntry.readExternal(ClassTableEntry.java:33)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at weblogic.rjvm.InboundMsgAbbrev.readObject(InboundMsgAbbrev.java:65)
at weblogic.rjvm.InboundMsgAbbrev.read(InboundMsgAbbrev.java:37)
at weblogic.rjvm.MsgAbbrevJVMConnection.readMsgAbbrevs(MsgAbbrevJVMConnection.java:212)
at weblogic.rjvm.MsgAbbrevInputStream.readMessageContext(MsgAbbrevInputStream.java:237)
at weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:744)
at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java:782)
at weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:705)
at weblogic.socket.SocketMuxer.readReadySocket(SocketMuxer.java:641)
at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:282)
at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:32)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
>
Exception in thread "main" weblogic.rjvm.PeerGoneException: ; nested exception is:
java.rmi.UnmarshalException: Incoming message header or abbreviation processing failed ; nested exception is:
java.io.InvalidClassException: javax.management.ObjectName; local class incompatible: stream classdesc serialVersionUID = -5467795090068647408, local class serialVersionUID = 1081892073854801359
at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:164)
at weblogic.management.internal.AdminMBeanHomeImpl_815_WLStub.getMBeansByType(Unknown Source)
at weblogic.TestJMX.find(TestJMX.java:26)
at weblogic.TestJMX.main(TestJMX.java:48)
Caused by: java.rmi.UnmarshalException: Incoming message header or abbreviation processing failed ; nested exception is:
java.io.InvalidClassException: javax.management.ObjectName; local class incompatible: stream classdesc serialVersionUID = -5467795090068647408, local class serialVersionUID = 1081892073854801359
at weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:765)
at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java:782)
at weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:705)
at weblogic.socket.SocketMuxer.readReadySocket(SocketMuxer.java:641)
at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:282)
at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:32)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
Caused by: java.io.InvalidClassException: javax.management.ObjectName; local class incompatible: stream classdesc serialVersionUID = -5467795090068647408, local class serialVersionUID = 1081892073854801359
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1316)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at weblogic.rjvm.ClassTableEntry.readExternal(ClassTableEntry.java:33)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at weblogic.rjvm.InboundMsgAbbrev.readObject(InboundMsgAbbrev.java:65)
at weblogic.rjvm.InboundMsgAbbrev.read(InboundMsgAbbrev.java:37)
at weblogic.rjvm.MsgAbbrevJVMConnection.readMsgAbbrevs(MsgAbbrevJVMConnection.java:212)
at weblogic.rjvm.MsgAbbrevInputStream.readMessageContext(MsgAbbrevInputStream.java:237)
at weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:744)
... 7 more
--------------- nested within: ------------------
weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception - with nested exception:
[weblogic.rjvm.PeerGoneException: ; nested exception is:
java.rmi.UnmarshalException: Incoming message header or abbreviation processing failed ; nested exception is:
java.io.InvalidClassException: javax.management.ObjectName; local class incompatible: stream classdesc serialVersionUID = -5467795090068647408, local class serialVersionUID = 1081892073854801359]
at weblogic.management.internal.AdminMBeanHomeImpl_815_WLStub.getMBeansByType(Unknown Source)
at weblogic.TestJMX.find(TestJMX.java:26)
at weblogic.TestJMX.main(TestJMX.java:48)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值