Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/402.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用t3s连接到Weblogic JMS队列?_Java_Ssl_Jms_Weblogic - Fatal编程技术网

Java 如何使用t3s连接到Weblogic JMS队列?

Java 如何使用t3s连接到Weblogic JMS队列?,java,ssl,jms,weblogic,Java,Ssl,Jms,Weblogic,我希望通过独立应用程序中的最后一行,而不引发任何异常: Properties props = new Properties(); props.setProperty("java.naming.factory.initial", "weblogic.jndi.WLInitialContextFactory"); props.setProperty("java.naming.provider.url",

我希望通过独立应用程序中的最后一行,而不引发任何异常:

    Properties props = new Properties();
    props.setProperty("java.naming.factory.initial",
                      "weblogic.jndi.WLInitialContextFactory");
    props.setProperty("java.naming.provider.url",
                      "t3s://localhost:9002");
    props.setProperty("java.naming.security.principal",
                      "<username>");
    props.setProperty("java.naming.security.credentials",
                      "<password>");
    Context ctx = new InitialContext(props);
Properties=newproperties();
setProperty(“java.naming.factory.initial”,
“weblogic.jndi.WLInitialContextFactory”);
props.setProperty(“java.naming.provider.url”,
“t3s://localhost:9002”);
setProperty(“java.naming.security.principal”,
"");
props.setProperty(“java.naming.security.credentials”,
"");
Context ctx=新的初始上下文(props);
…但我在一个例外情况下得到了这些信息:

Warning Security BEA-090542 Certificate chain received from localhost - 127.0.0.1 was not trusted causing SSL handshake failure. Check the certificate chain to determine if it should be trusted or not. If it should be trusted, then update the client trusted CA configuration to trust the CA certificate that signed the peer certificate chain. If you are connecting to a WLS server that is using demo certificates (the default WLS server behavior), and you want this client to trust demo certificates, then specify -Dweblogic.security.TrustKeyStore=DemoTrust on the command line for this client. 警告:从localhost接收到的安全BEA-090542证书链-127.0.0.1不受信任,导致SSL握手失败。检查证书链以确定是否应信任它。如果应该信任它,则更新客户端受信任CA配置以信任签署对等证书链的CA证书。如果要连接到使用演示证书(默认WLS服务器行为)的WLS服务器,并且希望此客户端信任演示证书,请在此客户端的命令行上指定-Dweblogic.security.TrustKeyStore=DemoTrust。 因此,我使用以下命令为ca创建了一个密钥库:

keytool -keystore client.jks -importcert -file cacert.pem keytool-keystore client.jks-importcert-file cacert.pem …并使用属性weblogic.security.TrustKeyStore=client.jks引用它


这仍然不起作用,很可能是因为我没有向密钥库提供密码。我错过了什么?如何提供此密码?(或者,如何在不设置密码的情况下创建密钥库?

差不多两个月后,我又回到了这个问题。找到后,我发现这是可行的:

        System.setProperty("weblogic.security.SSL.ignoreHostnameVerification","true");
        System.setProperty("java.protocol.handler.pkgs", "weblogic.net");
        System.setProperty("weblogic.security.TrustKeyStore","CustomTrust");
        System.setProperty("weblogic.security.CustomTrustKeyStoreFileName", "<keystorelocation>");
        System.setProperty("weblogic.security.CustomTrustKeyStorePassPhrase","<keystorepassword>"); 
        System.setProperty("weblogic.security.CustomTrustKeyStoreType","JKS");
System.setProperty(“weblogic.security.SSL.ignoreHostnameVerification”,“true”);
setProperty(“java.protocol.handler.pkgs”、“weblogic.net”);
System.setProperty(“weblogic.security.TrustKeyStore”、“CustomTrust”);
System.setProperty(“weblogic.security.CustomTrustKeyStoreName”,”;
System.setProperty(“weblogic.security.CustomTrustKeyStorePassphase”,”;
System.setProperty(“weblogic.security.CustomTrustKeyStoreType”、“JKS”);

我只使用系统属性使其工作。

您在管理控制台中设置了队列和连接工厂吗?是的,使用t3协议,没有ssl,一切都可以正常工作。使用t3s,我永远无法找到jndi查找。创建InitialContext实例时,在ssl握手时引发异常。