Folks,

I have a simple stateless SessionBean packaged in a jar file. I cannot seem
to look up the bean ref via JNDI.

The ejb-jar.xml file looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>

<ejb-jar>
  <enterprise-beans>
    <session>
      <ejb-name>OrganisationListBean</ejb-name>

<home>uk.co.landmark.contactmanager.server.organisation.ejb.OrganisationList
Home</home>

<remote>uk.co.landmark.contactmanager.server.organisation.ejb.OrganisationLi
st</remote>

<ejb-class>uk.co.landmark.contactmanager.server.organisation.ejb.Organisatio
nListBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
    </session>
  </enterprise-beans>
</ejb-jar>



The jboss.cml file looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<jboss>
  <enterprise-beans>
     <session>
       <ejb-name>OrganisationListBean</ejb-name>
       <jndi-name>OrganisationList</jndi-name>
     </session>
  </enterprise-beans>
</jboss>



The lookup code is:

    // Set up the naming provider; this may not always be necessary,
depending
    // on how the system is configured.
    Properties env = new Properties();
    env.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
    env.setProperty("java.naming.provider.url",     "localhost:1099");
    env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");

    try
    {
      // Get a naming context
      logger.info("Getting initial context");
      InitialContext initialContext = new InitialContext();
      logger.info("Got initial context");

      logger.info("looking up object");
      String className = (String) initialContext.lookup("OrganisationList");
      logger.info("found object");
    }
    catch (NamingException ex)
    {
      logger.error("Failed to establish initial context", ex);
      throw new NotFoundException("Failed to establish initial context",
ex);
    }

(logger is a Log4j Category object)

The jboss trace is:

[] Getting initial context
[] Got initial context
[] looking up object


and then nothing more is displayed....



Any ideas what I am doing wrong here?

(As an aside, how can I persuade log4j to put the class name between the
square brackets?)


Thanks in advance - Adam.






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

Reply via email to