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  貌似可以不写

     

  • 相关阅读:
    XML(学习笔记)
    css样式学习笔记
    Request(对象)
    sql一些错误修改的总结
    转载(如何学习C#)
    sql server(学习笔记2 W3Cschool)
    sql sqrver(学习笔记1 W3Cschool)
    关于 flutter开发碰到的各种问题,有的已经解决有的一直没解决或者用其他方法替代
    关于 Flutter IOS build It appears that your application still contains the default signing identifier.
    关于 flutter本地化问题 The getter 'pasteButtonLabel' was called on null
  • 原文地址:https://www.cnblogs.com/Jtianlin/p/5021540.html
Copyright © 2011-2022 走看看