java - 如果在 Websphere 8.5 中启用了 SSL,则无法查找

标签 java ssl ejb websphere websphere-8

我编写了一个简单的 ejb 瘦客户端来查找部署在 IBM WebSphere 8.5 中的 bean。

当服务器上未启用 SSL 时,我能够成功查找 bean,但是一旦启用 SSL,我就开始遇到下面提到的异常。

这就是我通过管理控制台启用安全性的方式:enter image description here

异常:

javax.naming.NamingException: Error getting WsnNameService properties [Root exception is org.omg.CORBA.TRANSIENT: initial and forwarded IOR inaccessible  vmcid: IBM  minor code: E07  completed: No]
at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1552)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:1042)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:962)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:614)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:128)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:765)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:164)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:179)
at javax.naming.InitialContext.lookup(InitialContext.java:436)
at nh.indi.test.S2SCommTest.lookupServiceEJB(S2SCommTest.java:55)
at nh.indi.test.S2SCommTest.main(S2SCommTest.java:22) 
Caused by: org.omg.CORBA.TRANSIENT: initial and forwarded IOR inaccessible  vmcid: IBM  minor code: E07  completed: No
at com.ibm.rmi.corba.ClientDelegate.createRequest(ClientDelegate.java:1276)
at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1342)
at com.ibm.rmi.corba.ClientDelegate.createRequest(ClientDelegate.java:1164)
at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1308)
at com.ibm.rmi.corba.ClientDelegate.request(ClientDelegate.java:1886)
at com.ibm.CORBA.iiop.ClientDelegate.request(ClientDelegate.java:1264)
at org.omg.CORBA.portable.ObjectImpl._request(ObjectImpl.java:458)
at com.ibm.WsnBootstrap._WsnNameServiceStub.getProperties(_WsnNameServiceStub.java:38)
at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1549)
... 10 more

代码:

public static void main(String args[]) throws NamingException {

    Properties ejbProps = new Properties();
    ejbProps.put("org.omg.CORBA.ORBClass", "com.ibm.CORBA.iiop.ORB");
    ejbProps.put(Context.INITIAL_CONTEXT_FACTORY,
            "com.ibm.websphere.naming.WsnInitialContextFactory");
    ejbProps.put(Context.PROVIDER_URL, "corbaloc:iiop:160.XX.XX.XX:2809");

    InitialContext ffmContext = new InitialContext(ejbProps);
    Object remoteObject = ffmContext
            .lookup("ejb/MyAppEar-CLUSTER/MyAppEJB.jar/BatchIdTrackingBean#indi.nh.business.framework.bos.di.BatchIdTrackingBeanRemote");

    BatchIdTrackingBeanRemote serviceTester = (BatchIdTrackingBeanRemote) PortableRemoteObject
            .narrow(remoteObject, BatchIdTrackingBeanRemote.class);

    System.out.println(serviceTester);

}

在运行程序时,我还传递了存在于我的本地文件系统中的 sas.client.props 文件位置,如此处所述。 1

-Dcom.ibm.CORBA.ConfigURL=file:///C:/Temp/docs/S2S_Docs/sas.client.props

1 : How to connect to a websphere Application Server 8.5 Message Queue while Administrative Security is enabled

任何人都可以帮助我如何在 websphere 应用服务器上启用 SSL 或我在客户端或服务器端配置中缺少的情况下成功测试它。

最佳答案

您还需要将此属性添加到 java 命令:-Dcom.ibm.CORBA.ConfigURL=file:///home/user1/sas.client.props

您可以从 WebSphere Application Server 安装中复制 ssl.client.props 文件(除了 sas.client.props 之外)。您至少需要将 ssl.client.props 文件中 key 文件的位置更新为您创建或复制 key 文件的位置。例如,

-Dcom.ibm.ssl.keyStore=/home/user1/etc/key.p12 -Dcom.ibm.ssl.trustStore=/home/user1/etc/trust.p12

当您再次运行客户端时,如果不存在,它应该会提示您将签名者添加到信任库。

更多详情请访问:https://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/tcli_ejbthinclient.html

关于java - 如果在 Websphere 8.5 中启用了 SSL,则无法查找,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35003351/

相关文章:

java - 无法在ubuntu 14.04上格式化hadoop namenode

ssl - 在 Heroku 服务器上部署 golang martini HTTPS

jakarta-ee - EJB 事务 REQUIRE_NEW

ssl - 2 个域,每个域都有自己的 SSL 证书,指向一组文件

ejb - 在 EJB 方法/@RequestScoped 和 @Stateless 之间传递状态

jakarta-ee - EJB - 家庭和远程接口(interface)的原因

Java 按日期作为字符串对列表 <SqlRow> 进行排序

java - 如何使用 OpenTok 收听来 self 的应用程序的传入视频通话?

java - 传递参数Object

ssl - 如何在 Heroku 上部署安全的 (HTTPS) Meteor 应用程序?