Description of problem: CLI permits creating new mail-session with name different to jndi-name attribute's value. But because only jndi-name is saved in config xml, the name for mail-session cannot be restored and it is changed to the same value as jndi-name attribute after server reload/restart. This might be seen as unexpected behaviour. Steps to Reproduce: 1. starting server with no mail-session defined gives this output: [standalone@localhost:9999 /] /subsystem=mail:read-children-names(child-type=mail-session) { "outcome" => "success", "result" => [] } 2. add new mail-session with name different from jndi-name value: [standalone@localhost:9999 /] /subsystem=mail/mail-session=testMS:add(jndi-name=java:jboss/mail/testJNDI) {"outcome" => "success"} 3. check result - name of created mail-session: [standalone@localhost:9999 /] /subsystem=mail:read-children-names(child-type=mail-session) { "outcome" => "success", "result" => ["testMS"] } 4. check result - jndi-name value for created mail sesison: [standalone@localhost:9999 /] /subsystem=mail/mail-session=testMS:read-attribute(name=jndi-name) { "outcome" => "success", "result" => "java:jboss/mail/testJNDI" } 5. reload/restart server 6. list created mail-sessions - different name shows up: [standalone@localhost:9999 /] /subsystem=mail:read-children-names(child-type=mail-session) { "outcome" => "success", "result" => ["java:jboss/mail/testJNDI"] } 7. check if it is the mail session I want - print its jndi-name value: [standalone@localhost:9999 /] /subsystem=mail/mail-session=java\:jboss\/mail\/testJNDI:read-attribute(name=jndi-name) { "outcome" => "success", "result" => "java:jboss/mail/testJNDI" } Actual results: The name of mail-session node in CLI configuation is changed to jndi-name attribute's value after server reload/restart. Expected results: a) prohibit creating mail-session with different names for mail-session itself and for jndi-name. Then step 2 should fail. or b) the actual node name is also saved into config xml so that it can be restored after reload/restart Additional info: This can also lead to error in web management console. After step 2 try to edit any paramater of this mail-session through web console and you get error since it uses jndi-name as mail-session name in configuration address.
Issue is still valid for EAP 6.3.0.ER10. The only difference came up in step 1. - starting server with no mail-session defined gives actually this output: [standalone@localhost:9999 /] /subsystem=mail:read-children-names(child-type=mail-session) { "outcome" => "success", "result" => ["java:jboss/mail/Default"] } But the invalid name changing still persists.
This is bug that was fixed in upstream long time ago. Just needs backporting.
Verified with EAP 6.4.0.DR10