[jboss-user] [EJB 3.0] - Re: EJB Annotation question?

jxcheng do-not-reply at jboss.com
Wed Dec 6 18:47:36 EST 2006


Yes, it is in a client application.

Why @EJB annotation does not work there?

Is it due to that JBOSS does not fully implement EJB 3.0?


In Sun's JavaEE 5 tutorial and sample code,
I see the following in a client program:


  | package converter.client;
  | 
  | import converter.ejb.Converter;
  | import java.math.BigDecimal;
  | import javax.ejb.EJB;
  | 
  | 
  | /**
  |  *
  |  * @author ian
  |  */
  | public class ConverterClient {
  |     @EJB
  |     private static Converter converter;
  | 
  |     /** 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 = converter.dollarToYen(param);
  | 
  |             System.out.println("$" + param + " is " + yenAmount + " Yen.");
  | 
  |             BigDecimal euroAmount = converter.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();
  |         }
  |     }
  | }
  | 

The client code above works well with Sun's Java System Application Server 9.0.


Thanks




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991815#3991815

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991815



More information about the jboss-user mailing list