There's a method in one of our Stateless EJB (named Log) that returns the logged in user. The code below prints out:
User1: b User2: b Why??? Two Log EJB's were created using different InitialContexts so I would expect that: User1: a User2: b should be printed. | public static InitialContext getInitialContext(String as_username, String as_password) throws Exception { | Properties p = new java.util.Properties(); | p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory"); | p.put(Context.PROVIDER_URL, "localhost:1099"); | p.put(Context.SECURITY_PRINCIPAL, as_username); | p.put(Context.SECURITY_CREDENTIALS, as_password); | | p.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); | p.put("jnp.disableDiscovery", "true"); | | return new InitialContext(p); | } | | public static void main(String[] args) throws Exception { | InitialContext lctx1 = getInitialContext("a", "a"); | InitialContext lctx2 = getInitialContext("b", "b"); | | Log llog1 = ((LogHome)PortableRemoteObject.narrow(lctx1.lookup("MobilePackage/Log"), LogHome.class)).create(); | Log llog2 = ((LogHome)PortableRemoteObject.narrow(lctx2.lookup("MobilePackage/Log"), LogHome.class)).create(); | | System.out.println("User1: " + llog1.getUserId()); | System.out.println("User2: " + llog2.getUserId()); | } | | View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3903199#3903199 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3903199 ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user