Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/338.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 Wildfly 16.0.0.Final和带有安全域的ejb客户端连接_Java_Jboss_Ejb_Wildfly - Fatal编程技术网

Java Wildfly 16.0.0.Final和带有安全域的ejb客户端连接

Java Wildfly 16.0.0.Final和带有安全域的ejb客户端连接,java,jboss,ejb,wildfly,Java,Jboss,Ejb,Wildfly,《Wildfly开发者指南》解释了如何使用Wildfly特定的属性设置InitialContext 关于“作用域EJB客户机上下文”的部分,您可以将这些属性也传递给初始上下文: Properties jndiPropsL = new Properties(); jndiPropsL.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); jndiPropsL.setProperty("endpoint.name"

《Wildfly开发者指南》解释了如何使用Wildfly特定的属性设置
InitialContext

关于“作用域EJB客户机上下文”的部分,您可以将这些属性也传递给
初始上下文

Properties jndiPropsL = new Properties();
jndiPropsL.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
jndiPropsL.setProperty("endpoint.name", "client-endpoint");
jndiPropsL.setProperty("org.jboss.ejb.client.scoped.context", "true");
jndiPropsL.setProperty("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
jndiPropsL.setProperty("remote.connections", "default");
jndiPropsL.setProperty("remote.connection.default.host", jbossHost);
jndiPropsL.setProperty("remote.connection.default.port", remotingPort);
jndiPropsL.setProperty("remote.connection.default.protocol", "http-remoting");
jndiPropsL.setProperty("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");
jndiPropsL.setProperty("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
Properties jndiPropsL = new Properties();
jndiPropsL.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
jndiPropsL.setProperty("remote.clusters", "ejb");
与此相反,《Wildfly安全指南》解释了如何设置“安全的”EJB客户端连接:

Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
properties.put(Context.PROVIDER_URL, "remote+http://127.0.0.1:8080");
InitialContext context = new InitialContext(properties);
凭据通过
wildfly config.xml
文件传递

如果我想要两个文档中的功能,即“安全”连接和范围上下文,我必须配置什么?我是否只需要提供两组属性,然后设置主机和端口两次?

如“Wildfly Elytron安全指南”(请参阅)中所述,以前作为
remote.connection.
属性提供的大多数设置现在被替换为
Wildfly config.xml
中的专用部分

新的XML结构中似乎只支持
remote.clusters
选项。因此,您必须将其作为属性提供给
InitialContext

Properties jndiPropsL = new Properties();
jndiPropsL.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
jndiPropsL.setProperty("endpoint.name", "client-endpoint");
jndiPropsL.setProperty("org.jboss.ejb.client.scoped.context", "true");
jndiPropsL.setProperty("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
jndiPropsL.setProperty("remote.connections", "default");
jndiPropsL.setProperty("remote.connection.default.host", jbossHost);
jndiPropsL.setProperty("remote.connection.default.port", remotingPort);
jndiPropsL.setProperty("remote.connection.default.protocol", "http-remoting");
jndiPropsL.setProperty("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");
jndiPropsL.setProperty("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
Properties jndiPropsL = new Properties();
jndiPropsL.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
jndiPropsL.setProperty("remote.clusters", "ejb");
与ejb客户机库的旧版本不同,如果您确实在使用集群,则只需传入此选项。为非ha设置设置此选项将导致连接尝试失败