|
From: <php...@li...> - 2007-11-01 15:33:38
|
Hi there!
Running (the otherwise excellent) php-java-bridge-4.1.8 I encountered a bug=
.
I had the following java-class structure
Class A
Class B extends A
>From php I referenced a remote EJB and called a method with the
following signature:
public A getA();
Where the method in fact returns an instance of class B.
In php I then tried to figure out whether it was an instance of Class
A or B by using
java_instance_of:
$obj =3D $bean->getA();
$clazz =3D new JavaClass("org.test.B");
if ($clazz instanceof Java && java_instanceof($address, $clazz)){
//...
} else {
//...
}
However, this raised a LinkageException on the JVM, claiming that
Class B already was loaded by the classloader.
If "$clazz =3D new JavaClass("org.test.B");" was performed before
"$bean->getA();" everything worked out fine, so I figured that
something was buggy in the dynamic classloading scheme.
I've attached a patch to the DynamicJavaBridgeClassLoader which
addresses this, by checking findLoadedClass(name) before
doLoadClass(name) but after verifying that it isn't in the cache.
/Sincerely
P-a B=E4ckstr=F6m
Sweden
|