• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Two Tomcat 5 servers, servlet works in one but not the other

 
Ranch Hand
Posts: 87
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello.

I had two servers, a primary and a backup, both running Tomcat 5 instances along with a couple of web apps containing a servlet.

The backup server went down so a new server was built. Tomcat 5 was reinstalled and the web apps deployed.

However, while the primary servlet continues to work, the new server throws a nebulous NoClassDefFoundError.

The app is xml-based and uses xercesImpl.jar which is in the common/endorsed folder. I am thinking maybe on the new Tomcat 5 instance, it can't find common/endorsed (some classpath issue??)

Otherwise, the setup looks completely identical as far as the Tomcat 5 file directory and web apps. I just can't figure out why one server works and the other throws this error.

Thank you very much for any input and for reading this.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, one way to resolve that problem would be to upgrade to Tomcat6 or later where the infamous "3 libraries" collapse down to 1 and there's less to fiddle with. I think the concept of "endorsed" libraries goes away as well. Or at least drops off my radar. Tomcat 5 is pretty obsolete now.

It would help if you could paste in a copy of the stack trace, though.
 
Tommy Griffith
Ranch Hand
Posts: 87
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, i was planning to upgrade it until this backup server went down, the customer is trying to restore it exactly as the primary is currently configured and has been working for years. The primary is running in JRE 1.4 and now the backup is running in jre 1.5 but now I am getting

org.apache.commons.dbcp.SQLNestedException Cannot load JDBC driver class 'new.sourceforge.jtds.jdbc.Driver

could this have something with the two different jre versions? thank you.
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check to make sure that the JTDS driver jar has been copied into the proper Tomcat library directory (I forget which one it is, alas).

The JTDS driver is a Microsoft SQL server driver downloadable from SourceForge.net that has the virtue of working in cases where Microsoft's own JDBC SQL Server driver didn't. However, Tomcat doesn't come with any database drivers at all, so regardless of what database and driver preferences you have, you'll need to install them into Tomcat yourself.
 
Tommy Griffith
Ranch Hand
Posts: 87
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim. I compared commons/lib on the "working" server with the backup server and noticed some jars, primarily jtds-0.8.jar and some commons whatever jars weren't there so i copied them over to commons/lib.

I tried it again but received the same error. Does Tomcat need to be restarted in order to load the new jars? i wouldn''t think there'd be any compatibility issue with that particular jtds driver between java 1.4 and 1.5...at least i';d think it'd be able to see it.

I now know what you mean about the three common folders. I think the one, endorsed, only wants certain types of jars, like xerces, for example.
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tomcat, its components, and its applications have a plethora of classpaths. The 3-part library system was designed with that in mind. You had one place to put classes that were used only by Tomcat, one for classes shared among applications, and one for classes shared by everyone. For reasons that I missed hearing about, they did away with all of that in Tomcat 6, which, if nothing else, reduces confusion.

jtds.jar is the JDBC driver, so you're OK on that one. And yes, you'll generally have to restart Tomcat when adding/replacing/removing server jars. "Hot" updates apply only to deployed applications, and ever then there are limitations.

Unless you're running Tomcat 5.0, drop JDK 1.4 like a hot rock. Depending on how recent your JTDA driver is, it may or may not make a difference, but JDK 1.4 passed End of Life long ago.
 
Tommy Griffith
Ranch Hand
Posts: 87
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tim, it seems to see the driver ok now, but now I am receiving this exception which i was getting yesterday and i couldn't figure it out...

javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found


the common/endorsed folder has...

xercesImpl.jar
xmlParserAPIs.jar

..on both servers.

is this exception related to those jars some how?

the org.apache package makes me think it's tied into tomcat. but maybe its the jre version. i was reading something where jre 5 has it's own xml parser or something.

 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're getting into murky waters there. I forget what version of the JDK added built-in XML parsing, but it break a few things. Or, more correctly, added some new configuration requirements.

Tomcat uses the Apache Digester to parse the server.xml file and its adjuncts into internal data structures. And, for that matter, the webapp web.xml files . So there are potential conflicts there if you plop down xalan in the wrong place. About this point, I have to leave you to your own devices, since I have to get back to work and it would require more research than I have time to spare.
 
Tommy Griffith
Ranch Hand
Posts: 87
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tim, i figured out the issue. The backup server (tomcat with jre 1.5) was throwing this error;

javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found

because the org.apache.xalan packages were already bundled with jre 1.5. Tomcat was, i presume, confused over which package to use, it's own or that in the two jars in common/endorsed.

I removed the xercesImpl.jar and xmlParserAPIs.jar from the common/endorsed folder on the tomcat 5/jre 1.5 server and it resolved the issue.

In the meantime, I left them in the same folder on the primary tomcat 5/jre 1.4 server and it continues to function as it has been.

As you alluded to, these are old implementations so the problem is likely not to surface much anymore but i am posting here for future reference just in case. Thank you very much for your time.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic