我开始将Seam 2.3应用程序迁移到JavaEE 6,并且其中一部分将使用PicketLink 2.5.0和PicketBox 5.0来提高安全性,尤其是IDM组件。我正在尝试利用JPA身份存储,并使用适当的注释创建了自己的实体。但是,当我尝试添加用户时,出现以下异常:

java.lang.NoClassDefFoundError: org/picketlink/idm/config/StoreConfiguration

我已经查看了JAR文件,并且肯定没有看到该对象。我正在使用PicketBox 5.0。这是PicketLink和PicketBox的组合的已知问题吗?我做错什么了吗?该对象是否位于其他JAR中?创建我的用户的代码如下所示:
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.identityManager().jpaStore();

PicketBoxConfiguration config = builder.build();
DefaultPicketBoxManager picketBoxManager = new DefaultPicketBoxManager(
        config);

picketBoxManager.start();

EntityManagerPropagationContext.set(this.entityManager);

IdentityManager idm = picketBoxManager.getIdentityManager();

    SimpleUser user = new SimpleUser("testuser");
    idm.add(user);
    System.out.println("User added");

更新:有关我的设置的更多信息...

我已经下载了PicketLink 2.5.0beta6和PicketBox 5.0.0。所有相关的JAR都保存在我的EAR文件中,该文件已部署在JBoss EAP 6.1上。运行代码时,我看到抛出以下异常:
java.lang.NoClassDefFoundError: org/picketlink/idm/config/StoreConfiguration
    org.picketbox.core.AbstractPicketBoxManager.doStart(AbstractPicketBoxManager.java:244)
    org.picketbox.core.AbstractPicketBoxLifeCycle.start(AbstractPicketBoxLifeCycle.java:53)
    net.test.services.TestEJB.doTest(TestEJB.java:42)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:601)
    org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)
    org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
    org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
    org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58)
    org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
    org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374)
    org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:129)
    org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:137)
    org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58)
    org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

...

JBWEB000071: root cause

java.lang.ClassNotFoundException: org.picketlink.idm.config.StoreConfiguration from [Module "deployment.TestApp-ear.ear:main" from Service Module Loader]
    org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:196)
    org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444)
    org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432)
    org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374)
    org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119)
    org.picketbox.core.AbstractPicketBoxManager.doStart(AbstractPicketBoxManager.java:244)
    org.picketbox.core.AbstractPicketBoxLifeCycle.start(AbstractPicketBoxLifeCycle.java:53)
    net.test.services.TestEJB.doTest(TestEJB.java:42)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:601)

最佳答案

我可以在JBoss站点上找到说明如何在JBoss EAP 6.1中升级PicketLink库的文档。一切都解决了。

08-18 09:36