| Summary: | Error message when multiple jetty jars are on the classpath is unhelpful | ||
|---|---|---|---|
| Product: | [RT] Jetty | Reporter: | Geir Hedemark <geir> |
| Component: | server | Assignee: | Greg Wilkins <gregw> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | geir, jetty-inbox |
| Version: | unspecified | ||
| Target Milestone: | 7.5.x | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
|
Description
Geir Hedemark
Suggested patch:
diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java
index 6ba2729..b92b121 100644
--- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java
+++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java
@@ -307,7 +307,7 @@ public class XmlConfiguration
// Check the class of the object
Class<?> oClass = (Class<?>)nodeClass(_config);
if (oClass != null && !oClass.isInstance(obj))
- throw new IllegalArgumentException("Object is not of type " + oClass);
+ throw new IllegalArgumentException("Object is not of type " + oClass+". Actual type is "+obj.getClass()+". If names look the same there may be several jetty jar files on the classpath.");
configure(obj,_config,0);
return obj;
}
thanks for the suggestion.
I went with:
if (oClass != null && !oClass.isInstance(obj))
{
String loaders = (oClass.getClassLoader()==obj.getClass().getClassLoader())?"":"Object Class and type Class are from different loaders.";
throw new IllegalArgumentException("Object of class '"+obj.getClass().getCanonicalName()+"' is not of type '" + oClass.getCanonicalName()+"'. "+loaders);
}
|