Bugs item #432610, was updated on 2001-06-12 17:33
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=432610&group_id=22866

Category: JBossServer
Group: v2.2.2 (stable)
Status: Open
Resolution: None
Priority: 5
Submitted By: Peter L�ffler (pejolo)
Assigned to: Nobody/Anonymous (nobody)
Summary: Cannot activate dynamic proxy instances

Initial Comment:

JBoss is unable to reactivate (stateful) session beans 
with fields containing dynamic proxy instances.
Passivation works fine but on (re)activation I get the
message "Could not activate; nested exception is: 
java.lang.ClassNotFoundException: ..."
Everything works fine when putting all my classes into
the classpath (instead of deploying them into JBoss'
deploy directory).


A simple test case to reproduce this behaviour:

// Helper classes:

public interface A { }

import java.io.Serializable;
public class AImpl implements A, Serializable { }

import java.io.Serializable;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationHandler;
public class AInvocationHandler
    implements InvocationHandler, Serializable {
  private A delegate;
  public AInvocationHandler(A delegate) {
    this.delegate = delegate;
  }
  public Object invoke(Object proxy, Method m,
      Object[] args) throws Throwable {
    return m.invoke(delegate, args);
  }
}

// EJB classes:

import java.rmi.RemoteException;
import javax.ejb.EJBObject;
public interface Test extends EJBObject {
  public void simpleMethod(A a) throws RemoteException;
}

import java.rmi.RemoteException;
import javax.ejb.EJBHome;
import javax.ejb.CreateException;
public interface TestHome extends EJBHome {
  public Test create()
      throws RemoteException, CreateException;
}

import java.util.ArrayList;
import java.rmi.RemoteException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.ejb.CreateException;
public class TestBean implements SessionBean {
  private ArrayList objects;
  public void ejbCreate() throws CreateException {
    objects = new ArrayList();
  }
  public void simpleMethod(A a) {
    objects.add(a);
  }
  public void ejbRemove() { }
  public void ejbActivate() { }
  public void ejbPassivate() { }
  public void setSessionContext(
      SessionContext context) { }
}

// Test client:

import java.lang.reflect.Proxy;
import java.rmi.RemoteException;
import java.util.Properties;
import javax.ejb.CreateException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
public class TestClient {
  public static void main(String[] args)
      throws NamingException, RemoteException,
      InterruptedException, CreateException {
    Properties props = new Properties();
    props.put(
       javax.naming.Context.INITIAL_CONTEXT_FACTORY,
       "org.jnp.interfaces.NamingContextFactory");
    props.put(javax.naming.Context.PROVIDER_URL,
       "localhost:1099");
    InitialContext jndiContext =
        new InitialContext(props);
    TestHome testHome =
        (TestHome) PortableRemoteObject.narrow(
        jndiContext.lookup("Test"), TestHome.class);
    Test test = testHome.create();
    A a = (A) Proxy.newProxyInstance(
        A.class.getClassLoader(),
        new Class[] {A.class},
        new AInvocationHandler(new AImpl()));
    test.simpleMethod(a);
    System.out.println("Waiting for passivation ...");
    Thread.currentThread().sleep(1500000);
    /* REMARK: If you don't want to wait thaaaaat long,
     * change this line into
     * Thread.currentThread().sleep(15000);
     * and choose the following settings for
     * "Standard Stateful SessionBean"
     * in standardjboss.xml:
     * <overager-period>3</overager-period>
     * <max-bean-age>6</max-bean-age>
     * <resizer-period>4</resizer-period>
     */
    System.out.println("... finished");
    test.simpleMethod(a);
  }
}


The interesting part of server.log (with call-logging=
true for stateful session beans) looks like this:

[Default] JBoss 2.2.2 Started in 0m:20s
[Bean Cache] Resized cache for bean Test: old capacity 
 = 1000, new capacity = 50
[Test] create()
[Test] [992386455934] simpleMethod(AImpl@1cfec1)
[Bean Cache] Scheduling for passivation overaged bean
 Test with id = 992386455934 - Cache size = 1
[Bean Cache] Aging out from cache bean Testwith id =
 992386455934; cache size = 1
[Container factory] Scheduled passivation of bean Test
 with id = 992386455934
[Container factory] Passivated bean Test with id =
 992386455934
[Test] [992386455934] simpleMethod(AImpl@6df389)
[Test] Could not activate; nested exception is: 
        java.lang.ClassNotFoundException: A
[Test] java.rmi.NoSuchObjectException: Could not
 activate; nested exception is: 
[Test]  java.lang.ClassNotFoundException: A
[Test]  at org.jboss.ejb.plugins.AbstractInstanceCache
 .get(AbstractInstanceCache.java:173)
[Test]  at org.jboss.ejb.plugins
 .StatefulSessionInstanceInterceptor.invoke(
 StatefulSessionInstanceInterceptor.java:157)
[Test]  at org.jboss.ejb.plugins.LogInterceptor
 .invoke(LogInterceptor.java:195)
[Test]  at org.jboss.ejb.StatefulSessionContainer
 .invoke(StatefulSessionContainer.java:326)
[Test]  at org.jboss.ejb.plugins.jrmp.server
 .JRMPContainerInvoker.invoke(
 JRMPContainerInvoker.java:392)
[Test]  at java.lang.reflect.Method.invoke(
 Native Method)
[Test]  at sun.rmi.server.UnicastServerRef.dispatch(
 UnicastServerRef.java:241)
[Test]  at sun.rmi.transport.Transport$1.run(
 Transport.java:142)
[Test]  at java.security.AccessController.doPrivileged(
 Native Method)
[Test]  at sun.rmi.transport.Transport.serviceCall(
 Transport.java:139)
[Test]  at sun.rmi.transport.tcp.TCPTransport
 .handleMessages(TCPTransport.java:443)
[Test]  at sun.rmi.transport.tcp.TCPTransport
 $ConnectionHandler.run(TCPTransport.java:643)
[Test]  at java.lang.Thread.run(Thread.java:484)


JBoss Version: 2.2.2 (standalone)
Java version: 1.3.0,Sun Microsystems Inc.
Java VM: Java HotSpot(TM) Server VM 1.3.0,
 Sun Microsystems Inc.
System: SunOS 5.7,sparc


Patch coming soon!

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=432610&group_id=22866

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to