Thursday, December 31, 2015 Server chose unsupported or disabled protocol: SSLv3

If you get this error message " Server chose unsupported or disabled protocol: SSLv3",
chances are that your JVM, for vulnerability issues connected to SSLv3, is configured to disable this protocol.
If you REALLY need to support SSLv3, check which file you are using for, then edit yourfile and make sure your property:
jdk.tls.disabledAlgorithms=SSLv3, DH keySize < 768
doesn't contain SSLv3 (make it jdk.tls.disabledAlgorithms=DH keySize < 768)

Monday, December 21, 2015

Struts 1.2 in WebLogic 12.1.3, german characters encoding issue

"As of WebLogic Server 12.1.3, the default value of the encoding element for the jsp-descriptor element in weblogic.xml is UTF-8 for JSP pages. Prior to WebLogic Server 12.1.3, the default value for JSP encoding was ISO-8859-1."
If you have issues
1) Add <%@ page contentType="text/html;charset=UTF-8" %> line on top of every jsp page. 

 2) Add 

 In pom.xml  

 3) Add 
 In web.xml 

 4) Add 
 <jsp-property-group > 
 </jsp-config> in web.xml – 

5) Add <constant name="struts.i18n.encoding" value="UTF-8"/> In struts-config.xml 

 6) change text encoding to UTF-8 in the properties file. 

7) Add the below to your weblogic.xml.


(see oracle Support "Default JSP Encoding Changed to UTF-8 (Doc ID 2053210.1)" )

(it should be ISO8859-1, not ISO8859_1)

Also, to determine which encoding you are actually using, check in your html for "<meta http-equiv="content-type" content="text/html; charset=utf-8" /> " . And in the browser (IE in my case) you have a menu "view-encoding"...

Friday, December 18, 2015

Umlaut in emails

If in an email you see f�r instead of für, chances are that your weblogic/JavaMail is not using the right encoding (presumably UTF-8)

You can try several options:

change the template to use escaped (HTML) charachers
see :
message.setText(text, "UTF-8");

Tuesday, December 15, 2015

org.eclipse.persistence.indirection.IndirectSet locking

one has to be careful with Lazy loading of entities (i.e. INDIRECTION)

in fact the getDelegate() code contains a synchronized clause, so one can easily end up in a series of blocked threads like the one below waiting on lock 0x0000000785157eb8 :

"[STUCK] ExecuteThread: '33' for queue: 'weblogic.kernel.Default (self-tuning)'" daemon prio=10 tid=0x00007f93100206f0 nid=0x17fc waiting for monitor entry [0x00007f9384ecb000]
   java.lang.Thread.State: BLOCKED (on object monitor)
 at org.eclipse.persistence.indirection.IndirectSet.getDelegate(
 - waiting to lock <0x0000000785157eb8> (a org.eclipse.persistence.indirection.IndirectSet)
 at org.eclipse.persistence.indirection.IndirectSet.hashCode(
 at java.util.WeakHashMap.hash(
 at java.util.WeakHashMap.getEntry(
 at java.util.WeakHashMap.containsKey(
 at org.apache.commons.lang.builder.ToStringStyle.isRegistered(
 at org.apache.commons.lang.builder.ToStringStyle.appendInternal(
 at org.apache.commons.lang.builder.ToStringStyle.append(
 at org.apache.commons.lang.builder.ToStringBuilder.append(
 at org.apache.commons.lang.builder.ReflectionToStringBuilder.appendFieldsIn(
 at org.apache.commons.lang.builder.ReflectionToStringBuilder.toString(
 at org.apache.commons.lang.builder.ReflectionToStringBuilder.toString(
 at org.apache.commons.lang.builder.ReflectionToStringBuilder.toString(

"[STUCK] ExecuteThread: '50' for queue: 'weblogic.kernel.Default (self-tuning)'" daemon prio=10 tid=0x00007f931003e400 nid=0x2d37 runnable [0x00007f9371cf9000]
   java.lang.Thread.State: TIMED_WAITING (parking)
 at sun.misc.Unsafe.park(Native Method)
 at java.util.concurrent.locks.LockSupport.parkNanos(
 at org.eclipse.persistence.logging.JavaLog.internalLog(
 at org.eclipse.persistence.logging.JavaLog.log(
 at org.eclipse.persistence.internal.sessions.AbstractSession.log(
 at org.eclipse.persistence.internal.sessions.AbstractSession.log(
 at org.eclipse.persistence.internal.sessions.AbstractSession.log(
 at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(
 at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(
 at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(
 at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(
 at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(
 - locked <0x00000007811573d8> (a org.eclipse.persistence.internal.indirection.QueryBasedValueHolder)
 at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(
 at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiate(
 at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(
 - locked <0x0000000785157ee8> (a org.eclipse.persistence.internal.indirection.UnitOfWorkQueryValueHolder)
 at org.eclipse.persistence.indirection.IndirectSet.buildDelegate(
 at org.eclipse.persistence.indirection.IndirectSet.getDelegate(
 - locked <0x0000000785157eb8> (a org.eclipse.persistence.indirection.IndirectSet)
 at org.eclipse.persistence.indirection.IndirectSet.hashCode(
 at java.util.WeakHashMap.hash(
 at java.util.WeakHashMap.getEntry(
 at java.util.WeakHashMap.containsKey(

My 2 cents: LAZY loading should NOT be really the default, unless you REALLY have performance issues (I know, EclipseLink site says the opposite). The effect of loading an object ANYWHERE in your code, while you are for instance in the middle of doing logging, can be really disruptive.

Monday, December 14, 2015

Online Java Thread Dump Analyzer

simple and cool.... it's just what you need in 95% of the cases

Friday, December 11, 2015

Java Mission Control JMC video training

Very good overall coverage of JMC features


in recent (>= 12.1.2 ) versions of WLS, as stated in Oracle Doc ID 1624363.1:
"In production mode of WLS 12.1.2, the full Java exception stack trace is not returned to the ejb caller when an exception is thrown."
so all you get on the client is a "weblogic.utils.StackTraceDisabled.unknownMethod()"
Just add -Dweblogic.PrintStackTraceInProduction=true (I guess both on the client and on the server, if they are on different WLS instances...)

Sunday, December 6, 2015

Debugging SSL with

This is a guide to interpreting the output of
and this is what I get
by running this code with args[0] (code courtesy of the excellent book "Java Network Programming, 4th Edition" that I highly recommend reading)


public class HTTPSClient {

  public static void main(String[] args) {

    if (args.length == 0) {
      System.out.println("Usage: java HTTPSClient2 host");

    int port = 443; // default https port
    String host = args[0];

    SSLSocketFactory factory
        = (SSLSocketFactory) SSLSocketFactory.getDefault();
    SSLSocket socket = null;
    try {
      socket = (SSLSocket) factory.createSocket(host, port);

      // enable all the suites
      String[] supported = socket.getSupportedCipherSuites();

      Writer out = new OutputStreamWriter(socket.getOutputStream(), "UTF-8");
      // https requires the full URL in the GET line
      out.write("GET http://" + host + "/ HTTP/1.1\r\n");
      out.write("Host: " + host + "\r\n");

      // read response
      BufferedReader in = new BufferedReader(
          new InputStreamReader(socket.getInputStream()));

      // read the header
      String s;
      while (!(s = in.readLine()).equals("")) {

      // read the length
      String contentLength = in.readLine();
      int length = Integer.MAX_VALUE;
      try {
        length = Integer.parseInt(contentLength.trim(), 16);
      } catch (NumberFormatException ex) {
        // This server doesn't send the content-length
        // in the first line of the response body

      int c;
      int i = 0;
      while ((c = != -1 && i++ < length) {

    } catch (IOException ex) {
    } finally {
        try {
          if (socket != null) socket.close();
        } catch (IOException e) {}

Friday, December 4, 2015


When creating an array, remember that it will be not of the type declared for the variable, but of the type decided in the initializer:

public class ArrayStoreExceptinTest {
 public static void main(String[] args) {

  // test 1: all ok

  Object[] myarray1 = new Object[2];
  System.out.println("myarray1 " + myarray1.getClass().getName());
  myarray1[0] = new Integer(0);
  myarray1[1] = new String("");
  myarray1[1] = new Integer(0);

  // test 2: fails with java.lang.ArrayStoreException
  try {
   Object[] myarray2 = new String[2];
   System.out.println("myarray2 " + myarray2.getClass().getName());
   myarray2[0] = new Integer(0);
  } catch (Exception e) {

  // test 3: all ok
  Animal[] myarray3 = new Animal[] { new Cat(), new Dog() };
  System.out.println("myarray3 " + myarray3.getClass().getName());
  myarray3[0] = new Dog();

  try {
   // test 4: fails with java.lang.ArrayStoreException
   Animal[] myarray4 = new Cat[] { new Cat(), new Cat() };
   System.out.println("myarray4 " + myarray4.getClass().getName());
   myarray4[0] = new Dog();
  } catch (Exception e) {


interface Animal {


class Dog implements Animal {


class Cat implements Animal {


this is the output:

myarray1 [Ljava.lang.Object;
myarray2 [Ljava.lang.String;
java.lang.ArrayStoreException: java.lang.Integer
 at ArrayStoreExceptinTest.main(
myarray3 [LAnimal;
myarray4 [LCat;
java.lang.ArrayStoreException: Dog
 at ArrayStoreExceptinTest.main(

so if you initialize an Animal[] as a Cat[], you can't assign to a member a variable of type Dog, even if a Dog is an Animal...