Search code examples
ejbwebspherewebsphere-8

User context for @Startup EJB on websphere


Where do I set the user context Websphere uses when it calls a @Startup EJB?

I have a Java EE application with a startup EJB, and I know that it sets a user when calling the EJB, since the call fails due to missing roles. However, I couldn't find where to set the user.


Solution

  • The EJB spec states that session bean @PostConstruct methods are called in an unspecified security context, and WebSphere does not document a specific security context or allow it to be configured. In practice, singleton session bean @PostConstruct will typically be called with an unauthorized user as the security context. If setting a specific security context is important, then you could open a WebSphere RFE, but I would recommend finding another solution to avoid a vendor-specific solution.