Hi there,


I have followed the tutorial about how to setup db connection (with mysql).

But still giving me the followoing errors:

type Exception report

message 

description The server encountered an internal error () that prevented it 
from fulfilling this request.

exception org.apache.jasper.JasperException: The absolute uri: 
http://java.sun.com/jsp/jstl/sql cannot be resolved in either web.xml or 
the jar files deployed with this application
        
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
        
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
        
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
        
org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:317)
        
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:148)
        org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:424)
        org.apache.jasper.compiler.Parser.parseDirective(Parser.java:493)
        org.apache.jasper.compiler.Parser.parseElements(Parser.java:1557)
        org.apache.jasper.compiler.Parser.parse(Parser.java:127)
        
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:212)
        
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
        org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:156)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
        
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
        
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)       
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)



I feel a bit confused about where to put the web.xml file and context.xml 
file.

Here I assumed create the context.xml file in 

/tomcat/apache-tomcat-5.5.26/webapps/DBTest/META-INF

and web.xml in

/tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF



and mysql-connector-java is in the following path:

linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/lib # ls
.  ..  mysql-connector-java-5.1.3-rc-bin.jar





What is missing and where I incorrectly setup the file?



Your suggestion is highly appreciated.



Thanks




> ----- Original Message -----
> From: David Smith
> Sent: 28/08/08 03:06 am
> To: Tomcat Users List
> Subject: Re: Can't execute servlet project
> 
> The datasource for your webapp isn't setup correctly.  Take a look at 
> 
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html 
> for help on how to properly setup a database connection pool.  My only 
> edit that article I would recommend is don't add ?autoReconnect=true to 
> the end of the mysql database url.  Instead, add validationQuery="select 
> 1" to the <Resource ... /> element in your context.xml file so 
> connections are tested and regenerated as needed.
> 
> --David
> 
> sam wun wrote:
> > HI there,
> >
> >
> >
> > I managed to fix the jdk version error, now it comes with a different 
> > error.
> >
> > The url I am trying to put on the firefox browser is 
> >
> > http://10.1.9.1:8080/DBTest/CreateCustomerServlet
> >
> >
> >
> >
> >
> > The error is:
> >
> > TTP Status 500 - 
> >
> > type Exception report
> >
> > message 
> >
> > description The server encountered an internal error () that prevented 
> it 
> > from fulfilling this request.
> >
> > exception javax.servlet.ServletException: Cannot create JDBC driver of 
> > class '' for connect URL 'null'
> >     servlet.CreateCustomerServlet.doGet(CreateCustomerServlet.java:38)
> >     javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
> >     javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >
> > root cause org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot 
> create 
> > JDBC driver of class '' for connect URL 'null'
> >     
> > 
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1150)
> >     
> > 
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
> >     command.CommandExecutor.getConnection(CommandExecutor.java:54)
> >     
> command.CommandExecutor.executeDatabaseCommand(CommandExecutor.java:38)
> >     servlet.CreateCustomerServlet.doGet(CreateCustomerServlet.java:33)
> >     javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
> >     javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >
> > root cause java.sql.SQLException: No suitable driver
> >     java.sql.DriverManager.getDriver(Unknown Source)
> >     
> > 
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1143)
> >     
> > 
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
> >     command.CommandExecutor.getConnection(CommandExecutor.java:54)
> >     
> command.CommandExecutor.executeDatabaseCommand(CommandExecutor.java:38)
> >     servlet.CreateCustomerServlet.doGet(CreateCustomerServlet.java:33)
> >     javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
> >     javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >
> > note The full stack trace of the root cause is available in the Apache 
> > Tomcat/5.5.26 logs.
> >   
> >> ----- Original Message -----
> >> From: David Smith
> >> Sent: 28/08/08 12:44 am
> >> To: Tomcat Users List
> >> Subject: Re: Can't execute servlet project
> >>
> >> Looks normal .. you won't get a file named CreateCustomerServlet under 
> >> DbTest.  You should get a class named CreateCustomerServlet.class in 
> >> WEB-INF/classes/servlet.  That class will be called when your webapp 
> >> receive's a request for 
> >> http://localhost:8080/DbTest/CreateCustomerServlet (assuming tomcat 
> was 
> >> installed with listening on port 8080 and it's installed on your local 
> >> workstation).  That's what the <servlet-mapping> ... 
> </servlet-mapping> 
> >> part of web.xml is all about -- mapping URLs to servlets.
> >>
> >>
> >> --David
> >>
> >> sam wun wrote:
> >>     
> >>> I got a similar web.xml, but the is different. 
> >>>
> >>> Here is the entire content of my web.xml.
> >>>
> >>>
> >>>
> >>> <?xml version="1.0" encoding="UTF-8"?>
> >>> <web-app id="WebApp_ID" version="2.4" 
> >>> xmlns="http://java.sun.com/xml/ns/j2ee"; 
> >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> >>> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
> >>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
> >>>     <display-name>
> >>>     DBTest</display-name>
> >>>     <servlet>
> >>>         <description>
> >>>         Servlet to create customers</description>
> >>>         <display-name>
> >>>         CreateCustomerServlet</display-name>
> >>>         <servlet-name>CreateCustomerServlet</servlet-name>
> >>>         <servlet-class>
> >>>         servlet.CreateCustomerServlet</servlet-class>
> >>>     </servlet>
> >>>     <servlet-mapping>
> >>>         <servlet-name>CreateCustomerServlet</servlet-name>
> >>>         <url-pattern>/CreateCustomerServlet</url-pattern>
> >>>     </servlet-mapping>
> >>>     <welcome-file-list>
> >>>         <welcome-file>index.html</welcome-file>
> >>>         <welcome-file>index.htm</welcome-file>
> >>>         <welcome-file>index.jsp</welcome-file>
> >>>         <welcome-file>default.html</welcome-file>
> >>>         <welcome-file>default.htm</welcome-file>
> >>>         <welcome-file>default.jsp</welcome-file>
> >>>     </welcome-file-list>
> >>>     <resource-ref>
> >>>         <description>DB Connection</description>
> >>>           <res-ref-name>jdbc/TestDB</res-ref-name>
> >>>          <res-type>javax.sql.DataSource</res-type>
> >>>          <res-auth>Container</res-auth>
> >>>     </resource-ref>
> >>> </web-app>
> >>>
> >>>
> >>>
> >>> However, I don't see "CreateCustomerServlet" copied into my DBTest 
> >>>       
> >> folder 
> >>     
> >>> in the linux(tomcat) server.
> >>>
> >>> Here is the project directory listing of my tomcat server (in linux):
> >>>
> >>> linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest # ls
> >>> .  ..  META-INF  WEB-INF  customers.jsp
> >>>
> >>>
> >>>
> >>> Thanks
> >>>
> >>> Sam
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>   
> >>>       
> >>>> ----- Original Message -----
> >>>> From: David Smith
> >>>> Sent: 27/08/08 11:29 pm
> >>>> To: Tomcat Users List
> >>>> Subject: Re: Can't execute servlet project
> >>>>
> >>>> But if you followed the tutorial, there should be a servlet mapping 
> in 
> >>>> your web.xml looking like what I copied and pasted from the article 
> >>>> below:
> >>>>
> >>>> <servlet>
> >>>>     <description>Create Customers Servlet</description>
> >>>>     <display-name>ListCustomers</display-name>
> >>>>     <servlet-name>ListCustomers</servlet-name>
> >>>>     <servlet-class>servlet.ListCustomersServlet</servlet-class>
> >>>> </servlet>
> >>>> <servlet-mapping>
> >>>>     <servlet-name>ListCustomers</servlet-name>
> >>>>     <url-pattern>/ListCustomers</url-pat-tern>
> >>>> </servlet-mapping>
> >>>>
> >>>> This defines a servlet in the <servlet> element and then defines the 
> >>>> URLs this servlet should service in the <servlet-mapping> element.  
> In 
> >>>> this case there doesn't need to be a physical file named 
> ListCustomers 
> >>>> in the top level of the DbTest webapp.
> >>>>
> >>>> Your tutorial was very much geared to showing you how Eclipse works, 
> >>>> more or less assuming you had some familiarity with servlet and/or 
> >>>>         
> >> java 
> >>     
> >>>> programming.  I would recommend finding some tutorial material that 
> >>>> focuses on servlet/jsp programming, ignoring IDEs like Eclipse.
> >>>>
> >>>> --David
> >>>>
> >>>> sam wun wrote:
> >>>>     
> >>>>         
> >>>>> HI there,
> >>>>>
> >>>>>
> >>>>>
> >>>>> It sounds logical, but there is no LIstCustomers in the DBTest 
> >>>>>           
> >> folder.
> >>     
> >>>>>
> >>>>> Thanks
> >>>>>
> >>>>> Sam
> >>>>>
> >>>>>
> >>>>>
> >>>>>   
> >>>>>       
> >>>>>           
> >>>>>> ----- Original Message -----
> >>>>>> From: David Smith
> >>>>>> Sent: 27/08/08 09:59 pm
> >>>>>> To: Tomcat Users List
> >>>>>> Subject: Re: Can't execute servlet project
> >>>>>>
> >>>>>> I see .... the jsp is a view and as such wasn't designed to be run 
> >>>>>>             
> >> on 
> >>     
> >>>>>> it's own.  Try http://localhost/DBTest/ListCustomers in your 
> >>>>>>             
> >> browser.  
> >>     
> >>>>>> That should hit the servlet which in turn should generate the 
> >>>>>>             
> >> required 
> >>     
> >>>>>> bean and forward the user to your jsp.
> >>>>>>
> >>>>>> --David
> >>>>>>
> >>>>>>
> >>>>>> sam wun wrote:
> >>>>>>     
> >>>>>>         
> >>>>>>             
> >>>>>>> Hi, thanks for trying to help.
> >>>>>>>
> >>>>>>> I dont' have a clue on this *bean*.
> >>>>>>>
> >>>>>>> The entire tutorial doesn't mention about how to setup a bean...
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> The tutorial I;ve followed is shown as below:
> >>>>>>>
> >>>>>>> http://java.sys-con.com/node/152270
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> Thanks
> >>>>>>>
> >>>>>>> Sam
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>   
> >>>>>>>           
> >>>>>>>               
> >> ---------------------------------------------------------------------
> >> To start a new topic, e-mail: users@tomcat.apache.org
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>     
> >
> >   
> 
> 
> -- 
> David Smith
> Programmer/Analyst
> College of Agriculture and Life Sciences
> Cornell University
> B32 Morrison Hall
> Ithaca, NY 14853
> Phone: (607) 255-4521
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Reply via email to