4

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

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)
4

1 回答 1

0

我能够在 JBoss 站点上找到解释如何在 JBoss EAP 6.1 中升级 PicketLink 库的文档。这解决了一切。

于 2013-08-16T14:18:28.003 回答