2 Replies Latest reply on Oct 6, 2008 2:34 PM by ajanz

    Getting Properties form Session Bean

    ajanz
      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.
        • 1. Re: Getting Properties form Session Bean
          andre.eugenio

          Why not just inject the SessioBean ?


          @In SessionBean beanName;


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

          • 2. Re: Getting Properties form Session Bean
            ajanz
            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