Bug 1086129

Summary: Changing the JNDI bound values in the naming subsystem requires reload.
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Jay SenSharma <jsenshar>
Component: NamingAssignee: Jay SenSharma <jsenshar>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1.0CC: sjadhav
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-14 05:35:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jay SenSharma 2014-04-10 07:46:46 UTC
Description of problem:
-----------------------
    Changing the values which are binded in the naming subsystem shows "reload-required", which it ideally should not. The JNDI naming should follow the "rebind" feature of InitialContext. The values should be rebinded in the JNDI.

    Ideally the JNDI value should not have required the reload and in the runtime only the JNDI value should have changed.



Version-Release number of selected component (if applicable):


How reproducible:
-----------------
Steps to Reproduce:



1. Bind a simple object in the JNDI like following:

[standalone@localhost:9999 /] /subsystem=naming/binding=java\:jboss\/exported\/test/:add(binding-type=simple,value=100,type=int)
{"outcome" => "success"}


2. Change the value of the jndi binding as following:

[standalone@localhost:9999 /] /subsystem=naming/binding=java\:jboss\/exported\/test/:write-attribute(name=value,value="500")
{
    "outcome" => "success",
    "response-headers" => {
        "operation-requires-reload" => true,
        "process-state" => "reload-required"
    }
}


3. Now using a simple JNDI lookup code check the value of the JNDI it will still show "100". Like use the following JSP code to do a jndi lookup.

<%@page import="java.util.*,javax.naming.*" %>
<%
       String jndiName = "java:jboss/exported/test";
       int data =0;
       try{            
            Context ic = new InitialContext();
            System.out.println("\n\tAbout to look up jndi name " + jndiName);
            Object obj = ic.lookup(jndiName);
            System.out.println("lookup returned " + obj);
            data= (Integer) obj;
            System.out.println("\n\tGot the Data: " + data);
	   }
     catch(Exception e)
          {
             System.out.println("******* Inside catch "+e);
             e.printStackTrace();
          }
     out.println("<h1>Got the Data: " + data);
%>

    However the value is persisted in the XML configuration as following:

    [standalone@localhost:9999 /] /subsystem=naming/binding=java\:jboss\/exported\/test/:read-attribute(name=value)
    {
        "outcome" => "success",
        "result" => "500",
        "response-headers" => {"process-state" => "reload-required"}
    }

    It can be noticed that in the JNDI which was bound as 100 with JNDI name as "java:jboss/exported/test", then later when tried changing the value of this JNDI bindng from "100" to "500" and it is noticed that even after the "write-attribute" operation the runtime model object value was still 100 but the changes were persisted in the XML configuration as following:

            <subsystem xmlns="urn:jboss:domain:naming:1.3">
                <bindings>
                    <simple name="java:jboss/exported/test" value="500" type="int"/>
                </bindings>
                <remote-naming/>
            </subsystem>






Actual results:
================
- The XML configuration gets updated but the object which is bound in the JNDI  does not get changed in the Runtime. 


Expected results:
================
- The JNDI bound value change should have reflected without the need of reload.



Additional info:
================
- As the InitialContext has a method rebind(Name name, Object obj) Binds a name to an object, overwriting any existing binding similarly the above CLI command also should have worked in runtime. [1]

[1] http://docs.oracle.com/javase/6/docs/api/javax/naming/InitialContext.html#rebind(javax.naming.Name, java.lang.Object)

Comment 3 JBoss JIRA Server 2015-01-20 07:36:16 UTC
Eduardo Martins <emartins.redhat> updated the status of jira WFLY-3239 to Resolved

Comment 4 JBoss JIRA Server 2016-04-26 23:04:41 UTC
Stuart Douglas <stuart.w.douglas> updated the status of jira WFLY-3239 to Reopened