我需要使用Jetty运行此代码(适用于JBoss):
import javax.annotation.PostConstruct;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Inject;
import org.picketlink.idm.PartitionManager;
import org.picketlink.idm.model.basic.Realm;
@Startup
@Singleton
public class PicketLinkStartup {
@Inject
private PartitionManager partitionManager;
@PostConstruct
public void workaround() {
/*
* This forces the partition manager to be loaded on app startup. Without
* this, it is possible for a FailedAuthenticationException to leave
* picketlink in a bad state where the default partition is no longer
* accessible.
*/
partitionManager.getPartition(Realm.class, Realm.DEFAULT_REALM);
}
}
我需要在Jetty启动时运行PicketLinkStartup
。有没有办法做到这一点?
答案 0 :(得分:0)
JBoss是一个带有EJB容器的完整EE应用程序服务器,而Jetty只是一个servlet容器。要在应用程序中使用会话bean,您需要部署到EJB容器中。
您可以尝试将OpenEJB与Jetty集成,但不能保证它能够正常工作。