[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: EntityManager throws a nullpointerexception JBOSS 4.2.2G

jaikiran do-not-reply at jboss.com
Mon May 26 11:02:32 EDT 2008

anonymous wrote : SystemUser _SystemUser = new Query().AuthenticateUser("july","1234");

Here's the problem :)

You are using the Query class as just another java class and instantiating it on your own. As a result you are not getting access to the additional services which the application server injects in the EJB.

Any EJB clients, need to lookup the EJB to be able to avail the services provided by the server. You might have to read through some examples which explain how to lookup the EJB from a client. Usually, this is how it is done:

//assuming the server and the client are on the same server,
  | //else pass context properties
  | javax.naming.Context ctx = new javax.naming.InitialContext();  
  | QueryInt bean = (QueryInt) ctx.lookup("QueryBeanJNDIName");// this is the jndi-name to which the bean is bound.
  | SystemUser _SystemUser = bean.AuthenticateUser("july","1234");
  | if (_SystemUser != null)
  | 	System.out.println(_SystemUser.getIdSystemUser());			

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

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

More information about the jboss-user mailing list