Issue Type: Bug Bug
Affects Versions: 1.0.0.M6
Assignee: Daniel Bevenius
Components: security
Created: 14/Dec/12 5:19 AM
Description:

When deploying aerogear-security-picketbox the following deployment error is displayed:

11:06:31,562 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.subunit."todo-ear.ear"."todo-server.war".component.PicketBoxLoadUsers.START: org.jboss.msc.service.StartException in service jboss.deployment.subunit."todo-ear.ear"."todo-server.war".component.PicketBoxLoadUsers.START: Failed to start service
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_35]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_35]
        at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_35]
Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
        at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:163)
        at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:85)
        at org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:116)
        at org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:130)
        at org.jboss.as.ee.component.ComponentStartService.start(ComponentStartService.java:44)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
        ... 3 more
Caused by: javax.ejb.EJBException: java.lang.RuntimeException: Error while executing operation on JPA Identity Store.
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:166)
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:230)
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:333)
        at org.jboss.as.ejb3.tx.SingletonLifecycleCMTTxInterceptor.processInvocation(SingletonLifecycleCMTTxInterceptor.java:56)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
        at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
        at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
        at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161)
        ... 9 more
Caused by: java.lang.RuntimeException: Error while executing operation on JPA Identity Store.
        at org.picketlink.idm.jpa.schema.internal.JPATemplate.execute(JPATemplate.java:54)
        at org.picketbox.cdi.idm.DefaultJPATemplate$Proxy$_$$_WeldClientProxy.execute(DefaultJPATemplate$Proxy$_$$_WeldClientProxy.java)
        at org.picketlink.idm.jpa.schema.internal.SimpleJPAIdentityStore.executeOperation(SimpleJPAIdentityStore.java:604)
        at org.picketlink.idm.jpa.schema.internal.SimpleJPAIdentityStore.persist(SimpleJPAIdentityStore.java:624)
        at org.picketlink.idm.jpa.schema.internal.SimpleJPAIdentityStore.createUser(SimpleJPAIdentityStore.java:96)
        at org.picketlink.idm.internal.DefaultIdentityManager.createUser(DefaultIdentityManager.java:73)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [classes.jar:1.6.0_35]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [classes.jar:1.6.0_35]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [classes.jar:1.6.0_35]
        at java.lang.reflect.Method.invoke(Method.java:597) [classes.jar:1.6.0_35]
        at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:44)
        at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
        at org.jboss.weld.proxies.IdentityManager$1109238416$Proxy$_$$_WeldClientProxy.createUser(IdentityManager$1109238416$Proxy$_$$_WeldClientProxy.java)
        at org.jboss.aerogear.security.picketbox.config.PicketBoxLoadUsers.create(PicketBoxLoadUsers.java:54)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [classes.jar:1.6.0_35]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [classes.jar:1.6.0_35]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [classes.jar:1.6.0_35]
        at java.lang.reflect.Method.invoke(Method.java:597) [classes.jar:1.6.0_35]
        at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:130)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
        at org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:73)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
        at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:112)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
        at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
        at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228)
        ... 18 more
Caused by: java.lang.NullPointerException
        at org.picketlink.idm.jpa.schema.internal.SimpleJPAIdentityStore$6.execute(SimpleJPAIdentityStore.java:619)
        at org.picketlink.idm.jpa.schema.internal.JPATemplate.execute(JPATemplate.java:50)
        ... 52 more

SimpleJPAIdentityStore uses a JPATemplate instance which can be configured with an EntityManager. PicketBoxLoadUsers tries to set the EntityManager that this JPATemplate should us by calling from its create method:

JPAIdentityStoreContext.set(this.entityManager);

I think the problem here is that the above call as no effect, as we configure the JPATemplete that should be in use in PicketBoxConfigurer:

builder
       .identityManager()
       .jpaStore().template(this.jpaTemplate);

If the JPATemplate has not been set, for example by removing the above lines of code, JPAIdentityManagerConfiguration will use the one set by the call to JPAIdentityStoreContext and the EntityManager will be non-null.

Note that this error is only seen after the fix for AEROGEAR-729 has been applied.

Fix Versions: 1.0.0.M7
Project: AeroGear
Priority: Major Major
Reporter: Daniel Bevenius
Security Level: Public (Everyone can see)
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira