Updating ejb deployment descriptor in installed applications with the wsadmin tool

open wsadmin shell


ksh ./wsadmin.sh -lang jython -conntype SOAP -host yourhost.com -port 8879 -user userid -password password

print AdminApp.update('MyAppName', 'file', '[-operation update -contents /home/users/sg/1.xml -contenturi MyEJB.jar/META-INF/ejb-jar.xml]')

where

  • ‘MyAppName’ is display name of my application, deployed with .ear file
  • /home/users/sg/1.xml ejb deployment descriptor that I want to update in my application
  • MyEJB.jar/META-INF/ejb-jar.xml MyEJB.jar is the ejb deployed with in enterprise application (EAP), I want to update deployment descriptor of this ejb.
  • NOTE that -contenturi is
    MyEJB.jar/META-INF/ejb-jar.xml
    NOT
    MyEJB.jar,META-INF/ejb-jar.xml
    if you put , instead of / you will get
    com.ibm.websphere.management.exception.AdminException: ERROR: File does not exist for update operation

    P.S always look in dmgr logs for errors in deployment.

    Advertisements

    anonymous classes are not closure

    anonymous classes are not closure

    tired of doing “for”, lets implement internal iterator for my collection class

    import java.text.*;
    import java.util.*;
    
    
    public class closure_test {
        public static void main(final String[] args) {
            test_without_closure();
            test_with_closure2();
            test_with_closure();
        }
    
        static void test_without_closure() {
            try {
                String  userhome = null;
                TheList lst      = new TheList();
    
                for (Iterator it = lst.iterator(); it.hasNext();) {
                    String child = (String) it.next();
    
                    if (child.indexOf("user.home") != -1) {
                        userhome = child.toString();
    
                        // no need to make userhome final
                        // and I can break too
                        break;
                    }
                }
    
                System.out.println(userhome);
            } catch (final Throwable t) {
                t.printStackTrace();
            }
        }
    
        static void test_with_closure() {
            try {
                String  userhome = null;
                TheList lst      = new TheList();
                lst.forEach(new TheList.Closure() {
                        public void run(final Object child) {
                            if (((String) child).indexOf("user.home") != -1) {
                                //userhome=child.toString(); // wont compile
    // local variable userhome is accessed from 
    // within inner class; needs to be declared final
    
    // if I make userhome then cant assign value to it, 
    // see test_with_closure2 for ugly solution
    
    // cant break
                            }
                        }
                    });
            } catch (final Throwable t) {
                t.printStackTrace();
            }
        }
    
        static void test_with_closure2() {
            try {
                final String[] userhome = new String[1];
                TheList        lst      = new TheList();
                lst.forEach(new TheList.Closure() {
                        public void run(final Object child) {
                            if (((String) child).indexOf("user.home") != -1) {
                                userhome[0] = child.toString(); // now compile, its ugly
                                                                // still cant break?
                            }
                        }
                    });
                System.out.println(userhome[0]);
            } catch (final Throwable t) {
                t.printStackTrace();
            }
        }
    }
    
    
    class TheList {
        private static final MessageFormat FMT  = new MessageFormat("{0}={1}");
        private final ArrayList            list = new ArrayList();
    
        public TheList() {
            Properties props = System.getProperties();
    
            for (Iterator it = props.entrySet().iterator(); it.hasNext();) {
                Map.Entry ent = (Map.Entry) it.next();
                list.add(FMT.format(new Object[] { ent.getKey(), ent.getValue() }));
            }
        }
    
        public void forEach(final Closure closure) {
            for (Iterator it = list.iterator(); it.hasNext();) {
                closure.run(it.next());
            }
        }
    
        public Iterator iterator() {
            return list.iterator();
        }
    
        public static interface Closure {
            public void run(final Object child);
        }
    }
    
    anonymous classes are closure? NO
    what does non-final do to a local variable that makes it non-accessible from inner class ?
    closure implemented using inner class are ugly and difficult to use with all unnecessary method implementation.