This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line!
See this thread for details.
  • 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 ...
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown

not able to run two site simultaneously in a tomcat websrever

Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

we have purchasing 10 domain plesk server from webhosting company.
on that our 1st site is running successfully. After uploading 2nd site the problem arise.

We are using tomcat as application server , jdk1.6 and mysql 5.0 database.

while running both the site simultaneously it gives us class cast exception
Which ever site running 1st after restarting tomcat is working fine, the other site which we run second is not working it gives class cast exception.

Error :

rror in ConnectBean : java.lang.ClassCastException: com.mysql.jdbc.Connection cannot be cast to com.mysql.jdbc.Connection
java.lang.ClassCastException: com.mysql.jdbc.Connection cannot be cast to com.mysql.jdbc.Connection
at SaarthiBean.DB.SaarthiConnectBean.changeDB(
at SaarthiBean.DB.SaarthiConnectBean.changeDB(
at SaarthiBean.DB.SaarthiConnectBean.<init>(
at org.apache.jsp._1_jsp._jspService(
at org.apache.jasper.runtime.HttpJspBase.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.jasper.servlet.JspServletWrapper.service(
at org.apache.jasper.servlet.JspServlet.serviceJspFile(
at org.apache.jasper.servlet.JspServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.jk.server.JkCoyoteHandler.invoke(
at org.apache.jk.common.HandlerRequest.invoke(
at org.apache.jk.common.ChannelSocket.invoke(
at org.apache.jk.common.ChannelSocket.processConnection(
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(
at org.apache.tomcat.util.threads.ThreadPool$

can any one tell me what is the reason of problem?
how we can solve it?

Posts: 43081
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Tomcat uses different classloaders to load the classes for each web app (or each individual site). I'll bet that you have more than one copy of the MySQL JDBC driver jar file, so those would be loaded by different classloaders, which makes them incompatible.

Try moving the jar file to a location that's shared by all web apps (and sites) on the Tomcat, like the TOMCAT_HOME/shared/lib or the TOMCAT_HOME/common/endorsed directory.
[ December 18, 2008: Message edited by: Ulf Dittmer ]
Make yourself as serene as a flower, as a tree. And on wednesdays, as serene as this tiny ad:
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic