[jboss-dev-forums] [Design of EJB 3.0] - JNDI Binding and ejbcontext test

adrian@jboss.org do-not-reply at jboss.com
Tue Nov 13 14:33:54 EST 2007


The ejbcontext test is failing because it binds the remote proxy at /Stateless
but then wants to bind the home in a subcontext /Stateless/home

The /Stateless jndi binding can't be both a binding and a naming context. ;-)

The same is true for the Stateful bean in this test.

But this brought up an issue, where the already succesful bindings are not removed
from jndi, even though the deployment has failed.


  | 
  |    public void start() throws Exception
  |    {
  |       init();
  | 
  |       super.start();
  |       Class[] interfaces = {ProxyFactory.class};
  |       String targetId = getTargetId();
  |       String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
  |       Object factoryProxy = createPojiProxy(targetId, interfaces, clientBindUrl);
  |       log.debug("Binding proxy factory for " + container.getEjbName() + " in JNDI at " + jndiName + PROXY_FACTORY_NAME + " with client bind url " + clientBindUrl);
  |       try
  |       {
  | 
  | // OK
  | 
  |          Util.rebind(container.getInitialContext(), jndiName + PROXY_FACTORY_NAME, factoryProxy);
  |       }
  |       catch (NamingException e)
  |       {
  |          NamingException namingException = new NamingException("Could not bind stateful remote proxy with ejb name " + container.getEjbName() + " into JNDI under jndiName: " + container.getInitialContext().getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
  |          namingException.setRootCause(e);
  |          throw namingException;
  |       }
  |       assert !Dispatcher.singleton.isRegistered(targetId) : targetId + " is already registered";
  |       Dispatcher.singleton.registerTarget(targetId, this);
  | 
  |       StatefulContainer statefulContainer = (StatefulContainer) container;
  |       RemoteHome remoteHome = (RemoteHome) statefulContainer.resolveAnnotation(RemoteHome.class);
  |       if (remoteHome != null && !bindHomeAndBusinessTogether(statefulContainer))
  |       {
  |          Object homeProxy = createHomeProxy(remoteHome.value());
  |          String homeJndiName = ProxyFactoryHelper.getHomeJndiName(container);
  |          log.debug("Binding home proxy at " + homeJndiName);
  | 
  | // OOPS an error doesn't unbind the remote proxy!
  | 
  |          Util.rebind(container.getInitialContext(), homeJndiName, homeProxy);
  |       }
  |    }
  | 
  | 

THIS IS A MEMORY LEAK!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104290#4104290

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104290



More information about the jboss-dev-forums mailing list