当前位置: 代码迷 >> Web前端 >> weblogic JMX 中遇到的有关问题
  详细解决方案

weblogic JMX 中遇到的有关问题

热度:595   发布时间:2012-06-30 17:20:12.0
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
附:请导入weblogic.jar编译出错如下
<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)
1 楼 beyondsanli 2008-05-08  
有人说是:
这并不是程序有问题,只是他们不兼容,找了好久,没有合适的解决方法,只好改用Weblogic server9,希望好用吧!
欢迎大家赐教!
  相关解决方案