JBoss Community

Problem with NotEligibleForDirectInvocationException

reply from Manu Osten in EJB 3.0 - View the full discussion

hmmm. I try to start without PortableRemoteObject.narrow. It is not working.

 

error message:

 

 

java.lang.ClassCastException: javax.naming.Reference cannot be cast to de.kirchedlau.ponteseam.sessions.ContentInterface

    at de.kirchedlau.ponte.utils.sessions.EJBHandler.<init>(EJBHandler.java:26)

    at de.kirchedlau.ponte.ejb.sessions.AccoutingBeanTest.setUpBeforeClass(AccoutingBeanTest.java:30)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

 

 

 

ok with relevant EJB-Code:

 

JUnit-Class (AccountingBeanTest):

 

static EJBHandler ejbHandler;
    static AccountingInterface session;
    static AuthInterface authsession;
 
 
    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
        ejbHandler = new EJBHandler();
        session = ejbHandler.accoutingsession;
    }
 
 
    @Test
    public void testGetInstitutionTypeList() {
        
        if(session == null) {
            System.out.println("session is Null");
        } else {
            System.out.println("session is Not Null");
            System.out.println(session.toString());
        }
        Collection<InstitutionType> typeList = null;
        try {
            typeList = session.getInstitutionTypeList();
        } catch (Exception e) {
            e.printStackTrace();
        }
        Assert.assertNotNull(typeList);
        Assert.assertEquals(typeList.size(), 7);
    }
 

 

statless Bean (AccountingBean)

 

 

@Name("accountingBean")
@Stateless
public class AccountingBean implements AccountingInterface {
 
    @PersistenceContext(unitName = "PonteSeam")
    private EntityManager manager;
    
    @Resource
    SessionContext context;
 
    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
    @SuppressWarnings("unchecked")
    public Collection<InstitutionType> getInstitutionTypeList() {
        final Query query = manager.createQuery("from InstitutionType");
 
        return (Collection<InstitutionType>) query.getResultList();
    }

 

Interface:

@Remote
public interface AccountingInterface {
    
    // InstitutionTypes
    public Collection<InstitutionType> getInstitutionTypeList();

 

 

Calling EJB-Beans from war-files with same EJBHandler is working, but from JUnit not.

 

Manu

Reply to this message by going to Community

Start a new discussion in EJB 3.0 at Community