[jboss-user] [JBoss Seam] - Backing and session bean communication error

vas_opel do-not-reply at jboss.com
Mon Dec 3 07:38:01 EST 2007


I have implemented a session bean to keep parameter values that will be used by the entire application.This is the simplest form of my session bean:


  | @Stateful
  | @Name("cart")
  | @Scope(SESSION)
  | public class Brtest implements BrtestI,Serializable{
  | 	
  | 	 static final long serialVersionUID = 8722576722482084467L;
  | 	
  |     @PersistenceContext(type=PersistenceContextType.EXTENDED)
  |     EntityManager em;
  | 	
  |     public String getCart() {
  |         return "hello";
  |     }
  | 
  |     @Destroy
  |     @Remove
  |     public void destroy() {}
  | 
  | }
  | 

I have to inject an instance of the previous session bean in one of my backing beam following the dvd store example of the seam examples and this is my code:


  | @Stateful
  | @Name("testSession")
  | public class TestSessionManager extends TestSessionManager implements serialisable{
  | 
  | 	@In(create=true) Brtest cart;
  | 
  | 	@PersistenceContext(type=PersistenceContextType.EXTENDED)
  | 	private EntityManager em;
  | 
  | 	static final long serialVersionUID = -6536629890251170098L;
  | 
  | 	@In 
  | 	protected FacesContext facesContext;	
  | 
  | 	protected void getValueFromSession(){
  | 		cart.getCart();
  | 	}
  | 	
  | 

The exception thrown is this:
anonymous wrote : 
  | 
  | Caused by: javax.ejb.EJBTransactionRolledbackException: java.lang.IllegalArgumentException: could not set field value: testSession.cart
  | 	at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:93)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
  | 	at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
  | 	at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)
  | 	at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
  | 	at $Proxy341.getUsername(Unknown Source)
  | 	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.seam.util.Reflections.invoke(Reflections.java:20)
  | 	at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
  | 	at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
  | 	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
  | 	at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
  | 	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
  | 	at org.jboss.seam.interceptors.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:31)
  | 	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
  | 	at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
  | 	at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
  | 	at org.javassist.tmp.java.lang.Object_$$_javassist_290.getUsername(Object_$$_javassist_290.java)
  | 	... 73 more
  | Caused by: java.lang.IllegalArgumentException: could not set field value: testSession.cart
  | 	at org.jboss.seam.Component.setFieldValue(Component.java:1559)
  | 	at org.jboss.seam.Component.access$500(Component.java:135)
  | 	at org.jboss.seam.Component$BijectedField.set(Component.java:2285)
  | 	at org.jboss.seam.Component.injectAttributes(Component.java:1368)
  | 	at org.jboss.seam.Component.inject(Component.java:1195)
  | 	at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
  | 	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
  | 	at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
  | 	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
  | 	at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
  | 	at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
  | 	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.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
  | 	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.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:71)
  | 	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:46)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
  | 	... 104 more
  | Caused by: java.lang.IllegalArgumentException: Could not set field value by reflection: TestSessionManager.cart on: twp.session.TestSessionManager  with value: class org.javassist.tmp.java.lang.Object_$$_javassist_291
  | 	at org.jboss.seam.util.Reflections.set(Reflections.java:77)
  | 	at org.jboss.seam.Component.setFieldValue(Component.java:1555)
  | 	... 128 more
  | Caused by: java.lang.IllegalArgumentException
  | 	at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
  | 	at java.lang.reflect.Field.set(Field.java:656)
  | 	at org.jboss.seam.util.Reflections.set(Reflections.java:63)
  | 	... 129 more
  | 
  | 

Does anyone know what may cause this exception? Is there any additional configuration to be made (such as property files) in order a backing bean to communicate with the session bean? 

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

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



More information about the jboss-user mailing list