Using Java JConsole connect to remote WebLogic JMX server

WebLogic farm, one Admin Server, two managed servers.

MBean defintion:

mdcsObjectName: com.auspost:Name=mdcsNfr,Type=PostNfr,Location=wlsa_mdcs_pdev_admin
mdcsObjectName: com.auspost:Name=mdcsNfr,Type=PostNfr,Location=wls_mdcs_pdev1
mdcsObjectName: com.auspost:Name=mdcsNfr,Type=PostNfr,Location=wls_mdcs_pdev2

Connect MBean Server with JConsole:

set JAVA_HOME=C:Program FilesJavajdk1.6.0_45
set WL_HOME=C:binwls1036wlserver
“%JAVA_HOME%binjconsole.exe” -J-Djava.class.path=”%JAVA_HOME%libjconsole.jar;%WL_HOME%serverlibwljmxclient.jar” -J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote -debug

Admin Server
service:jmx:t3://hx549:3101/jndi/weblogic.management.mbeanservers.domainruntime
wladmin/Welcome123

Managed Server 1
service:jmx:t3://hx549:3102/jndi/weblogic.management.mbeanservers.runtime
wladmin/Welcome123

Managed Server 2
service:jmx:t3://hx749:3103/jndi/weblogic.management.mbeanservers.runtime
wladmin/Welcome123

Attributes with Internal suffix are used and kept its own node’s information. NO internal attributes keep / sync between all nodes information.

Picture (Device Independent Bitmap)

Picture (Device Independent Bitmap)-3

Picture (Device Independent Bitmap)-4

When node1 is down:

Picture (Device Independent Bitmap)-2

Reference: http://pineapplesoftware.blogspot.com.au/2013/10/to-celebrate-support-of-missioncontrol.html

JavaScript world is a bit insane for the moment

Have a look Meteor – https://www.meteor.com/, an “ultra simple”, “database everywhere”, “data on the wire”, “real time”, and another pure JavaScript web application framework. Meteor even makes Angular.js so yesterday.

Just like this great country, politicians fight election campaign on popularities, not on issues. Programming today has become a pop culture. Every JavaScript web framework try to make themselves Rails like. Maybe it’s better wait for all nuclear fallout to settle and learn something far more better, stable and rewarding … …

JRockit starts WebLogic Server with parameters

$ /bea/1036/java/bin/java -jrockit -Xms512m -Xmx512m -Dweblogic.Name=wls_mdcs_pdev1 -Djava.security.policy=/bea/1036/wlserver_10.3/server/lib/weblogic.policy -Dweblogic.system.BootIdentityFile=/beavar/1036/domains/wlsd_mdcs_pdev/servers/wls_mdcs_pdev1/data/nodemanager/boot.properties -Dweblogic.nodemanager.ServiceEnabled=true -Dweblogic.security.SSL.ignoreHostnameVerification=true -Dweblogic.ReverseDNSAllowed=false -Xms:1g -Xmx:1g -Xgc:deterministic -Xmanagement:ssl=false,authenticate=false,port=3111 -Dcom.sun.management.jmxremote.password.file=/beavar/1036/domains/wlsd_mdcs_pdev/jmxremote.password -Dlog4j.configuration=file:./mdcs/properties/log4j.properties -Xverify:none -da -Dplatform.home=/bea/1036/wlserver_10.3 -Dwls.home=/bea/1036/wlserver_10.3/server -Dweblogic.home=/bea/1036/wlserver_10.3/server -Dweblogic.management.discover=false -Dweblogic.management.server=http://10.3.94.46:3101 -Dwlw.iterativeDev= -Dwlw.testConsole= -Dwlw.logErrorsToConsole= -Dweblogic.ext.dirs=/bea/1036/patch_wls1036/profiles/default/sysext_manifest_classpath:/bea/1036/patch_ocp371/profiles/default/sysext_manifest_classpath -Xgc:deterministic weblogic.Server

Invoke SSH client by clicking URL hyperlinking

Add “ssh” URI schema support in Windows 7 sysstem. Here is the regedit file ssh.reg:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOTssh]

[HKEY_CLASSES_ROOTsshShell]

[HKEY_CLASSES_ROOTsshShellOpen]

[HKEY_CLASSES_ROOTsshShellOpenCommand]
@=hex(2):22,00,43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,
00,46,00,69,00,6c,00,65,00,73,00,20,00,28,00,78,00,38,00,36,00,29,00,5c,00,
74,00,65,00,72,00,61,00,74,00,65,00,72,00,6d,00,5c,00,74,00,74,00,65,00,72,
00,6d,00,70,00,72,00,6f,00,2e,00,65,00,78,00,65,00,22,00,20,00,22,00,2f,00,
61,00,75,00,74,00,68,00,3d,00,70,00,75,00,62,00,6c,00,69,00,63,00,6b,00,65,
00,79,00,22,00,20,00,22,00,2f,00,6b,00,65,00,79,00,66,00,69,00,6c,00,65,00,
3d,00,43,00,3a,00,5c,00,63,00,79,00,67,00,77,00,69,00,6e,00,36,00,34,00,5c,
00,68,00,6f,00,6d,00,65,00,5c,00,6d,00,69,00,61,00,6f,00,74,00,5c,00,2e,00,
73,00,73,00,68,00,5c,00,69,00,64,00,5f,00,64,00,73,00,61,00,22,00,20,00,25,
00,31,00,00,00

Update SSH URI schema on Command Prompt:

C:>ftype ssh="C:Program Files (x86)teratermttermpro.exe" "/auth=publickey" "/keyfile=C:cygwin64homemiaot.sshid_dsa" %1

Install Tera Term, a SSH client supports SSH URI schema, also it’s FREE.

Add SSH link on wiki, e.g., ssh://miaot@hx562.corpdev.apdev.local

Click the link, see Windows launching Tera Term log on remote host.

Reference

Connection reset by peer

This mysterious OpenSSH client broken error when try to connect linux boxes in corporate network from Cygwin’s OpenSSH client.

But, Windows’ Putty program is without such issue.

Come across a post discussing a similar issue – http://www.held.org.il/blog/2011/05/the-myterious-case-of-broken-ssh-client-connection-reset-by-peer/

It seems that limitation on Cisco switch so network people change the default ciphers on OpenSSH Server. So the solution is quite simple – have a look “Ciphers” and “MACs” settings in /etc/ssh/ssh_config file, then add the SAME “Ciphers” and “MACs” into client’s config file:

$ cat ~/.ssh/config
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160

Unix command find directories without specific files

In development box already set up Maven local repository. New projects are base on Grails and build with Gradle. Gradle set up to re-use Maven local repository, but Maven repository is NOT as reliable as you expect.

Then come across a problem that Gradle fails to download dependencies if not present in MavenLocal(), i.e., directories have Maven pom.xml but without artifact jar files. This makes Gradle build failed.

http://forums.gradle.org/gradle/topics/gradle_fails_to_download_dependencies_if_not_present_in_mavenlocal

So need to find out these directories:

$ find . -type d -not -empty -links 2 -exec sh -c 'set -- "$0"/*.jar; ! [ -e "$1" ]' {} ; -print

IntelliJ’s intelligent Subversion solution

Grass roots developers always have a tough life. They have so many demanding bosses to serve, and work load piled high to finish, everyday. But that is not all.

After spending premium to buy latest IntelliJ 12, only a few honeymoon days with Darcula theme, then find out SVN is broken. When sync with SVN repository with JIRA SVN branch, a red flash error indicating there is malfunction in the engine:

E170001: HTTP proxy authorization failed

Open the hood and inspect inside, everything looks absolutely fine. Proxy settings, authenticated user and password all good. Can connect to JetBrains website and check the latest update, but just can’t connect to JIRA SVN repository on the internet.

Relunctantly back to TortoiseSVN to check-in and check-out codes. Just like the its name, it’s bloody slow and painful.

Googling and digging, try to understand why IntelliJ is not smart enough this time and new version causes so silly problem. However, only find out a lot “me too”, “me too” replies.

Having wasted a few more days in vain, then start suspecting that maybe it’s not IntelliJ’s fault, maybe it’s new version SVN client – SVNKit’s problem.

When more evidence and witness’s testimony above water, then hear “rumours” that I.T security and network just did a major change recently, fixing a lot holes, of course breaking a lot windows at same time.  What they did – Proxy Authentication against a LDAP backend server, especially by Microsoft Active directory and network may caused the chaos. You have to guess hard.

Google such work around solution is quite easy. SVNKit already has a JNA-based implementation of a Negotiate authenticator that supports both Kerberos and NTLM. Just add the following lines:

-Dsvnkit.http.ntlm=jna
-Dsvnkit.http.sslProtocols=SSLv3

in C:Program FilesJetBrainsIntelliJ IDEA 12.1.3binidea.exe.vmoptions file. Voilà! Can browse, sync, update JIRA SVN respository in IntelliJ, finally.

How to set up and run MySQL on Red Hat Linux 6.1 without being root/su?

jenkins@ci ~
11:36:57 317 $ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.1 (Santiago)
jenkins@ci ~
11:37:07 318 $ uname -a
Linux hx371 2.6.32-131.0.15.el6.x86_64 #1 SMP Tue May 10 15:42:40 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
  • Download MySQL 5.1 (mysql-5.1.68-linux-x86_64-glibc23.tar.gz) from http://downloads.mysql.com/archives.php?p=mysql-5.1&v=5.1.68
  • Unzip tar ball into ~/mysql-binary directory
  • Create ~/mysql/data, ~/mysql/log, ~/mysql/run directories
  • Create ~/my.cnf file:
    jenkins@ci ~
    11:41:18 321 $ cat my.cnf
    [server]
    user=jenkins
    basedir=/u01/apps/jenkins/mysql-binary
    datadir=/u01/apps/jenkins/mysql/data
    socket=/tmp/mysql.sock
    port=3306
    
    [safe_mysqld]
    log_error=/u01/apps/jenkins/mysql/log/error.log
    pid-file=/u01/apps/jenkins/mysql/run/mysqld.pid
  • Set up database:
    jenkins@ci ~/mysql-binary
    11:43:37 762 $ ./scripts/mysql_install_db --defaults-file=~/my.cnf --user=jenkins --basedir=/u01/apps/jenkins/mysql-binary --datadir=/u01/apps/jenkins/mysql/data --socket=/tmp/mysql.sock
  • Start up database:
    jenkins@ci ~/mysql-binary
    11:44:58 762 $ nohup ./bin/mysqld_safe --defaults-file=~/my.cnf &
  • Login database:
    jenkins@ci ~/mysql-binary
    11:45:56 762 $ ~/mysql-binary/bin/mysql -h localhost -u username -ppassword --database=userDB

How to log SOAP web service call message in Java application

  • Enable Spring web service tracing in log4j.xml, i.e., WebServiceTemplate for client-side Web service access in Spring-WS:
<category name="org.springframework.ws.client.MessageTracing" additivity="false">
        <priority value="trace" />
        <appender-ref ref="INTERFACES_LOG" />
</category>

In the log file:

TRACE 2013-03-27 15:54:16,440 [TP-Processor7] org.springframework.ws.client.MessageTracing.sent - Sent request [<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header>
......
TRACE 2013-03-27 15:54:55,409 [TP-Processor48] org.springframework.ws.client.MessageTracing.received - Received response [<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  • for other web service clients don’t use Spring WebServiceTemplate, enable HttpTransportPipe dump in JVM:
export CATALINA_OPTS="-Xmx512m -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC -Djavax.net.ssl.trustStore=keystore.jks -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.keyStore=keystore.jks -Djavax.net.ssl.keyStorePassword=password -Ddce.env=sit -Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true"

so you can see in log SOAP message like:

SOAPAction: "http://sap.com/xi/WebService/soap1.1"
Accept: text/xml, multipart/related, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Content-Type: text/xml;charset="utf-8"

<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
......
    </S:Body>
</S:Envelope>

Apache Web Server, mod_proxy_balancer, Tomcat and Cacti

Is Apache mature enough? Is Apache community ready to offer high scalability, high availability solution for large corporate? The answer is obvious now.

With Apache Web Server, mod_proxy_balancer module, Apache Tomcat. it’s easier and simpler to build a software based load balancer solution for Java web applications.

[text]
<Proxy balancer://api-ajpCluster>
BalancerMember ajp://app11.unix.local:9021 route=jvm1
BalancerMember ajp://app12.unix.local:9021 route=jvm2
ProxySet stickysession=JSESSIONID
ProxySet nofailover=on
</Proxy>

<Proxy balancer://apapi-ajpCluster>
BalancerMember ajp://app11.unix.local:9121 route=jvm1
BalancerMember ajp://app12.unix.local:9121 route=jvm2 status=+H
ProxySet stickysession=JSESSIONID
ProxySet nofailover=on
</Proxy>

<Location /api>
RequestHeader set AUTH-KEY dGVzdHRleHR0b2VuY29kZQ==
ProxyPass balancer://apapi-ajpCluster/api
</Location>

ProxyPassMatch ^/(articles.*)$ balancer://apapi-ajpCluster/ap-api/$1
ProxyPassMatch ^/(consignments.*)$ balancer://apapi-ajpCluster/ap-api/$1
ProxyPassMatch ^/(products.*)$ balancer://apapi-ajpCluster/ap-api/$1
ProxyPass /isalive balancer://apapi-ajpCluster/ap-api/isalive
ProxyPass / balancer://api-ajpCluster/api/
[/text]

With Cacti, a monitoring and reporting tool, now you have a complete solution for a high scalability, high availability application requirement. Check:

Monitoring and Reporting