diff --git a/mosgi/console.gui/src/main/java/org/apache/felix/mosgi/console/gui/Gateway.java b/mosgi/console.gui/src/main/java/org/apache/felix/mosgi/console/gui/Gateway.java
index 5556307..d2b5c46 100644
--- a/mosgi/console.gui/src/main/java/org/apache/felix/mosgi/console/gui/Gateway.java
+++ b/mosgi/console.gui/src/main/java/org/apache/felix/mosgi/console/gui/Gateway.java
@@ -34,25 +34,20 @@
 public class Gateway extends JMXServiceURL {
 
   private static final String JMX_SERVICE = "service:jmx:";
+  private static final String DEFAULT_JMXSURL = JMX_SERVICE+"rmi:///jndi/rmi://127.0.0.1:1099/core";
 
-  private static final String DEFAULT_PROFILE  = "core";
-  private static final String DEFAULT_HOST     = "127.0.0.1";
-  private static final String DEFAULT_PROTOCOL = "rmi";
-  private static final String DEFAULT_PORT     = "1099";
-
-  private static Hashtable HT_GATEWAY = new Hashtable(); // used to manage virtuals gateways
+  private static Hashtable HT_GATEWAY = new Hashtable();
 
   private JMXConnector jmxc;
   private MBeanServerConnection mbsc;
 
-  private String nickname; // used to manage virtuals gateways
-  private String name; // name for the GUI = this.nickname+" : "+this.toString()
+  private String nickname;
   private Gateway parentGateway;
   private String toolTipText;
   private boolean isConnected;
   
-  public String getName() {
-    return this.name;
+  public String getNickname() {
+    return this.nickname;
   }
 
   public MBeanServerConnection getMbsc() {
@@ -72,11 +67,10 @@
   }
 
   // The constructor (private)
-  private Gateway(String nickname, String surl, Gateway vosgi) throws MalformedURLException {
+  private Gateway(String nickname, String surl, Gateway parent) throws MalformedURLException {
     super(surl);
     this.nickname = nickname;
-    this.name = nickname+" : \""+this.toString().substring(JMX_SERVICE.length())+"\"";
-    this.parentGateway = vosgi;
+    this.parentGateway = parent;
     this.isConnected = false;
     this.toolTipText = "<html><B>\""+nickname+"\" JMXServiceURL =<br>"+
       "- protocol=</B>"+this.getProtocol()+"<br><B>"+
@@ -88,6 +82,9 @@
 
   // Intermediate private Gateway creator
   private static Gateway newGateway(String nickname, String serviceURL, String parent_gateway) throws Exception {
+    if ( !serviceURL.startsWith(JMX_SERVICE) ) {
+      serviceURL = JMX_SERVICE+serviceURL;
+    }
     if ( serviceURL.contains("null") ) {
       throw new Exception("Invalid service URL \""+serviceURL+"\"");
     }
@@ -100,81 +97,56 @@
       }
     }
 
-    Gateway newGateway = new Gateway(nickname, serviceURL, vosgiGateway);
-    return newGateway;
+    return new Gateway(nickname, serviceURL, vosgiGateway);
   }
 
   // Creation of Gateways from the config properties file
   public static Gateway[] newGateways(BundleContext bc) {
+    String str_jmxsurl, nickname, str_parent;
     Vector v_gateways = new Vector();
-    String protocol, host, profile, port, nickname, parent_gateway;
-    int port_int;
 
     int i = 1;
-    profile = bc.getProperty("mosgi.jmxconsole.id."+i+".profile");
-    if ( profile == null) { profile = DEFAULT_PROFILE; }
-  
-    while ( profile != null ) {
-      host = bc.getProperty("mosgi.jmxconsole.id."+i+".host");
-      if ( host == null ) { host = DEFAULT_HOST; }
-      protocol = bc.getProperty("mosgi.jmxconsole.id."+i+".protocol");
-      if ( protocol == null ) { protocol = DEFAULT_PROTOCOL; }
-      port = bc.getProperty("mosgi.jmxconsole.id."+i+".port");
-      if ( port == null ) { port = DEFAULT_PORT; }
-      try {
-        port_int = Integer.parseInt(port);
-      } catch (Exception exep) { try { port_int = Integer.parseInt(DEFAULT_PORT); } catch (Exception e) {} }
-      String serviceURL = JMX_SERVICE+protocol+":///jndi/"+"rmi"+"://"+host+":"+port+"/"+profile;
-      parent_gateway = bc.getProperty("mosgi.jmxconsole.id."+i+".virtual");
-      Gateway g = null;
-      nickname =  bc.getProperty("mosgi.jmxconsole.id."+i+".nickname");
+    str_jmxsurl = bc.getProperty("mosgi.jmxconsole.id."+i+".jmxsurl");
+    if ( str_jmxsurl == null ) { str_jmxsurl = DEFAULT_JMXSURL; }
+
+    while ( str_jmxsurl != null) {
+      nickname = bc.getProperty("mosgi.jmxconsole.id."+i+".nickname");
       if (nickname == null ) { nickname = ""+i; };
+      str_parent = bc.getProperty("mosgi.jmxconsole.id."+i+".parent");
+      Gateway g = null;
       try {
-        g = Gateway.newGateway(nickname, serviceURL, parent_gateway);
+        g = Gateway.newGateway(nickname, str_jmxsurl, str_parent);
         if ( g != null ) {
           v_gateways.addElement(g);
         }
       } catch (Exception exep) {
-        System.out.println(""+exep);
+        System.out.println("Gateway creation error:\n "+exep.toString());
       }
-      i++;
-      profile = bc.getProperty("mosgi.jmxconsole.id."+i+".profile");
+      str_jmxsurl = bc.getProperty("mosgi.jmxconsole.id."+(++i)+".jmxsurl");
     }
+
     Gateway[] gateways=new Gateway[v_gateways.size()];
     v_gateways.toArray(gateways);
     return gateways;
   }
 
   // GUI gateway creator
-  public static Gateway newGateway() {
+  public static Gateway newGateway(Gateway ref) throws Exception {
     String nickname = JOptionPane.showInputDialog("Profil nickname", "");
-    if ( nickname == null) return null; // should check nickname is unique
-    String host = JOptionPane.showInputDialog("Host", DEFAULT_HOST);
-    if ( host == null ) return null;
-    String protocol = JOptionPane.showInputDialog("Protocol", DEFAULT_PROTOCOL);
-    if ( protocol==null ) return null;
-    String port = JOptionPane.showInputDialog("Port", DEFAULT_PORT);
-    try { Integer.parseInt(port); } catch (Exception ex) { return null; }
-    String profile = JOptionPane.showInputDialog("OSGi profil name", "");
-    if (profile==null) return null;
+    if ( nickname == null) return null;
+    String gateway_ref = ref!=null?ref+"":"";
+    String str_jmxsurl = JOptionPane.showInputDialog("JMX service URL", gateway_ref);
+    if ( str_jmxsurl == null) return null;
     Object gateway_list[] = HT_GATEWAY.keySet().toArray();
     Object gateway_list2[] = new Object[gateway_list.length+1];
     System.arraycopy(gateway_list, 0, gateway_list2, 1, gateway_list.length);
     gateway_list2[0] = "None";
     java.util.Arrays.sort(gateway_list);
-    int val = JOptionPane.showOptionDialog(new javax.swing.JFrame(), "Virtual of", "Is it a virtual gateway ?", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, gateway_list2, gateway_list2[0]);
-    String virtual = "";
-    if ( val != JOptionPane.CLOSED_OPTION ) { virtual = ""+gateway_list2[val]; }
-    if ( val == 0 ) { virtual = ""; }
-    String serviceURL = JMX_SERVICE+protocol+":///jndi/"+protocol+"://"+host+":"+port+"/"+profile;
-    Gateway g = null;
-    try { 
-      g = Gateway.newGateway(nickname, serviceURL, virtual);
-    } catch (Exception exep) {
-      System.out.println(""+exep);
-      return null;
-    }
-    return g;
+    int val = JOptionPane.showOptionDialog(new javax.swing.JFrame(), "Link to another gateway ?", "Gateway association", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, gateway_list2, gateway_list2[0]);
+    String str_parent = "";
+    if ( val != JOptionPane.CLOSED_OPTION ) { str_parent = ""+gateway_list2[val]; }
+    if ( val == 0 ) { str_parent = ""; }
+    return Gateway.newGateway(nickname, str_jmxsurl, str_parent);
   }
 
   public boolean connect(NotificationListener notificationListener) {
diff --git a/mosgi/console.gui/src/main/java/org/apache/felix/mosgi/console/gui/NodeCellRenderer.java b/mosgi/console.gui/src/main/java/org/apache/felix/mosgi/console/gui/NodeCellRenderer.java
index 2c92433..47b239d 100644
--- a/mosgi/console.gui/src/main/java/org/apache/felix/mosgi/console/gui/NodeCellRenderer.java
+++ b/mosgi/console.gui/src/main/java/org/apache/felix/mosgi/console/gui/NodeCellRenderer.java
@@ -42,7 +42,7 @@
     Object o = ((DefaultMutableTreeNode) value).getUserObject();
     if ( !o.equals(NodesTree.TOP_NAME) ) {
       Gateway g = (Gateway) o;
-      super.getTreeCellRendererComponent(tree, g.getName(), sel, expanded, leaf, row, hasFocus);
+      super.getTreeCellRendererComponent(tree, g.getNickname(), sel, expanded, leaf, row, hasFocus);
       if ( g.isConnected() ) {
         setIcon(iconConnected);
       } else {
diff --git a/mosgi/console.gui/src/main/java/org/apache/felix/mosgi/console/gui/NodesTree.java b/mosgi/console.gui/src/main/java/org/apache/felix/mosgi/console/gui/NodesTree.java
index 8fdc83b..01cae00 100644
--- a/mosgi/console.gui/src/main/java/org/apache/felix/mosgi/console/gui/NodesTree.java
+++ b/mosgi/console.gui/src/main/java/org/apache/felix/mosgi/console/gui/NodesTree.java
@@ -175,10 +175,20 @@
   public void actionPerformed(ActionEvent ae) {
     Object object = ae.getSource();
     if ( object == jb_addNode ) { // Add a new node into tree
-      Gateway g = Gateway.newGateway();
-      if ( g != null ) {
+      DefaultMutableTreeNode node = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
+      Gateway selectedGateway = null;
+      if ( node != null && node != top) {
+        selectedGateway = (Gateway) node.getUserObject();
+      }
+      Gateway newGateway = null;
+      try {
+        newGateway = Gateway.newGateway(selectedGateway);
+      } catch (Exception exep) {
+        JOptionPane.showMessageDialog(null, "Gateway creation error:\n "+exep.toString(), "Error", JOptionPane.ERROR_MESSAGE);
+      }
+      if ( newGateway != null ) {
         TreePath tp = tree.getSelectionPath();
-        this.createTreeNode(g);
+        this.createTreeNode(newGateway);
         dtm.reload(top);
         isAllNodesConnected = false;
         tree.setSelectionPath(tp);
@@ -188,7 +198,7 @@
       if ( node != top) {
         Gateway g = (Gateway) node.getUserObject();
         if ( !node.equals(top) ){
-	  if( JOptionPane.showConfirmDialog(null, "Sure we remove this gateway \""+g.getName()+"\" ?\n "+g.toString()) == JOptionPane.YES_OPTION ) {
+	  if( JOptionPane.showConfirmDialog(null, "Sure we remove this gateway \""+g.getNickname()+"\" ?\n "+g.toString()) == JOptionPane.YES_OPTION ) {
             g.disconnect(this);
 	    dtm.removeNodeFromParent(node);
 	    System.out.println("Remove node : "+g);
@@ -271,8 +281,9 @@
       String packages = bc.getProperty("mosgi.jmxconsole.protocol."+protoName+".package");
       if ( packages == null ) {
         packages = "";
+      } else {
+        System.out.println("Protocol provider package for \""+protoName+"\" is prefixed with \""+packages+"\"");
       }
-      System.out.println("Protocol provider package for \""+protoName+"\" = "+packages);
       PROTOCOL_PACKAGE_PROVIDER.put(protoName, packages);
       return packages;
     }
diff --git a/mosgi/doc/config.properties.jmxconsole b/mosgi/doc/config.properties.jmxconsole
index ec7bb55..335c820 100644
--- a/mosgi/doc/config.properties.jmxconsole
+++ b/mosgi/doc/config.properties.jmxconsole
@@ -35,17 +35,14 @@
 # mosgi.jmxconsole.rmiport.core=1099
 
 # NEW :
-mosgi.jmxconsole.id.1.nickname=main
-mosgi.jmxconsole.id.1.profile=core
-mosgi.jmxconsole.id.1.host=127.0.0.1
-mosgi.jmxconsole.id.1.protocol=rmi
-mosgi.jmxconsole.id.1.port=1099
-#mosgi.jmxconsole.id.1.jmxserviceurl=service:jmx:rmi:///jndi/rmi://127.0.0.1:1099/core
+# mosgi.jmxconsole.id.<number>.nickname is the gateway nickname used by the GUI (default value is the gateway <number>)
+# mosgi.jmxconsole.id.<number>.jmxsurl is the string used to create the JMXServiceURL. This string must look like this : service:jmx:<protocol>:<sap>, <protocol> ie. "rmi", <sap> ie. "///jndi/rmi://127.0.0.1:1099/core"
+# More details on the JMXServiceURL class javadoc
+mosgi.jmxconsole.id.1.jmxsurl=service:jmx:rmi:///jndi/rmi://127.0.0.1:1099/core
+mosgi.jmxconsole.id.1.nickname=core std (rmi)
 
-mosgi.jmxconsole.id.2.profile=core2
-mosgi.jmxconsole.id.2.host=127.0.0.1
-mosgi.jmxconsole.id.2.protocol=rmi
-mosgi.jmxconsole.id.2.port=1100
+mosgi.jmxconsole.id.2.jmxsurl=service:jmx:ws://127.0.0.1:1100/core2
+mosgi.jmxconsole.id.2.nickname=core 2 (web service connector)
 
 felix.startlevel.framework=1
 felix.startlevel.bundle=1
diff --git a/mosgi/doc/core.sh b/mosgi/doc/core.sh
index ec22190..1d80b5c 100755
--- a/mosgi/doc/core.sh
+++ b/mosgi/doc/core.sh
@@ -1,5 +1,6 @@
 #!/bin/sh
-rm -rf ~/.felix/core
+
+#rm -rf ~/.felix/core
 
 echo "cd into felix directory"
 cd ../../main
diff --git a/mosgi/doc/jmxconsole.sh b/mosgi/doc/jmxconsole.sh
index f4b5bf7..1e390fc 100755
--- a/mosgi/doc/jmxconsole.sh
+++ b/mosgi/doc/jmxconsole.sh
@@ -1,5 +1,6 @@
 #!/bin/sh
-rm -rf ~/.felix/jmxconsole
+
+#rm -rf ~/.felix/jmxconsole
 
 echo "cd into felix directory"
 cd ../../main
diff --git a/mosgi/jmx.agent/src/main/java/org/apache/felix/mosgi/jmx/agent/AgentActivator.java b/mosgi/jmx.agent/src/main/java/org/apache/felix/mosgi/jmx/agent/AgentActivator.java
index 3bdf8e0..cc0a0ae 100644
--- a/mosgi/jmx.agent/src/main/java/org/apache/felix/mosgi/jmx/agent/AgentActivator.java
+++ b/mosgi/jmx.agent/src/main/java/org/apache/felix/mosgi/jmx/agent/AgentActivator.java
@@ -56,17 +56,10 @@
     AgentActivator.bc=context;
     this.version=(String)bc.getBundle().getHeaders().get(Constants.BUNDLE_VERSION);
     AgentActivator.log(LogService.LOG_INFO, "Starting JMX Agent "+version,null);
-    String profile=bc.getProperty(BundleCache.CACHE_PROFILE_PROP);
-    if (profile==null){
-      profile=System.getProperty(BundleCache.CACHE_PROFILE_PROP);
-     }
-    String virtual=bc.getProperty("mosgi.jmxconsole.core."+profile);
     StringTokenizer st=new StringTokenizer(System.getProperty("java.version"), ".");
     st.nextToken();
-    int minor=Integer.parseInt(st.nextToken());
-
-    System.out.println("VIRTUAL OOOO "+virtual+" : "+profile);
-    this.startAgent(virtual, minor);
+    int minorVersion = Integer.parseInt(st.nextToken());
+    this.startAgent(minorVersion);
     this.registerExistingMBeans();
     bc.addServiceListener(this);
   }
@@ -110,11 +103,9 @@
     }
   }
 
-  private void startAgent(String virtual, int minor){
-    if (virtual==null && minor >=5){
-      Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
-      //this.server= ManagementFactory.getPlatformMBeanServer();
-      this.server = MBeanServerFactory.createMBeanServer();
+  private void startAgent(int minor){
+    if ( minor >= 5 ){
+      this.server = java.lang.management.ManagementFactory.getPlatformMBeanServer();
       AgentActivator.log(LogService.LOG_DEBUG, "A jdk1.5 agent started "+this.server,null);
     }else {
       Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
