dev@glassfish.java.net

Re: Embedded EJB container

From: Ron Monzillo <Ronald.Monzillo_at_Sun.COM>
Date: Mon, 08 Jun 2009 14:39:15 -0400

Jerome Dochez wrote:
> Ron Monzillo wrote:
>
>> Hi Jerome,
>>
>> I have been away, so I am just catching up on my email.
>
> not it is not, got busy with javaone.
>
>>
>> On the chance that it was not resolved, the PolicyConfigurationFactory
>> implementation class is configued via the system property:
>>
>> javax.security.jacc.PolicyConfigurationFactory.provider
>>
>> The factory is used to find the policy configuration interface for the
>> associated policy provider. The configuration interface is used by the
>> deployment system to convey the ee application security policy to the
>> pluggabble policy subsystem (for subsquent enforcement by the policy
>> subsystem).
>>
>> both the factory and the policy implementation classes must be must be
>> defined (using different properties), and it looks like you were
>> testing in an environment where the factory property had not been
>> defined.
>>
> I was afraid it would be something like this... Is there no other way to
> achieve pluggability ? System properties are evil in general but they
> are particularly evil in embedded mode...
>

the factory must be defined by a system property (given the current
state of the standard). If you can describe how you the implementation
class should be identified, then I can try to make a maintenance
revision to the spec.

Java uses a security property to define the policy provider (which in
the general case need not be jacc compatible). The security property is
named "policy.provider", and is defined in jre/lib/security/java.security.

jacc defines a system property to allow replacement of the provider
configured via the security property. you could directly configure the
jacc policy provider via the security property (but you would still need
to configure the factory via a system property).

Ron

> jerome
>
>> Ron
>>
>> Jerome Dochez wrote:
>>
>>> In my test, I am not doing any transaction, so I could not care less
>>> which one is used so far as long as it runs my simple EJB. The
>>> dependency list is not final yet, I am just trying to get basic EJBs
>>> working.
>>>
>>> On May 28, 2009, at 11:57 PM, Marina Vatkina wrote:
>>>
>>>> Hi Jerome,
>>>>
>>>> I can't speak for the security, but I do see that you are using
>>>> JavaEETransactionManagerSimplifiedDelegate which means that e.g.
>>>> jts.jar is not present in your setup. Is it expected?
>>>>
>>>> thanks,
>>>> -marina
>>>>
>>>> Jerome Dochez wrote:
>>>>
>>>>> Kumar, Ken, Marina
>>>>> I am making progress on the embedded EJB container, I now have a
>>>>> test trying to deploy a simple ejb jar file within maven. It seems
>>>>> to work until the ejb container tries to setup the security.
>>>>> I have placed inmemory.jacc.provider in the classpath (remember no
>>>>> OSGi in such env). Why is it complaining that the jacc.factory is
>>>>> not found ? isn't it SimplePolicyProvider ?
>>>>> part of the classpath :
>>>>> [DEBUG] /Users/dochez/.m2/repository/org/glassfish/security/
>>>>> inmemory.jacc.provider/3.0-SNAPSHOT/inmemory.jacc.provider-3.0-
>>>>> SNAPSHOT.jar I get the following exception :
>>>>> -------------------------------------------------------
>>>>> T E S T S
>>>>> -------------------------------------------------------
>>>>> Running org.glassfish.tests.ejb.EmbeddedTest
>>>>> May 28, 2009 9:57:20 PM AppServerStartup start
>>>>> INFO: Starting GlassFish Kernel
>>>>> May 28, 2009 9:57:20 PM
>>>>> com.sun.enterprise.v3.server.AppServerStartup run
>>>>> INFO: GlassFish v3 startup time : Embedded(271ms) startup
>>>>> services(287ms) total(558ms)
>>>>> May 28, 2009 9:57:20 PM AppServerStartup run
>>>>> INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
>>>>> Deployment expansion took 11
>>>>> May 28, 2009 9:57:20 PM
>>>>> com.sun.enterprise.transaction.JavaEETransactionManagerSimplified
>>>>> initDelegates
>>>>> INFO: Using com .sun
>>>>> .enterprise.transaction.JavaEETransactionManagerSimplifiedDelegate
>>>>> as the delegate
>>>>> >>Started EJB Container Service....: server
>>>>> >>EjbContainerUtil:
>>>>> com.sun.ejb.containers.EjbContainerUtilImpl_at_3aca6da2
>>>>> DOL Loading time52
>>>>> May 28, 2009 9:57:21 PM
>>>>> org.glassfish.ejb.security.application.EJBSecurityManager
>>>>> getPolicyFactory
>>>>> SEVERE: jaccfactory.notfound
>>>>> May 28, 2009 9:57:21 PM org.glassfish.api.ActionReport failure
>>>>> SEVERE: Exception while invoking class
>>>>> org.glassfish.ejb.startup.EjbDeployer load method
>>>>> java.lang.RuntimeException: EJB Container initialization error
>>>>> at org .glassfish
>>>>> .ejb.startup.EjbApplication.loadContainers(EjbApplication.java:
>>>>> 198) at
>>>>> org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:160)
>>>>> at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:57)
>>>>> at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:152)
>>>>> at org
>>>>> .glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:
>>>>> 174)
>>>>> at com .sun .enterprise
>>>>> .v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:
>>>>> 282) at org .glassfish .kernel
>>>>> .embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:
>>>>> 65) at
>>>>> org.glassfish.tests.ejb.EmbeddedTest.test(EmbeddedTest.java:24)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at sun .reflect
>>>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>>>>> 39) at sun .reflect .DelegatingMethodAccessorImpl
>>>>> .invoke(DelegatingMethodAccessorImpl.java:25) at
>>>>> java.lang.reflect.Method.invoke(Method.java:597)
>>>>> at org .junit .internal
>>>>> .runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:
>>>>> 99) at org .junit .internal
>>>>> .runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:
>>>>> 81) at org .junit .internal .runners
>>>>> .BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
>>>>> at org .junit
>>>>> .internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:
>>>>> 75) at org
>>>>> .junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:
>>>>> 45)
>>>>> at org .junit .internal .runners .TestClassMethodsRunner
>>>>> .invokeTestMethod(TestClassMethodsRunner.java:66) at org .junit
>>>>> .internal
>>>>> .runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:
>>>>> 35) at org.junit.internal.runners.TestClassRunner
>>>>> $1.runUnprotected(TestClassRunner.java:42) at org .junit
>>>>> .internal .runners
>>>>> .BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
>>>>> at
>>>>> org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:
>>>>> 52)
>>>>> at org .apache
>>>>> .maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:
>>>>> 62) at org .apache .maven .surefire .suite
>>>>> .AbstractDirectoryTestSuite
>>>>> .executeTestSet(AbstractDirectoryTestSuite.java:140) at org
>>>>> .apache .maven .surefire .suite
>>>>> .AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:
>>>>> 127) at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at sun .reflect
>>>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>>>>> 39) at sun .reflect .DelegatingMethodAccessorImpl
>>>>> .invoke(DelegatingMethodAccessorImpl.java:25) at
>>>>> java.lang.reflect.Method.invoke(Method.java:597)
>>>>> at org .apache .maven .surefire
>>>>> .booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:
>>>>> 345) at org .apache
>>>>> .maven.surefire.booter.SurefireBooter.run(SurefireBooter.java:
>>>>> 241) at org .apache
>>>>> .maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.java:
>>>>> 537) at org .apache .maven
>>>>> .plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:
>>>>> 483) at org .apache .maven .lifecycle .DefaultLifecycleExecutor
>>>>> .executeGoals(DefaultLifecycleExecutor.java:678) at org .apache
>>>>> .maven .lifecycle .DefaultLifecycleExecutor
>>>>> .executeGoalWithLifecycle(DefaultLifecycleExecutor.java:540) at
>>>>> org .apache .maven .lifecycle
>>>>> .DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:
>>>>> 519) at org .apache .maven .lifecycle .DefaultLifecycleExecutor
>>>>> .executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
>>>>> at org .apache .maven .lifecycle .DefaultLifecycleExecutor
>>>>> .executeTaskSegments(DefaultLifecycleExecutor.java:332) at org
>>>>> .apache .maven .lifecycle
>>>>> .DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:
>>>>> 181) at
>>>>> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
>>>>> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
>>>>> at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at sun .reflect
>>>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>>>>> 39) at sun .reflect .DelegatingMethodAccessorImpl
>>>>> .invoke(DelegatingMethodAccessorImpl.java:25) at
>>>>> java.lang.reflect.Method.invoke(Method.java:597)
>>>>> at
>>>>> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java: 315)
>>>>> at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>>>>> at
>>>>> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>>>>> at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>>>>> Caused by: java.lang.RuntimeException:
>>>>> javax.security.jacc.PolicyContextException:
>>>>> java.lang.ClassNotFoundException: JACC:Error
>>>>> PolicyConfigurationFactory : cannot find class : null
>>>>> at org .glassfish .ejb .security .factory
>>>>> .EJBSecurityManagerFactory
>>>>> .createManager(EJBSecurityManagerFactory.java:205) at org
>>>>> .glassfish
>>>>> .ejb.startup.EjbApplication.loadContainers(EjbApplication.java:
>>>>> 182) ... 50 more
>>>>> Caused by: javax.security.jacc.PolicyContextException:
>>>>> java.lang.ClassNotFoundException: JACC:Error
>>>>> PolicyConfigurationFactory : cannot find class : null
>>>>> at org .glassfish .ejb .security .application
>>>>> .EJBSecurityManager.getPolicyFactory(EJBSecurityManager.java:
>>>>> 220) at org .glassfish .ejb .security .application
>>>>> .EJBSecurityManager.loadPolicyConfiguration(EJBSecurityManager.java:
>>>>> 235) at org .glassfish .ejb .security
>>>>> .application.EJBSecurityManager.initialize(EJBSecurityManager.java:
>>>>> 299) at org .glassfish .ejb .security
>>>>> .application.EJBSecurityManager.<init>(EJBSecurityManager.java:
>>>>> 183) at org .glassfish .ejb .security .factory
>>>>> .EJBSecurityManagerFactory
>>>>> .createManager(EJBSecurityManagerFactory.java:198) ... 51 more
>>>>> Caused by: java.lang.ClassNotFoundException: JACC:Error
>>>>> PolicyConfigurationFactory : cannot find class : null
>>>>> at javax .security .jacc .PolicyConfigurationFactory
>>>>> .getPolicyConfigurationFactory(PolicyConfigurationFactory.java:
>>>>> 172) at org .glassfish .ejb .security .application
>>>>> .EJBSecurityManager.getPolicyFactory(EJBSecurityManager.java:
>>>>> 217) ... 55 more
>>>>> Caused by: java.lang.ClassNotFoundException: JACC:Error
>>>>> PolicyConfigurationFactory : property not set :
>>>>> javax.security.jacc.PolicyConfigurationFactory.provider
>>>>> at javax .security .jacc .PolicyConfigurationFactory
>>>>> .getPolicyConfigurationFactory(PolicyConfigurationFactory.java:
>>>>> 157) ... 56 more
>>>>> May 28, 2009 9:57:21 PM org.glassfish.api.ActionReport failure
>>>>> SEVERE: Exception while loading the app
>>>>> java.lang.RuntimeException: EJB Container initialization error
>>>>> at org .glassfish
>>>>> .ejb.startup.EjbApplication.loadContainers(EjbApplication.java:
>>>>> 198) at
>>>>> org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:160)
>>>>> at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:57)
>>>>> at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:152)
>>>>> at org
>>>>> .glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:
>>>>> 174)
>>>>> at com .sun .enterprise
>>>>> .v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:
>>>>> 282) at org .glassfish .kernel
>>>>> .embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:
>>>>> 65) at
>>>>> org.glassfish.tests.ejb.EmbeddedTest.test(EmbeddedTest.java:24)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at sun .reflect
>>>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>>>>> 39) at sun .reflect .DelegatingMethodAccessorImpl
>>>>> .invoke(DelegatingMethodAccessorImpl.java:25) at
>>>>> java.lang.reflect.Method.invoke(Method.java:597)
>>>>> at org .junit .internal
>>>>> .runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:
>>>>> 99) at org .junit .internal
>>>>> .runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:
>>>>> 81) at org .junit .internal .runners
>>>>> .BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
>>>>> at org .junit
>>>>> .internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:
>>>>> 75) at org
>>>>> .junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:
>>>>> 45)
>>>>> at org .junit .internal .runners .TestClassMethodsRunner
>>>>> .invokeTestMethod(TestClassMethodsRunner.java:66) at org .junit
>>>>> .internal
>>>>> .runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:
>>>>> 35) at org.junit.internal.runners.TestClassRunner
>>>>> $1.runUnprotected(TestClassRunner.java:42) at org .junit
>>>>> .internal .runners
>>>>> .BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
>>>>> at
>>>>> org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:
>>>>> 52)
>>>>> at org .apache
>>>>> .maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:
>>>>> 62) at org .apache .maven .surefire .suite
>>>>> .AbstractDirectoryTestSuite
>>>>> .executeTestSet(AbstractDirectoryTestSuite.java:140) at org
>>>>> .apache .maven .surefire .suite
>>>>> .AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:
>>>>> 127) at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at sun .reflect
>>>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>>>>> 39) at sun .reflect .DelegatingMethodAccessorImpl
>>>>> .invoke(DelegatingMethodAccessorImpl.java:25) at
>>>>> java.lang.reflect.Method.invoke(Method.java:597)
>>>>> at org .apache .maven .surefire
>>>>> .booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:
>>>>> 345) at org .apache
>>>>> .maven.surefire.booter.SurefireBooter.run(SurefireBooter.java:
>>>>> 241) at org .apache
>>>>> .maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.java:
>>>>> 537) at org .apache .maven
>>>>> .plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:
>>>>> 483) at org .apache .maven .lifecycle .DefaultLifecycleExecutor
>>>>> .executeGoals(DefaultLifecycleExecutor.java:678) at org .apache
>>>>> .maven .lifecycle .DefaultLifecycleExecutor
>>>>> .executeGoalWithLifecycle(DefaultLifecycleExecutor.java:540) at
>>>>> org .apache .maven .lifecycle
>>>>> .DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:
>>>>> 519) at org .apache .maven .lifecycle .DefaultLifecycleExecutor
>>>>> .executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
>>>>> at org .apache .maven .lifecycle .DefaultLifecycleExecutor
>>>>> .executeTaskSegments(DefaultLifecycleExecutor.java:332) at org
>>>>> .apache .maven .lifecycle
>>>>> .DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:
>>>>> 181) at
>>>>> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
>>>>> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
>>>>> at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at sun .reflect
>>>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>>>>> 39) at sun .reflect .DelegatingMethodAccessorImpl
>>>>> .invoke(DelegatingMethodAccessorImpl.java:25) at
>>>>> java.lang.reflect.Method.invoke(Method.java:597)
>>>>> at
>>>>> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java: 315)
>>>>> at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>>>>> at
>>>>> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>>>>> at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>>>>> Caused by: java.lang.RuntimeException:
>>>>> javax.security.jacc.PolicyContextException:
>>>>> java.lang.ClassNotFoundException: JACC:Error
>>>>> PolicyConfigurationFactory : cannot find class : null
>>>>> at org .glassfish .ejb .security .factory
>>>>> .EJBSecurityManagerFactory
>>>>> .createManager(EJBSecurityManagerFactory.java:205) at org
>>>>> .glassfish
>>>>> .ejb.startup.EjbApplication.loadContainers(EjbApplication.java:
>>>>> 182) ... 50 more
>>>>> Caused by: javax.security.jacc.PolicyContextException:
>>>>> java.lang.ClassNotFoundException: JACC:Error
>>>>> PolicyConfigurationFactory : cannot find class : null
>>>>> at org .glassfish .ejb .security .application
>>>>> .EJBSecurityManager.getPolicyFactory(EJBSecurityManager.java:
>>>>> 220) at org .glassfish .ejb .security .application
>>>>> .EJBSecurityManager.loadPolicyConfiguration(EJBSecurityManager.java:
>>>>> 235) at org .glassfish .ejb .security
>>>>> .application.EJBSecurityManager.initialize(EJBSecurityManager.java:
>>>>> 299) at org .glassfish .ejb .security
>>>>> .application.EJBSecurityManager.<init>(EJBSecurityManager.java:
>>>>> 183) at org .glassfish .ejb .security .factory
>>>>> .EJBSecurityManagerFactory
>>>>> .createManager(EJBSecurityManagerFactory.java:198) ... 51 more
>>>>> Caused by: java.lang.ClassNotFoundException: JACC:Error
>>>>> PolicyConfigurationFactory : cannot find class : null
>>>>> at javax .security .jacc .PolicyConfigurationFactory
>>>>> .getPolicyConfigurationFactory(PolicyConfigurationFactory.java:
>>>>> 172) at org .glassfish .ejb .security .application
>>>>> .EJBSecurityManager.getPolicyFactory(EJBSecurityManager.java:
>>>>> 217) ... 55 more
>>>>> Caused by: java.lang.ClassNotFoundException: JACC:Error
>>>>> PolicyConfigurationFactory : property not set :
>>>>> javax.security.jacc.PolicyConfigurationFactory.provider
>>>>> at javax .security .jacc .PolicyConfigurationFactory
>>>>> .getPolicyConfigurationFactory(PolicyConfigurationFactory.java:
>>>>> 157) ... 56 more
>>>>> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
>>>>> 1.108 sec
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>