Uploaded image for project: 'PicketLink'
  1. PicketLink
  2. PLINK-747

NoClassDefFoundError on org/picketlink/idm/config/Builder

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • PLINK_2.7.1.Final
    • IDM
    • None
    • Compatibility/Configuration

      I am deploying a Java EE 7 application on Wildfly 10, with the PicketLink subsystem configured and installed. My app is being deployed as an EAR file. The jboss-deployment-structure.xml has the EAR-level dependencies for PicketLink specified as the following:

      <module name="org.picketlink.config" export="true" meta-inf="import"
      				annotations="true" services="import" />
      			<module name="org.picketlink.core.api" export="true" meta-inf="import"
      				annotations="true" services="import" />
      			<module name="org.picketlink.idm.api" export="true" meta-inf="import"
      				annotations="true" services="import" />
      			<module name="org.picketlink.core" export="true" meta-inf="import"
      				annotations="true" services="import" />
      			<module name="org.picketlink.idm" export="true" meta-inf="import"
      				annotations="true" services="import" />
      			<module name="org.picketlink.common" export="true" meta-inf="import"
      				annotations="true" services="import" />
      			<module name="org.picketlink.idm.schema" export="true"
      				meta-inf="import" annotations="true" services="import" />
      

      I have also included the same module dependencies for each sub-deployment listed in the jboss-deployment-structure.xml file.

      The following code is used to read my picketlink.xml file from the classpath once the application starts:

      public void identityConfigurationEvent(@Observes IdentityConfigurationEvent event) {
      		if (logger.isDebugEnabled()) {
      			logger.debug("identityConfigurationEvent(IdentityConfigurationEvent) - start"); //$NON-NLS-1$
      		}
      
      		if (logger.isInfoEnabled()) {
      			logger.info(
      					"identityConfigurationEvent(IdentityConfigurationEvent) - Creating PicketLink identity configuration..."); //$NON-NLS-1$
      		}
      
      		ClassLoader cl = Thread.currentThread().getContextClassLoader();
      		InputStream inStream = cl.getResourceAsStream("/META-INF/picketlink.xml");
      
      		if (inStream == null) {
      			logger.error(
      					"identityConfigurationEvent(IdentityConfigurationEvent) - No picketlink.xml file found on classpath.  Unable to create identity configuration.", //$NON-NLS-1$
      					null);
      
      		} else {
      			if (logger.isDebugEnabled()) {
      				logger.debug(
      						"identityConfigurationEvent(IdentityConfigurationEvent) - picketlink.xml file located on classpath"); //$NON-NLS-1$
      			}
      
      			XMLConfigurationProvider configProvider = new XMLConfigurationProvider();
      
      			IdentityConfigurationBuilder builder = configProvider.readIDMConfiguration(inStream);
      			builder.named("Holocron_IDM").stores().jpa()
      					.addContextInitializer(new PicketLinkContextInitializer(this.entityManager));
      
      			IdentityConfiguration config = builder.build();
      			if (config == null) {
      				logger.error(
      						"identityConfigurationEvent(IdentityConfigurationEvent) - Unable to create IdentityConfiguration from picketlink.xml file", //$NON-NLS-1$
      						null);
      			} else {
      				if (logger.isInfoEnabled()) {
      					logger.info(
      							"identityConfigurationEvent(IdentityConfigurationEvent) - PicketLink identity configuration created successfully"); //$NON-NLS-1$
      				}
      			}
      		}
      

      However, when execution reaches the line where the XMLConfigurationProvider is created, the following exception is thrown:

      18:15:17,851 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 165) MSC000001: Failed to start service jboss.deployment.subunit."mytest-ear-0.1-SNAPSHOT.ear"."mytest-security.jar".component.PicketLinkInitializer.START: org.jboss.msc.service.StartException in service jboss.deployment.subunit."mytest-ear-0.1-SNAPSHOT.ear"."mytest-security.jar".component.PicketLinkInitializer.START: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
      	at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:57) [wildfly-ee-10.0.0.Final.jar:10.0.0.Final]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [rt.jar:1.8.0_60]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_60]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_60]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_60]
      	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_60]
      	at org.jboss.threads.JBossThread.run(JBossThread.java:320)
      Caused by: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
      	at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:163) [wildfly-ee-10.0.0.Final.jar:10.0.0.Final]
      	at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:134) [wildfly-ee-10.0.0.Final.jar:10.0.0.Final]
      	at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:88) [wildfly-ee-10.0.0.Final.jar:10.0.0.Final]
      	at org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:124)
      	at org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:138)
      	at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:54) [wildfly-ee-10.0.0.Final.jar:10.0.0.Final]
      	... 6 more
      Caused by: javax.ejb.EJBException: javax.enterprise.event.ObserverException
      	at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:187)
      	at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
      	at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:349)
      	at org.jboss.as.ejb3.tx.LifecycleCMTTxInterceptor.processInvocation(LifecycleCMTTxInterceptor.java:66)
      	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
      	at org.jboss.as.weld.injection.WeldInjectionContextInterceptor.processInvocation(WeldInjectionContextInterceptor.java:43)
      	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
      	at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
      	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
      	at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45) [wildfly-ee-10.0.0.Final.jar:10.0.0.Final]
      	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
      	at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
      	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
      	at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
      	at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
      	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
      	at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
      	at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161) [wildfly-ee-10.0.0.Final.jar:10.0.0.Final]
      	... 11 more
      Caused by: javax.enterprise.event.ObserverException
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.8.0_60]
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [rt.jar:1.8.0_60]
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.8.0_60]
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:422) [rt.jar:1.8.0_60]
      	at java.lang.Class.newInstance(Class.java:442) [rt.jar:1.8.0_60]
      	at org.jboss.weld.security.NewInstanceAction.run(NewInstanceAction.java:33)
      	at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_60]
      	at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:40)
      	at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:78)
      	at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:96)
      	at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:78)
      	at org.jboss.weld.injection.MethodInvocationStrategy$SimpleMethodInvocationStrategy.invoke(MethodInvocationStrategy.java:129)
      	at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:309)
      	at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:287)
      	at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:265)
      	at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:271)
      	at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:260)
      	at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:154)
      	at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:136)
      	at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:673)
      	at org.jboss.weld.util.ForwardingBeanManager.fireEvent(ForwardingBeanManager.java:101)
      	at org.picketlink.internal.CDIEventBridge.fireEvent(CDIEventBridge.java:50)
      	at org.picketlink.internal.CDIEventBridge$Proxy$_$$_WeldClientProxy.fireEvent(Unknown Source)
      	at org.picketlink.producer.IdentityManagementConfiguration.getIdentityConfiguration(IdentityManagementConfiguration.java:104)
      	at org.picketlink.producer.IdentityManagementProducer.createEmbeddedPartitionManager(IdentityManagementProducer.java:145)
      	at org.picketlink.producer.IdentityManagementProducer.init(IdentityManagementProducer.java:99)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_60]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_60]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_60]
      	at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_60]
      	at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88)
      	at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:78)
      	at org.jboss.weld.util.Beans.callInitializers(Beans.java:402)
      	at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:390)
      	at org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
      	at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
      	at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
      	at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)
      	at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
      	at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
      	at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
      	at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)
      	at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
      	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:742)
      	at org.jboss.weld.injection.producer.AbstractMemberProducer.getReceiver(AbstractMemberProducer.java:123)
      	at org.jboss.weld.injection.producer.AbstractMemberProducer.produce(AbstractMemberProducer.java:158)
      	at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:181)
      	at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:70)
      	at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
      	at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
      	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:742)
      	at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:842)
      	at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
      	at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:378)
      	at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:389)
      	at org.jboss.weld.injection.producer.DefaultInjector$1.proceed(DefaultInjector.java:71)
      	at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
      	at org.jboss.weld.injection.producer.DefaultInjector.inject(DefaultInjector.java:73)
      	at org.jboss.weld.injection.producer.ejb.SessionBeanInjectionTarget.inject(SessionBeanInjectionTarget.java:140)
      	at org.jboss.as.weld.injection.WeldInjectionContext.inject(WeldInjectionContext.java:39)
      	at org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:51)
      	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
      	at org.jboss.as.ee.component.AroundConstructInterceptorFactory$1.processInvocation(AroundConstructInterceptorFactory.java:28) [wildfly-ee-10.0.0.Final.jar:10.0.0.Final]
      	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
      	at org.jboss.as.weld.injection.WeldInterceptorInjectionInterceptor.processInvocation(WeldInterceptorInjectionInterceptor.java:56)
      	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
      	at org.jboss.as.weld.ejb.Jsr299BindingsCreateInterceptor.processInvocation(Jsr299BindingsCreateInterceptor.java:100)
      	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
      	at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [wildfly-ee-10.0.0.Final.jar:10.0.0.Final]
      	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
      	at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275)
      	... 27 more
      Caused by: java.lang.NoClassDefFoundError: org/picketlink/idm/config/Builder
      	at com.mytest.security.PicketLinkConfiguration.identityConfigurationEvent(PicketLinkConfiguration.java:96)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_60]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_60]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_60]
      	at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_60]
      	at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88)
      	... 88 more
      Caused by: java.lang.ClassNotFoundException: org.picketlink.idm.config.Builder from [Module "org.picketlink.config:main" from local module loader @44a3ec6b (finder: local module finder @71623278 (roots: /Volumes/Untitled/Servers/wildfly-10.0.0.Final/modules,/Volumes/Untitled/Servers/wildfly-10.0.0.Final/modules/system/layers/base))]
      	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198) [jboss-modules.jar:1.5.1.Final]
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363) [jboss-modules.jar:1.5.1.Final]
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351) [jboss-modules.jar:1.5.1.Final]
      	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93) [jboss-modules.jar:1.5.1.Final]
      	... 94 more
      
      

      This exception only occurs when deploying the app as an EAR file. If packaged as a WAR, I am able to configure via XML file with no problem.

              psilva@redhat.com Pedro Igor Craveiro
              sdnakhla_jira Akhbar Falafel (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: