Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
06. Oct 2008, 14:13 CET | Link

i got a UploadBean which corresponds to an rich:fileUpload.

i need some Propteties from the sessionbean for the uploadfunction.

how can i get the session bean from my upload bean?

i tried

 SessionBean session = (SessionBean) FacesContext.getCurrentInstance().getExternalContext()
     .getSessionMap().get("Session");

but got an class cast exception.

2 Replies:
06. Oct 2008, 14:20 CET | Link

Why not just inject the SessioBean ?

@In SessionBean beanName;

In your code Session is the name of the bean (@Name) ?

 

Waaaaaaagh !

06. Oct 2008, 14:34 CET | Link
Ok i tried

@In SessionBean Session;

the session bean is defined


@Stateful
@Name("Session")
@Scope(value = ScopeType.SESSION)
@Synchronized(timeout = 10000)
public class SessionBean implements Session {


but i got error

caused by: java.lang.IllegalArgumentException: Can not set de.soaworkflow.session.SessionBean field de.soaworkflow.session.UploadBean.Session to org.javassist.tmp.java.lang.Object_$$_javassist_2
 at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
 at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
 at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
 at java.lang.reflect.Field.set(Field.java:657)
 at org.jboss.seam.util.Reflections.set(Reflections.java:64)
 ... 73 more