Lookup an EJB Implementation by jndi name -
i new jndi namespace , trying lookup ejb class service class through below code
initialcontext ctx; try { ctx = new initialcontext(); ctx.lookup("?????"); } catch (namingexception e) { // todo auto-generated catch block e.printstacktrace(); }
but don't have clue put inside lookup. know jndi name goes there. can jndi name ejb class. new thing , can't devote time in learning jndi.
refer server log file. when ejb beans deployed. looks
jndi bindings session bean named sampleimpl in deployment unit subdeployment "sample-web-1.0.0.war" of deployment "xyz.ear" follows:
sample code lookup ejb bean.
final hashtable jndiproperties = new hashtable(); jndiproperties.put(context.url_pkg_prefixes, "org.jboss.ejb.client.naming"); final context context = new initialcontext(jndiproperties); sampleif sif = (sampleejbif) context.lookup("java:app/sample-ejb-1.0-snapshot/sampleimpl");
other ways define lookup path
java:global/pms/pms-web-1.0.0/sampleclass!com.etipl.pms.x12.sampleclass java:app/pms-web-1.0.0/sampleclass!com.etipl.pms.x12.sampleclass java:module/sampleclass!com.etipl.pms.x12.sampleclass java:global/pms/pms-web-1.0.0/sampleclass java:app/pms-web-1.0.0/sampleclass java:module/sampleclass
Comments
Post a Comment