• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Tomcat , problem with libraries order

 
Ranch Hand
Posts: 127
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I develop my application with FOP (Apache's formatter) on Oracle's JDeveloper 9i - there everything works OK.
But when I deploy application (through war file) to Tomcat 4.0.3, problems begin.
By this simple code I load XML file and change its encoding:
Document document;
XMLDocument xdoc;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(false);
DocumentBuilder builder = dbf.newDocumentBuilder();
document = builder.parse(new File("report.xml"));
xdoc = (XMLDocument) document; // ERROR ON TOMCAT
String se = xdoc.getEncoding();
xdoc.setEncoding("WINDOWS-1250");
...
The marked line generates error "ClassCastException".
Both Document and XMLDocument are from the library XMLPARSERV2.JAR, which is loaded before every library FOP 0.20.3 (uses avalon-framework-4.0.jar, batik.jar, logkit-1.0.jar ,
xalan-2.0.0.jar, xerces.jar)
But the class with same name (with different beahavior) - Document.class is
also stored in batik.jar, xalan-2.0.0.jar and xerces.jar.
I think that Tomcat somewhat mixes the libraries order and takes Document.class from one of the FOP libraries instead from xmlparserv2.jar.
I am still rather new to this. Do I need to have set Classpath or something else installed, even if the application is run via web-browser ? (Now I have Tomcat and browser on one PC)
Does somebody see the solution to this ? Thanks.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy Jiri,
Welcome to JavaRanch!
Let's move this conversation to The Apache/Tomcat Forum...
 
Joel Salatin has signs on his property that say "Trespassers will be Impressed!" Impressive tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic