Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-6246

Naming context read-only during legacy SAR deployment

    XMLWordPrintable

Details

    Description

      When the #startService() and #stopService() methods of a sublass of ServiceMBeanSupport are invoked the JNDI context is read only.

      Consider the following MBean:

      public class LegacySample extends ServiceMBeanSupport implements LegacySampleMBean {
      
              private static final String NAME = "java:global/env/foo/legacy";
              private static final String VALUE = "BAR";
      
              private static final Logger LOG = Logger.getLogger("sar-legacy");
      
              public LegacySample() {
                      super();
              }
      
              @Override
              protected void startService() throws Exception {
                      InitialContext ic = new InitialContext();
                      ic.rebind(NAME, VALUE);
                      LOG.info("started");
              }
      
              @Override
              protected void stopService() throws Exception {
                      InitialContext ic = new InitialContext();
                      ic.unbind(NAME);
                      LOG.info("stopped");
              }
      
              @Override
              public String getMessage() {
                      return "legacy";
              }
      
      }
      

      This will fail.

      Attachments

        Issue Links

          Activity

            People

              emartins@redhat.com Eduardo Martins
              pmarscha Philippe Marschall (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: