I got a chance to look at this today and the problem is that you are not allowed to do ANYTHING in your EJB constructor that requires the container environment. Look at the operations allowed in the methods of a stateless session bean table in the EJB spec. For the bean constructor line there are no operations allowed.
The attempt to lookup the component ENC in the constructor is causing the ENC to be associated with a class loader that is not unique to the EJB and this results in the duplicate binding attempt when the second session bean is deployed. All of your setup work should be done in the ejbCreate() method. xxxxxxxxxxxxxxxxxxxxxxxx Scott Stark Chief Technology Officer JBoss Group, LLC xxxxxxxxxxxxxxxxxxxxxxxx ----- Original Message ----- From: "Keith Kee" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 18, 2001 8:39 AM Subject: [JBoss-user] javax.naming.NameAlreadyBoundException; remaining name 'env' > Hi: > I wonder if anyone is encountering the same problem as I do. I have 2 > EJBs in an application, and one of them makes a jndi look up in the > constructor as shown: > > package com.example; > > import java.rmi.RemoteException; > import javax.ejb.*; > > import javax.naming.InitialContext; > > > public class ExampleMainEJB implements SessionBean { > > public ExampleMainEJB () { > try { > InitialContext c=new InitialContext(); > System.err.println("Initial context:"+c); > System.err.println("lookup:"+c.lookup("java:comp/env/blah")); > } catch (Exception e) { > System.err.println("Exception:"+e); > } > } > public void ejbCreate() {} > public void ejbRemove() {} > public void ejbActivate() {} > public void ejbPassivate(){} > public void setSessionContext(SessionContext sc) {} > } > > _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user