Hi all,

I'm new to OpenEJB and I'm trying to learn with a small made up example.
Specifically, I have 1 stateless bean that I want to give a local ejb
reference and be able to perform a JNDI lookup on that reference. So I have
a Java interface, its implementation, an META-INF/ejb-jar.xml and a main
program.  My problem is that the lookup by the local reference name fails.
Here are my short files:

DataRepo.java

@Local
public interface DataRepo
{
    List<Point> getInterestingPoints();
}

DataRepoImpl.java

@Stateless( name = "dataRepo" )
@TransactionManagement( value = TransactionManagementType.CONTAINER )
@TransactionAttribute( value = TransactionAttributeType.REQUIRED )
@LocalBean
public class DataRepoImpl implements DataRepo
{
    @Override
    public List<Point> getInterestingPoints()
    {
        return null;
    }
}

main program:

{
        Properties p = new Properties();
        final Context context =
EJBContainer.createEJBContainer(p).getContext();
        DataRepo repo =
(DataRepo)context.lookup("java:comp/env/ejb/TheRepo"));
}

<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee";>
<enterprise-beans>
    <session>
        <ejb-name>dataRepo</ejb-name>
        <ejb-local-ref>
            <ejb-ref-name>ejb/TheRepo</ejb-ref-name>
            <local>optimus.DataRepo</local>
        </ejb-local-ref>
    </session>
</enterprise-beans>
</ejb-jar>

I can find the ejb from its auto-constructed "java:global/..." name. I'm
also sure that ejb-jar.xml is taken into consideration because when I
purposefully introduce an error in it OpenEJB complains.

What am I doing wrong? Why is my ejb-ref-name ignored here?

Thanks much in advance!

Best,
Boris



--
View this message in context: 
http://tomee-openejb.979440.n4.nabble.com/using-local-ejb-reference-in-the-embedded-container-tp4672896.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Reply via email to