hi,
i have developed an EJB as mentioned in the tutorial of eclipse EJB Development section. I have created a TraderBean and generated the rest of the classes and interface classes and deployment descriptor through XDoclet and deployed the bean through eclipse on bea weblogic, but the problem is, it doesnt deploy the bean with the JNDI name i assigned it in the deployment descriptor, bea weblogic assigns the JNDI name by itself.
I have also developed my client which calls my ejb bean but it couldnt lookup my EJB because it isnt deployed with the JNDI name i gave it.
How can i make the ejb deployed to bea with the my JNDI name?? Below i am attaching the weblogic-ejb-jar.xml and my client lookup methods.
Please reply ASAP
Thanks
Mak
**********weblogic-ejb-jar
.xml******
********
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN" "
http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd">
<weblogic-ejb-jar>
<description><![CDATA[Gene
rated by XDoclet]]></description>
<weblogic-enterprise-bean>
<ejb-name>Trader</ejb-name
>
<stateless-session-descrip
tor>
</stateless-session-descri
ptor>
<reference-descriptor>
</reference-descriptor>
<jndi-name>firstEJB</jndi-
name>
</weblogic-enterprise-bean
>
<!--
To add enterprise beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called weblogic-enterprise-beans.
xml that contains
the <weblogic-enterprise-bean>
</weblogic
-enterpris
e-bean> markup for those beans.
-->
</weblogic-ejb-jar>
**************************
**********
********
********** lookuphome****************
*******
//url is "t3://localhost:7001"
private TraderHome lookupHome() throws NamingException {
Context ctx = getInitialContext();
try {
Object home = (TraderHome) ctx.lookup("firstEJB");
// also tried ctx.lookup("ejb/firstEJB")
return (TraderHome) PortableRemoteObject.narro
w(home, TraderHome.class);
//return (TraderHome) narrow(home, TraderHome.class);
} catch (NamingException ne) {
log("The client was unable to lookup the EJBHome. Please make sure ");
log("that you have deployed the ejb with the JNDI name "+
JNDI_NAME+" on the WebLogic server at "+url);
throw ne;
}
}
private Context getInitialContext() throws NamingException {
try {
// Get an InitialContext
Hashtable h = new Hashtable();
h.put(Context.INITIAL_CONT
EXT_FACTOR
Y,"weblogi
c.jndi.WLI
nitialCont
extFactory
");
h.put(Context.PROVIDER_URL
, url);
return new InitialContext(h);
} catch (NamingException ne) {
log("We were unable to get a connection to the WebLogic server at "+url);
log("Please make sure that the server is running.");
throw ne;
}
}
**************************
*****
Start Free Trial