Hi,
That seems like a promising approach, but I wasn't able to get it to work.
Here is the actual code:
MainEJB mainEJB =
(MainEJB)context.lookup("java:global/embeddedejb/MainEJB");
mainEJB.go(new Runnable() {
public void run()
{
Context initCtx = null;
try
{
initCtx = new InitialContext();
DataRepo repo =
(DataRepo)initCtx.lookup("java:comp/env/ejb/TheRepo");
}
catch (NamingException e)
{
e.printStackTrace();
}
}
});
I should not that those are the only JNDI objects traced out at startup
time:
INFO - Jndi(name="java:global/embeddedejb/dataRepo!optimus.DataRepoImpl")
INFO - Jndi(name="java:global/embeddedejb/dataRepo!optimus.DataRepo")
INFO - Jndi(name="java:global/embeddedejb/dataRepo")
INFO - Jndi(name="java:global/embeddedejb/MainEJB!optimus.MainEJB")
INFO - Jndi(name="java:global/embeddedejb/MainEJB")
I don't see my custom ejb/TheRepo anywhere. My ejb-jar.xml is under
target/classes/META-INF where target/classes is the Maven compilation output
folder. If I modify ejb-jar.xml to not be valid XML any longer, I get an
exception from openejb. However, if I modify it to misspell the EJB I'm
trying to refer (for example, instead of <ejb-name>dataRepo</ejb-name>, I
put <ejb-name>dataRepo2</ejb-name>), I don't get any errors!
Thanks a lot!
Boris
--
View this message in context:
http://tomee-openejb.979440.n4.nabble.com/using-local-ejb-reference-in-the-embedded-container-tp4672896p4672902.html
Sent from the TomEE Users mailing list archive at Nabble.com.