[GLASSFISH-20689] @runAs annotation fails when ejb is called from servlet during deplyment Created: 09/Jul/13  Updated: 20/Dec/16

Status: Open
Project: glassfish
Component/s: security
Affects Version/s: 4.0_dev
Fix Version/s: 4.1.1

Type: Bug Priority: Major
Reporter: rsoika Assignee: Nithya Ramakrishnan
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

OpenJDK Runtime Environment (IcedTea 2.3.9) (7u21-2.3.9-1ubuntu1)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)


I have a EAR project containing an EJB and a WEB module. The EJB module contains a stateless session ejb with a runAs annotation:

@DeclareRoles({ "org.imixs.ACCESSLEVEL.MANAGERACCESS" })
public class UserGroupService {

In the web module there is a Servlet defined whith a loadOnStartup=1 option:

public class SetupServlet extends HttpServlet {
	UserGroupService userGroupService;

To declare the RunAs annotation the EAR module contains a glassfish-application.xml file with


So I think I map a principal to that role which is used to by the RunAs annotation.
In addition the ejb module contains a glassfish-ejb-jar.xml file with :


During deployment the servlet should call some methods of the UserGroupService. The UserGroupService is injected as far as I can see during debugging.
But now I got a "Could not create stateless EJB" exception when the servlet tries to call a EJB method.

The same ear deploys on GlassFish without any problem.
Are there any changes in the security definition? Or is there something going wrong during the deployment process of GlassFish4

Comment by rsoika [ 30/Dec/13 ]

I am now running nightly build glassfish4.0.1.b04-12_28_2013
But it seems that I have still the same issue. The only log file information is:

WARNING: A system exception occurred during an invocation on EJB ProfileService, method: public org.imixs.workflow.ItemCollection org.imixs.marty.ejb.ProfileService.lookupProfileById(java.lang.String)

Can I do anything to provide you with helpful information? Or can you tell me what that issue depends on?

Comment by rsoika [ 30/Dec/13 ]

During deployment I see the following warning. But no information why that warning is shown:

[2013-12-30T16:09:01.431+0100] [glassfish 4.0] [WARNING] [] [javax.enterprise.system.tools.deployment.dol] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1388416141431] [levelValue: 900] [[

Comment by rsoika [ 14/Jan/14 ]

I have not tested the application with WildFly. I can deploy the same application without any problems on WildFly 8

Comment by Nithya Ramakrishnan [ 05/Mar/14 ]


Have you tried moving the security-role-mapping to glassfish-ejb-jar.xml from glassfish-application.xml ?
If the same prb exists, couuld you pls attach the app ?

Generated at Sun Apr 23 12:30:19 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.