Hi, all
I am confusing the jndi name with the files. I have problem with javax.naming.NameNotFoundException: XXX not bound.
this is ejb-jar.xml:
<ejb-jar>
...
Models a Country Group
<ejb-name>CountryGroupEJB</ejb-name>
nz.co.sns.business.CountryGroupHome
nz.co.sns.business.CountryGroup
<ejb-class>nz.co.sns.business.CountryGroupEJB</ejb-class>
...
...
this is the jboss.xml:
...
<ejb-name>CountryGroupEJB</ejb-name>
<jndi-name>nz/co/sns/business/CountryGroup</jndi-name>
...
this is the web.xml:
<web-app>
...
<ejb-ref>
Reference the CountryGroup bean
<ejb-ref-name>ejb/CountryGroup</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
nz.co.sns.business.CountryGroupHome
nz.co.sns.business.CountryGroup
</ejb-ref>
...
This is the jboss-web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<ejb-ref>
<ejb-ref-name>ejb/CountryGroup</ejb-ref-name>
<jndi-name>sns/CountryGroupEJB</jndi-name>
</ejb-ref>
</jboss-web>
the ear file is sns.ear deployed
when jboss running with embedded tomcat, I see:
....
2001-10-16 04:07:03 - ContextManager: Adding context Ctx( /sns )
[Auto deploy] AbstractWebContainer.parseWebAppDescriptors, Begin
[Auto deploy] addEnvEntries
[Auto deploy] linkResourceRefs
[Auto deploy] linkEjbRefs
[Auto deploy] Linking ejb-ref: ejb/CountryGroup to JNDI name: sns/CountryGroupEJB
...
the war and the bean jar is in same ear file.
the code to lookup the ref is:
InitialContext jndiContext = new InitialContext();
Object obj = jndiContext.lookup("sns/CountryGroupEJB");
or
InitialContext jndiContext = new InitialContext();
Object obj = jndiContext.lookup("CountryGroupEJB");
when it invokes the codes, it occurs above error, says:
javax.naming.NameNotFoundException: sns not bound
or
javax.naming.NameNotFoundException: CountryGroupEJB not bound
If I run a standalone client call JNDI name lookup "nz/co/sns/business/CountryGroup", it can success to get the bean home.
What is wrong? or I miss some configs in some where?
Pls help!!!!!!!
Thanks in advance
Sorry, For the previous post, I miss some: when a servlet invoke lookup the bean, it occurs the exception, and standalone client can't.