• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

not able to run two site simultaneously in a tomcat websrever

 
Dhrupal Patel
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic