This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Tomcat and the fly likes not able to run two site simultaneously in a tomcat websrever Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » Tomcat
Reply Bookmark "not able to run two site simultaneously in a tomcat websrever" Watch "not able to run two site simultaneously in a tomcat websrever" New topic
Author

not able to run two site simultaneously in a tomcat websrever

Dhrupal Patel
Greenhorn

Joined: Dec 17, 2008
Posts: 9
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
Marshal

Joined: Mar 22, 2005
Posts: 35249
    
    7
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 ]

Android appsImageJ pluginsJava web charts
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: not able to run two site simultaneously in a tomcat websrever
 
Similar Threads
Trouble Installing JForum on VPS
java.sql.SQLException
Problem grabbing RSS from a website and displaying it from servlet
java.io.CharConversionException when reading a string of characters from database
Marking servlet HelloWorld as unavailable