I don't know if this here is the right forum, but hopefully I get some answers from the experts.
We are migration a devided application (web, batch processing, web services all single applications) into a JEE application, running on JBoss.
As far, most of the parts are running correctly, but we have a little problem with the interaction of the web with our EJB3 session / entity beans. For auditing purpose we must store the name of the user which created or modified an entity. Therefore we write an interceptor with get the principal from the SecurityAssociation class.
To access the session beans we make a JNDI lookup like
environment.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory"); environment.put(Context.SECURITY_PRINCIPAL, "testName"); environment.put(Context.SECURITY_CREDENTIALS, "testPassw"); environment.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); environment.put("java.naming.provider.url", "jnp://localhost:1099"); InitialContext context = new InitialContext(environment); context.lookup(jndiName);