Hi, I seem to of been on this problem for weeks.
Trying to find a Stock CMP Entity beans local interface from a session bean.
Using Rational Application Developer 7, from the Universal
Test Client I can find the StockCMPLocalHome interface. However with the following jndi code variations from the session bean I cannot find it.
-BEGIN CODE----------------------------
try {
jndiname = "java:comp/env/ejb/Stock";
o = context.lookup(jndiname);
} catch (NamingException ne1) {
System.out.println("ONE FAILED "+jndiname+" Err="+ne1.getMessage());
}
try {
jndiname = "java:comp/env/ejb/StockCMPLocal";
o = context.lookup(jndiname);
} catch (NamingException ne1) {
System.out.println("TWO FAILED "+jndiname+" Err="+ne1.getMessage());
}
try {
jndiname = "java:comp/env/Stock";
o = context.lookup(jndiname);
} catch (NamingException ne1) {
System.out.println("THREE FAILED "+jndiname+" Err="+ne1.getMessage());
}
try {
jndiname = "java:comp/env/ejb/StockCMP";
o = context.lookup(jndiname);
} catch (NamingException ne1) {
System.out.println("FOUR FAILED "+jndiname+" Err="+ne1.getMessage());
}
try {
jndiname = "java:comp/env/ejbs.StockCMPLocalHome";
o = context.lookup(jndiname);
} catch (NamingException ne1) {
System.out.println("FIVE FAILED "+jndiname+" Err="+ne1.getMessage());
}
try {
jndiname = "java:comp/env/ejbs.StockCMP";
o = context.lookup(jndiname);
} catch (NamingException ne1) {
System.out.println("SIX FAILED "+jndiname+" Err="+ne1.getMessage());
}
-END CODE----------------------------
I have provided the output below, note it cannot even find the
ejb namespace in some.
-BEGIN ERR----------------------------
[18/07/07 21:13:45:781 CEST] 00000023 SystemOut O ONE FAILED
java:comp/env/ejb/Stock Err=Name comp/env/ejb not found in context "java:".
[18/07/07 21:13:45:781 CEST] 00000023 SystemOut O TWO FAILED java:comp/env/ejb/StockCMPLocal Err=Name comp/env/ejb not found in context "java:".
[18/07/07 21:13:45:781 CEST] 00000023 SystemOut O THREE FAILED java:comp/env/Stock Err=Name "comp/env/Stock" not found in context "java:".
[18/07/07 21:13:45:781 CEST] 00000023 SystemOut O FOUR FAILED java:comp/env/ejb/StockCMP Err=Name comp/env/ejb not found in context "java:".
[18/07/07 21:13:45:781 CEST] 00000023 SystemOut O FIVE FAILED java:comp/env/ejbs.StockCMPLocalHome Err=Name "comp/env/ejbs.StockCMPLocalHome" not found in context "java:".
[18/07/07 21:13:45:781 CEST] 00000023 SystemOut O SIX FAILED java:comp/env/ejbs.StockCMP Err=Name "comp/env/ejbs.StockCMP" not found in context "java:".
-END ERR----------------------------
I have also included the ejb-jar.xml file below.
-BEGIN ejb-jar.xml------------------
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"> <display-name>
StockEJB</display-name>
<enterprise-beans>
<entity id="StockCMP">
<ejb-name>StockCMP</ejb-name>
<local-home>ejbs.StockCMPLocalHome</local-home>
<local>ejbs.StockCMPLocal</local>
<ejb-class>ejbs.StockCMPBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>false</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>StockCMP</abstract-schema-name>
<cmp-field id="CMPAttribute_1184702097046">
<field-name>id</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_1184702097047">
<field-name>sname</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
</entity>
<session id="StockList">
<ejb-name>StockList</ejb-name>
<home>ejbs.StockListHome</home>
<remote>ejbs.StockList</remote>
<ejb-class>ejbs.StockListBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
-END ejb-jar.xml--------------------
Thanks Phil