Monday, August 31, 2015

java.lang.NoSuchMethodError: weblogic.rmi.internal.MethodDescriptor.

The full error message is: java.lang.NoSuchMethodError: weblogic.rmi.internal.MethodDescriptor.(Ljava/lang/reflect/Method;Ljava/lang/Class;ZZZZII)V and this can happen if you use in WL 12 an EJB client stub generated by WL 10.3.5 (I think the issue is not there if the stub is generated by 10.3.6).

Simply said, the MethodDescriptor constructors have been changed in WebLogic and that specific one has been removed.

In wl12 the class is packaged in wlthint3client.jar, weblogic.server.merged.jar, com.bea.core.weblogic.rmi.client_4.0.0.0.jar , com.oracle.webservices.wls.jaxrpc-client.jar, com.oracle.webservices.wls.jaxws-wlswss-client.jar

You have only 2 solutions: either to use a wlfullclient.jar from the previous release of WL, or to regenerate the stub with WL12 appc.

see also http://stackoverflow.com/questions/25630220/oracle-iam-platform-utils-nosuchserviceexception-java-lang-reflect-invocationt/32314398#32314398 and https://liujinyao.wordpress.com/2015/05/11/java-lang-nosuchmethoderror-weblogic-rmi-internal-methoddescriptor-ljavalangreflectmethodljavalangclasszzzziiv/

As mentioned by Özkan Pakdil in the comment, it's much simpler to "delete *******_stub.class from client jar and deploy the ear that way so at the end wl12 generates it on the fly"

Thursday, August 27, 2015

Java Decompilers

http://jd.benow.ca/ this one is really excellent! Code available here https://github.com/java-decompiler/jd-gui

I have also used several times http://www.javadecompilers.com/ this online decompiler (CFR version) and it's pretty cool.

See also my old post here

Monday, August 24, 2015

Traumatic upgrade to Windows 10

I deeply, deeply fear Microsoft so I have postponed the upgrade. But curiosity is human and I caved in...
Much to my surprise the update worked, but after the update nothing was working :o)) ... everything was just "not responding".
Finally I restarted, opened powershell as administrator (it took me ages just to do that, as nothing was working) and pasted this command
Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
Surprisingly, things seem to work much better. However if I could go back in time I would NOT upgrade... who knows what other surprises are still waiting me....

Sunday, August 23, 2015

Awesome WebLogic presentations on Slideshare

Looking for a presentation on WebLogic I found out very precious and professional material on Slideshare.... much better than many books...

WebLogic in Practice: SSL Configuration

many useful keytool/openssl commands illustrated Oracle WebLogic Server Basic Concepts a bit outdated but excellent

Oracle WebLogic Diagnostics & Perfomance tuning

12 Things About WebLogic 12.1.3 #oow2014 interesting stuff



Sunday, August 9, 2015

Sample code to test an object monitor

package com.pierre;

public class LockGeneration {
 public static Object myMonitor = new Object();

 public static void main(String[] args) throws InterruptedException {
  T1 t1 = new T1();
  T2 t2 = new T2();
  t1.start();
  t2.start();
  for (;;) {
   Thread.sleep(1000);
  }
 }

}

class T1 extends Thread {

 @Override
 public void run() {
  System.out.println("T1 started");
  super.run();
  for (;;) {
   try {
    synchronized (LockGeneration.myMonitor) {
     Thread.sleep(1030);
    }
    Thread.sleep(10);
   } catch (InterruptedException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
  }
 }

}

class T2 extends Thread {

 @Override
 public void run() {
  System.out.println("T2 started");
  super.run();
  for (;;) {
   try {
    synchronized (LockGeneration.myMonitor) {
     Thread.sleep(1050);
    }
    Thread.sleep(10);
   } catch (InterruptedException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
  }
 }

}


a thread dump will show for instance:

"Thread-1" prio=6 tid=0x000000001b9be000 nid=0x3c4c waiting for monitor entry [0x000000001c57f000]
   java.lang.Thread.State: BLOCKED (on object monitor)
 at com.pierre.T2.run(LockGeneration.java:48)
 - waiting to lock <0x0000000755ecf6b0> (a java.lang.Object)

   Locked ownable synchronizers:
 - None

"Thread-0" prio=6 tid=0x000000001b9bd000 nid=0x513c waiting on condition [0x000000001c47f000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
 at java.lang.Thread.sleep(Native Method)
 at com.pierre.T1.run(LockGeneration.java:27)
 - locked <0x0000000755ecf6b0> (a java.lang.Object)

   Locked ownable synchronizers:
 - None



so the thread (T1 in this case) holding the lock on the object monitor will show "locked < OBJECT ID > " (the TD shows also the TYPE of the lock, a java.lang.Object)

the thread T1 when sleeping will be in TIMED_WAITING (= wait for on a notification but with a timeout), and waiting on condition

the thread T2 waiting to acquire the lock will be in BLOCKED (on object monitor) and waiting to lock <0x0000000755ecf6b0> (which is the same OBJECT ID held by T1.