users@glassfish.java.net

Re: Dynamic user registration

From: <glassfish_at_javadesktop.org>
Date: Wed, 11 Mar 2009 18:47:24 PDT

How can I login to my EE-application (with a JDBCRealm configuration) from my remote client (unit test)?

I've now set up everything and I want to test it in a unit test inside the EJB module:
    @Test
    public void testGetUserInfo() throws NamingException {

        Context context = getInitialContext();

        AccountManager accountManager = (AccountManager) context.lookup(
                "AccountManager");
        UserInfo userInfo = accountManager.getUserInfo();

    }

This runs, if I have no @RolesAllowed annotated methods/ class, but as soon as I add:
@RolesAllowed("USERS")
to the getUserInfo-method of the bean, I get the exception:

javax.naming.NamingException: ejb ref resolution error for remote business interfaceprojectx.contacts.biz.AccountManager [Root exception is java.rmi.AccessException: CORBA NO_PERMISSION 0 No; nested exception is:
        org.omg.CORBA.NO_PERMISSION: ----------BEGIN server-side stack trace----------
org.omg.CORBA.NO_PERMISSION: vmcid: 0x0 minor code: 0 completed: No
        at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.handle_null_service_context(SecServerRequestInterceptor.java:407)



Well, an exception was expected, of course, since I haven't logged in yet.

So, how can I login to my EE-application (with a JDBCRealm configuration) from my remote client (unit test)?

-Florian
[Message sent by forum member 'puce' (puce)]

http://forums.java.net/jive/thread.jspa?messageID=336522