-
Bug
-
Resolution: Done
-
Minor
-
None
The Remote Naming (JNDI) is Read-Only, remote clients cannot bind or rebind objects into it. Only applications running in the same JVM can bind values into JNDI.
public static void main(String[] args) throws Exception { Context ctx = getInitialContext("localhost", 8080, "admin", "redhat1!"); ctx.bind("java:/reproducer", "reproducer"); ctx.rebind("java:/reproducer", "reproducer"); } public static Context getInitialContext(String host, Integer port, String username, String password) throws NamingException { Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory"); props.put(Context.PROVIDER_URL, String.format("%s://%s:%d/wildfly-services", "http", host, port)); if(username != null && password != null) { props.put(Context.SECURITY_PRINCIPAL, username); props.put(Context.SECURITY_CREDENTIALS, password); } return new InitialContext(props); }
then you do get a NamingException on client side:
Exception in thread "main" javax.naming.NamingException [Root exception is java.io.IOException: WFHTTP000005: Invalid response code 500 (full response ClientResponse{responseHeaders={content-type=[text/html], content-length=[2480], date=[Tue, 12 May 2020 20:55:10 GMT]}, responseCode=500, status='', protocol=HTTP/2.0})] at org.wildfly.httpclient.naming.HttpRootContext.performOperation(HttpRootContext.java:442) at org.wildfly.httpclient.naming.HttpRootContext.lambda$processInvocation$4(HttpRootContext.java:383) at org.wildfly.httpclient.naming.HttpRootContext.performWithRetry(HttpRootContext.java:182) at org.wildfly.httpclient.naming.HttpRootContext.processInvocation(HttpRootContext.java:364) at org.wildfly.httpclient.naming.HttpRootContext.rebindNative(HttpRootContext.java:146) at org.wildfly.naming.client.AbstractContext.rebind(AbstractContext.java:154) at org.wildfly.naming.client.AbstractContext.rebind(AbstractContext.java:152) at org.wildfly.naming.client.WildFlyRootContext.rebind(WildFlyRootContext.java:195) at java.naming/javax.naming.InitialContext.rebind(InitialContext.java:425) at org.example.Test.main(Test.java:47) Caused by: java.io.IOException: WFHTTP000005: Invalid response code 500 (full response ClientResponse{responseHeaders={content-type=[text/html], content-length=[2480], date=[Tue, 12 May 2020 20:55:10 GMT]}, responseCode=500, status='', protocol=HTTP/2.0}) at org.wildfly.httpclient.common.HttpTargetContext$1$1.lambda$completed$4(HttpTargetContext.java:234) at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377) at java.base/java.lang.Thread.run(Thread.java:834)
The root cause of the exception should be something like:
Caused by: javax.naming.OperationNotSupportedException: WFLYNAM0043: Naming context is read-only at org.jboss.as.naming.WritableServiceBasedNamingStore.requireOwner(WritableServiceBasedNamingStore.java:163) at org.jboss.as.naming.WritableServiceBasedNamingStore.bind(WritableServiceBasedNamingStore.java:69) at org.jboss.as.naming.NamingContext.bind(NamingContext.java:262) at org.jboss.as.naming.NamingContext.bind(NamingContext.java:289) at org.wildfly.httpclient.naming.HttpRemoteNamingService$BindHandler.doOperation(HttpRemoteNamingService.java:237) at org.wildfly.httpclient.naming.HttpRemoteNamingService$BindHandler.doOperation(HttpRemoteNamingService.java:227)
The same issue for rebind / rename / createSubContext / destroySubContext etc.
The unbind operation has the following exception with HTTP status 405:
javax.naming.CommunicationException: WFHTTP000005: Invalid response code 405 (full response ClientResponse{responseHeaders={content-length=[83], content-type=[text/html], date=[Thu, 21 Jan 2021 06:36:50 GMT]}, responseCode=405, status='', protocol=HTTP/2.0}) [Root exception is java.io.IOException: WFHTTP000005: Invalid response code 405 (full response ClientResponse{responseHeaders={content-length=[83], content-type=[text/html], date=[Thu, 21 Jan 2021 06:36:50 GMT]}, responseCode=405, status='', protocol=HTTP/2.0})] at org.wildfly.httpclient.naming.HttpRootContext.performOperation(HttpRootContext.java:349) at org.wildfly.httpclient.naming.HttpRootContext.lambda$processInvocation$1(HttpRootContext.java:266) at org.wildfly.httpclient.naming.HttpRootContext.performWithRetry(HttpRootContext.java:182) at org.wildfly.httpclient.naming.HttpRootContext.processInvocation(HttpRootContext.java:243) at org.wildfly.httpclient.naming.HttpRootContext.processInvocation(HttpRootContext.java:237) at org.wildfly.httpclient.naming.HttpRootContext.unbindNative(HttpRootContext.java:151) at org.wildfly.naming.client.AbstractContext.unbind(AbstractContext.java:177) at org.wildfly.naming.client.AbstractContext.unbind(AbstractContext.java:175) at org.wildfly.naming.client.WildFlyRootContext.unbind(WildFlyRootContext.java:219) at java.naming/javax.naming.InitialContext.unbind(InitialContext.java:433) at Client.lambda$runTests$2(Client.java:45) at Client.test(Client.java:59) at Client.runTests(Client.java:45) at Client.main(Client.java:29) Caused by: java.io.IOException: WFHTTP000005: Invalid response code 405 (full response ClientResponse{responseHeaders={content-length=[83], content-type=[text/html], date=[Thu, 21 Jan 2021 06:36:50 GMT]}, responseCode=405, status='', protocol=HTTP/2.0}) at org.wildfly.httpclient.common.HttpTargetContext$1$1.lambda$completed$4(HttpTargetContext.java:236) at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377) at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1280) at java.base/java.lang.Thread.run(Thread.java:834)
- is cloned by
-
JBEAP-20822 (7.3.z) WEJBHTTP-51 - Http Naming Client does not get root cause of failure of remote bind operation
- Closed
- is incorporated by
-
WFLY-14333 Upgrade wildfly-http-client to 1.1.5.Final
- Closed
- split from
-
WFLY-13459 Remote Naming bind / rebind / unbind / rename / createSubcontext / destroySubcontext does not throw exception back to client
- Open