but, I have another problem.
Stateless EJB code:
@Depends({
  |     "jmx.service.wsmq:service=WSMQ_QXL",
  |     "jmx.service.wsmq:service=WSMQQueueConnectionFactory"
  | })
  | public @Stateless class TestEJBBean implements TestEJB {
  |     private static EJBUtil pu = EJBUtil.getInstance();
  |     
  |     @Resource(mappedName = "WSMQQueueConnectionFactory")
  |     private QueueConnectionFactory qf;
  |     
  |     @Resource(mappedName = "wsmq/QXL")
  |     private Queue qxl;
  |     
  |     public void dosomthing() {
  |             if(qf != null)
  |                     System.out.println("EJB qf ok");
  |             else
  |                     System.out.println("EJB qf null");
  |             if(qxl != null)
  |                     System.out.println("EJB qxl ok");
  |             else
  |                     System.out.println("EJB qxl null");
  |             pu.process();
  |     }
  | }
java bean code:
public class EJBUtil {
  |     private static EJBUtil instance;
  |     
  |     @Resource(mappedName = "WSMQQueueConnectionFactory")
  |     private QueueConnectionFactory qf;
  |     
  |     @Resource(mappedName = "wsmq/QXL")
  |     private Queue qxl;
  |     
  |     public synchronized void process() {
  |             if(qf != null)
  |                     System.out.println("qf ok");
  |             else
  |                     System.out.println("qf null");
  |             if(qxl != null)
  |                     System.out.println("qxl ok");
  |             else
  |                     System.out.println("qxl null");
  |     }
  |     
  |     public static synchronized EJBUtil getInstance() {
  |             if(instance == null)
  |                     instance = new EJBUtil();
  |             return instance;
  |     }
  | }
or like this:
public class EJBUtil {
  |     private static EJBUtil instance;
  |     
  |     @EJB(mappedName = "WSMQQueueConnectionFactory")
  |     private QueueConnectionFactory qf;
  |     
  |     @EJB(mappedName = "wsmq/QXL")
  |     private Queue qxl;
  |     
  |     public synchronized void process() {
  |             if(qf != null)
  |                     System.out.println("qf ok");
  |             else
  |                     System.out.println("qf null");
  |             if(qxl != null)
  |                     System.out.println("qxl ok");
  |             else
  |                     System.out.println("qxl null");
  |     }
  |     
  |     public static synchronized EJBUtil getInstance() {
  |             if(instance == null)
  |                     instance = new EJBUtil();
  |             return instance;
  |     }
  | }

call EJB TestEJB's method "dosomething", the result id:
anonymous wrote : 23:14:50,014 INFO  [STDOUT] EJB qf ok
  | 23:14:50,014 INFO  [STDOUT] EJB qxl ok
  | 23:14:50,014 INFO  [STDOUT] qf null
  | 23:14:50,014 INFO  [STDOUT] qxl null
it means @EJB @Resource about mappedName not working in java bean.

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

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


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to