We've a java class that creates a stateful ejb in its constructor and removes it in its finalize method. It works fine in weblogic. Removal does not work in Jboss 4.0.4. The remove call gives this exception:
java.lang.NullPointerException
at org.jboss.invocation.MarshalledValueInputStream.resolveClass(MarshalledValueInputStream.java:101)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
...
...
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
at $Proxy436.remove(Unknown Source)
The remove call works OK if it's called from a method other than finalize.
Is there a way to make it work in finalize method?