This content has been marked as final.
Show 1 reply
-
1. Re: Still having problems with java:comp/env lookups
waynebaylor Dec 26, 2007 3:30 PM (in response to emsa)ejb-jar.xml declares the ejbs and the jboss.xml maps them to their global jndi name.
ejb-jar.xml:<ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"> <enterprise-beans> <session> <ejb-name>MyBean</ejb-name> <local>com.example.MyLocal</local> <ejb-class>com.example.MyBean</ejb-class> </session> </enterprise-beans> </ejb-jar>
jboss.xml:<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd"> <jboss> <enterprise-beans> <session> <ejb-name>MyBean</ejb-name> <local-jndi-name>com.example.MyBean/local</local-jndi-name> </session> </enterprise-beans> </jboss>
with these you can use the following to look up the ejb:MyLocal bean = (MyLocal)new InitialContext().lookup("com.example.MyBean/local");