zoukankan      html  css  js  c++  java
  • Jconsle

    1. jconsole 远程连接:

        JConsole很好用,可以解决很多疑难杂症。但远程连接需要设置一下Java opt才可以使用。以下是步骤:

        1). 在java opt下添加如下内容:

             如果是无须验证添加

            # 指定远程服务的端口

            JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=12345"          

            # 指定远程服务的认证

            JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"  
            JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"

       2). 如无须验证,服务就设置完成了。

            如需密码验证

            a. 执行脚本中添加如下内容:

            JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=12345"
            JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=true"
            JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
            JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.pwd.file=/usr/java/jdk1.6.0_02/jre/lib/management/jmxremote.password"

            b. 将/usr/java/jdk1.6.0_02/jre/lib/management下的jmxremote.password.template,拷贝一份叫jmxremote.password。进去将内容全部删去,添加一行

                controlRole   R&D    (用户名,密码)

            c. 将jmxremote.password和jmxremote.access改成600权限,和所属该程序用户

               chown jboss:jboss jmxremote.access  jmxremote.password

               chmod 600 jmxremote.access  jmxremote.password

           d. 之后在JConsole里添加用户名,密码就可以了。

           注:如果JConsole不能访问本机的程序的话,在java opt里添加如下内容:

                -Dcom.sun.management.jmxremote

      转自:http://java-boy.iteye.com/blog/608438

     

     tomcat 配置中一般讲上诉内容放到:

    JAVA 程序测试,测试类:

    package push;
    /**
     * @author tianlin
     * 2015年12月5日 下午3:14:46
     *
     **/
    public class JconsoleTest {
    	
    	public static void main(String[] args) throws InterruptedException {
    		
    		MyThread t1 = new MyThread();
    		t1.start();
    		MyThread t2 = new MyThread();
    		t2.start();
    		MyThread t3 = new MyThread();
    		t3.start();
    		MyThread t4 = new MyThread();
    		t4.start();
    	}
    
    }
    
    class MyThread extends Thread {
    	
    	@Override
    	public void run() {
    		
    		boolean flag = true;
    		while(flag){
    			for(int i=0;i<600;i++){
    				if(i==100){
    					flag = false;
    				}
    				try {
    					Thread.sleep(10000);
    				} catch (InterruptedException e) {
    					e.printStackTrace();
    				}
    				System.out.println("------------------------------" + i);
    			}
    		}
    		
    	}
    }
    

         linux 编写执行脚本start.sh,内容如下:

    java -Dcom.sun.management.jmxremote.port=8880 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=192.168.1.210  -Dcom.sun.management.jmxremote.ssl=false push/JconsoleTest
    

         备注:-Djava.rmi.server.hostname=192.168.1.210  -Dcom.sun.management.jmxremote.ssl=false  貌似可以不写

     

  • 相关阅读:
    xcode
    C++中一个井号和两个井号的使用
    未能正确加载“visual C++ package”包
    cocos2dx CCLayer上精灵的点击判断的问题
    Command /Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp failed with exit code 1
    如何优化cocos2d程序的内存使用和程序大小:第二部分_(转)
    PVR: VFrame attempted to use one of these functions 报错
    网页里加入百度在线音乐播放器
    CCHttpClient发起https请求
    伪装qq空间登录
  • 原文地址:https://www.cnblogs.com/Jtianlin/p/5021540.html
Copyright © 2011-2022 走看看