具有自定义SSLSocketFactory的T3客户端

编程入门 行业动态 更新时间:2024-10-27 23:20:41
本文介绍了具有自定义SSLSocketFactory的T3客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有这样的T3客户端代码:

I have my T3 client code like this:

private InitialContext initContext() { Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); p.put(Context.PROVIDER_URL, context.providerURL); for (Map.Entry<String, String> entry : getEnvironmentProperties().entrySet()) { p.put(entry.getKey(), entry.getValue()); } InitialContext res = null; try { res = new InitialContext(p); } catch (NamingException e) { e.printStackTrace(); } return res; }

我的t3客户端部署在Tomcat上(使用wlthint3client-12.1.3.jar)并尝试查找部署在Weblogic上的外部系统的远程bean。

My t3 client deployed on Tomcat (uses wlthint3client-12.1.3.jar) and trying to lookup remote bean of external system which deployed on Weblogic.

但是,当我尝试执行新的InitialContext(p)时,会收到SSLHandshake异常,因为它会获得带有standart SSLConext和standart java信任库的standart SSLSocketFactory。

However when I trying to perform new InitialContext(p) I receive SSLHandshake exception, because it gets standart SSLSocketFactory with standart SSLConext and standart java trust store.

我的问题-有什么办法可以赋予InitialContext一些将覆盖SSLSocketFacory的属性。我的目标是向该t3客户端填充我的cutum信任库。

My question - is there any way to give to InitialContext some property which will override SSLSocketFacory. My aim is to populate my cutom trust store to this t3 client.

像这样的不断变化的标准信托商店

Changing standart trust store like this

System.setProperty("javax.ssl.trustStore", "pathToTrustStore");

工作正常,但是如果我的t3客户端用于与2个不同的外部系统进行通信,这样做可能是个问题。

works fine, however in case if my t3 client is used to communicate with 2 different external systems, it might be a problem in doing so.

是否可以提供一些物业?

Is there some property that I can populate?

Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); **p.put("CUSTOM SSL SOCKET FACTORY, "MY CLASS");**

推荐答案

通过在应用程序端添加一些参数来解决问题

Problem was solved by adding few parameters on application side

export JAVA_OPTS ="$JAVA_OPTS -Djavax.ssl.trustStore=path/truststore.jks" export JAVA_OPTS ="$JAVA_OPTS -Djavax.ssl.trustStorePassword=changeIT"

更多推荐

具有自定义SSLSocketFactory的T3客户端

本文发布于:2023-08-07 15:03:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1319761.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   客户端   SSLSocketFactory

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!