• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

not able to run two site simultaneously in a tomcat websrever

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

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(SaarthiConnectBean.java:60)
at SaarthiBean.DB.SaarthiConnectBean.changeDB(SaarthiConnectBean.java:30)
at SaarthiBean.DB.SaarthiConnectBean.<init>(SaarthiConnectBean.java:19)
at org.apache.jsp._1_jsp._jspService(_1_jsp.java:58)
at org.apache.jasper.runtime.HttpJspBase.service(jasper5-runtime-5.5.23.jar.so)
at javax.servlet.http.HttpServlet.service(tomcat5-servlet-2.4-api-5.5.23.jar.so)
at org.apache.jasper.servlet.JspServletWrapper.service(jasper5-compiler-5.5.23.jar.so)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(jasper5-compiler-5.5.23.jar.so)
at org.apache.jasper.servlet.JspServlet.service(jasper5-compiler-5.5.23.jar.so)
at javax.servlet.http.HttpServlet.service(tomcat5-servlet-2.4-api-5.5.23.jar.so)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(catalina-5.5.23.jar.soa0q5kw.so)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(catalina-5.5.23.jar.soa0q5kw.so)
at org.apache.catalina.core.StandardWrapperValve.invoke(catalina-5.5.23.jar.soa0q5kw.so)
at org.apache.catalina.core.StandardContextValve.invoke(catalina-5.5.23.jar.soa0q5kw.so)
at org.apache.catalina.core.StandardHostValve.invoke(catalina-5.5.23.jar.soa0q5kw.so)
at org.apache.catalina.valves.ErrorReportValve.invoke(catalina-5.5.23.jar.soa0q5kw.so)
at org.apache.catalina.core.StandardEngineValve.invoke(catalina-5.5.23.jar.soa0q5kw.so)
at org.apache.catalina.connector.CoyoteAdapter.service(catalina-5.5.23.jar.soa0q5kw.so)
at org.apache.jk.server.JkCoyoteHandler.invoke(tomcat-ajp-5.5.23.jar.so)
at org.apache.jk.common.HandlerRequest.invoke(tomcat-ajp-5.5.23.jar.so)
at org.apache.jk.common.ChannelSocket.invoke(tomcat-ajp-5.5.23.jar.so)
at org.apache.jk.common.ChannelSocket.processConnection(tomcat-ajp-5.5.23.jar.so)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(tomcat-ajp-5.5.23.jar.so)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(tomcat-util-5.5.23.jar.so)
at java.lang.Thread.run(libgcj.so.7rh)


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

thanks
 
Rancher
Posts: 43016
76
  • 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 ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic