0

有没有人真正成功地做到了这一点?我在不同的网站上看到了不同的建议。我尝试使用 WebSphere 客户端,但这破坏了我的 JBoss 应用程序中需要使用 JNDI 查找的所有其他内容。

我尝试过使用 Jacorb,但它返回了非描述性错误,我尝试搜索这些错误但没有运气。

我试过使用 Sun 上下文工厂,但我得到了类转换异常。

我没有尝试过任何工作。有没有人让这个工作?我能够使用几种不同的方法让它在独立的应用程序中工作。

4

1 回答 1

0

应该可以使用AluniteClassLoader

ClassLoader previous = Thread.currentThread().getContextClassLoader();            
try {
  ClassLoader cl = new AluniteClassLoader(new URL[]{new URL("file://path/to/websphere/client.jar")}, previous);
  Thread.currentThread().setContextClassLoader(cl);

  //Service lookup & method invocation
} finally {
  Thread.currentThread().setContextClassLoader(previous);
}
于 2013-09-10T09:38:36.923 回答