Wednesday, November 26, 2014

jinfo causing segmentation fault on a 64 bit JVM

On a machine, I have jinfo resolving to:

/usr/bin/jinfo

When I run it against a 64bit JVM, I get:

jinfo -sysprops ${pid}

Attaching to process ID 26267, please wait...
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xaeec7791, pid=31050, tid=2934725520
#
# JRE version: 6.0_33-b03
# Java VM: Java HotSpot(TM) Server VM (20.8-b03 mixed mode linux-x86 )
# Problematic frame:
# C  [libsaproc.so+0x1791]  long double restrict+0x1d
#
# An error report file with more information is saved as:
# /opt/oracle/usr/hs_err_pid31050.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted



and the file /opt/oracle/usr/hs_err_pid31050.log says:


#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xaeec7791, pid=31050, tid=2934725520
#
# JRE version: 6.0_33-b03
# Java VM: Java HotSpot(TM) Server VM (20.8-b03 mixed mode linux-x86 )
# Problematic frame:
# C  [libsaproc.so+0x1791]  long double restrict+0x1d
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#



The problem evidently is that THAT jinfo is a 32 bit version, and I should rather use /usr/lib/jvm/java-1.6.0-sun-1.6.0.81.x86_64/bin/jinfo



bugbuster, the alternative to Selenium

I have just seen a presentation of BugBuster, it's a JavaScript web functional test product with a recorder - a Chrome extension - which is totally integrated to your browser.

This means that it instruments the browser to monitor if the previous operation (like : form submission, AJAX xml send) is completed.... no need for "wait" statements.

I was really impressed by the cleanness of the interface, simplicity of use and the fact that it delivers you compact code that you can review and eventually customize.

The pricing seems very honest, so it's worth a try.

The company is a spinoff of the University of Lausanne... it's nice to see a University doing research and creating products...

Saturday, November 22, 2014

Jewish Auschwitz Survivor Ernst Lobethal (aka Ernest Lobet)

I have a keen interest about the history of the Holocaust (I believe that these days we have several Holocausts going on, the Palestinian just to name one...)... so with some paid help I have written down the interview of one of "my favorite" survivors, and written a draft article for the Wikipedia... for reasons that totallz escape me that article was not approved, so here it goes for all those who care....dedicated to all the migrants fleeing their countries who have been destabilized by NATO terrorists undercover of pseudo-islamic organizations.


Ernst Lobethal (Wrocław 6 February 1923 – New York 1 October 2012), aka Ernest Lobet, was a German Jew,. He was a survivor of the Auschwitz-Birkenau concentration camp. The book The Man who Broke into Auschwitz talks extensively about his internment in Auschwitz.

Biography

His father, Rudolf Lobethal, an affluent manager, fled to South Africa with most of the family patrimony. His mother, Freda Silberstine, died shortly after in 1932. He was interned into an orphanage, then entrusted to a foster family and later he lived with his disabled grandmother, that he supported working in a Exhaust Tyre Recycling Factory in 1941-42.
In January 1943 he was deported to Auschwitz in one of the last deportation trains from Breslau.

Experiences in Auschwitz

In Buna-Monowitz he was assigned to a construction commando, but he bought the benevolence of a kapo with the 100 Marks note that he kept hidden in his belt, and managed to get a better job computing statistics in a civilian office.
He casually met a British POW, "Ginger" (Denis Avey) who wrote a letter to Ernst's sister in Birmingham. Two months later he received 10 packs of cigarettes from his sister, and this small patrimony allowed him to improve his standard of life in the camp.

The Death Marches

On 18 January 1945, while the Russians were approaching, he was evacuated in a "death march" to Gleiwitz, some 65 Km away, with 10 thousand people from Buna and 30 thousand from Auschwitz III. Most of the prisoners died of cold and exhaustion along the march. The march lasted 24 hours without any stop. It is estimated that out of the 40-45 thousand who left Auschwitz, only 25 thousand survived the march.
Ernst put himself at the head of the column, knowing that the first to arrive would be the better accommodated. He was then put in a cattle car, without roof, 80 people in a wagon, and moved to Mauthausen, with no food and drinking melted snow along the trip. The Mauthausen camp was full so they where shipped to another camp in Czechoslovakia. During this trip he lost his eyesight - probably for malnutrition. While crossing Czechoslovakia, the local population was tracking the passage of the train and were throwing food to the inmates from the bridges.
In his own words:
"as we were passing these overpasses in Czechoslovakia the passing of the train somehow was being telegraphed from place to place within Czechoslovakia and obviously if you were standing on an overpass the sight that you must have seen must have been something to behold for I don't know how many cattle cars there were but they were all open and inside you had these zebra clad skeletons huddled together listless like cows being slaughtered, being led to the slaughter house and obviously some of these Czechs had come with bread and they threw that from the overpass into the cars. Through our entire trip through Austria where of course you also had lots of overpasses and lots of civilians see what was passing underneath and through our entire trip through Germany after we left Czechoslovakia we would never again receive as much as a slice of bread from any of these Austrians or Germans "

Mittelbau Dora and Mauthausen

At the end of the evacuation he was assigned to work as a bricklayer aid in the tunnels of Mittelbau Dora, the V2 rocket factory built into a mountain. In Mittelbau Dora the work and living conditions were appalling, so he pretended to be a locksmith and was transferred to Mauthausen in February 1945. Out of 6000 inmates only 1500 were alive 6 weeks later, because of the extreme malnutrition.

Liberation and emigration to USA

On 11 April 1945 he survived an Allied bombing of the barracks with incendiary bombs, and manages to escape from the destroyed camp, and joins the USA troops who accommodate him in a hotel in Sondershausen.
He was given a pass to reach Paris, where he earned his life for some months with informal street commerce of G.I. cigarettes. Then he got a job as an taxi stand boy for the American Red Cross.
Eventually he found a sponsor to immigrate to USA where he landed in NY on Labor Day 1 Sept 1947, on the ship Marine Flasher. He immediately had his tattooed lager number removed and he changed his name into Ernest Lobet. He was soon after drafted and sent to fight in Korean War. After meeting his former schoolmate Henry Kamm he decided to go back to college and graduated in Engineering, then in Law. He married and had 3 children.

References


See also


External links

Category:Auschwitz concentration camp survivors



Monday, November 17, 2014

Monitor cpu usage per thread in java...

There is a thread on SO , from which I discovered the TopThreads plugin for JConsole:

http://arnhem.luminis.eu/new_version_topthreads_jconsole_plugin/

jconsole -J-Djava.class.path=C:\Oracle\MIDDLE~1\JDK160~1\lib\jconsole.jar;C:\Oracle\MIDDLE~1\JDK160~1\lib\tools.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\wlfullclient.jar -J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote -pluginpath "c:\pierre\downloads\topthreads-1.1.jar" -debug

in the jconsole output you should see "Plugin class net.luminis.jmx.topthreads.PluginAdapter loaded."

and here you are: AWESOME!!!


Surely you can script it with ThreadJMX MBean, to create a monitoring tool, but this JConsole UI is so nice...

Also great is this trick: run TOP, then SHIFT-H, take the decimal value of the threads who eat more CPU, convert to HEX and match it to the nid in a jstack threadDump
http://code.nomad-labs.com/2010/11/18/identifying-which-java-thread-is-consuming-most-cpu/

JKS: protecting your Private Key with a password

Strangely, Puppet java_ks module doesn't cater for protecting the Private Key with a password. This feature seems to be available only through the Oracle proprietary ImportPrivateKey tool , through the "-keyfilepass" option.

Another tool providing the same functionality is ExtKeyTool, available here .

If you don't need a scripting interface, but are happy with a UI, you can use Keystore Explorer, it' really cool. It allows you very simply to export the Private Key in PKCS#8, PVK or OpenSSL formats. All these formats can be encrypted and protected with a password, to avoid that the PK is stolen. Not necessarily your .key file is protected. Incidentally if your .key file begins with "-----BEGIN RSA PRIVATE KEY-----", it's most likely a OpenSSL file.

Traditionally in the WebLogic world people use the utils.ImportPrivateKey utility; as you see, it supports all: a password-protected key file (-keyfilepass), a password-protected JKS store (-storepass), a password-protected key entry in the JKS Store (-keypass):

cd $DOMAIN_HOME/bin
. ./setDomainEnv.sh
java utils.ImportPrivateKey

Usage: java utils.ImportPrivateKey
        -certfile  -keyfile 
        [-keyfilepass ]
        -keystore  -storepass  [-storetype ]
        -alias  [-keypass ]
        [-help]

Where:
-certfile, -keyfile, -keyfilepass
        certificate and private key files, and the private key password

-keystore, -storepass, -storetype
        keystore file name, password, and type. The default type is JKS.

-alias -keypass
        alias and password of the keystore key entry where the private key
        and the public certificate will be imported. When the key entry
        password is not specified, the private key password will be used
        instead, or when it is not specified either, the keystore password.



In fact, you MUST protect your key with a password in the JKS file, but the .key file needs not to be protected (-keyfilepass can be omitted). The -keypass parameter is the same you provide for "Private Key Passphrase" in the "SSL" configuration of the WebLogic Server. The -storepass corresponds to the "Custom Identity Keystore Passphrase" in the "Keystore" tab of the WLConsole.

Another workaroundish way of doing it is using keytool and going through a pkcs12 keystore:
-importkeystore [-v]
             [-srckeystore ] [-destkeystore ]
             [-srcstoretype ] [-deststoretype ]
             [-srcstorepass ] [-deststorepass ]
             [-srcprotected] [-destprotected]
             [-srcprovidername ]
             [-destprovidername ]
             [-srcalias  [-destalias ]
               [-srckeypass ] [-destkeypass ]]
             [-noprompt]
             [-providerclass  [-providerarg ]] ...
             [-providerpath ]



Just use the -destkeypass option, and -srcstoretype PKCS12 (see this SO post).



Sunday, November 16, 2014

Linux Certification LPIC

Really awesome resource, much better than any other training material seen so far: http://lpic2.unix.nl/index.html

I am considering taking Linux administration certification - there is an amazing amount of tricks I am totally unaware of, much to my shame
More here https://www.lpi.org/linux-certifications/entry-level-credential/linux-essentials

Monday, November 10, 2014

Install puppet modules recursively from a Puppetfile

If you have worked with r10k or puppet-librarian (or even worse, if you have managed Puppet modules manually) you must have realized how pathetic these tools are.

Luckily now Bruno Bieth comes to our rescue with a brilliant Swiss (actually: French!) knife:

https://github.com/backuity/puppet-module-installer

The tool is VERY simple to install (no gem, no ruby, no crap) and it gives you invaluable dependency analysis, consistency checks and graphs that will unveil any dodgy situation in your Puppet module dependencies.



Friday, November 7, 2014

SBConsoleAccessException

I had to start admin on a different machine, and I was getting

com.bea.alsb.console.common.base.SBConsoleAccessException: The current login role is not authorized to use the console action: "/sbSubModules"

The only way I managed to make it work is by replacing DOMAIN_HOME/servers/osbpp1ms2/data/ldap/ with the content of another server:

cd opt/oracle/domains/osbpp1do/servers/osbpp1as/data/
cp -R ldap/ ldapOLD/ 
cp -R /opt/oracle/domains/osbpp1do/servers/osbpp1ms2/data/ldap/* ldap/


Thursday, November 6, 2014

Java: what is your default timezone?

cat MyTimezone.java

import java.util.TimeZone;

public class  MyTimezone {
    public static void main(String[] args) throws Exception {
        TimeZone timeZone = TimeZone.getDefault();
        System.out.println(timeZone);
    }
}


javac MyTimezone.java

java MyTimezone

on one machine I have:

sun.util.calendar.ZoneInfo[id="Europe/Zurich",offset=3600000,dstSavings=3600000,useDaylight=true,
transitions=119,lastRule=java.util.SimpleTimeZone[id=Europe/Zurich,offset=3600000,dstSavings=3600000,
useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,
endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]]


on another machine I have:

sun.util.calendar.ZoneInfo[id="Europe/Vaduz",offset=3600000,dstSavings=3600000,useDaylight=true,
transitions=119,lastRule=java.util.SimpleTimeZone[id=Europe/Vaduz,offset=3600000,dstSavings=3600000,
useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,
endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]]


The second machine has timezone "Europe/Vaduz", and the Oracle DB doesn't recognize it:
SELECT * FROM V$TIMEZONE_NAMES where TZNAME = 'Europe/Vaduz';
nothing!

This explains why your JVM might get in trouble with the Oracle DB and you have to set explicitly the timezone yourself...

See also http://www.javamonamour.org/2014/11/ora-01882-timezone-region-not-found.html

Funnily:
diff /usr/share/zoneinfo/Europe/Vaduz /etc/localtime

diff /usr/share/zoneinfo/Europe/Zurich /etc/localtime


these 2 files are identical.

How does Java determine its default timezone from the Linux machine it's running on?

on RHEL, use redhat-config-date system-config-time timeconfig tzselect

Wednesday, November 5, 2014

ORA-01882: timezone region not found

After applying package update on Linux RHEL, we get on all Datasources:

ORA-01882: timezone region not found

First let's determine on which timezone our server is:

grep "ZONE=" /etc/sysconfig/clock

ZONE="Europe/Zurich"

let's open a connection to our DB and check:

SELECT * FROM V$TIMEZONE_NAMES where TZNAME = 'Europe/Zurich';

Europe/Zurich LMT

Europe/Zurich BMT

Europe/Zurich CET

Europe/Zurich CEST



I think CET is pretty decent...

I can fix the issue in 2 ways:

either I do "export TZ=CET" in my "soa" Linux user profile (.bashrc)

or I set the property in DOMAIN_HOME/bin/setDomainEnv.sh

-Duser.timezone=CET

Either will work.

Small test harness:

cat DBPing.java


import java.sql.DriverManager;
import java.sql.SQLException;

public class DBPing {
        public static void main(String[] args) throws ClassNotFoundException, SQLException {
                Class.forName("oracle.jdbc.driver.OracleDriver");
                System.out.println("length " + args.length);
                String user = args[0];
                String password = args[1];
                String url = args[2];
                String now = new java.util.Date().toString();
                System.out.println(now + " user= " + user + " password=" + password + " url=" + url);
                java.sql.Connection conn = DriverManager.getConnection(url, user, password);
                System.out.println("ok");
        }
}



javac DBPing.java

java -cp /opt/oracle/fmw11_1_1_5/wlserver_10.3/server/lib/ojdbc6.jar:. DBPing acme ********** jdbc:oracle:thin:@mydb.acme.com:1551/s_gr00

length 3
Wed Nov 05 15:41:24 CET 2014 user= acme password=bla
url=jdbc:oracle:thin:@mydb.acme.com:1551/s_gr00
Exception in thread "main" java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
ORA-01882: timezone region not found

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:389)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:382)
        at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:573)
        at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:431)
        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
        at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:366)
        at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:752)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:366)
        at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:538)
        at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:228)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
        at java.sql.DriverManager.getConnection(DriverManager.java:582)
        at java.sql.DriverManager.getConnection(DriverManager.java:185)
        at DBPing.main(DBPing.java:13)


second edition:

import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.TimeZone;

public class DBPing {
        public static void main(String[] args) throws ClassNotFoundException, SQLException {
                TimeZone timeZone = TimeZone.getTimeZone("Europe/Zurich");
                TimeZone.setDefault(timeZone);
                Class.forName("oracle.jdbc.driver.OracleDriver");
                System.out.println("length " + args.length);
                String user = args[0];
                String password = args[1];
                String url = args[2];
                String now = new java.util.Date().toString();
                System.out.println(now + " user= " + user + " password=" + password + " url=" + url);
                java.sql.Connection conn = DriverManager.getConnection(url, user, password);
                System.out.println("ok");
        }
}




by setting the timezone we fix the error...

Setting "oracle.jdbc.timezoneAsRegion=false" in the WebLogic Datasource properties also does the job. This probably is the least impact solution, as it affects only the DB...
CONNECTION_PROPERTY_TIMEZONE_AS_REGION

static final java.lang.String CONNECTION_PROPERTY_TIMEZONE_AS_REGION

Use JVM default timezone as specified rather than convert to a GMT offset. Default is true. 



Tuesday, November 4, 2014

Book: A Splendid Exchange: How Trade Shaped the World



This is a very enjoyable book, showing how trade shaped history, from Phoenician times to http://en.wikipedia.org/wiki/Zheng_He, Marco Polo, the British pirates and the http://en.wikipedia.org/wiki/Dutch_East_India_Company...

The only drawback is that it covers too many subjects, and finally none in a very specialized form. And of course his positive view of modern trade is totally delusional, and doesn't take into account the immense toll on environment.