Package org.jboss.tutorial.stateless.bean

Examples of org.jboss.tutorial.stateless.bean.HelloWorld


     String results = new String();
     String contents = new String((String)msgBody.get());
     try {
         InitialContext ctx = new InitialContext();
              
         HelloWorld client = (HelloWorld) ctx.lookup("HelloWorldBean/remote");
         results = client.sayHello(contents);
         System.out.println("Invoked EJB3: " + results);
     } catch (Exception e) {
     e.printStackTrace();
         System.out.println(e);
     }
View Full Code Here


public class Client
{
   public static void main(String[] args) throws Exception
   {
      // Store a reference to the calculator interface
      HelloWorld hw = null;

      // Decide whether to use a POJO or connect to an EJB
      if (args.length != 1)
      {
        System.err.println("Usage: java org.jboss.tutorial.client.Client [-pojo|-ejb]");
        System.exit(1);
      }
      else if (args[0].equals("-pojo"))
      {
        // Simply create a new POJO to act as the HelloWorld
        System.out.println("Creating a new HelloWorldBean POJO");
        hw = new HelloWorldBean();
      }
      else if (args[0].equals("-ejb"))
      {
        // Obtain an initial context
        InitialContext ctx = new InitialContext();
       
        // Look up a remote interface to a calculator EJB
        System.out.println("Obtaining a reference to a remote HelloWorldBean EJB");
        hw = (HelloWorld) ctx.lookup("HelloWorldBean/remote");
      }
      else
      {
        System.err.println("Usage: java org.jboss.tutorial.client.Client [-pojo|-ejb]");
        System.exit(1);       
      }

      if (hw != null)
      {
        System.out.println("[Client] " + hw.sayHello("JBoss"));       
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.tutorial.stateless.bean.HelloWorld

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.