[jboss-user] [EJB 3.0] - Problem with NotEligibleForDirectInvocationException

Manu Osten do-not-reply at jboss.com
Wed Jul 21 14:08:57 EDT 2010


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/553803#553803

--------------------------------------------------------------
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
[http://community.jboss.org/message/553803#553803]

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100721/9d85b7d2/attachment-0001.html 


More information about the jboss-user mailing list