Weblogic sees only user 'guest'


EJB programming & troubleshooting: Weblogic sees only user 'guest'

  1. Weblogic sees only user 'guest' (5 messages)

    Hi all,

    Eversince I started using Weblogic since January this year I'm having trouble with logging into it.

    When logging in I create an InitialContext on the client giving:

    Hashtable hash = new Hashtable();
    hash.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    hash.put(Context.SECURITY_PRINCIPAL, "foo");
    hash.put(Context.SECURITY_CREDENTIALS, "bar");
    Context ctx = new InitialContext(hash);

    Usually there's no problem, however sometimes this client logs in as user 'guest'.

    I have no idea why. I've reported this to BEA long ago and by then they said it was due to a bug in Weblogic 4.5 and would be fixed in 5.1.
    Anyway, I upgraded to 5.1 as soon as was available but eversince I'm still bugged by these login problems now and then.

    I've seen it with both servlets (running in from container) and command line apps.
    Usually everything goes fine, but sometimes a client refuses to login correctly. I haven't changed anything on the server.

    My guess is that I'm not the only one who noticed this, so someone probably already tracked it down and solved it.

    Could it be in the jdk on the client?


    Threaded Messages (5)

  2. Could you please provide the actual Error Stack trace that you are getting?

    Then we can see work on what could be the problem?
  3. There is no stack trace and there is no exception.
    It's just like InitialContext ignores my security information.

  4. Do you create an initial context for each thread that attempts to use your EJB's or their homes? Remember that the Context is thread specific even though the socket connection is shared.
  5. Chuck,

    Most clients aren't even multithreaded.
    Even the most simple commandline test app can demonstrate the problem:

    ---8<-----cut here----------------------------------
    import javax.naming.*;
    import java.rmi.*;
    import java.util.*;

    public class Client
    public static void main(String[] argv)
    Hashtable h = new Hashtable();
    h.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    h.put(Context.PROVIDER_URL, url);
    .put(Context.SECURITY_PRINCIPAL, "user");
    h.put(Context.SECURITY_CREDENTIALS, "password");
    Context ctx = new InitialContext(h);
    catch(NamingException ne)
    System.out.println("NamingException: " + ne.getMessage());
    ---8<-----cut here----------------------------------

    Note that I can't find any pattern. Usually it works fine, but sometimes starts to log in as 'guest'.
    It must ofcourse be when I change something, but I have no clue.

  6. Hmmm... I haven't seen that one!