Can you explain a bit more what you're trying to do? You say you have to set credentials for accessing JNDI within JBoss. Why is that - or are you talking about delegation of credentials for calls to other EJBs?
If the latter, I'm pretty sure that you can't do this, or at least that it's not something that the EJB spec would allow even if it doesn't say anything about it explicitly.
The only mechanism it supplies for defining the principal used by a bean is the "security-identity " element in the deployment descriptor.
You can either use "run-as" to specify the principal that should be used for delegated calls, or "use-caller-identity" to indicate that the caller's principal should be propagated.
Thanks for your reply.
It really helped. Now I have changed the approach and it works how I wanted. Actually I was still using EJB 1.1 specs.