I deployed and tested a simple EJB 3.0 program successfully with JBOSS 4.05.

The following code use JNDI lookup works fine.

  | Hashtable<String,String> h= new Hashtable<String,String>(); 
  | 
h.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
 
  | h.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces"); 
  | h.put(Context.PROVIDER_URL, "localhost");
  |     
  | InitialContext ctx = new InitialContext(h);
  |             
  |  WordReverse wr = (WordReverse) ctx.lookup("/WordReverseBean/remote");
  | 
  | wr.getReversedWorld("test")
  | 

However, I have problems using EJB annotation.  The following code compiles 
fine. but run into run-time Exception
     Exception in thread "main" java.lang.NullPointerException
It complains that the instance variable wr is NULL.  I tried different 
attribute values for the EJB annotation without sucsess.


  | @EJB(mappedName="jnp://localhost:1099/WordReverseBean/remote") 
  | //@EJB(beanName="WordReverseBean") 
  | //@EJB
  | private static WordReverse wr;
  | 
  | public static void main(String[] args) throws NamingException{
  | 
  | ...
  | wr.getReversedWorld("test")
  | ...
  | 

Could anyone help here?  

Thanks!

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991714
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to