Urgent-Help: Cannot Connect to MYSql DataBase from Java Servlet
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mohammad_Syed
Posted On:   Tuesday, January 3, 2006 01:51 PM

I desigend a J2EE Aplication using JSP and Servlets in MVC design.My system was working great untill i tried using filter for gzip compression for response output , after i used filter gzip, my whole application is destroyed, I cannot able to connect to my Mysql data base, my connection object always returns NULL, i tried every thing re-installing the mysql driver, re-installing the NetBeans ide , nothing is working, i am not able to connect with the database. This application was working perfect before i experimented with the Gzip filter.please any body can help me what i did wrong, did i corrupted tomcat server. My application is still on my laptop and is not have been loaded on internet yet. i am posting some errors it is showing on the tomcat    More>>

I desigend a J2EE Aplication using JSP and Servlets in MVC design.My system was working great untill i tried using filter for gzip compression for response output , after i used filter gzip, my whole application is destroyed, I cannot able to connect to my Mysql data base, my connection object always returns NULL, i tried every thing re-installing the mysql driver, re-installing the NetBeans ide , nothing is working, i am not able to connect with the database.


This application was working perfect before i experimented with the Gzip filter.please any body can help me what i did wrong, did i corrupted tomcat server. My application is still on my laptop and is not have been loaded on internet yet. i am posting some errors it is showing on the tomcat log.


I Want to mention i am using connection pooling which was working great, all the servlets are present in the application, the whole application and connection pooling was working great before i used this gzip filter.....


Also i like to mention the main problem is when i try to load the driver for Mysql database in my java class it always returns a null connection object. I use Class.forName function in java to load a driver for mysql database.Following is the code where my appliacation returns null connection object


public static Connection ConnectDB(String NameParm, String PasswordParm) {

try {


String url = "jdbc:mysql://localhost:3306/mysql";

Class.forName("com.mysql.jdbc.Driver");

conn = null;

conn = DriverManager.getConnection(url, NameParm,
PasswordParm);

System.out.println("Database connection
established");

return conn;

} catch (Exception e)
{
System.err.println("Cannot connect to database server ");
return conn;
}
}

please guilde me.. my application is totally stoped at this moment.


=========== E R R O R S- ON TOMCAT LOG ============
Jan 3, 2006 3:28:16 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@3a9bba')
Jan 3, 2006 3:28:16 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@1c5ddc9')
Jan 3, 2006 3:28:16 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@163f7a1')
Jan 3, 2006 3:28:16 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
Jan 3, 2006 3:28:16 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
Jan 3, 2006 3:28:32 PM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet ShadiManager as unavailable
Jan 3, 2006 3:28:32 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /CofeeAdvice threw load() exception
javax.servlet.UnavailableException: Couldn't create connection pool
at com.example.model.ServletController.init(ServletController.java:69)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:925)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3857)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4118)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:589)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:536)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:471)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1102)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
Jan 3, 2006 3:28:33 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jan 3, 2006 3:28:33 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Jan 3, 2006 3:28:34 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class com.sun.faces.config.ConfigureListener
java.lang.NoClassDefFoundError: javax/faces/FacesException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
at java.lang.Class.getConstructor0(Class.java:2640)
at java.lang.Class.newInstance0(Class.java:321)
at java.lang.Class.newInstance(Class.java:303)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3618)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4104)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:589)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:536)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:471)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1102)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
Jan 3, 2006 3:28:34 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)

   <<Less
About | Sitemap | Contact