Hi.
Here is my setup.
2 EJBs ( A , B ). B gets injected into A and I'm unit testing A.
Everything gets injected properly but during testing when EJB B trys to
initialize Ibatis and
I get this exception. How do I bind java:comp/env/jdbc/realdeal
using the context created by
org.apache.openejb.core.LocalInitialContextFactory ?
context.bind("java:comp/env/jdbc/realdeal, BasicDataSource) doesn't seem
to work.
Exception
Caused by: javax.naming.NameNotFoundException: Name
"comp/env/jdbc/realdeal" not found.
at
org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:195)
at
org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:149)
at
org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:124)
at javax.naming.InitialContext.lookup(InitialContext.java:409)
at
org.apache.openejb.core.ivm.naming.JndiUrlReference.getObject(JndiUrlReference.java:29)
at
org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:173)
at
org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:124)
at javax.naming.InitialContext.lookup(InitialContext.java:409)
at
org.apache.ibatis.datasource.jndi.JndiDataSourceFactory.setProperties(JndiDataSourceFactory.java:38)
... 76 more
EJB B configuration.
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
version="3.1">
<module-name>party</module-name>
<enterprise-beans>
<session>
....
<resource-ref>
<res-ref-name>jdbc/database</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
<lookup-name>java:comp/env/jdbc/realdeal</lookup-name>
</resource-ref>
</session>
</enterprise-beans>
</ejb-jar>