From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- .../session/stateless/HelloClient.java.original | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloClient.java.original (limited to 'Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloClient.java.original') diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloClient.java.original b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloClient.java.original new file mode 100644 index 0000000..f90a759 --- /dev/null +++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloClient.java.original @@ -0,0 +1,41 @@ +package examples.session.stateless; + +import javax.naming.Context; +import javax.naming.InitialContext; + +/** + * This class is an example of client code which invokes + * methods on a simple, remote stateless session bean. + */ +public class HelloClient { + + public static void main(String[] args) throws Exception { + /* + * Obtain the JNDI initial context. + * + * The initial context is a starting point for + * connecting to a JNDI tree. We choose our JNDI + * driver, the network location of the server, etc + * by passing in the environment properties. + */ + + System.out.println("about to create initialcontext"); + //Context ctx = new InitialContext(System.getProperties()); + Context ctx = new InitialContext(); + + //System.out.println ("Trying to get the name of this context: " + ctx.getNameInNamespace()); + + System.out.println("Got initial context ... yeah "); + + /* + * Get a reference to a bean instance, looked up by class name + */ + Hello hello = (Hello) ctx.lookup("HelloBean"); + + /* + * Call the hello() method on the bean. + * We then print the result to the screen. + */ + System.out.println(hello.hello()); + } +} -- cgit v1.2.3