Friday, November 25, 2016

UseSunHttpHandler

I am curious about this property -DUseSunHttpHandler=true, according to Oracle, it's all about which Stack is used to handle SSL (JSSE), Java or WebLogic:
"by setting UseSunHttpHandler, it is using the JSSE classes supplied by the JDK rather than the Weblogic classes. This means that such properties as -Dweblogic.security.SSL.ignoreHostnameVerification=true do not apply "
The property influences also how WebServices invokations are done.
For Web Services, there is also the property welogic.wsee.usesunhttphandler : see document "How to Use Sun.net.www.protocol.http.Handler for a Certain Web Service Request (Doc ID 1518346.1)"
However, I could not find a clear documentation about what the flag would really affect.

Multitenancy in WebLogic Server 12.2.1

Excellent presentation here:



Official documentation is here:

https://docs.oracle.com/middleware/1221/wls/WLSMT.pdf



Saturday, November 12, 2016

git sucks (I HAD to say it one day)

I am an occasional GIT user and it really, really gets on my nerve how difficult it is to do anything even basic, that with SVN I could do in a much more predictable way.

I have already lost on several occasions my work - and no clue what I have done wrong, and I didn't even receive any warning while GIT was destroying my files. I have worked 20 years with SVN CVS and the such, I have NEVER lost any work. With GIT it has already happened twice in a few months. VANISHED.

I understand that GIT is EXTREMELY powerful, but my life is short and I don't have the time to become a master before I can simply do some basic check-in check-out. Just provide me with a simple set of commands that work predictably under all circumstances, and leave the advanced stuff to the PRO.

Not to mention that I have struggled half an hour just to put together a .gitignore (that still doesn't do what I expected) or to change the color scheme (in vain, my commands are simply ignored).

This is a powerful, professional RANT against the tool, I don't understand all the details but mostly agree:
https://stevebennett.me/2012/02/24/10-things-i-hate-about-git/

Also this reading is very good http://merrigrove.blogspot.ch/2014/02/why-heck-is-git-so-hard-places-model-ok.html

This also is a good RANT https://www.reddit.com/r/programminghorror/comments/4qsywz/rant_git_sucks/?st=ivgje58g&sh=7143e0e2

I have probably spent a good week trying to educate myself over GIT, but I still feel totally scared by its hocus pocus. It's simply too complex to rely entirely on a command-line interface. Do yourself a favor: use only a visual interface to it.


Friday, November 11, 2016

verbose:class not tracing the classloader

If you start the jvm with "java -verbose:class" you get this stuff:

[Opened c:\pippo\wl12.1\oracle_common\modules\endorsed\javax-xml-bind.jar]
[Opened c:\pippo\wl12.1\oracle_common\modules\endorsed\javax-xml-ws.jar]
[Opened c:\pippo\wl12.1\oracle_common\modules\endorsed\jsr250-api.jar]
[Opened c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.Object from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.io.Serializable from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.Comparable from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.CharSequence from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.String from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.reflect.GenericDeclaration from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.reflect.Type from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.reflect.AnnotatedElement from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.Class from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.Cloneable from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.ClassLoader from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.System from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.Throwable from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.Error from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.ThreadDeath from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.Exception from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.RuntimeException from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.security.ProtectionDomain from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.security.AccessControlContext from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.ReflectiveOperationException from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.ClassNotFoundException from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.LinkageError from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.NoClassDefFoundError from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.ClassCastException from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.ArrayStoreException from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.VirtualMachineError from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.OutOfMemoryError from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]
[Loaded java.lang.StackOverflowError from c:\pippo\java\jdk170_101-64b\jre\lib\rt.jar]


but this is not enough to discover nasty classloader issues. I have searched the Planet but apparently there is no way to print also the classloader without with Java OOTB.

This is a lot better:

https://blogs.oracle.com/sundararajan/entry/tracing_class_loading_1_5

and I copy the code here just in case:

import java.lang.instrument.*;

import java.security.*;

 

public class ClassLoadTracer {

    public static void premain(String agentArgs, Instrumentation inst) {

         final java.io.PrintStream out = System.out;

         inst.addTransformer(new ClassFileTransformer() {

             public byte[] transform(ClassLoader loader, String className, Class classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {

                 out.print(className + " loaded by " + loader + " at " + new java.util.Date());

                 out.println(" in " + protectionDomain);
// dump stack trace of the thread loading class
//        Thread.dumpStack();

                 // we just want the original .class bytes to be loaded!
                 // we are not instrumenting it...
                 return null;
             }
         });
    }
}

 



and you get this:


sun/launcher/LauncherHelper loaded by null at Fri Nov 11 10:48:52 CET 2016 in null

sun/nio/cs/MS1252 loaded by null at Fri Nov 11 10:48:52 CET 2016 in null

sun/nio/cs/SingleByte loaded by null at Fri Nov 11 10:48:52 CET 2016 in null

sun/nio/cs/SingleByte$Decoder loaded by null at Fri Nov 11 10:48:52 CET 2016 in null

java/lang/Package loaded by null at Fri Nov 11 10:48:52 CET 2016 in null

weblogic/Server loaded by sun.misc.Launcher$AppClassLoader@2792e317 at Fri Nov 11 10:48:52 CET 2016 in ProtectionDomain  (file:/c:\pippo\wl12.1/wlserver/modules/features/weblogic.server.merged.jar <no signer certificates>)
sun.misc.Launcher$AppClassLoader@2792e317
<no principals>
java.security.Permissions@54a01a10 (
("java.lang.RuntimePermission" "exitVM")
("java.io.FilePermission" "\c:\pippo\wl12.1\wlserver\modules\features\weblogic.server.merged.jar" "read")
)

java/lang/Void loaded by null at Fri Nov 11 10:48:52 CET 2016 in null

utils/ValidateJavaEE6EndorsedOverrides loaded by sun.misc.Launcher$AppClassLoader@2792e317 at Fri Nov 11 10:48:52 CET 2016 in ProtectionDomain  (file:/c:\pippo\wl12.1/wlserver/modules/features/weblogic.server.merged.jar <no signer certificates>)
sun.misc.Launcher$AppClassLoader@2792e317
<no principals>
java.security.Permissions@54a01a10 (
("java.lang.RuntimePermission" "exitVM")
("java.io.FilePermission" "\c:\pippo\wl12.1\wlserver\modules\features\weblogic.server.merged.jar" "read")
)

weblogic/security/utils/SecurityUtils loaded by sun.misc.Launcher$AppClassLoader@2792e317 at Fri Nov 11 10:48:52 CET 2016 in ProtectionDomain  (file:/c:\pippo\wl12.1/wlserver/modules/features/weblogic.server.merged.jar <no signer certificates>)
sun.misc.Launcher$AppClassLoader@2792e317
<no principals>
java.security.Permissions@54a01a10 (
("java.lang.RuntimePermission" "exitVM")
("java.io.FilePermission" "\c:\pippo\wl12.1\wlserver\modules\features\weblogic.server.merged.jar" "read")
)

java/security/Security loaded by null at Fri Nov 11 10:48:52 CET 2016 in null

java/security/Security$1 loaded by null at Fri Nov 11 10:48:52 CET 2016 in null

java/util/Properties$LineReader loaded by null at Fri Nov 11 10:48:52 CET 2016 in null

sun/security/util/PropertyExpander loaded by null at Fri Nov 11 10:48:52 CET 2016 in null

sun/net/ProgressMonitor loaded by null at Fri Nov 11 10:48:52 CET 2016 in null

sun/net/DefaultProgressMeteringPolicy loaded by null at Fri Nov 11 10:48:52 CET 2016 in null

sun/net/ProgressMeteringPolicy loaded by null at Fri Nov 11 10:48:52 CET 2016 in null

weblogic/security/SecurityLogger loaded by sun.misc.Launcher$AppClassLoader@2792e317 at Fri Nov 11 10:48:52 CET 2016 in ProtectionDomain  (file:/c:\pippo\wl12.1/wlserver/modules/features/weblogic.server.merged.jar <no signer certificates>)
sun.misc.Launcher$AppClassLoader@2792e317
<no principals>
java.security.Permissions@54a01a10 (
("java.lang.RuntimePermission" "exitVM")
("java.io.FilePermission" "\c:\pippo\wl12.1\wlserver\modules\features\weblogic.server.merged.jar" "read")
)



The protection domain info is way too verbose, and probably you want to be able to control/filter better the output, otherwise it gets really too verbose.... but this seems to be really a big step forward...

You can use multiple agents:

http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/instrument/package-summary.html

 

On JVMs with a command-line interface, agents are specified by adding 
this switch to the JVM command-line:

-javaagent:jarpath[=options]

jarpath is the path to the agent JAR file. options is the agent options. 
This switch may be used multiple times on the same command line,
thus creating multiple agents. More than one agent may use the same jarpath.



Wednesday, November 2, 2016

Not only Java. my first (and last) experience with Airbnb

Driven more by the desire of a personal challenge, than by the lust for money, I have put on Airbnb a room for a short (10 days) period. I was really determined to treat my guest in a very friendly manner, and make his experience a pleasant one. So I spent the weekend cleaning carefully the house, biking 30 Km to IKEA to buy some extra furniture, then to ALDI and buy extra bedsheet and towels. On the whole, a lot of sweat just to get things ready.

The guy arrives, half an hour late (being half Swiss, I can't possibly conceive being 5 minutes late without at least call and beg for pardon... .half an hour for me is unconceivable...). We exchange a short conversation where I try to make him feel welcome, he seem a bit reserved so I leave him alone. The guy is from New York, then moved to California. I have worked in both places, I thought it would be a good subject for conversation, I was wrong. I even offer him to use my bicycle to make him feel that I am there to help, but he really stays very reserved.

The day after, he sends me 8 frantic message at office (I was in the middle of some production issues, so it was quite stressful to have to answer his insistent emails) complaining that there was no hot water. Well, I have lived for years without running hot water, one can easily heat some water on the stove.... no, he seems to find this experience as DRAMATIC. I decide to give him 2 days rent back just to appease him for the lack of hot water for 2 days (root cause: some unexpected maintenance work in the heating system). He grabs the money without any hesitation. I would have said "never mind, it's not your fault". He just took the money and not even said thanks.

For the rest of the time, he hardly says hello. On the first days, he leaves the WC in a pitiful state, and I have to work very hard to clean it... but again, I don't complain, I want my guest to be happy. But his total lack of communication (only emails) really makes me nervous. I start really repenting for having put myself in this situation, of sharing my house with a total stranger who wants to remain such.

Then on the day of departure I ask him to leave with me at 8.30 in the morning, because I am very afraid that he might forget the key, and I offer him again an extra day of rent for compensation. So in total he pays 230 CHF for 10 days in Zurich, while on average Airbnb hosts charge you 800.

AFTER he left, I receive this review:

I wouldn't ask anyone for their passport information.
Buy an Iron for people to iron their clothes. Checking out early in the morning isn't ideal for most people.
I would say assume that you will have nothing but female travelers so your bathroom has to be spotless.
Have a dresser or something where people can unpack and put their clothes in during their stay.
It will make them feel more at home.”

Your guest suggested that your space could be cleaner in the following areas: Bathroom Shower


I was totally shocked: for 23 CHF a day in Zurich the guy expects room service and 5 star hotel. He simply ignores the CRAP that he left in the WC and expects me to be fully at his service. Then he even complains for the early checkout even if I have given him a full day compensation for it.

I am sorry, never again. I understand that being a host takes really a lot of patience - I have very little, I can't stand arrogant people. And stingy miserable shameless misers, who want only to receive without giving anything.

I have found this article http://www.airbnbhell.com/last-straw-tired-airbnb-host/ describing quite well my experience "In the early days, there were sweet guests who brought gifts, followed the rules and genuinely wanted to get to know the person they were living with or living under. Over time though, guests seem to be more driven by finding cheap accommodations and the demands are ever increasing. "

PS I have nothing against AirBNB, it's a wonderful platform, very user-friendly and amazingly functional. They are not responsible if some people are a pain in the bass.