Created
November 2, 2014 09:33
-
-
Save kamcpp/981f65cfb4a0abf6865e to your computer and use it in GitHub Desktop.
TomEE-EJB-Remote-Invocation
This file contains hidden or 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
| import my_ejb_api.MyNumberGeneratorLocal; | |
| import my_ejb_api.MyNumberGeneratorRemote; | |
| import javax.naming.InitialContext; | |
| import javax.naming.NamingException; | |
| import java.util.Properties; | |
| public class Test { | |
| public static void main(String[] args) throws NamingException { | |
| Properties p = new Properties(); | |
| p.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory"); | |
| p.put("java.naming.provider.url", "http://localhost:8080/tomee/ejb"); | |
| InitialContext ctx = new InitialContext(p); | |
| MyNumberGeneratorRemote myNumberGeneratorRemote = (MyNumberGeneratorRemote) ctx.lookup("RandomNumberGeneratorRemote"); | |
| System.out.println(myNumberGeneratorRemote.generateNumber()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment