兄弟们,大老爷们,救火呀..weblogic jmx管理的程序..在线等

dxadnwfn 2008-06-17 02:45:09
这几天要做一个weblogic jmx的服务的管理,把weblogic里的jmx从程序中抽出写成程序.

我从网上搜索了一些程序,但是报错.环境是这样的. eclipse3.3+weblogic 8.1+jdk1.4

weblogic.jar 和jbossall-client.jar 已经加到lib下

出错的信息是
weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception - with nested exception:
[weblogic.rjvm.PeerGoneException: ; nested exception is:
weblogic.utils.NestedException: Lorg/jboss/mx/util/ObjectNamePatternHelper$PropertyPattern; - with nested exception:
[java.lang.NoClassDefFoundError: Lorg/jboss/mx/util/ObjectNamePatternHelper$PropertyPattern;]]
at weblogic.management.internal.AdminMBeanHomeImpl_811_WLStub.getActiveDomain(Unknown Source)
at com.ivsoftware.weblogic.WeblogicJMX.main(WeblogicJMX.java:32)
Exception in thread "main"


程序如下:


public class WeblogicJMX {

public MBeanHome localHome;

public MBeanHome adminHome;

public static final String SERVER_NAME = "weblogic";

public static final String SERVER_PASSWORD = "weblogic";

public static final String SERVER_URL = "t3://localhost:7001";
//public static final String SERVER_URL = "t3://158.222.30.246:7001";

public static final String SERVER_POOL="MyJDBCMultiPool";
// public static final String SERVER_POOL="MyPool";
public static void main(String[] args) {
WeblogicJMX weblogicJMX = new WeblogicJMX();
MBeanHome mBeanHome = weblogicJMX.getMBeanHome();
System.out.println(mBeanHome.getActiveDomain());
System.out.println("domainName:"+mBeanHome.getDomainName()+" serverName:"+mBeanHome.getMBeanServer());
//
// // In this case we want the 100 most recently executed statements
// JDBCStatementProfile[] profiles = weblogicJMX.getProfiles(100);
// // Doing the looping so that the most recent statements information is
// // retrieved first
// for (int i = profiles.length - 1; i > -1; i--) {
// // Getting the number of parameters passed into the current
// // //statement
// int paramCount = profiles[i].getParameterCount();
// // Format the start and end time for the current statement
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
// "yyyyy.MMMMM.dd GGG hh:mm:ss:SS aaa");
// String startTime = simpleDateFormat.format(new Date(profiles[i]
// .getStartTime()));
// String endTime = simpleDateFormat.format(new Date(profiles[i]
// .getStopTime()));
//
// // Append the parameters together in order to display them
// StringBuffer paramsBuffer = new StringBuffer();
// if (paramCount < 1) {
// paramsBuffer.append("None");
// } else {
// for (int j = 0; j < paramCount; j++) {
// paramsBuffer.append(profiles[i].getParameter(j));
// paramsBuffer.append(" ");
// }
// }
//
// String statementTxt = profiles[i].getStatementText();
// String paramsTxt = paramsBuffer.toString();
// long timeTaken = profiles[i].getTimeTaken();
//
// // Then use statementTxt, paramsTxt, timeTaken, startTime, endTime
// // etc to show the statement details in a UI
// }

}

private MBeanHome getMBeanHome() {
// URL to the serve whose JDBC activity we are tracing
// The MBeanHome will allow us to
// retrieve the MBeans related to JDBC statement tracing
MBeanHome home = null;

try { // We'll need the environment so that we can //retrieve the
// initial context

//--------------------

Environment env = new Environment();
env.setProviderUrl(SERVER_URL);
env.setSecurityPrincipal(SERVER_NAME);
env.setSecurityCredentials(SERVER_PASSWORD);
Context ctx = env.getInitialContext();

// Retrieving the MBeanHome interface for the server with //the url
// t3://localhost:7001
home = (MBeanHome) ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);

//----------------------
// home = (MBeanHome)Helper.getMBeanHome("weblogic","weblogic",SERVER_URL,"myserver");
} catch (Exception ne) {
System.out.println("Error getting MBeanHome " + ne);
}
return home;
}

public void configureJDBCAuditing(boolean isOn) {
try {
MBeanHome home = getMBeanHome();
// Retreive the bean to help us configure the Pool
JDBCConnectionPoolMBean mConfigBean = (JDBCConnectionPoolMBean) home
.getConfigurationMBean(SERVER_POOL, "JDBCConnectionPoolConfig");
mConfigBean.setSqlStmtProfilingEnabled(isOn);
mConfigBean.setSqlStmtParamLoggingEnabled(isOn);
} catch (InvalidAttributeValueException iave) {
System.out.println("Invalid attribute while configuring tracing "
+ iave);
} catch (InstanceNotFoundException infe) {
System.out.println("Instance not found while configuring tracing "
+ infe);
}
}

/** Pass in -1 to get all profiles */
public JDBCStatementProfile[] getProfiles(int maxProfiles) {
JDBCStatementProfile[] profiles = null;
try {
MBeanHome home = getMBeanHome();
JDBCConnectionPoolRuntimeMBean mbean = (JDBCConnectionPoolRuntimeMBean) home
.getRuntimeMBean(SERVER_POOL, "JDBCConnectionPoolRuntime");
int numProfiles = mbean.getStatementProfileCount();
int profilesIndex = 0;
// figure out index to start at and how many we want
if (maxProfiles != -1) {
profilesIndex = numProfiles - maxProfiles;
} else {
maxProfiles = numProfiles;
}
profiles = mbean.getStatementProfiles(profilesIndex, maxProfiles);
} catch (InstanceNotFoundException infe) {
System.out.println("Problem retrieving jdbc profiles " + infe);
}
return profiles;
}

public void reset() {
MBeanHome home = getMBeanHome();
try {
JDBCConnectionPoolRuntimeMBean mbean = (JDBCConnectionPoolRuntimeMBean) home
.getRuntimeMBean(SERVER_POOL, "JDBCConnectionPoolRuntime");
// Remove everything from the cache
mbean.resetStatementProfile();
} catch (InstanceNotFoundException infe) {
System.out.println("Problem while resetting JDBC profiles " + infe);
}
}

}







...全文
281 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
guanjun0901 2008-07-28
  • 打赏
  • 举报
回复
哥们怎么还不上线,迫切需要你的帮助,我在线等。。
guanjun0901 2008-07-25
  • 打赏
  • 举报
回复
大哥 你什么时候在,帮帮我呀,我现在有个需要达到和你一样功能的任务,可我对JMX一点都不懂。能否帮帮我,谢谢你了,我的QQ是514164938 迫切需要你的帮助
dxadnwfn 2008-07-14
  • 打赏
  • 举报
回复
没有一个答对的...

后来发现是因为多加了些jar包..

可能只个包里面有相同的东西,所以造成提示信息说某一个类没有找到

我原来是建的j2EE工程

后来我改建java工程就OK了
night__cat 2008-06-30
  • 打赏
  • 举报
回复
up
dxadnwfn 2008-06-18
  • 打赏
  • 举报
回复
要得到的是上面这些信息
dxadnwfn 2008-06-18
  • 打赏
  • 举报
回复
最小 堆栈大小 29,165 KB
最大 堆栈大小 30,519 KB
平均 堆栈大小 29,839 KB
总计 堆栈大小 32,576 KB
当前 堆栈大小 29,534 KB
告警配置
属性 值 阈值
最小 应答时间 0 ms
最大 应答时间 16 ms
平均应答时间 9 ms
当前 应答时间 没有可用数据
告警配置


线程池明细
名称 健康状况 总线程数 空闲线程 在用线程 未决的请求数目 告警配置
weblogic.admin.RMI 3 2 1 0
weblogic.admin.HTTP 2 2 0 0
weblogic.kernel.Default 15 15 0 0
weblogic.kernel.System 5 5 0 0
weblogic.kernel.Non-Blocking 0 0 0 0


数据库连接池的详细信息
名称 健康状况 连接池大小 活动连接 活动连接数% 遗漏的连接 线程等待 告警配置
MyPool 1 0 0% 0 0


JMS明细
名称 健康状况 字节
当前 挂起 接收数/分
信息数
当前 挂起 接收数/分
告警配置
WSStoreForwardInternalJMSSe... 0 0 0 0 0 0


得到这些信息
dxadnwfn 2008-06-18
  • 打赏
  • 举报
回复
我主要想问的不是这个;
大家知道Applications manager (nanageEngine)的,它里就用一个weblogic管理的

监视器信息
名称 skyon-gcw_WEBLOGIC-server_7001
健康状况 资源停止.
因为资源不可用所以健康状态为严重
类型 WebLogic服务器
WebLogic版本 WebLogic Server 8.1 SP1
监听端口 7001
活化时间 2008-6-18 上午11:06
主机名 skyon-gcw (192.168.8.114)
操作系统 Windows XP
最后轮询时间 2008-6-18 下午3:44
下次轮询时间 2008-6-18 下午3:49

等等...

大家提供点资料

老紫竹 2008-06-17
  • 打赏
  • 举报
回复
java.lang.NoClassDefFoundError: Lorg/jboss/mx/util/ObjectNamePatternHelper$PropertyPattern;]]


很明显,你缺少了一个类库

org.jboss.mx 。。。

我不知道这个jar应该叫什么名字,也许叫 mx.jar吧??
jdlsfl 2008-06-17
  • 打赏
  • 举报
回复
关注,帮顶
dxadnwfn 2008-06-17
  • 打赏
  • 举报
回复
我在线呀....
程声明:该课程是教学使用,视频内涉及漏洞利用方法,请勿在互联网环境中使用;维护互联网安全,人人有责。实验所需环境:vmware;kali虚拟机一台;windows server一台;有docker环境的Linux虚拟机环境下载地址在购买课程后单独发送 【课程配套资源】1、Python脚本(Margin老师自研,不光能学漏洞,还能学Python,实在是划算)2、与Margin老师实时互动3、免费的CISP-PTE考试技巧指导(Margin老师与CISP-PTE的负责人很熟的,非常多的一手消息^o^)4、Margin老师的内部直播可以优先参加5、Margin老师的课程基于CISP-PTE的知识体系进一步扩展,使课程内容更贴近实战   【课程主要解决问题】1、CSRF、SSRF搞不清楚?2、SSRF原理是什么?危害大小?如何利用SSRF获取主机权限?如果使用Python提高挖洞效率?3、Gopher协议、Dict协议?完全没听过啊,没关系,看完课程后你门清。4、SSRF渗透Redis数据库,Redis客户端和服务器端怎么通信?通信报文是怎么样的?看这里就行。5、SSRF渗透Struts2总是失败?不知道如何编码?不知道如何使用Gopher协议?来这里。6、SSRF表面简单,实则有无数坑,通过视频提高学习效率吧。 【CISP-PTE介绍】1、CISP-PTE是进入网络安全行业的TOP1认证,能帮你梳理完整的网络安全知识体系2、有PTE证书在网络安全公司是免技术笔试的,怎么样?是不是很棒。3、Margin老师的课程基于CISP-PTE的知识体系进一步扩展,使课程内容更贴近实战本课程属于CISP-PTE渗透测试工程师认证体系的课程,但内容更加丰富。CISP-PTE是国内第一个以动手实操为主的网络安全认证,该注册考试是为了锻炼考生世界解决网络安全问题的能力,持续增强我国的网络安全水平和防御能力,促进国内网络防御能力的不断提高。考试内容从多个层面进行,考点和网络安全动态相结合,真实的反应出真实的网络环境中发现的各种问题。如果要考取CISP-PTE证书需要掌握以下内容:1、Web安全基础,注入漏洞、上传漏洞、跨站脚本漏洞、访问控制漏洞、会话管理漏洞哦等。2、中间件的安全知识,如:Apache,IIS,Tomcat,以及 JAVA 开发的中间件 Weblogic,Jboss, Websphere 等,且要了解中间件加固方法,在攻与防的能力上不断提升。3、操作系统安全,包含Windows和Linux操作系统,从账户管理、文件系统权限、日志审计等方面讲解,了解常见的漏洞方式和加固方法。4、数据库安全,包含MSSQL、MYSQL、ORACLE、REDIS数据,了解常用的数据库漏洞和题全方法,保证数据库的安全性。 【关于Margin老师】· Margin/教育系统网络安全保障人员认证首批讲师/高级讲师· 擅长CTF/Web安全/渗透测试 /系统安全· 3年研发/擅长Java/Python/某银行现金循环机业务系统开发者· 曾参与开发网络安全认证教材· 知乎专栏/CISP-PTE渗透测试工程师学习· 4年线下网络安全讲师/2000+线下学员/100000+线上学员

67,515

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧