Created
March 22, 2013 17:01
-
-
Save lcruz/5222977 to your computer and use it in GitHub Desktop.
Calling an EJB from single program in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private EJBInterface getEJB() { | |
Hashtable h = new Hashtable(); | |
h.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); | |
h.put(Context.PROVIDER_URL, "t3://host:port"); | |
Context context; | |
try { | |
context = new InitialContext(h); | |
EJBHome home = | |
(EJBHome) context.lookup("<jndi_name>"); | |
return home.create(); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment