[jboss-user] [EJB 3.0] - Re: best way to expose ejb3 as web service?

jaki do-not-reply at jboss.com
Thu Aug 14 02:32:01 EDT 2008


Method in the stateless bean:



@SuppressWarnings("unchecked")
  | 	public User check(String login,String mdp) 
  | 	{		
  | 		Collection<User> users = new HashSet<User>();
  | 						
  | 		users =	em.createQuery(	"SELECT u " +
  | 								"FROM User u " +
  | 								"where user_login_id='" + login + "' and pass='"+ mdp +"'").getResultList();
  | 		User u = null;
  | 		for (Iterator<User> iterator = users.iterator(); iterator.hasNext();) 
  | 			u = iterator.next();				
  | 		return u;		
  | 	}

Method in the exposed stateless bean trying to call the above method :

@SuppressWarnings("unchecked")
  | 	public Utilisateur check(String login,String mdp) 
  | 	{		
  | 		Collection<Utilisateur> users = new HashSet<Utilisateur>();
  | 		
  | 		System.out.println("ENTERED USER CHECK "+login+mdp);
  | 		
  | 		Object random = em.createQuery("Select count(u)"+"from Utilisateur u").getSingleResult();
  | 		
  | 		users =	em.createQuery(	"SELECT u " +
  | 								"FROM Utilisateur u " +
  | 								"where user_login_id='" + login + "' and motdepasse='"+ mdp +"'").getResultList();
  | 		Utilisateur u = null;
  | 		for (Iterator<Utilisateur> iterator = users.iterator(); iterator.hasNext();) 
  | 			u = iterator.next();				
  | 		return u;		
  | 	}


Stack trace: anonymous wrote : 
  | Caused by: java.lang.NullPointerException
  | 	at com.session.impl.UserManagerBean.check(UserManagerBean.java:122)
  | 	at com.session.impl.UserBean.check(UserBean.java:37)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
  | 	at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
  | 	at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
  | 	... 39 more

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

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



More information about the jboss-user mailing list