Hi!
I run my application using mvn jetty:run
At compile time everything is fine, my row
Tidy tidier = new Tidy();
tidier.setInputEncoding("UTF-8");
compiles fine and the classpath shows the appropriate jar. However, at runtime I get the following exception and I cannot undestand why:
2009-11-11 17:48:53.384::WARN: Error starting handlers
java.lang.NoSuchMethodError: org.w3c.tidy.Tidy.setInputEncoding(Ljava/lang/String;)V
I am now thinking maybe there are two different versions of this Tidy in my classpath (the one apparently is not named tidy, otherwise I could detect it in the classpath shown by maven). I am trying to find out what jar file it is and so far I have tried the following:
Class<?> tidyClass = Class.forName(Tidy.class.getName());
ClassLoader tidyLoader = tidyClass.getClassLoader();
String name = Tidy.class.getName() + ".class"; // results in tidyClass=class org.w3c.tidy.Tidy
System.out.println("resource="+tidyLoader.getResource(name)); // results in tidyLoader=org.codehaus.classworlds.RealmClassLoader@337d0f
System.out.println("path="+tidyLoader.getResource(name).getPath()); // results in resource=null
I read somewhere that the path should show the jar but apparently not with this classloader... how can I figure it out? Everything works like a charm in eclipse but when I run with maven I get this mess.. BTW eclipse says
tidyClass=class org.w3c.tidy.Tidy
tidyLoader=sun.misc.Launcher$AppClassLoader@1a7bf11
resource=null so no jar info either.