glassfish
  1. glassfish
  2. GLASSFISH-20689

@runAs annotation fails when ejb is called from servlet during deplyment

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 4.0_b89_RC5
    • Fix Version/s: 4.1.1
    • Component/s: security
    • Labels:
      None
    • Environment:

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

      Description

      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" })
      @RunAs("org.imixs.ACCESSLEVEL.MANAGERACCESS")
      @Stateless
      @Local
      public class UserGroupService {
      ....
      

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

      @WebServlet(loadOnStartup=1)
      public class SetupServlet extends HttpServlet {
      	@EJB
      	UserGroupService userGroupService;
      

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

      	<security-role-mapping>
      		<role-name>org.imixs.ACCESSLEVEL.MANAGERACCESS</role-name>
      		<group-name>IMIXS-WORKFLOW-Manager</group-name>
      		<principal-name>IMIXS-WORKFLOW-Service</principal-name>
      	</security-role-mapping>	
      

      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 :

      	<ejb>
      			<ejb-name>UserGroupService</ejb-name>
      			<principal>
      				<name>IMIXS-WORKFLOW-Service</name>
      			</principal>
      		</ejb>
      

      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 3.1.2.2 without any problem.
      Are there any changes in the security definition? Or is there something going wrong during the deployment process of GlassFish4

        Activity

        Hide
        Nithya Ramakrishnan added a comment -

        Hi,

        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 ?

        Show
        Nithya Ramakrishnan added a comment - Hi, 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 ?
        Hide
        rsoika added a comment -

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

        Show
        rsoika added a comment - I have not tested the application with WildFly. I can deploy the same application without any problems on WildFly 8
        Hide
        rsoika added a comment -

        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] [[
        enterprise.deployment.backend.computeRunAsPrincipal]]

        Show
        rsoika added a comment - 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] [[ enterprise.deployment.backend.computeRunAsPrincipal]]
        Hide
        rsoika added a comment -

        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?

        Show
        rsoika added a comment - 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?

          People

          • Assignee:
            Nithya Ramakrishnan
            Reporter:
            rsoika
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: