Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2006

Tip: Looking for answers? Try searching our database.

Access Application Server from EJB Client

Thread view: 
sss - 05 Dec 2006 22:50 GMT
Finally I get it run the sample ejb client using EJB3.0.
However, now i want to know how to connect the application server
from a different computer.( i need to specify the ip and port right? )

package converter.client;

import converter.ejb.ConverterTestRemote;
import java.math.BigDecimal;
import javax.ejb.EJB;

/**
*
* @author ian
*/
public class ConverterClient {

   @EJB
   private static ConverterTestRemote converterBean;

   /** Creates a new instance of Client */
   public ConverterClient(String[] args) {
   }

   /**
    * @param args the command line arguments
    */
   public static void main(String[] args) {
       ConverterClient client = new ConverterClient(args);
       client.doConversion();
   }

   public void doConversion() {
       try {
           BigDecimal param = new BigDecimal("100.00");
           BigDecimal yenAmount = converterBean.dollarToYen(param);

           System.out.println("$" + param + " is " + yenAmount + " Yen.");

           BigDecimal euroAmount = converterBean.yenToEuro(yenAmount);
           System.out.println(yenAmount + " Yen is " + euroAmount + "
Euro.");

           System.exit(0);
       } catch (Exception ex) {
           System.err.println("Caught an unexpected exception!");
           ex.printStackTrace();
       }
   }
}
Jim Cheng - 08 Dec 2006 03:42 GMT
Are u using Sun's Java Enterprise Application Server?
You may want to take a look at the attributes of javax.ejb.EJB and try
to set attribute values of the @EJB annotation.

Regards,
Jim

> Finally I get it run the sample ejb client using EJB3.0.
> However, now i want to know how to connect the application server
[quoted text clipped - 45 lines]
>     }
> }


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.