Manu Osten [http://community.jboss.org/people/argonist] replied to the 
discussion

"Problem with NotEligibleForDirectInvocationException"

To view the discussion, visit: http://community.jboss.org/message/552788#552788

--------------------------------------------------------------
Hello,

"session" object:

static EJBHandler ejbHandler;
    static AccountingInterface session;
    static AuthInterface authsession;
 
 
    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
//        ExecuteMySQLScripts executeScripts = new ExecuteMySQLScripts();
//        executeScripts.executeMySQLScripts();
        ejbHandler = new EJBHandler();
        session = ejbHandler.accoutingsession;
        authsession = ejbHandler.authSession;
    }



EJBHandler

package de.kirchedlau.ponte.utils.sessions;
 
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
 
import com.sun.corba.se.impl.javax.rmi.PortableRemoteObject;
 
import de.kirchedlau.ponteseam.sessions.AccountingInterface;
import de.kirchedlau.ponteseam.sessions.AuthInterface;
import de.kirchedlau.ponteseam.sessions.ContentInterface;
import de.kirchedlau.ponteseam.sessions.MailInterface;
import de.kirchedlau.ponteseam.sessions.RequestInterface;
 
public class EJBHandler {
    
    Context jndiContext = null;
    public ContentInterface contentSession = null;
    public RequestInterface requestSession = null;
    public AuthInterface authSession = null;
    public MailInterface mailsession = null;
    public AccountingInterface accoutingsession = null;
    
    public EJBHandler() {
        setContext();
        contentSession = new 
SessionFinder<ContentInterface>().getRef("PonteSeam-ear/ContentBean/remote", 
ContentInterface.class);
        requestSession = new 
SessionFinder<RequestInterface>().getRef("PonteSeam-ear/RequestBean/remote", 
RequestInterface.class);
        authSession = new 
SessionFinder<AuthInterface>().getRef("PonteSeam-ear/AuthBean/remote", 
AuthInterface.class);
        mailsession = new 
SessionFinder<MailInterface>().getRef("PonteSeam-ear/MailBean/remote",MailInterface.class);
        accoutingsession = new 
SessionFinder<AccountingInterface>().getRef("PonteSeam-ear/AccountingBean/remote",AccountingInterface.class);
    }
    
    private void setContext()
    {
        try {
            jndiContext = new InitialContext();
            
        } catch (NamingException e) {
            e.printStackTrace();
        }
    }
        
    // T: SessionBean Interface
    public class SessionFinder<T>
    {
 
        @SuppressWarnings("unchecked")
        public T getRef(String className, Class classOfT){
            try {
                Object ref1 = jndiContext.lookup(className);
                T session =  (T) new PortableRemoteObject().narrow( ref1, 
classOfT);
                return session;
            } catch (NamingException e) {
                e.printStackTrace();
            }
            return null;
        }        
    }
}



I think that classpath is right. 

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/552788#552788]

Start a new discussion in EJB 3.0 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to