glassfish
  1. glassfish
  2. GLASSFISH-16264

Embedded GF 3.1 (re)deployment with EJBContainer causes exception: Error linking security policy for ejb-timer-service-app

    Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.1
    • Fix Version/s: 4.1
    • Component/s: security
    • Labels:
      None
    • Environment:

      Windows 7 Premium 64 bit; Glassfish 3.1; JDK 1.6.0_22 32 bit

      Description

      I have a JUnit test that starts up embedded glassfish 3.1 and deploys a module which contains EJBs. I placed the container init code in a @Before method so that it will be started fresh for each test like so:

      //Set up the embedded EJB containers env properties
      Map<String, Object> p = new HashMap<String, Object>();
      p.put(EJBContainer.APP_NAME, "myapp");
      p.put(EJBContainer.MODULES, new File("out/production/myapp"));
      p.put("org.glassfish.ejb.embedded.glassfish.installation.root", "C:/glassfish3/glassfish");
      ejbC = EJBContainer.createEJBContainer(p);

      I also have a @After method which closes the container after each test like :

      @After
      public void tearDown() throws Exception

      { if (ejbC != null) ejbC.close(); }

      The problem I am having is that the first test method deploys and runs fine, however, subsequent test methods fail on deployment with the following exception thrown by the EJBContainer.createEJBContainer(p) line of code above:

      Mar 24, 2011 10:21:32 AM com.sun.ejb.containers.EjbContainerUtilImpl deployEJBTimerService
      INFO: Loading EJBTimerService. Please wait.
      classLoader = WebappClassLoader (delegate=true; repositories=WEB-INF/classes/)
      SharedSecrets.getJavaNetAccess()=java.net.URLClassLoader$7@167a209
      Mar 24, 2011 10:21:32 AM org.hibernate.validator.engine.resolver.DefaultTraversableResolver detectJPA
      INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
      Mar 24, 2011 10:21:32 AM org.eclipse.persistence.session.file:/C:/Users/nwhite/AppData/Local/Temp/gfembed8734725078398943370tmp/applications/ejb-timer-service-app/WEB-INF/classes/___EJB__Timer__App
      INFO: EclipseLink, version: Eclipse Persistence Services - 2.2.0.v20110202-r8913
      Mar 24, 2011 10:21:36 AM org.eclipse.persistence.session.file:/C:/Users/nwhite/AppData/Local/Temp/gfembed8734725078398943370tmp/applications/ejb-timer-service-app/WEB-INF/classes/___EJB__Timer__App
      INFO: file:/C:/Users/nwhite/AppData/Local/Temp/gfembed8734725078398943370tmp/applications/ejb-timer-service-app/WEB-INF/classes/___EJB__Timer__App login successful
      Mar 24, 2011 10:21:36 AM com.sun.ejb.containers.TimerBeanContainer <init>
      INFO: [TimerBeanContainer] Created TimerBeanContainer: TimerBean
      Mar 24, 2011 10:21:36 AM com.sun.ejb.containers.BaseContainer initializeHome
      INFO: Portable JNDI names for EJB TimerBean : [java:global/ejb-timer-service-app/TimerBean, java:global/ejb-timer-service-app/TimerBean!com.sun.ejb.containers.TimerLocal]
      classLoader = WebappClassLoader (delegate=true; repositories=WEB-INF/classes/)
      SharedSecrets.getJavaNetAccess()=java.net.URLClassLoader$7@167a209
      Mar 24, 2011 10:21:36 AM org.glassfish.api.ActionReport failure
      SEVERE: Exception while loading the app
      Mar 24, 2011 10:21:36 AM org.eclipse.persistence.session.file:/C:/Users/nwhite/AppData/Local/Temp/gfembed8734725078398943370tmp/applications/ejb-timer-service-app/WEB-INF/classes/___EJB__Timer__App
      INFO: file:/C:/Users/nwhite/AppData/Local/Temp/gfembed8734725078398943370tmp/applications/ejb-timer-service-app/WEB-INF/classes/___EJB__Timer__App logout successful
      Mar 24, 2011 10:21:36 AM com.sun.ejb.containers.EjbContainerUtilImpl deployEJBTimerService
      WARNING: Cannot deploy or load EJBTimerService:
      org.glassfish.deployment.common.DeploymentException: Error in linking security policy for ejb-timer-service-app – Inconsistent Module State
      at com.sun.enterprise.security.SecurityUtil.linkPolicyFile(SecurityUtil.java:335)
      at com.sun.enterprise.security.SecurityDeployer.linkPolicies(SecurityDeployer.java:279)
      at com.sun.enterprise.security.SecurityDeployer.access$100(SecurityDeployer.java:81)
      at com.sun.enterprise.security.SecurityDeployer$AppDeployEventListener.event(SecurityDeployer.java:114)
      at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
      at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:262)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
      at com.sun.ejb.containers.EjbContainerUtilImpl.deployEJBTimerService(EjbContainerUtilImpl.java:547)
      at com.sun.ejb.containers.EjbContainerUtilImpl.getEJBTimerService(EjbContainerUtilImpl.java:289)
      at com.sun.ejb.containers.EjbContainerUtilImpl.getEJBTimerService(EjbContainerUtilImpl.java:284)
      at com.sun.ejb.containers.EjbContainerUtilImpl.getEJBTimerService(EjbContainerUtilImpl.java:269)
      at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:755)
      at com.sun.ejb.containers.AbstractSingletonContainer.<init>(AbstractSingletonContainer.java:141)
      at com.sun.ejb.containers.CMCSingletonContainer.<init>(CMCSingletonContainer.java:77)
      at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:115)
      at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:234)
      at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:290)
      at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:101)
      at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186)
      at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:249)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
      at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:193)
      at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:142)
      at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:135)
      at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:132)
      at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:127)

      During the shutdown process after the first test runs I noticed the following:

      Mar 24, 2011 10:21:19 AM com.sun.ejb.containers.TimerBeanContainer doConcreteContainerShutdown
      INFO: [TimerBeanContainer] Shutdown() called....
      Mar 24, 2011 10:21:19 AM com.sun.ejb.containers.EJBTimerService onShutdown
      INFO: EJB5122:EJB Timer Service shutdown at [2011/03/24 10:21:19]
      Mar 24, 2011 10:21:19 AM com.sun.enterprise.web.WebContainer unloadWebModule
      SEVERE: WEB0162: [WebContainer] Undeployment failed for context [/ejb-timer-service-app]
      Mar 24, 2011 10:21:19 AM org.eclipse.persistence.session.file:/C:/Users/nwhite/AppData/Local/Temp/gfembed671660783214676050tmp/applications/ejb-timer-service-app/WEB-INF/classes/___EJB__Timer__App
      INFO: file:/C:/Users/nwhite/AppData/Local/Temp/gfembed671660783214676050tmp/applications/ejb-timer-service-app/WEB-INF/classes/___EJB__Timer__App logout successful

        Activity

        Hide
        Cheng Fang added a comment -

        Assign it to me.

        Show
        Cheng Fang added a comment - Assign it to me.
        Hide
        Cheng Fang added a comment -

        Stacktrace for the permission check error:

             [java] WARNING: A system exception occurred during an invocation on EJB TimerBean method public java.util.Set com.sun.ejb.containers.TimerBean.findActiveTimersOwnedByThisServer()
             [java] javax.ejb.AccessLocalException: Client not authorized for this invocation.
             [java] 	at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1885)
             [java] 	at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:212)
             [java] 	at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
             [java] 	at $Proxy130.findActiveTimersOwnedByThisServer(Unknown Source)
             [java] 	at com.sun.ejb.containers.EJBTimerService.restoreEJBTimers(EJBTimerService.java:486)
             [java] 	at com.sun.ejb.containers.EjbContainerUtilImpl.getEJBTimerService(EjbContainerUtilImpl.java:307)
             [java] 	at com.sun.ejb.containers.EjbContainerUtilImpl.getEJBTimerService(EjbContainerUtilImpl.java:289)
             [java] 	at com.sun.ejb.containers.EjbContainerUtilImpl.getEJBTimerService(EjbContainerUtilImpl.java:274)
             [java] 	at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:755)
             [java] 	at com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:155)
             [java] 	at com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:149)
             [java] 	at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:105)
             [java] 	at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:230)
             [java] 	at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:290)
             [java] 	at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:101)
             [java] 	at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186)
             [java] 	at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:257)
             [java] 	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
             [java] 	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
             [java] 	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
             [java] 	at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
             [java] 	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
             [java] 	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
             [java] 	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
             [java] 	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
             [java] 	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
             [java] 	at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:129)
             [java] 	at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:105)
             [java] 	at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:140)
             [java] 	at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:134)
             [java] 	at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:127)
             [java] 	at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
             [java] 	at com.acme.Client.test(Client.java:81)
             [java] 	at com.acme.Client.main(Client.java:70)
        
        Show
        Cheng Fang added a comment - Stacktrace for the permission check error: [java] WARNING: A system exception occurred during an invocation on EJB TimerBean method public java.util.Set com.sun.ejb.containers.TimerBean.findActiveTimersOwnedByThisServer() [java] javax.ejb.AccessLocalException: Client not authorized for this invocation. [java] at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1885) [java] at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:212) [java] at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88) [java] at $Proxy130.findActiveTimersOwnedByThisServer(Unknown Source) [java] at com.sun.ejb.containers.EJBTimerService.restoreEJBTimers(EJBTimerService.java:486) [java] at com.sun.ejb.containers.EjbContainerUtilImpl.getEJBTimerService(EjbContainerUtilImpl.java:307) [java] at com.sun.ejb.containers.EjbContainerUtilImpl.getEJBTimerService(EjbContainerUtilImpl.java:289) [java] at com.sun.ejb.containers.EjbContainerUtilImpl.getEJBTimerService(EjbContainerUtilImpl.java:274) [java] at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:755) [java] at com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:155) [java] at com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:149) [java] at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:105) [java] at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:230) [java] at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:290) [java] at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:101) [java] at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186) [java] at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:257) [java] at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461) [java] at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240) [java] at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382) [java] at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355) [java] at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370) [java] at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064) [java] at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96) [java] at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244) [java] at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232) [java] at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:129) [java] at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:105) [java] at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:140) [java] at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:134) [java] at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:127) [java] at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102) [java] at com.acme.Client.test(Client.java:81) [java] at com.acme.Client.main(Client.java:70)
        Hide
        Cheng Fang added a comment -

        After applying Kumar's hack (related to inService check) to 3.1.1 build, the ejbdev test embedded/timertest passed when running the second timer tests. I tried the test run several times w/ the same result.

        The ejb error Kumar was seeing before (Caused by: java.lang.NoSuchFieldError: moduleName) looks like a setup issue. moduleName field was recently added to 3.2, but not to 3.1.1. When runnign w/ 3.1.1, there should be no trace of it. With 3.2, it should be resolved correctly.

        Re-assign to security team to pursue a formal fix.

        Show
        Cheng Fang added a comment - After applying Kumar's hack (related to inService check) to 3.1.1 build, the ejbdev test embedded/timertest passed when running the second timer tests. I tried the test run several times w/ the same result. The ejb error Kumar was seeing before (Caused by: java.lang.NoSuchFieldError: moduleName) looks like a setup issue. moduleName field was recently added to 3.2, but not to 3.1.1. When runnign w/ 3.1.1, there should be no trace of it. With 3.2, it should be resolved correctly. Re-assign to security team to pursue a formal fix.
        Hide
        syvalta added a comment -

        Could the "Fix version" be updated as this is still open and 3.1.2 has already been released?

        Show
        syvalta added a comment - Could the "Fix version" be updated as this is still open and 3.1.2 has already been released?
        Hide
        markds added a comment -

        Can I ask what is happening with this bug? It still occurs in 3.1.2.2

        Show
        markds added a comment - Can I ask what is happening with this bug? It still occurs in 3.1.2.2

          People

          • Assignee:
            JeffTancill
            Reporter:
            emailnbw
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: