jconsole: “Connection Failed: Retry?” #SOLVED #java #jmx

So you wrote a piece of server software and you found out about JMX and the jconsole tool to remotely monitor all sorts of interesting metrics remotely, all without adding a single line of code to your project.

Say you want to run it the simplest way possible with no authentication, the tutorial says that these are the options you need to pass to the remote virtual machine to enable JMX remote monitoring on some port (let’s put 9595 for illustrative purposes).

[bash]
-Dcom.sun.management.jmxremote.port=9595′,
-Dcom.sun.management.jmxremote.ssl=false’,
-Dcom.sun.management.jmxremote.authenticate=false
[/bash]

right?

But when you open your jconsole on your local computer to connect to the remote server…

[bash]
jconsole myserver.com:9696
[/bash]

You get this fucking error no matter what you do.

You’re just missing one more option they must have forgotten to mention in the retard tutorial at oracle.com

(let’s use IP address 72.14.204.147 as the remote server IP)

[bash]
-Dcom.sun.management.jmxremote.port=9595′,
-Dcom.sun.management.jmxremote.ssl=false’,
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=72.14.204.147 #ip of the remote machine, yes the ip, not the name
[/bash]

Voilà

[SCREENCAST] How to do Unit Testing on Android with Eclipse

I was going to make a tutorial, but then I figured that making a video would be a much better way to show this.
As for the code that you could grab from a tutorial, there’s a link at the end of the post with all the code shown in the video demo.

The video demo covers how to create and run Unit Test classes for regular Java classes on Android, and also how to create and run Unit Test classes that test classes that depend on Android “Context” or “Activity” objects.

If your Android unit tests are not running because of frustrating error messages, the time spent watching this video will save you a lot of reading and headaches.

Check the screencast after the break

Continue reading

Droid vs Nexus 1 – SunSpider JavaScript Benchmark showdown

Nexus One runs JavaScript 2.32 times faster than the Motorola Droid.

The SunSpider JavaScript Benchmark was run several times on both phones and results were consistent.

It’d be great to compare with the iPhone 3Gs, If someone has an iPhone 3Gs, please run the test and send me the results to update this post.

MOTOROLA DROID NEXUS ONE
============================================
RESULTS (means and 95% confidence intervals)
--------------------------------------------
Total:                 34157.4ms +/- 2.8%
--------------------------------------------

  3d:                   4277.6ms +/- 3.3%
    cube:               1212.4ms +/- 9.6%
    morph:              1680.0ms +/- 12.5%
    raytrace:           1385.2ms +/- 5.2%

  access:               4350.8ms +/- 7.1%
    binary-trees:        473.2ms +/- 7.6%
    fannkuch:           1959.4ms +/- 9.7%
    nbody:               985.2ms +/- 9.6%
    nsieve:              933.0ms +/- 39.8%

  bitops:               2921.4ms +/- 3.4%
    3bit-bits-in-byte:   545.4ms +/- 4.1%
    bits-in-byte:        735.6ms +/- 16.3%
    bitwise-and:         539.8ms +/- 9.9%
    nsieve-bits:        1100.6ms +/- 3.0%

  controlflow:           414.2ms +/- 8.5%
    recursive:           414.2ms +/- 8.5%

  crypto:               2064.4ms +/- 4.5%
    aes:                 859.8ms +/- 3.4%
    md5:                 638.8ms +/- 4.6%
    sha1:                565.8ms +/- 8.1%

  date:                 4434.2ms +/- 9.0%
    format-tofte:       1663.6ms +/- 6.7%
    format-xparb:       2770.6ms +/- 12.7%

  math:                 3223.6ms +/- 3.0%
    cordic:             1110.8ms +/- 6.2%
    partial-sums:       1264.0ms +/- 3.4%
    spectral-norm:       848.8ms +/- 3.2%

  regexp:               3980.0ms +/- 1.3%
    dna:                3980.0ms +/- 1.3%

  string:               8491.2ms +/- 3.8%
    base64:             1108.4ms +/- 7.0%
    fasta:              1683.4ms +/- 1.6%
    tagcloud:           1500.2ms +/- 9.5%
    unpack-code:        2456.2ms +/- 8.7%
    validate-input:     1743.0ms +/- 4.5%
============================================
RESULTS (means and 95% confidence intervals)
--------------------------------------------
Total:                 14706.8ms +/- 4.8%
--------------------------------------------

  3d:                   1593.6ms +/- 6.0%
    cube:                474.8ms +/- 17.2%
    morph:               566.2ms +/- 2.6%
    raytrace:            552.6ms +/- 1.0%

  access:               1885.0ms +/- 10.3%
    binary-trees:        202.8ms +/- 25.7%
    fannkuch:            819.4ms +/- 1.1%
    nbody:               406.2ms +/- 20.7%
    nsieve:              456.6ms +/- 28.1%

  bitops:               1640.8ms +/- 29.2%
    3bit-bits-in-byte:   300.8ms +/- 30.9%
    bits-in-byte:        390.0ms +/- 44.9%
    bitwise-and:         372.0ms +/- 55.7%
    nsieve-bits:         578.0ms +/- 36.8%

  controlflow:           200.8ms +/- 4.5%
    recursive:           200.8ms +/- 4.5%

  crypto:                880.8ms +/- 2.1%
    aes:                 385.6ms +/- 4.6%
    md5:                 254.4ms +/- 5.3%
    sha1:                240.8ms +/- 9.0%

  date:                 1843.6ms +/- 20.6%
    format-tofte:        840.0ms +/- 45.9%
    format-xparb:       1003.6ms +/- 1.3%

  math:                 1250.8ms +/- 1.6%
    cordic:              464.0ms +/- 1.1%
    partial-sums:        450.2ms +/- 3.0%
    spectral-norm:       336.6ms +/- 3.6%

  regexp:               2003.4ms +/- 15.2%
    dna:                2003.4ms +/- 15.2%

  string:               3408.0ms +/- 7.7%
    base64:              387.6ms +/- 2.4%
    fasta:               729.8ms +/- 3.7%
    tagcloud:            605.8ms +/- 4.2%
    unpack-code:        1019.8ms +/- 29.1%
    validate-input:      665.0ms +/- 1.1%

Crónicas del Buen Programador: Invierte en Conocimientos


“Una inversión en conocimiento siempre paga el mejor Interes” Benjamin Franklin

Tus conocimientos y tu experiencia son tus mejores bienes. En 1999 recuerdo que compre un libro llamado “Java In A Nutshell“. Era un libro de referencia completa al lenguaje, en aquel entonces la API era Java 1.1.8. Lei el libro de la primera pagina a la ultima pagina. En unos cuantos meses empece a ganar reputación en la escuela de Ingeniería Informática porque sabia programar (muy poco en comparación a hoy en día) en Java.
Continue reading