0

RuntimeFactoryandApplicationオブジェクトを作成するステートレス セッション Bean があります。どちらのクラスも Social Business Toolkit の一部です。Applicationプロパティとマネージド Bean ファイルの読み取りに使用されますが、オブジェクトRuntimeFactoryを取得できなかったため、これは発生しませんでした。Application

AbstractRuntimeFactoryMapwithApplicationオブジェクトがあります:

private Map<ClassLoader,AbstractApplication> applications = new HashMap<ClassLoader, AbstractApplication>();

ClassLoader次のメソッドを使用して設定されます。

protected ClassLoader getContextClassLoader() {
    return Thread.currentThread().getContextClassLoader();
}

オブジェクトは次のApplicationメソッドで取得されます。

public Application getApplicationUnchecked() {
    ClassLoader cl = getContextClassLoader();
    return applications.get(cl);
}

デバッグ中に、スレッド ID が同じままであることに気付きましたが、ClassLoader. これはどのように起こりますか?セッション Bean は、RuntimeFactory と Application の 1 つだけです。getContextClassLoader() は常に同じオブジェクトを返すべきではありませんか?

回避策として、次を使用します。

ClassLoader cl = this.getClass().getClassLoader();

はどこthisにありますがRuntimeFactory、これが良い解決策かどうかはわかりません..実際の問題の回避策のように感じます。

ps: WebSphere Portal をアプリケーション サーバーとして使用しています。

4

1 に答える 1

3

この場合、RuntimeFactory を使用する必要はなく、回避する方が簡単な場合があります。私は昨年、EJB を使用していた別の顧客と仕事をしていましたが、彼らは必要なエンドポイントを直接インスタンス化し、エンドポイントの設定を自分で管理することを選択しました。コードは次のようになります。

    BasicEndpoint endpoint = new ConnectionsBasicEndpoint();
    endpoint.setUrl(url);
    endpoint.setUser(user);
    endpoint.setPassword(password);
    endpoint.setForceTrustSSLCertificate(true);

    BlogService blogService = new BlogService(endpoint);
于 2014-04-29T13:25:46.777 に答える