I was testing distributing EJB's to different server with their client and kept
hitting my head to the wall with the following problem almost the whole day:
Stacktrace = javax.naming.AuthenticationException. Root exception is java.lang.SecurityException:
Authentication for user masters2 denied in realm weblogic at weblogic.security.acl.Realm.authenticate(Realm.java:212)
at weblogic.security.acl.Realm.getAuthenticatedName(Realm.java:233) at weblogic.security.acl.internal.Security.authenticate(Security.java:125)
at weblogic.jndi.WLInitialContextFactoryDelegate.pushUser(WLInitialContextFactoryDelegate.java:522)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:366)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:338)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:211)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:149)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662) at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243) at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.(InitialContext.java:195) at jsp_servlet._distributed_ejb.__recordList.getInitialContext(__recordList.java:99)
at jsp_servlet._distributed_ejb.__recordList.getRemoteContext(__recordList.java:90)
at jsp_servlet._distributed_ejb.__recordList._jspService(__recordList.java:183)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
It seems that the problem was with an error with weblogic documentation about
getting InitialContext. The example code from bea was:
Context ctx = getInitialContext("t3://localhost:7001", "user1", "user1Password");
..
static Context getInitialContext(String url, String user, String password) {
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, url);
h.put(Context.SECURITY_PRINCIPAL, user);
return new InitialContext(h);
}
Funnily, password is not used....after realising that I added line
h.put(Context.SECURITY_CREDENTIALS, password);
and the code works. Is it possible that this was the problem (and documentation
has been incorrect for years now) or was there something that I missed?
> and the code works. Is it possible that this was the problem (and
documentation
> has been incorrect for years now) or was there something that I missed?
ya, that was the problem if you refering to:
http://e-docs.bea.com/wls/docs70/ejb/EJB_design.html#1035574
we will get that corrected.
cheers,
mihir
Great....since the problem is also with 6.0 and 6.1 documentation and since a
lot of people still use that (for example me) it would be a good idea to fix those
too.