"env not bound" when deploying session bean - how to bind JN
hrdill May 10, 2004 10:46 AMI am deploying a simple EJB, building using xdoclet, snippets of which follow:
public class TopicSenderEJB extends BaseStatelessSessionEJB { /** * @ejb.bean * name="TopicSenderEJB" * jndi-name="ejb/TopicSenderEJB" * local-jndi-name="ejb/local/TopicSenderEJB" * type="Stateless" * view-type="local" * * @ejb.transaction * type="Supports" * * @ejb.util * generate="logical" */ .... /** * ejbCreate() * * @ejb.create-method * * @ejb.transaction * type="Required" */ public void ejbCreate() throws CreateException { Context context = null; try { context = new InitialContext(); m_topic = (Topic)context.lookup("java:jms/TestTopic"); TopicConnectionFactory connectionFactory = (TopicConnectionFactory)context.lookup("jms/TopicConnectionFactory"); m_topicConnection = connectionFactory.createTopicConnection(); } catch(Exception e) { throw new CreateException(e.getMessage()); } }
Which generates the following in jboss.xml:
<session> <ejb-name>TopicSender</ejb-name> <jndi-name>TopicSender</jndi-name> <local-jndi-name>TopicSenderLocal</local-jndi-name </session>
and the following names in TopicSenderHome.java:
public static final String COMP_NAME="java:comp/env/ejb/TopicSender"; public static final String JNDI_NAME="TopicSender";
This final bit becomes troublesome when I deploy the bean; I get the following:
24626 [main] ERROR com.authentica.jmstest.TopicMessagingService - Could not create TopicSender; exception in TopicSenderLocalHome.create()
24657 [main] ERROR org.jboss.deployment.MainDeployer - could not create deployment: file:/C:/Programming/jboss/jmstest/server/default/tmp/deploy/tmp65483jmstes
t.ear-contents/jmstest-service.sar
org.jboss.deployment.DeploymentException: create operation failed for package file:/C:/Programming/jboss/jmstest/server/default/tmp/deploy/tmp65483jmstest.ear-c
ontents/jmstest-service.sar; - nested throwable: (org.jboss.deployment.DeploymentException: Could not create TopicSender.env not bound; - nested throwable: (jav
a.lang.RuntimeException: Could not create TopicSender.env not bound))
at org.jboss.deployment.SARDeployer.create(SARDeployer.java:202)
at org.jboss.deployment.MainDeployer.create(MainDeployer.java:786)
at org.jboss.deployment.MainDeployer.create(MainDeployer.java:778) etc...
Why is "env" not bound, and how can I remedy this? I was unable to find much in the JNDI documentation about binding specific namespaces before an EJB is deployed.
-HDill