hi friends m new to servlet programming. am using eclipse IDE
i followed a tutorial to fetch data from mysql. nothing error is showing.
It shows like server is working fine.But result is not displayed. Please help me out.
servlet coding
public class Databaseaccess extends HttpServlet {
private static final long serialVersionUID = 1L;
// Extract data from result set
while(rs.next()){
//Retrieve by column name
String uname = rs.getString("username");
String name = rs.getString("name");
How are you trying to run servlet, i mean is it accessible when you do some action.First check is your servlet accessible or not by setting debugger in the servlet class file.
Later issue can be figured out if database is accessible or not.
Thanks
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
0
elakiya selvi wrote:But result is not displayed.
What does this mean? What are you doing, and what is the result? Which parts of the code are or are not executed?
am new to servlet and m working on my college project.
i think servlet is not working.
Status report
message /Databaseaccess/
description The requested resource (/Databaseaccess/) is not available.
Server console
Apr 28, 2012 8:38:56 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\PROGRAM FILES\PC CONNECTIVITY SOLUTION\;C:\Windows\SYSTEM32;C:\Windows;C:\Windows\SYSTEM32\WBEM;C:\Windows\SYSTEM32\WINDOWSPOWERSHELL\V1.0\;C:\PROGRAM FILES\WIDCOMM\BLUETOOTH SOFTWARE\;C:\PROGRAM FILES\DELL\DW WLAN CARD;C:\MAVEN\APACHE-MAVEN-3.0.2\BIN;C:\SPRING-ROO-1.1.0.M1\BIN;;C:\PROGRAM FILES\PANDA SECURITY\PANDA GLOBAL PROTECTION 2011;C:\WINDOWS\SYSTEM32\GS\GS7.05\BIN;C:\PROGRAM FILES\MYSQL\MYSQL SERVER 5.5\BIN;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;C:\Program Files\eclipse-java-indigo\eclipse;;.
Apr 28, 2012 8:38:57 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Apr 28, 2012 8:38:57 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1403 ms
Apr 28, 2012 8:38:57 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Apr 28, 2012 8:38:57 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
Apr 28, 2012 8:38:57 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor Databaseaccess.xml
Apr 28, 2012 8:38:57 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor Servlettest.xml
Apr 28, 2012 8:38:57 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Apr 28, 2012 8:38:57 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Apr 28, 2012 8:38:58 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/60 config=null
Apr 28, 2012 8:38:58 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 867 ms
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
0
The servlet is never accessed because apparently nothing is mapped to the URL you're trying to access. How are you mapping the servlet in the web.xml file?
This would only be correct if the servlet is in the ROOT web app, which most likely it is not. The name of the web app is the name of the directory underneath Tomcat's webapps directory in which your code lives.
am using eclipse to develop program..
my servlets resides in <wtpwebapps> along with ROOT.(D:\mkm\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps)
and accessed with the link
http://localhost:8080/wtpwebapps/Databaseaccess/
INFO: Deploying configuration descriptor D:\mkm\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\localhost\Databaseaccess.xml
Apr 29, 2012 7:53:26 AM org.apache.catalina.startup.SetContextPropertiesRule begin
WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.serveratabaseaccess' did not find a matching property.
Apr 29, 2012 7:53:27 AM org.apache.catalina.startup.HostConfig deployDescriptor
Runrioter Wung
Greenhorn
Joined: Sep 03, 2011
Posts: 21
posted
0
Do you solve the problem,now? I think that the String named "DB_URL" is wrong. where is the number of port? The default number is 3306.
For example: