[jboss-cvs] JBossAS SVN: r96391 - projects/naming/trunk/jnpserver/src/main/java/org/jnp/interfaces.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Nov 15 21:26:10 EST 2009


Author: scott.stark at jboss.org
Date: 2009-11-15 21:26:09 -0500 (Sun, 15 Nov 2009)
New Revision: 96391

Modified:
   projects/naming/trunk/jnpserver/src/main/java/org/jnp/interfaces/NamingContext.java
Log:
JBNAME-2, add the full discovery failure trace to the naming exception.

Modified: projects/naming/trunk/jnpserver/src/main/java/org/jnp/interfaces/NamingContext.java
===================================================================
--- projects/naming/trunk/jnpserver/src/main/java/org/jnp/interfaces/NamingContext.java	2009-11-16 02:05:20 UTC (rev 96390)
+++ projects/naming/trunk/jnpserver/src/main/java/org/jnp/interfaces/NamingContext.java	2009-11-16 02:26:09 UTC (rev 96391)
@@ -24,6 +24,8 @@
 import java.io.BufferedInputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
@@ -1765,7 +1767,7 @@
                }
             }
 
-            // If there is still no
+            // If there is still no server, try discovery
             Exception discoveryFailure = null;
             if (naming == null)
             {
@@ -1784,8 +1786,14 @@
                   StringBuffer buffer = new StringBuffer(50);
                   buffer.append("Could not obtain connection to any of these urls: ").append(urls);
                   if (discoveryFailure != null)
-                     buffer.append(" and discovery failed with error: ").append(discoveryFailure);
+                  {
+                     StringWriter sw = new StringWriter();
+                     PrintWriter pw = new PrintWriter(sw);
+                     discoveryFailure.printStackTrace(pw);
+                     buffer.append(" and discovery failed with error: ").append(sw.toString());
+                  }
                   CommunicationException ce = new CommunicationException(buffer.toString());
+                  
                   ce.setRootCause(serverEx);
                   throw ce;
                }




More information about the jboss-cvs-commits mailing list