You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "trevor paterson (RI)" <tr...@roslin.ed.ac.uk> on 2008/08/25 17:26:10 UTC
Tomcat6 relative contexts
Prior to tomcat6 you could happily deploy a 'bar.war' to a context like
'/foo/bar' simply by including a context.xml file in the META-INF
directory of the war
with content <Context path='/foo/bar'/>.
we can no longer get this to work - the only way we can get a subcontext
recognized is by putting this Context element in the server.xml (which
then causes autodeployment to both '/bar' and '/foo/bar').
We have tried using the TomcatClientDeployer aswell as deploying on
start up and through the web interface to manager to no avail
are we missing some subtle change from tomcat5 to 6 that is causing
this?
Ta
Trevor Paterson PhD
new email trevor.paterson@roslin.ed.ac.uk
<ma...@roslin.ed.ac.uk>
Bioinformatics
The Roslin Institute
Edinburgh University
Scotland EH25 9PS
phone +44 (0)131 5274477
http://www.roslin.ed.ac.uk <http://www.roslin.ed.ac.uk/>
http://www.comparagrid.org <http://www.comparagrid.org/>
http://www.thearkdb.org <http://www.thearkdb.org/>
Please consider the environment before printing this e-mail
The University of Edinburgh is a charitable body, registered in Scotland
with registration number SC005336
Disclaimer:This e-mail and any attachments are confidential and intended
solely for the use of the recipient(s) to whom they are addressed. If
you have received it in error, please destroy all copies and inform the
sender.
Re: RE: how to reference a class to the current src directory.
Posted by sam wun <sw...@gmx.com>.
Hi,
Thanks for the help.
Can you tell me how to compile these .java files into classes in
Eclipse(3.4)?
All these java files are under "command" package.
Thanks
Sam
> ----- Original Message -----
> From: Tandel, Aswin
> Sent: 26/08/08 02:23 am
> To: Tomcat Users List
> Subject: RE: how to reference a class to the current src directory.
>
> Hi,
>
> For the classes in the same directory it is not required to give class
> path reference.
>
> Chances are that DatabaseCommand is not compiled.
> Check if you have the class file in bin directory.
>
> If not then clean the project and build again
>
>
> Thanks and Regards,
> Ashwin Tandel
> Email - aswin.tandel@citi.com
>
> -----Original Message-----
> From: sam wun [mailto:sw2018@gmx.com]
> Sent: Monday, August 25, 2008 12:04 PM
> To: Tomcat Users List
> Subject: how to reference a class to the current src directory.
>
> Hi there,
>
> I have created a Web project using Eclipse 3.4. However, it can't resolve
> the class reference to the current directory.
> Here is the project layout and description of the problem:
>
> >DBTest
> >src
> > command
> CommandExecutor.java
> ...
> ...
> DatabaseCommand.java
> ...
>
>
> Double-clicks on the file CommandExecutor.java, it display the following
> content:
>
> package command;
>
> import java.sql.Connection;
> import java.sql.SQLException;
> import javax.sql.DataSource;
> import javax.naming.InitialContext;
> import javax.naming.Context;
> import javax.naming.NamingException;
>
> /**
> * Gets and caches data sources, gets connections
> * Implements Singleton pattern
> */
>
> public class CommandExecutor {
>
> private static CommandExecutor myOnlyInstance = null;
> private DataSource ds = null;
>
> // accessor method for the singleton
> public static CommandExecutor getInstance() throws NamingException
> {
> if (myOnlyInstance == null) {
> myOnlyInstance = new CommandExecutor();
> }
> return myOnlyInstance;
> }
>
> // Constructor for the singleton
> private CommandExecutor() throws NamingException {
> getDataSource();
> }
>
> // get the data source from initial context
> public DataSource getDataSource() throws NamingException {
>
> if (ds == null) {
>
> InitialContext ctx = new InitialContext();
> Context envCtx = (Context)
> ctx.lookup("java:comp/env");
> ds = (DataSource) envCtx.lookup("jdbc/TestDB");
>
> }
>
> return ds;
> }
>
> // get the SQL connection from the database
> public Connection getConnection() throws NamingException,
> SQLException {
> return getDataSource().getConnection();
>
> }
>
> // execute particular database command
> public Object executeDatabaseCommand(DatabaseCommand c) throws
> Exception {
>
> Connection conn = null;
> try {
> conn = getConnection();
> Object o = c.executeDatabaseOperation(conn);
> return o;
> } catch (SQLException e) {
> throw e;
> } catch (NamingException ne) {
> throw ne;
> } finally {
> if (conn != null) conn.close();
> }
> }
> }
>
> The DatabaseCommand has error. Move the cursor onto the name of
> DatabaseCommand, an error message popup:
>
> DatabaseCommand cannot be resolved as a type
> 3 quick fixes available:
> . Add type parameter "DatabaseCommand" to "CommandExecutor"
> . Add type parameter "DatabaseCommand" to
> "executeDatabaseCommand(DatabaseCommand)"
> . Fix Project Setup...
>
> I think I need to choose the third option "Fix Project Setup".
>
> Now, from Java Build Path, under the Source menu tab, it has the the
> following layout:
> DBTest/src
> Included: (All)
> Excluded: (None)
> Native librarylocation (None)
>
> Look back the very beginning of this post, you can see the class file
> DatabaseCommand.java file is already defined in the same directory as as
> CommandExecutor.java defined.
>
> How to tell Eclipse compiler that the DatabaseCommand class is in the
> same
> directory as the CommandExecutor.java?
>
> Thanks
> Sam
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: how to create domain.Order class
Posted by Youssef Mohammed <yo...@gmail.com>.
>
> I am wondering where to create a domain.Order class/java file. Do I have
> to create a directory domain under src/ directory and then create
> Order.java file inside theh domain folder?
yes.
Best of luck in your homework :P
>
>
>
>
>
> Thanks
>
> Sam
>
>
>
--
Regards, Youssef
how to create domain.Order class
Posted by sam wun <sw...@gmx.com>.
Hi,
I have a java class file CreateOrder.java with the following coding:
package command;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.PreparedStatement;
import domain.Order;
/**
* Create Order in the database
*/
public class CreateOrder implements DatabaseCommand {
private Order order;
public CreateOrder(Order o) {
this.order = o;
}
public Object executeDatabaseOperation(Connection conn) throws
SQLException {
// Create order
PreparedStatement sta = conn.prepareStatement("INSERT INTO
ORDERS (ID, CUST_ID, DATE_PLACED, AMOUNT) VALUES (?, ?, ?, ?)");
sta.setInt(1, order.getId());
sta.setInt(2, order.getCustId());
sta.setDate(3, order.getDatePlaced());
sta.setInt(4, order.getOrderAmount());
int rows_inserted = sta.executeUpdate();
sta.close();
return rows_inserted;
}
}
Can anyone tell me how to create domain.Order class?
I am using Eclipse 3.4, the project name is DBTest with the following
structure:
> DBTest
Deployment Descriptor: DBTest
Java Resourse: src
+command
...
CreateOrder.java
...
Libraries
Build
WebContent
JavaScript Support
I am wondering where to create a domain.Order class/java file. Do I have
to create a directory domain under src/ directory and then create
Order.java file inside theh domain folder?
Thanks
Sam
Re: RE: how to reference a class to the current src directory.
Posted by sam wun <sw...@gmx.com>.
I just found out I have a class missing in the src (command) directory.
I need to create a Customer and Order class and .java file.
The Cusotmer and Order class is related to the database tables Customer and
Order.
I am wondering how to create a getters and setters of Customer and Order
class in Eclipse?
thanks
sam
> ----- Original Message -----
> From: Tandel, Aswin
> Sent: 26/08/08 02:23 am
> To: Tomcat Users List
> Subject: RE: how to reference a class to the current src directory.
>
> Hi,
>
> For the classes in the same directory it is not required to give class
> path reference.
>
> Chances are that DatabaseCommand is not compiled.
> Check if you have the class file in bin directory.
>
> If not then clean the project and build again
>
>
> Thanks and Regards,
> Ashwin Tandel
> Email - aswin.tandel@citi.com
>
> -----Original Message-----
> From: sam wun [mailto:sw2018@gmx.com]
> Sent: Monday, August 25, 2008 12:04 PM
> To: Tomcat Users List
> Subject: how to reference a class to the current src directory.
>
> Hi there,
>
> I have created a Web project using Eclipse 3.4. However, it can't resolve
> the class reference to the current directory.
> Here is the project layout and description of the problem:
>
> >DBTest
> >src
> > command
> CommandExecutor.java
> ...
> ...
> DatabaseCommand.java
> ...
>
>
> Double-clicks on the file CommandExecutor.java, it display the following
> content:
>
> package command;
>
> import java.sql.Connection;
> import java.sql.SQLException;
> import javax.sql.DataSource;
> import javax.naming.InitialContext;
> import javax.naming.Context;
> import javax.naming.NamingException;
>
> /**
> * Gets and caches data sources, gets connections
> * Implements Singleton pattern
> */
>
> public class CommandExecutor {
>
> private static CommandExecutor myOnlyInstance = null;
> private DataSource ds = null;
>
> // accessor method for the singleton
> public static CommandExecutor getInstance() throws NamingException
> {
> if (myOnlyInstance == null) {
> myOnlyInstance = new CommandExecutor();
> }
> return myOnlyInstance;
> }
>
> // Constructor for the singleton
> private CommandExecutor() throws NamingException {
> getDataSource();
> }
>
> // get the data source from initial context
> public DataSource getDataSource() throws NamingException {
>
> if (ds == null) {
>
> InitialContext ctx = new InitialContext();
> Context envCtx = (Context)
> ctx.lookup("java:comp/env");
> ds = (DataSource) envCtx.lookup("jdbc/TestDB");
>
> }
>
> return ds;
> }
>
> // get the SQL connection from the database
> public Connection getConnection() throws NamingException,
> SQLException {
> return getDataSource().getConnection();
>
> }
>
> // execute particular database command
> public Object executeDatabaseCommand(DatabaseCommand c) throws
> Exception {
>
> Connection conn = null;
> try {
> conn = getConnection();
> Object o = c.executeDatabaseOperation(conn);
> return o;
> } catch (SQLException e) {
> throw e;
> } catch (NamingException ne) {
> throw ne;
> } finally {
> if (conn != null) conn.close();
> }
> }
> }
>
> The DatabaseCommand has error. Move the cursor onto the name of
> DatabaseCommand, an error message popup:
>
> DatabaseCommand cannot be resolved as a type
> 3 quick fixes available:
> . Add type parameter "DatabaseCommand" to "CommandExecutor"
> . Add type parameter "DatabaseCommand" to
> "executeDatabaseCommand(DatabaseCommand)"
> . Fix Project Setup...
>
> I think I need to choose the third option "Fix Project Setup".
>
> Now, from Java Build Path, under the Source menu tab, it has the the
> following layout:
> DBTest/src
> Included: (All)
> Excluded: (None)
> Native librarylocation (None)
>
> Look back the very beginning of this post, you can see the class file
> DatabaseCommand.java file is already defined in the same directory as as
> CommandExecutor.java defined.
>
> How to tell Eclipse compiler that the DatabaseCommand class is in the
> same
> directory as the CommandExecutor.java?
>
> Thanks
> Sam
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
RE: how to reference a class to the current src directory.
Posted by "Tandel, Aswin " <as...@citi.com>.
Hi,
For the classes in the same directory it is not required to give class path reference.
Chances are that DatabaseCommand is not compiled.
Check if you have the class file in bin directory.
If not then clean the project and build again
Thanks and Regards,
Ashwin Tandel
Email - aswin.tandel@citi.com
-----Original Message-----
From: sam wun [mailto:sw2018@gmx.com]
Sent: Monday, August 25, 2008 12:04 PM
To: Tomcat Users List
Subject: how to reference a class to the current src directory.
Hi there,
I have created a Web project using Eclipse 3.4. However, it can't resolve
the class reference to the current directory.
Here is the project layout and description of the problem:
>DBTest
>src
> command
CommandExecutor.java
...
...
DatabaseCommand.java
...
Double-clicks on the file CommandExecutor.java, it display the following
content:
package command;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
/**
* Gets and caches data sources, gets connections
* Implements Singleton pattern
*/
public class CommandExecutor {
private static CommandExecutor myOnlyInstance = null;
private DataSource ds = null;
// accessor method for the singleton
public static CommandExecutor getInstance() throws NamingException {
if (myOnlyInstance == null) {
myOnlyInstance = new CommandExecutor();
}
return myOnlyInstance;
}
// Constructor for the singleton
private CommandExecutor() throws NamingException {
getDataSource();
}
// get the data source from initial context
public DataSource getDataSource() throws NamingException {
if (ds == null) {
InitialContext ctx = new InitialContext();
Context envCtx = (Context)
ctx.lookup("java:comp/env");
ds = (DataSource) envCtx.lookup("jdbc/TestDB");
}
return ds;
}
// get the SQL connection from the database
public Connection getConnection() throws NamingException,
SQLException {
return getDataSource().getConnection();
}
// execute particular database command
public Object executeDatabaseCommand(DatabaseCommand c) throws
Exception {
Connection conn = null;
try {
conn = getConnection();
Object o = c.executeDatabaseOperation(conn);
return o;
} catch (SQLException e) {
throw e;
} catch (NamingException ne) {
throw ne;
} finally {
if (conn != null) conn.close();
}
}
}
The DatabaseCommand has error. Move the cursor onto the name of
DatabaseCommand, an error message popup:
DatabaseCommand cannot be resolved as a type
3 quick fixes available:
. Add type parameter "DatabaseCommand" to "CommandExecutor"
. Add type parameter "DatabaseCommand" to
"executeDatabaseCommand(DatabaseCommand)"
. Fix Project Setup...
I think I need to choose the third option "Fix Project Setup".
Now, from Java Build Path, under the Source menu tab, it has the the
following layout:
DBTest/src
Included: (All)
Excluded: (None)
Native librarylocation (None)
Look back the very beginning of this post, you can see the class file
DatabaseCommand.java file is already defined in the same directory as as
CommandExecutor.java defined.
How to tell Eclipse compiler that the DatabaseCommand class is in the same
directory as the CommandExecutor.java?
Thanks
Sam
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
how to reference a class to the current src directory.
Posted by sam wun <sw...@gmx.com>.
Hi there,
I have created a Web project using Eclipse 3.4. However, it can't resolve
the class reference to the current directory.
Here is the project layout and description of the problem:
>DBTest
>src
> command
CommandExecutor.java
...
...
DatabaseCommand.java
...
Double-clicks on the file CommandExecutor.java, it display the following
content:
package command;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
/**
* Gets and caches data sources, gets connections
* Implements Singleton pattern
*/
public class CommandExecutor {
private static CommandExecutor myOnlyInstance = null;
private DataSource ds = null;
// accessor method for the singleton
public static CommandExecutor getInstance() throws NamingException {
if (myOnlyInstance == null) {
myOnlyInstance = new CommandExecutor();
}
return myOnlyInstance;
}
// Constructor for the singleton
private CommandExecutor() throws NamingException {
getDataSource();
}
// get the data source from initial context
public DataSource getDataSource() throws NamingException {
if (ds == null) {
InitialContext ctx = new InitialContext();
Context envCtx = (Context)
ctx.lookup("java:comp/env");
ds = (DataSource) envCtx.lookup("jdbc/TestDB");
}
return ds;
}
// get the SQL connection from the database
public Connection getConnection() throws NamingException,
SQLException {
return getDataSource().getConnection();
}
// execute particular database command
public Object executeDatabaseCommand(DatabaseCommand c) throws
Exception {
Connection conn = null;
try {
conn = getConnection();
Object o = c.executeDatabaseOperation(conn);
return o;
} catch (SQLException e) {
throw e;
} catch (NamingException ne) {
throw ne;
} finally {
if (conn != null) conn.close();
}
}
}
The DatabaseCommand has error. Move the cursor onto the name of
DatabaseCommand, an error message popup:
DatabaseCommand cannot be resolved as a type
3 quick fixes available:
. Add type parameter "DatabaseCommand" to "CommandExecutor"
. Add type parameter "DatabaseCommand" to
"executeDatabaseCommand(DatabaseCommand)"
. Fix Project Setup...
I think I need to choose the third option "Fix Project Setup".
Now, from Java Build Path, under the Source menu tab, it has the the
following layout:
DBTest/src
Included: (All)
Excluded: (None)
Native librarylocation (None)
Look back the very beginning of this post, you can see the class file
DatabaseCommand.java file is already defined in the same directory as as
CommandExecutor.java defined.
How to tell Eclipse compiler that the DatabaseCommand class is in the same
directory as the CommandExecutor.java?
Thanks
Sam
Re: Can't generate class file from Interface
Posted by Gregor Schneider <rc...@googlemail.com>.
On Tue, Aug 26, 2008 at 2:02 PM, sam wun <sw...@gmx.com> wrote:
>
> package command;
>
> Package command;
>
notice the difference?
cheers
gregor
--
what's puzzlin' you, is the nature of my game
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Can't execute servlet project
Posted by Martin Gainty <mg...@hotmail.com>.
tough to follow without seeing the code
can you start with a simple example as described in
http://java.sun.com/products/jsp/tags/11/syntaxref11.fm14.html
<jsp:useBean id="cart" scope="session" class="session.Carts" />
The value of beanName is either a package and class name or
an Expression that evaluates to a package and
class name, and is passed to
Beans.instantiate.
The value of
type can be the same as beanName, a superclass of
beanName, or an interface implemented by beanName. useful when your class implements many interfaces and you will
be using only one interface
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.
> Date: Wed, 27 Aug 2008 07:59:16 -0400
> From: dns4@cornell.edu
> To: users@tomcat.apache.org
> 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
> >
> >
> >
> >
> >> ----- Original Message -----
> >> From: David Smith
> >> Sent: 26/08/08 11:28 pm
> >> To: Tomcat Users List
> >> Subject: Re: Can't execute servlet project
> >>
> >> 1. The 404 error accessing /DbTest/ -- define a welcome file in
> >> DBTest/WEB-INF/web.xml. Online docs at tomcat.apache.org and the
> >> servlet spec will help with this.
> >>
> >> 2. It would appear you need to do some more research on what you want to
> >> do. It looks like you are trying to expose an ArrayList stored in the
> >> request scope, but the jsp can't find it, hence the error. Where is
> >> this object supposed to come from if you didn't create a bean?
> >>
> >> --David
> >>
> >> sam wun wrote:
> >>
> >>> HI tere,
> >>>
> >>> I have completed a servlet project in Eclipse (3.4).
> >>> I also made a war.file by seleting the project name (DBTest in this
> >>>
> >> case)
> >>
> >>> and the export command from the Eclipse menu, and export it to the
> >>>
> >> Tomcat
> >>
> >>> 5.5.26 server in linux using manager.
> >>>
> >>> However when I click on the project name (/DBTest) in the manager
> >>>
> >> webpage,
> >>
> >>> it shown the following error:
> >>> =================================
> >>> HTTP Status 404 - /DBTest/
> >>> type Status report
> >>> message /DBTest/
> >>>
> >>> description The requested resource (/DBTest/) is not available.
> >>> Apache Tomcat/5.5.26
> >>> =================================
> >>>
> >>> Here is the jsp file in the tomcat server:
> >>> linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest # ls
> >>> . .. META-INF WEB-INF customers.jsp
> >>> its content is shown as below:
> >>> ----------------------------------------
> >>> linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest # vi customers.jsp
> >>> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
> >>> pageEncoding="ISO-8859-1"%>
> >>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> >>> <html>
> >>> <head>
> >>> <meta http-equiv="Content-Type" content="text/html;
> >>>
> >> charset=ISO-8859-1">
> >>
> >>> <title>Customers list</title>
> >>> </head>
> >>> <body>
> >>>
> >>> <jsp:useBean id="customers" type="java.util.ArrayList<domain.Customer>"
> >>> scope="request"/>
> >>>
> >>> <b>Registered Customers:</b><br>
> >>> <table border="1">
> >>> <tr>
> >>> <th>ID</th>
> >>> <th>First Name</th>
> >>> <th>Last Name</th>
> >>> <th>Address</th>
> >>> <th>Orders</th>
> >>> </tr>
> >>> <% for(domain.Customer c : customers) { %>
> >>> <tr>
> >>> <td><%= c.getId() %></td>
> >>> <td><%= c.getFirstName() %></td>
> >>> <td><%= c.getLastName() %></td>
> >>> <td><%= c.getAddress() %></td>
> >>> <td><a href="/DBTest/ListCustomerOrders?cust_id=<%=
> >>> c.getId() %>">Orders</a></td>
> >>> <% } %>
> >>>
> >>> </body>
> >>> </html>
> >>> --------------------------------------------
> >>>
> >>> If I execute a more specific url
> >>> (http://10.1.9.1:8080/DBTest/customers.jsp) from the web browser
> >>>
> >> (firefox),
> >>
> >>> it shows different errors:
> >>>
> >>> HTTP Status 500 -
> >>>
> >>> type Exception report
> >>>
> >>> message
> >>>
> >>> description The server encountered an internal error () that prevented
> >>>
> >> it
> >>
> >>> from fulfilling this request.
> >>>
> >>> exception
> >>>
> >>> org.apache.jasper.JasperException: Exception in JSP: /customers.jsp:11
> >>>
> >>> 8: </head>
> >>> 9: <body>
> >>> 10:
> >>> 11: <jsp:useBean id="customers"
> >>>
> >> type="java.util.ArrayList<domain.Customer>"
> >>
> >>> scope="request"/>
> >>> 12:
> >>> 13: <b>Registered Customers:</b><br>
> >>> 14: <table border="1">
> >>>
> >>>
> >>> Stacktrace:
> >>>
> >>>
> >>>
> >> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
> >>
> >>>
> >>>
> >>>
> >> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
> >>
> >>>
> >>>
> >>>
> >> 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)
> >>>
> >>> root cause
> >>>
> >>> javax.servlet.ServletException: bean customers not found within scope
> >>>
> >>>
> >>>
> >> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
> >>
> >>>
> >>>
> >>>
> >> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> >>
> >>> org.apache.jsp.customers_jsp._jspService(customers_jsp.java:97)
> >>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >>>
> >>>
> >>>
> >> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> >>
> >>>
> >>>
> >>>
> >> 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)
> >>>
> >>> root cause
> >>>
> >>> java.lang.InstantiationException: bean customers not found within scope
> >>> org.apache.jsp.customers_jsp._jspService(customers_jsp.java:55)
> >>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >>>
> >>>
> >>>
> >> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> >>
> >>>
> >>>
> >>>
> >> 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)
> >>>
> >>> note The full stack trace of the root cause is available in the Apache
> >>> Tomcat/5.5.26 logs.
> >>>
> >>>
> >>> I haven't create any *bean*, but servlet only.
> >>> How to get fix problem?
> >>>
> >>> Your help is much appreciated.
> >>>
> >>> Thanks
> >>> Sam
> >>>
> >>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
_________________________________________________________________
Be the filmmaker you always wanted to be—learn how to burn a DVD with Windows®.
http://clk.atdmt.com/MRT/go/108588797/direct/01/
Re: Why GlassFish
Posted by Peng Tuck Kwok <pe...@gmail.com>.
Meh, need to check tomcat more often :P
On Thu, Sep 4, 2008 at 4:52 PM, Leon Rosenberg <
rosenberg.leon@googlemail.com> wrote:
> On Thu, Sep 4, 2008 at 11:48 AM, Peng Tuck Kwok <pe...@gmail.com>
> wrote:
> > Johnny, you're having way too much fun :D .
> > Sam to answer your question, tomcat simply is the reference
> implementation
> > of servlet and jsp specification from Sun (and a damn fine one at that
> > too).
>
> No its not. Glassfish is the reference implementation of the servlet
> spec (since tomcat 5.0.25) :-)
>
> Leon
>
> Still, tomcat is the better implementation, simply because it doesn't
> have all the ejb stuff :-)
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Why GlassFish
Posted by Jack Woehr <ja...@well.com>.
Leon Rosenberg wrote:
> Still, tomcat is the better implementation, simply because it doesn't
> have all the ejb stuff :-)
>
I rise to agree with Leon. The reason I'm using Tomcat right now
(and pestering the list with build questions, thanks for the help) is that
it's simpler. I'm not /interested/ in application servers. I just /need/
one.
NetBeans supporting Tomcat closes the loop for me.
Thanks to the committers and architects for a manageable piece of open
source.
--
Jack J. Woehr # "Self-delusion is
http://www.well.com/~jax # half the battle!"
http://www.softwoehr.com # - Zippy the Pinhead
Re: Why GlassFish
Posted by Leon Rosenberg <ro...@googlemail.com>.
On Thu, Sep 4, 2008 at 11:48 AM, Peng Tuck Kwok <pe...@gmail.com> wrote:
> Johnny, you're having way too much fun :D .
> Sam to answer your question, tomcat simply is the reference implementation
> of servlet and jsp specification from Sun (and a damn fine one at that
> too).
No its not. Glassfish is the reference implementation of the servlet
spec (since tomcat 5.0.25) :-)
Leon
Still, tomcat is the better implementation, simply because it doesn't
have all the ejb stuff :-)
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Why GlassFish
Posted by Peng Tuck Kwok <pe...@gmail.com>.
Johnny, you're having way too much fun :D .
Sam to answer your question, tomcat simply is the reference implementation
of servlet and jsp specification from Sun (and a damn fine one at that
too).
Glassfish like other comparable app servers out there implement the JEE
specification (well whichever they are targeting) and as such they do much
more (as required by the spec).
Probably some confusion arises when you find that they can both do servlets
and jsp (web applications). This is because the app servers should provide
that feature.
So if you're looking to do ejb's a full blown app server would serve you
well. If you get by fine with just servlets+jsp+other frameworks thrown in
then tomcat is pretty suitable for you as well.
HIH
On Fri, Aug 29, 2008 at 3:32 AM, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
>
> --
> Ha ha... time to have some fun...
>
> They stole Tomcat... and messed it up ;)
>
> On a more serious not (if I can do it)... J2EE is a bit of a confusing
> definition... its got a wide scope.
> Within that... you have "servlet" containers... like Tomcat... aimed at the
> web but are actually capable of just about anything in a POJO designers
> hands.
> And then you get EJB.... what the hell does it do again... oh yes, it runs
> beans, and you have to join AA and find a good therapist ;)
>
> Tomcat can also do beans.... but they have rolled it up into what they call
> "biz logic", and tried to add many other tools, like for example they also
> plug RMI into it so you can call it from other Java applications, not just
> from a browser...
>
> They overlap alot... but they are different tools....
> In general... WEB == TOMCAT
>
> And its true that Tomcat is inside Glassfish somewhere... in fact if you
> drop a war into the fish... it will probably work... but not the other way
> around.
>
> Thats why some people in this group... with doubtful principles... say
> things like... something "fishy" going on, or I just like my "pussy" ;)
> ---------------------------------------------------------------------------
> HARBOR : http://www.kewlstuff.co.za/index.htm
> The most powerful application server on earth.
> The only real POJO Application Server.
> See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
> ---------------------------------------------------------------------------
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Can't execute servlet project
Posted by David Smith <dn...@cornell.edu>.
The only web.xml file you should be editing is in the WEB-INF folder of
your webapp -- DbTest in this case. Don't place it anywhere else and
don't mess with the web.xml file in tomcat's conf directory unless you
have an excellent reason to as those settings apply to _all_ webapps
under tomcat.
--David
sam wun wrote:
> BTW, where should I place the web.xml file in the tomcat server?
>
> The web (root) execution path of my tomcat server is:
>
> /tomcat/apache-tomcat-5.5.26/webapps/DBTest
>
>
>
> Thanks
>
> Sam
>
>
>> ----- Original Message -----
>> From: sam wun
>> Sent: 28/08/08 02:45 am
>> To: Tomcat Users List, Tomcat Users List
>> Subject: Re: Re: Can't execute servlet project
>>
>> 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
BTW, where should I place the web.xml file in the tomcat server?
The web (root) execution path of my tomcat server is:
/tomcat/apache-tomcat-5.5.26/webapps/DBTest
Thanks
Sam
> ----- Original Message -----
> From: sam wun
> Sent: 28/08/08 02:45 am
> To: Tomcat Users List, Tomcat Users List
> Subject: Re: Re: Can't execute servlet project
>
> 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: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
Re: Why GlassFish
Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
----- Original Message -----
From: "DIGLLOYD INC" <di...@diglloyd.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Friday, August 29, 2008 7:35 AM
Subject: Re: Why GlassFish
> Disclaimer: I am a Glassfish developer, working for Sun. So you can
> ignore whatever I say. :)
>
> I run Tomcat for my server (diglloyd.com), for specific reasons.
> Glassfish is a terrific product and so is Tomcat. Which is better
> depends on the goal, as with any product.
>
> Glassfish URL: https://glassfish.dev.java.net/
>
> Glassfish V2 has a number of differences with Tomcat, here are just a
> few:
>
> - it's a full Java EE compliant server (eg, servlet, ejb, etc)
> - it offers a fantastic web-based management interface, along with an
> extensive command-line interface
> - it offers an extensive MBean interface for management and monitoring
> - support for MySQL and Java DB built in
> - commercial support from Sun at a variety of levels
>
> It does indeed incorporate Tomcat, though there are some differences with
> Valves and configuration and deployment.
>
> Glassfish V3 moves to a powerful OSGi-based modular system. With V3,
> you'll essentially be able to pare a system down to any form you like,
> one that could run (for example), just Tomcat.
>
> Tomcat is a great technology. Glassfish is too, but has a much wider
> range of features. Sometimes simple is better, sometimes more features
> are better.
>
> Lloyd Chambers
> http://diglloyd.com
Yes... I was being somewhat flippant... what can I say, I'm a tomcat fan and
not too fond of EJB...
.... but Sam, if you trying to understand when you may use EJB... heres a
scenario for you...
You got a massive company... there are guys writing code for stock control,
book keeping, customer registers... yada yada.
Now within the company... say a bank... this code is being used by tellers,
and managers and suppliers and everyone...
So the big idea is that instead of writing the code a million times... its
written as modules and placed on a central EJB server..
Then when *any program* whether that be a servlet in tomcat, or a desktop
app, or a autoteller... say needs Mr X's balance..
They all ask the same bean... getMeTheBalanceOf(Mr X)... in the same
server...
This EJB box is sitting there with the IT people... and if they change the
"biz logic" centrally... it changes "everywhere"..
The idea is to keep the code tidy and in one place and its never
duplicated... even if you have 10 Tomcats running and 620 desktop apps...
Thats the idea of the EJB server...
It does get some competition because of other application technologies like
SOAP (Axis) that can also allow apps to work against TC...
So there is overlap... but its not uncommon for large co's with big budgets
to go the EJB way...
Learning EJB is a much steeper learning curve than little old tomcat... and
it tends to need a maintenance contract between
the big co and the EJB vendor...
There are many EJB servers out there...
Glassfish
Jboss
Spring... actually no I think they just dumped the EJB spec in favor of OSGI
Geronimo
openejb... I think that is a plugin for tomcat..
Resin... has an EJB module...
There is only one Pojo Application Server
Its like EJB, just more powerful and runs normal Java code... it runs on
Tomcat
and there are probably many more out there that I'm forgetting
WebSphere
etc...
Thats the idea behind EJB... writing the code once and having it centrally
administered...
And heres the really interesting thing... they all use Tomcat ;)
---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Why GlassFish
Posted by Martin Gainty <mg...@hotmail.com>.
In the present TC implementation i've seen integration of modules into axis
an intelligent and articulate response
without necessarily going line item by line item is/are there specific JSRs or modularity the developer
can benefit from
?
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.
> From: diglloyd1@diglloyd.com
> To: users@tomcat.apache.org
> Subject: Re: Why GlassFish
> Date: Thu, 28 Aug 2008 22:35:44 -0700
>
> Disclaimer: I am a Glassfish developer, working for Sun. So you can
> ignore whatever I say. :)
>
> I run Tomcat for my server (diglloyd.com), for specific reasons.
> Glassfish is a terrific product and so is Tomcat. Which is better
> depends on the goal, as with any product.
>
> Glassfish URL: https://glassfish.dev.java.net/
>
> Glassfish V2 has a number of differences with Tomcat, here are just a
> few:
>
> - it's a full Java EE compliant server (eg, servlet, ejb, etc)
> - it offers a fantastic web-based management interface, along with an
> extensive command-line interface
> - it offers an extensive MBean interface for management and monitoring
> - support for MySQL and Java DB built in
> - commercial support from Sun at a variety of levels
>
> It does indeed incorporate Tomcat, though there are some differences
> with Valves and configuration and deployment.
>
> Glassfish V3 moves to a powerful OSGi-based modular system. With V3,
> you'll essentially be able to pare a system down to any form you like,
> one that could run (for example), just Tomcat.
>
> Tomcat is a great technology. Glassfish is too, but has a much wider
> range of features. Sometimes simple is better, sometimes more features
> are better.
>
> Lloyd Chambers
> http://diglloyd.com
>
> [Mac OS X 10.5.2 Intel, Tomcat 6.0.16]
>
>
> On Aug 28, 2008, at 6:31 AM, sam wun wrote:
>
> > Hi,
> >
> >
> >
> > Just a quick question, I found that Tomcat is quite capable with
> > servlet
> > application, but lack of EJB support.
> >
> > Is GlassFish designed to fill the gaps to support EJB application
> > only?
> >
> >
> >
> > Thanks
> >
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
_________________________________________________________________
Be the filmmaker you always wanted to be—learn how to burn a DVD with Windows®.
http://clk.atdmt.com/MRT/go/108588797/direct/01/
Re: Why GlassFish
Posted by DIGLLOYD INC <di...@diglloyd.com>.
Disclaimer: I am a Glassfish developer, working for Sun. So you can
ignore whatever I say. :)
I run Tomcat for my server (diglloyd.com), for specific reasons.
Glassfish is a terrific product and so is Tomcat. Which is better
depends on the goal, as with any product.
Glassfish URL: https://glassfish.dev.java.net/
Glassfish V2 has a number of differences with Tomcat, here are just a
few:
- it's a full Java EE compliant server (eg, servlet, ejb, etc)
- it offers a fantastic web-based management interface, along with an
extensive command-line interface
- it offers an extensive MBean interface for management and monitoring
- support for MySQL and Java DB built in
- commercial support from Sun at a variety of levels
It does indeed incorporate Tomcat, though there are some differences
with Valves and configuration and deployment.
Glassfish V3 moves to a powerful OSGi-based modular system. With V3,
you'll essentially be able to pare a system down to any form you like,
one that could run (for example), just Tomcat.
Tomcat is a great technology. Glassfish is too, but has a much wider
range of features. Sometimes simple is better, sometimes more features
are better.
Lloyd Chambers
http://diglloyd.com
[Mac OS X 10.5.2 Intel, Tomcat 6.0.16]
On Aug 28, 2008, at 6:31 AM, sam wun wrote:
> Hi,
>
>
>
> Just a quick question, I found that Tomcat is quite capable with
> servlet
> application, but lack of EJB support.
>
> Is GlassFish designed to fill the gaps to support EJB application
> only?
>
>
>
> Thanks
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Why GlassFish
Posted by Robert Koberg <ro...@koberg.com>.
On Aug 28, 2008, at 9:31 AM, sam wun wrote:
> Hi,
>
>
>
> Just a quick question, I found that Tomcat is quite capable with
> servlet
> application, but lack of EJB support.
>
> Is GlassFish designed to fill the gaps to support EJB application
> only?
As Pythagoras said, just say no to beans.
>
>
>
>
> Thanks
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Why GlassFish
Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
----- Original Message -----
From: "sam wun" <sw...@gmx.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Thursday, August 28, 2008 3:31 PM
Subject: Why GlassFish
> Hi,
>
>
>
> Just a quick question, I found that Tomcat is quite capable with servlet
> application, but lack of EJB support.
>
> Is GlassFish designed to fill the gaps to support EJB application only?
Ha ha... time to have some fun...
They stole Tomcat... and messed it up ;)
On a more serious not (if I can do it)... J2EE is a bit of a confusing
definition... its got a wide scope.
Within that... you have "servlet" containers... like Tomcat... aimed at the
web but are actually capable of just about anything in a POJO designers
hands.
And then you get EJB.... what the hell does it do again... oh yes, it runs
beans, and you have to join AA and find a good therapist ;)
Tomcat can also do beans.... but they have rolled it up into what they call
"biz logic", and tried to add many other tools, like for example they also
plug RMI into it so you can call it from other Java applications, not just
from a browser...
They overlap alot... but they are different tools....
In general... WEB == TOMCAT
And its true that Tomcat is inside Glassfish somewhere... in fact if you
drop a war into the fish... it will probably work... but not the other way
around.
Thats why some people in this group... with doubtful principles... say
things like... something "fishy" going on, or I just like my "pussy" ;)
---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Why GlassFish
Posted by sam wun <sw...@gmx.com>.
Hi,
Just a quick question, I found that Tomcat is quite capable with servlet
application, but lack of EJB support.
Is GlassFish designed to fill the gaps to support EJB application only?
Thanks
Re: Can't execute servlet project
Posted by David Smith <dn...@cornell.edu>.
The docs should have been clear the context.xml to modify would exist in
one of a couple of places:
- context.xml file in DbTest/META-INF
- DbTest.xml in $CATALINA_HOME/conf/Catalina/localhost
Also username/password for the db connection should *NOT* be the
root/admin user/password for your database. That's just a huge, crazy
security hole waiting to be exploited. Create a new user in MySQL with
privileges on the javatest database and use that in the Resource
username and password attributes.
You can do this easily using the MySQL command line tool (and the root
MySQL account):
grant all on javatest.* to 'mywebappuser'@'localhost' identified by
'mywebapppassword' ;
This creates a user named 'mywebappuser' with full privileges on the
javatest tables. Because I added @'localhost' in the command, the user
account is only valid when the user log's in from the same machine MySQL
is running on. That helps protect the db server.
Then the Resource element becomes:
<Resource name="jdbc/TestDB" auth="Container"
type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="mywebappuser" password="mywebapppassword"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/javatest"
validationQuery="select 1"/>
Note I also dropped ?autoReconnect=true from the url (bad idea to leave
that in, I should submit a patch to the tomcat docs at some point),
replacing it with a new attribute: validationQuery="select 1"
--David
sam wun wrote:
> HI there,
>
>
>
> According to the tomcat online document, do I have to modify the
> context.xml file?
>
> $CATALINA_HOME/conf/context.xml
>
>
>
> with the following new setup: <Resource name="jdbc/TestDB" auth="Container"
> type="javax.sql.DataSource"
> maxActive="100" maxIdle="30" maxWait="10000"
> username="javauser" password="javadude"
> driverClassName="com.mysql.jdbc.Driver"
>
> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
>
>
>
> where username/password is the root/admin user/password of the mysql
> database?
>
>
>
> 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
>>
>>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Can't execute servlet project
Posted by Pid <p...@pidster.com>.
sam wun wrote:
> HI there,
>
> According to the tomcat online document, do I have to modify the
> context.xml file?
>
> $CATALINA_HOME/conf/context.xml
Not that one, that one affects *all* deployed contexts.
Add a context.xml file to your webapp, in the META-INF folder.
DBTest/index.jsp
DBTest/META-INF/context.xml
DBTest/WEB-INF/web.xml
p
> with the following new setup: <Resource name="jdbc/TestDB" auth="Container"
> type="javax.sql.DataSource"
> maxActive="100" maxIdle="30" maxWait="10000"
> username="javauser" password="javadude"
> driverClassName="com.mysql.jdbc.Driver"
>
> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
>
>
>
> where username/password is the root/admin user/password of the mysql
> database?
>
>
>
> 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: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>>>
>>
>> --
>> 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: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Can't execute servlet project
Posted by David Smith <dn...@cornell.edu>.
The jndi resource howto page link I posted should have mentioned the
.jar file get's placed in tomcat's common/lib.
--David
sam wun wrote:
> Hi,
>
>
>
> I couldn't find an installation document about installing the driver.
>
> I;ve downloaded the driver:
>
> linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls
> mysql-connector-java-5.1.3-rc-bin.jar
> mysql-connector-java-5.1.3-rc-bin.jar
>
>
>
> Do you know how to configure tomcat to make use of it?
>
>
>
> Thanks
>
> Sam
>
>
>
>
>> ----- Original Message -----
>> From: Pid
>> Sent: 28/08/08 06:47 pm
>> To: Tomcat Users List
>> Subject: Re: Can't execute servlet project
>>
>> sam wun wrote:
>>
>>> Do I need to put mysql driver in the common/lib/ directory in linux?
>>>
>> Yes, that's a basic requirement.
>>
>>
>>> If I need to have that, where can I download it?
>>>
>> The MySQL site - you could probably have guessed that.
>>
>> http://dev.mysql.com/usingmysql/java/
>>
>>
>>
>>> Thanks
>>>
>>>
>>>
>>>
>>>> ----- Original Message -----
>>>> From: sam wun
>>>> Sent: 28/08/08 04:44 pm
>>>> To: Tomcat Users List
>>>> Subject: Re: Re: Can't execute servlet project
>>>>
>>>> HI there,
>>>>
>>>>
>>>>
>>>> According to the tomcat online document, do I have to modify the
>>>> context.xml file?
>>>>
>>>> $CATALINA_HOME/conf/context.xml
>>>>
>>>>
>>>>
>>>> with the following new setup: <Resource name="jdbc/TestDB"
>>>> auth="Container"
>>>> type="javax.sql.DataSource"
>>>> maxActive="100" maxIdle="30" maxWait="10000"
>>>> username="javauser" password="javadude"
>>>> driverClassName="com.mysql.jdbc.Driver"
>>>>
>>>> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
>>>>
>>>>
>>>>
>>>> where username/password is the root/admin user/password of the mysql
>>>> database?
>>>>
>>>>
>>>>
>>>> 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
>>>>>
>>>>>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
The URL I put in the firefox browser is:
10.1.9.1:8080/DBtest/testdb.jsp
Here is the /tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/web.xml
file:
<?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>
Create customer servlet</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>
> ----- Original Message -----
> From: sam wun
> Sent: 03/09/08 01:41 am
> To: Tomcat Users List
> Subject: Re: Re: Can't execute servlet project
>
> Thanks David,
>
>
>
> After copied the jstl and standard dot jar files into the directory:
>
> linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/lib # ls
> . .. jstl.jar mysql-connector-java-5.1.3-rc-bin.jar standard.jar
>
>
>
> I got the following different errors:
>
> (In line 4, what is jdbc/TestDB? I have database called javatest, and
> table
> testdata. Should I rename it to jdbc/javatest?
>
>
>
>
>
> HTTP Status 500 -
>
> type Exception report
>
> message
>
> description The server encountered an internal error () that prevented it
> from fulfilling this request.
>
> exception org.apache.jasper.JasperException: Exception in JSP:
> /testdb.jsp:4
>
> 1: <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> 2: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> 3:
> 4: <sql:query var="rs" dataSource="jdbc/TestDB">
> 5: select id, foo, bar from testdata
> 6: </sql:query>
> 7:
>
>
> Stacktrace:
>
>
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
>
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
> 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)
>
> root cause javax.servlet.ServletException: Unable to get connection,
> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> Cannot
> create JDBC driver of class '' for connect URL 'null'"
>
>
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
>
>
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> 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)
>
> root cause javax.servlet.jsp.JspException: Unable to get connection,
> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> Cannot
> create JDBC driver of class '' for connect URL 'null'"
>
>
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
>
>
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
>
>
> org.apache.jsp.testdb_jsp._jspx_meth_sql_005fquery_005f0(testdb_jsp.java:101)
> org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:58)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> 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)
>
>
>
>
>
> > ----- Original Message -----
> > From: David Smith
> > Sent: 03/09/08 01:23 am
> > To: Tomcat Users List
> > Subject: Re: Can't execute servlet project
> >
> > Download the binary zip file and expand it. Within it is a lib
> > directory with just standard.jar and jstl.jar.
> >
> > --David
> >
> > sam wun wrote:
> > > I just went to the website , very confused.
> > >
> > > The taglib file is not a jar file. they are binary or source file.
> > >
> > > And I couldn't find standard.jar file either.
> > >
> > >
> > >
> > > Thanks
> > >
> > >
> > >
> > >
> > >> ----- Original Message -----
> > >> From: David Smith
> > >> Sent: 02/09/08 11:44 pm
> > >> To: Tomcat Users List
> > >> Subject: Re: Can't execute servlet project
> > >>
> > >> Hmmm... good question. I moved over to Maven and don't manually
> > >> download these any more. This looks like it should do the trick:
> > >>
> > >> Try
> > >>
> > http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi
> > >>
> > >> --David
> > >>
> > >> sam wun wrote:
> > >>
> > >>> Hi David,
> > >>>
> > >>>
> > >>>
> > >>> No, I don't have this 2 jar files in the common/lib/ directory.
> > >>>
> > >>> where can I download it from?
> > >>>
> > >>>
> > >>>
> > >>> Thanks
> > >>>
> > >>> Sam
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>> ----- Original Message -----
> > >>>> From: David Smith
> > >>>> Sent: 02/09/08 10:39 pm
> > >>>> To: Tomcat Users List
> > >>>> Subject: Re: Can't execute servlet project
> > >>>>
> > >>>> Do you have jstl.jar and standard.jar in your WEB-INF/lib
> directory?
> > >>>>
> > >>>> --David
> > >>>>
> > >>>> sam wun wrote:
> > >>>>
> > >>>>
> > >>>>> Hi,
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> I have added testdb.jsp in the following path in Suse linux (the
> > >>>>>
> > >> tomcat
> > >>
> > >>>>> server):
> > >>>>>
> > >>>>> /tomcat/apache-tomcat-5.5.26/webapps/DBTest/
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> The content of the testdb.jsp code is:
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> > >>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> > >>>>>
> > >>>>> <sql:query var="rs" dataSource="jdbc/TestDB">
> > >>>>> select FIRST_NAME from DBTest.Customer
> > >>>>> </sql:query>
> > >>>>>
> > >>>>> <html>
> > >>>>> <head>
> > >>>>> <title>DB Test</title>
> > >>>>> </head>
> > >>>>> <body>
> > >>>>>
> > >>>>> <h2>Results</h2>
> > >>>>>
> > >>>>> <c:forEach var="row" items="${rs.rows}">
> > >>>>> Foo ${row.foo}<br/>
> > >>>>> Bar ${row.bar}<br/>
> > >>>>> </c:forEach>
> > >>>>>
> > >>>>> </body>
> > >>>>> </html>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> when I execute url 10.1.9.1:8080/testdb.jsp in firefox web
> browser,
> > >>>>>
> > >> it
> > >>
> > >>>>> shown the following error:
> > >>>>>
> > >>>>> HTTP Status 500 -
> > >>>>>
> > >>>>> 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)
> > >>>>>
> > >>>>> Here is the web.xml file I got:
> > >>>>>
> > >>>>> (in the path
> /tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/)
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> <?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>
> > >>>>> Create customer servlet</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>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> Thanks
> > >>>>>
> > >>>>> Sam
> > >>>>>
> > >>>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>> ----- Original Message -----
> > >>>>>> From: Martin Gainty
> > >>>>>> Sent: 28/08/08 10:07 pm
> > >>>>>> To: sw2018@gmx.com
> > >>>>>> Subject: RE: Can't execute servlet project
> > >>>>>>
> > >>>>>> david's advice is correct..
> > >>>>>>
> > >>>>>> configure ./META-INF/ApplicationContext.xml
> > >>>>>> <Context path="/DBTest" docBase="DBTest"
> > >>>>>> debug="5" reloadable="true" crossContext="true">
> > >>>>>>
> > >>>>>> <!-- maxActive: Maximum number of dB connections in pool.
> Make
> > >>>>>>
> > >>>>>>
> > >>>> sure
> > >>>>
> > >>>>
> > >>>>>> you
> > >>>>>> configure your mysqld max_connections large enough to
> > >>>>>>
> > >> handle
> > >>
> > >>>>>> all of your db connections. Set to 0 for no limit.
> > >>>>>> -->
> > >>>>>>
> > >>>>>> <!-- maxIdle: Maximum number of idle dB connections to
> retain
> > in
> > >>>>>> pool.
> > >>>>>> Set to -1 for no limit. See also the DBCP
> documentation
> > on
> > >>>>>>
> > >>>>>>
> > >>>> this
> > >>>>
> > >>>>
> > >>>>>> and the minEvictableIdleTimeMillis configuration
> > parameter.
> > >>>>>> -->
> > >>>>>>
> > >>>>>> <!-- maxWait: Maximum time to wait for a dB connection to
> > become
> > >>>>>> available
> > >>>>>> in ms, in this example 10 seconds. An Exception is
> thrown
> > >>>>>>
> > >> if
> > >>
> > >>>>>> this timeout is exceeded. Set to -1 to wait
> > indefinitely.
> > >>>>>> -->
> > >>>>>>
> > >>>>>> <!-- username and password: MySQL dB username and password
> for
> > >>>>>>
> > >> dB
> > >>
> > >>>>>> connections -->
> > >>>>>>
> > >>>>>> <!-- driverClassName: Class name for the old mm.mysql JDBC
> > >>>>>>
> > >> driver
> > >>
> > >>>>>>
> > >>>>>>
> > >>>> is
> > >>>>
> > >>>>
> > >>>>>> org.gjt.mm.mysql.Driver - we recommend using
> Connector/J
> > >>>>>>
> > >>>>>>
> > >>>> though.
> > >>>>
> > >>>>
> > >>>>>> Class name for the official MySQL Connector/J driver is
> > >>>>>> com.mysql.jdbc.Driver.
> > >>>>>> -->
> > >>>>>>
> > >>>>>> <!-- url: The JDBC connection url for connecting to your
> MySQL
> > >>>>>>
> > >> dB.
> > >>
> > >>>>>> The autoReconnect=true argument to the url makes sure
> > that
> > >>>>>>
> > >>>>>>
> > >>>> the
> > >>>>
> > >>>>
> > >>>>>> mm.mysql JDBC Driver will automatically reconnect if
> > mysqld
> > >>>>>> closed the
> > >>>>>> connection. mysqld by default closes idle connections
> > >>>>>>
> > >> after
> > >>
> > >>>>>>
> > >>>>>>
> > >>>> 8
> > >>>>
> > >>>>
> > >>>>>> hours.
> > >>>>>> -->
> > >>>>>>
> > >>>>>> <Resource name="jdbc/TestDB" auth="Container"
> > >>>>>> type="javax.sql.DataSource"
> > >>>>>> maxActive="100" maxIdle="30" maxWait="10000"
> > >>>>>> username="javauser" password="javadude"
> > >>>>>> driverClassName="com.mysql.jdbc.Driver"
> > >>>>>>
> > >>>>>> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
> > >>>>>>
> > >>>>>> </Context>
> > >>>>>> //sub in the username and password for the DB
> > >>>>>> also in /WEB-INF/web.xml you would need this entry
> > >>>>>> <web-app 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"
> > >>>>>> version="2.4">
> > >>>>>> <description>MySQL Test App</description>
> > >>>>>> <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>
> > >>>>>> then put in this test code changing :
> > >>>>>> DBNAME to the name of your Database
> > >>>>>> TABLE to the name of the table in DBNAME you want to query
> > >>>>>> COLUMN for the specific attribute to query
> > >>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"
> %>
> > >>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> > >>>>>>
> > >>>>>> <sql:query var="rs" dataSource="jdbc/TestDB">
> > >>>>>> select COLUMN from DBNAME.TABLE
> > >>>>>> </sql:query>
> > >>>>>>
> > >>>>>> <html>
> > >>>>>> <head>
> > >>>>>> <title>DB Test</title>
> > >>>>>> </head>
> > >>>>>> <body>
> > >>>>>>
> > >>>>>> <h2>Results</h2>
> > >>>>>>
> > >>>>>> <c:forEach var="row" items="${rs.rows}">
> > >>>>>> Foo ${row.foo}<br/>
> > >>>>>> Bar ${row.bar}<br/>
> > >>>>>> </c:forEach>
> > >>>>>>
> > >>>>>> </body>
> > >>>>>> </html>
> > >>>>>>
> > >>>>>> if you need UNICODE support or Character Large Object (strings >
> > 64k
> > >>>>>>
> > >>>>>>
> > >>>> in
> > >>>>
> > >>>>
> > >>>>>> length) download JDBC 4 driver
> > >>>>>> http://dev.mysql.com/downloads/connector/j/5.1.html
> > >>>>>>
> > >>>>>> personally I am using the 'older' version of MYSQL so I use the
> > 3.1
> > >>>>>>
> > >>>>>>
> > >>>> jar
> > >>>>
> > >>>>
> > >>>>>> which you can acquire here
> > >>>>>> http://dev.mysql.com/downloads/connector/j
> > >>>>>>
> > >>>>>> location of driver classes:
> > >>>>>>
> > >>>>>> is located in $TOMCAT_HOME/common/lib
> > >>>>>> personally I dont like putting anything in common since it will
> > >>>>>>
> > >> affect
> > >>
> > >>>>>> all webapps but i usually
> > >>>>>> place in /WEB-INF/lib
> > >>>>>>
> > >>>>>> and please follow david's advice and read the tutorial
> > >>>>>>
> > >>>>>> Martin
> > >>>>>> ______________________________________________
> > >>>>>> Disclaimer and confidentiality note
> > >>>>>> Everything in this e-mail and any attachments relates to the
> > >>>>>>
> > >> official
> > >>
> > >>>>>> business of Sender. This transmission is of a confidential
> nature
> > >>>>>>
> > >> and
> > >>
> > >>>>>> Sender does not endorse distribution to any party other than
> > >>>>>>
> > >> intended
> > >>
> > >>>>>> recipient. Sender does not necessarily endorse content contained
> > >>>>>>
> > >>>>>>
> > >>>> within
> > >>>>
> > >>>>
> > >>>>>> this transmission.
> > >>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>>> Date: Thu, 28 Aug 2008 11:02:52 +0200
> > >>>>>>> From: sw2018@gmx.com
> > >>>>>>> Subject: Re: Re: Can't execute servlet project
> > >>>>>>> To: users@tomcat.apache.org; users@tomcat.apache.org
> > >>>>>>>
> > >>>>>>> Hi,
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>> I couldn't find an installation document about installing the
> > >>>>>>>
> > >> driver.
> > >>
> > >>>>>>> I;ve downloaded the driver:
> > >>>>>>>
> > >>>>>>> linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls
> > >>>>>>> mysql-connector-java-5.1.3-rc-bin.jar
> > >>>>>>> mysql-connector-java-5.1.3-rc-bin.jar
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>> Do you know how to configure tomcat to make use of it?
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>> Thanks
> > >>>>>>>
> > >>>>>>> Sam
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>
> ---------------------------------------------------------------------
> > >> To start a new topic, e-mail: users@tomcat.apache.org
> > >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > >> For additional commands, e-mail: users-help@tomcat.apache.org
> > >>
> > >>
> > >
> > >
> >
> >
> > --
> > 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: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
This is the only context.xml file I got in the tomcat (5.5.26) directory:
/tomcat/apache-tomcat-5.5.26/conf/context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat
restarts -->
<!--
<Manager pathname="" />
-->
</Context>
> ----- Original Message -----
> From: David Smith
> Sent: 03/09/08 01:49 am
> To: Tomcat Users List
> Subject: Re: Can't execute servlet project
>
> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> Cannot create JDBC driver of class '' for connect URL 'null'"
>
> This error typically indicates the JNDI db pool hasn't been setup
> correctly. Some config option isn't setup. What's in this webapp's
> context xml file? Also what's in it's WEB-INF/web.xml? Lastly, you
> should have your database driver jar file in tomcat's common/lib (for
> tomcat v 5.5) or /lib (tomcat v 6).
>
> You can also take a look at tomcat's JDBC Datasource howto's on the
> tomcat website for your version of tomcat which offer a lot of help.
>
> --David
>
> sam wun wrote:
> > Thanks David,
> >
> >
> >
> > After copied the jstl and standard dot jar files into the directory:
> >
> > linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/lib # ls
> > . .. jstl.jar mysql-connector-java-5.1.3-rc-bin.jar standard.jar
> >
> >
> >
> > I got the following different errors:
> >
> > (In line 4, what is jdbc/TestDB? I have database called javatest, and
> table
> > testdata. Should I rename it to jdbc/javatest?
> >
> >
> >
> >
> >
> > HTTP Status 500 -
> >
> > type Exception report
> >
> > message
> >
> > description The server encountered an internal error () that prevented
> it
> > from fulfilling this request.
> >
> > exception org.apache.jasper.JasperException: Exception in JSP:
> > /testdb.jsp:4
> >
> > 1: <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> > 2: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> > 3:
> > 4: <sql:query var="rs" dataSource="jdbc/TestDB">
> > 5: select id, foo, bar from testdata
> > 6: </sql:query>
> > 7:
> >
> >
> > Stacktrace:
> >
> >
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
> >
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
> >
> 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)
> >
> > root cause javax.servlet.ServletException: Unable to get connection,
> > DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> Cannot
> > create JDBC driver of class '' for connect URL 'null'"
> >
> >
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
> >
> >
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> > org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> >
> 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)
> >
> > root cause javax.servlet.jsp.JspException: Unable to get connection,
> > DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> Cannot
> > create JDBC driver of class '' for connect URL 'null'"
> >
> >
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
> >
> >
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
> >
> >
> org.apache.jsp.testdb_jsp._jspx_meth_sql_005fquery_005f0(testdb_jsp.java:101)
> > org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:58)
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> >
> 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)
> >
> >
> >
> >
> >
> >
> >> ----- Original Message -----
> >> From: David Smith
> >> Sent: 03/09/08 01:23 am
> >> To: Tomcat Users List
> >> Subject: Re: Can't execute servlet project
> >>
> >> Download the binary zip file and expand it. Within it is a lib
> >> directory with just standard.jar and jstl.jar.
> >>
> >> --David
> >>
> >> sam wun wrote:
> >>
> >>> I just went to the website , very confused.
> >>>
> >>> The taglib file is not a jar file. they are binary or source file.
> >>>
> >>> And I couldn't find standard.jar file either.
> >>>
> >>>
> >>>
> >>> Thanks
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>> ----- Original Message -----
> >>>> From: David Smith
> >>>> Sent: 02/09/08 11:44 pm
> >>>> To: Tomcat Users List
> >>>> Subject: Re: Can't execute servlet project
> >>>>
> >>>> Hmmm... good question. I moved over to Maven and don't manually
> >>>> download these any more. This looks like it should do the trick:
> >>>>
> >>>> Try
> >>>>
> >>>>
> >>
> http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi
> >>
> >>>> --David
> >>>>
> >>>> sam wun wrote:
> >>>>
> >>>>
> >>>>> Hi David,
> >>>>>
> >>>>>
> >>>>>
> >>>>> No, I don't have this 2 jar files in the common/lib/ directory.
> >>>>>
> >>>>> where can I download it from?
> >>>>>
> >>>>>
> >>>>>
> >>>>> Thanks
> >>>>>
> >>>>> Sam
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>> ----- Original Message -----
> >>>>>> From: David Smith
> >>>>>> Sent: 02/09/08 10:39 pm
> >>>>>> To: Tomcat Users List
> >>>>>> Subject: Re: Can't execute servlet project
> >>>>>>
> >>>>>> Do you have jstl.jar and standard.jar in your WEB-INF/lib
> directory?
> >>>>>>
> >>>>>> --David
> >>>>>>
> >>>>>> sam wun wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> I have added testdb.jsp in the following path in Suse linux (the
> >>>>>>>
> >>>>>>>
> >>>> tomcat
> >>>>
> >>>>
> >>>>>>> server):
> >>>>>>>
> >>>>>>> /tomcat/apache-tomcat-5.5.26/webapps/DBTest/
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> The content of the testdb.jsp code is:
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> >>>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> >>>>>>>
> >>>>>>> <sql:query var="rs" dataSource="jdbc/TestDB">
> >>>>>>> select FIRST_NAME from DBTest.Customer
> >>>>>>> </sql:query>
> >>>>>>>
> >>>>>>> <html>
> >>>>>>> <head>
> >>>>>>> <title>DB Test</title>
> >>>>>>> </head>
> >>>>>>> <body>
> >>>>>>>
> >>>>>>> <h2>Results</h2>
> >>>>>>>
> >>>>>>> <c:forEach var="row" items="${rs.rows}">
> >>>>>>> Foo ${row.foo}<br/>
> >>>>>>> Bar ${row.bar}<br/>
> >>>>>>> </c:forEach>
> >>>>>>>
> >>>>>>> </body>
> >>>>>>> </html>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> when I execute url 10.1.9.1:8080/testdb.jsp in firefox web
> browser,
> >>>>>>>
> >>>>>>>
> >>>> it
> >>>>
> >>>>
> >>>>>>> shown the following error:
> >>>>>>>
> >>>>>>> HTTP Status 500 -
> >>>>>>>
> >>>>>>> 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)
> >>>>>>>
> >>>>>>> Here is the web.xml file I got:
> >>>>>>>
> >>>>>>> (in the path
> /tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/)
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> <?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>
> >>>>>>> Create customer servlet</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>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> Thanks
> >>>>>>>
> >>>>>>> Sam
> >>>>>>>
> >>>>>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>> ----- Original Message -----
> >>>>>>>> From: Martin Gainty
> >>>>>>>> Sent: 28/08/08 10:07 pm
> >>>>>>>> To: sw2018@gmx.com
> >>>>>>>> Subject: RE: Can't execute servlet project
> >>>>>>>>
> >>>>>>>> david's advice is correct..
> >>>>>>>>
> >>>>>>>> configure ./META-INF/ApplicationContext.xml
> >>>>>>>> <Context path="/DBTest" docBase="DBTest"
> >>>>>>>> debug="5" reloadable="true" crossContext="true">
> >>>>>>>>
> >>>>>>>> <!-- maxActive: Maximum number of dB connections in pool.
> Make
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> sure
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> you
> >>>>>>>> configure your mysqld max_connections large enough to
> >>>>>>>>
> >>>>>>>>
> >>>> handle
> >>>>
> >>>>
> >>>>>>>> all of your db connections. Set to 0 for no limit.
> >>>>>>>> -->
> >>>>>>>>
> >>>>>>>> <!-- maxIdle: Maximum number of idle dB connections to
> retain
> >>>>>>>>
> >> in
> >>
> >>>>>>>> pool.
> >>>>>>>> Set to -1 for no limit. See also the DBCP
> documentation
> >>>>>>>>
> >> on
> >>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> this
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> and the minEvictableIdleTimeMillis configuration
> >>>>>>>>
> >> parameter.
> >>
> >>>>>>>> -->
> >>>>>>>>
> >>>>>>>> <!-- maxWait: Maximum time to wait for a dB connection to
> >>>>>>>>
> >> become
> >>
> >>>>>>>> available
> >>>>>>>> in ms, in this example 10 seconds. An Exception is
> thrown
> >>>>>>>>
> >>>>>>>>
> >>>> if
> >>>>
> >>>>
> >>>>>>>> this timeout is exceeded. Set to -1 to wait
> >>>>>>>>
> >> indefinitely.
> >>
> >>>>>>>> -->
> >>>>>>>>
> >>>>>>>> <!-- username and password: MySQL dB username and password
> for
> >>>>>>>>
> >>>>>>>>
> >>>> dB
> >>>>
> >>>>
> >>>>>>>> connections -->
> >>>>>>>>
> >>>>>>>> <!-- driverClassName: Class name for the old mm.mysql JDBC
> >>>>>>>>
> >>>>>>>>
> >>>> driver
> >>>>
> >>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> is
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> org.gjt.mm.mysql.Driver - we recommend using
> Connector/J
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> though.
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> Class name for the official MySQL Connector/J driver is
> >>>>>>>> com.mysql.jdbc.Driver.
> >>>>>>>> -->
> >>>>>>>>
> >>>>>>>> <!-- url: The JDBC connection url for connecting to your
> MySQL
> >>>>>>>>
> >>>>>>>>
> >>>> dB.
> >>>>
> >>>>
> >>>>>>>> The autoReconnect=true argument to the url makes sure
> >>>>>>>>
> >> that
> >>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> the
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> mm.mysql JDBC Driver will automatically reconnect if
> >>>>>>>>
> >> mysqld
> >>
> >>>>>>>> closed the
> >>>>>>>> connection. mysqld by default closes idle connections
> >>>>>>>>
> >>>>>>>>
> >>>> after
> >>>>
> >>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> 8
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> hours.
> >>>>>>>> -->
> >>>>>>>>
> >>>>>>>> <Resource name="jdbc/TestDB" auth="Container"
> >>>>>>>> type="javax.sql.DataSource"
> >>>>>>>> maxActive="100" maxIdle="30" maxWait="10000"
> >>>>>>>> username="javauser" password="javadude"
> >>>>>>>> driverClassName="com.mysql.jdbc.Driver"
> >>>>>>>>
> >>>>>>>> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
> >>>>>>>>
> >>>>>>>> </Context>
> >>>>>>>> //sub in the username and password for the DB
> >>>>>>>> also in /WEB-INF/web.xml you would need this entry
> >>>>>>>> <web-app 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"
> >>>>>>>> version="2.4">
> >>>>>>>> <description>MySQL Test App</description>
> >>>>>>>> <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>
> >>>>>>>> then put in this test code changing :
> >>>>>>>> DBNAME to the name of your Database
> >>>>>>>> TABLE to the name of the table in DBNAME you want to query
> >>>>>>>> COLUMN for the specific attribute to query
> >>>>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"
> %>
> >>>>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> >>>>>>>>
> >>>>>>>> <sql:query var="rs" dataSource="jdbc/TestDB">
> >>>>>>>> select COLUMN from DBNAME.TABLE
> >>>>>>>> </sql:query>
> >>>>>>>>
> >>>>>>>> <html>
> >>>>>>>> <head>
> >>>>>>>> <title>DB Test</title>
> >>>>>>>> </head>
> >>>>>>>> <body>
> >>>>>>>>
> >>>>>>>> <h2>Results</h2>
> >>>>>>>>
> >>>>>>>> <c:forEach var="row" items="${rs.rows}">
> >>>>>>>> Foo ${row.foo}<br/>
> >>>>>>>> Bar ${row.bar}<br/>
> >>>>>>>> </c:forEach>
> >>>>>>>>
> >>>>>>>> </body>
> >>>>>>>> </html>
> >>>>>>>>
> >>>>>>>> if you need UNICODE support or Character Large Object (strings >
> >>>>>>>>
> >> 64k
> >>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> in
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> length) download JDBC 4 driver
> >>>>>>>> http://dev.mysql.com/downloads/connector/j/5.1.html
> >>>>>>>>
> >>>>>>>> personally I am using the 'older' version of MYSQL so I use the
> >>>>>>>>
> >> 3.1
> >>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> jar
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> which you can acquire here
> >>>>>>>> http://dev.mysql.com/downloads/connector/j
> >>>>>>>>
> >>>>>>>> location of driver classes:
> >>>>>>>>
> >>>>>>>> is located in $TOMCAT_HOME/common/lib
> >>>>>>>> personally I dont like putting anything in common since it will
> >>>>>>>>
> >>>>>>>>
> >>>> affect
> >>>>
> >>>>
> >>>>>>>> all webapps but i usually
> >>>>>>>> place in /WEB-INF/lib
> >>>>>>>>
> >>>>>>>> and please follow david's advice and read the tutorial
> >>>>>>>>
> >>>>>>>> Martin
> >>>>>>>> ______________________________________________
> >>>>>>>> Disclaimer and confidentiality note
> >>>>>>>> Everything in this e-mail and any attachments relates to the
> >>>>>>>>
> >>>>>>>>
> >>>> official
> >>>>
> >>>>
> >>>>>>>> business of Sender. This transmission is of a confidential
> nature
> >>>>>>>>
> >>>>>>>>
> >>>> and
> >>>>
> >>>>
> >>>>>>>> Sender does not endorse distribution to any party other than
> >>>>>>>>
> >>>>>>>>
> >>>> intended
> >>>>
> >>>>
> >>>>>>>> recipient. Sender does not necessarily endorse content contained
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> within
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> this transmission.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>> Date: Thu, 28 Aug 2008 11:02:52 +0200
> >>>>>>>>> From: sw2018@gmx.com
> >>>>>>>>> Subject: Re: Re: Can't execute servlet project
> >>>>>>>>> To: users@tomcat.apache.org; users@tomcat.apache.org
> >>>>>>>>>
> >>>>>>>>> Hi,
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> I couldn't find an installation document about installing the
> >>>>>>>>>
> >>>>>>>>>
> >>>> driver.
> >>>>
> >>>>
> >>>>>>>>> I;ve downloaded the driver:
> >>>>>>>>>
> >>>>>>>>> linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls
> >>>>>>>>> mysql-connector-java-5.1.3-rc-bin.jar
> >>>>>>>>> mysql-connector-java-5.1.3-rc-bin.jar
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Do you know how to configure tomcat to make use of it?
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Thanks
> >>>>>>>>>
> >>>>>>>>> Sam
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: Can't execute servlet project
Posted by David Smith <dn...@cornell.edu>.
Leave web.xml -- it's the global web.xml. DBTest.xml can be removed
without error. It isn't harming anything here but at the same time it
doesn't belong here.
--David
sam wun wrote:
> I found there are some xml file in the conf/ directory:
>
> linux:~/tomcat/apache-tomcat-5.5.26/conf # ls
> . Catalina catalina.policy logging.properties
> server.xml web.xml
> .. DBTest.xml catalina.properties server-minimal.xml
> tomcat-users.xml
> linux:~/tomcat/apache-tomcat-5.5.26/conf #
>
> do I need to remove DBTest.xml and web.xml here?
>
> Thanks
>
> Sam
>
>
>
>
>> ----- Original Message -----
>> From: sam wun
>> Sent: 03/09/08 11:13 am
>> To: Tomcat Users List
>> Subject: Re: Re: Can't execute servlet project
>>
>> After moved the context.xml file to
>> /tomcat/apache-tomcat-5.5.26/conf/Catalina/localhost/
>>
>> with the content changed to:
>>
>> <Context>
>>
>> <!-- Default set of monitored resources -->
>> <WatchedResource>WEB-INF/web.xml</WatchedResource>
>>
>> <!-- Uncomment this to disable session persistence across Tomcat
>> restarts -->
>> <!--
>> <Manager pathname="" />
>> -->
>> <Resource name="jdbc/TestDB" auth="Container"
>> type="javax.sql.DataSource"
>> maxActive="100" maxIdle="30" maxWait="10000"
>> username="javauser" password="javadude"
>> driverClassName="com.mysql.jdbc.Driver"
>> url="jdbc:mysql://localhost:3306/javatest"
>> validationQuery="select 1" />
>> </Context>
>> (I have the exact db, table and username/password created like this).
>>
>> And I have removed the context.xml file in webapps/DBTest/WEB-INF/lib/
>>
>> My testdb.jsp in /tomcat/apache-tomcat-5.5.26/webapps/DBTest looks is
>> shown
>> below:
>>
>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>>
>> <sql:query var="rs" dataSource="jdbc/TestDB">
>> select id, foo, bar from testdata
>> </sql:query>
>>
>> <html>
>> <head>
>> <title>DB Test</title>
>> </head>
>> <body>
>>
>> <h2>Results</h2>
>>
>> <c:forEach var="row" items="${rs.rows}">
>> Foo ${row.foo}<br/>
>> Bar ${row.bar}<br/>
>> </c:forEach>
>>
>> </body>
>> </html>
>>
>>
>>
>> Then shudown and restarted tomcat server.
>>
>>
>> I m still getting the DataSource Invalid errors:
>>
>>
>>
>> HTTP Status 500 -
>>
>> type Exception report
>>
>> message
>>
>> description The server encountered an internal error () that prevented it
>> from fulfilling this request.
>>
>> exception org.apache.jasper.JasperException: Unable to get connection,
>> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
>> Cannot
>> create JDBC driver of class '' for connect URL 'null'"
>>
>>
>> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
>>
>>
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
>> 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)
>>
>> root cause javax.servlet.ServletException: Unable to get connection,
>> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
>> Cannot
>> create JDBC driver of class '' for connect URL 'null'"
>>
>>
>> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
>>
>>
>> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
>> org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>
>>
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>> 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)
>>
>>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
I found there are some xml file in the conf/ directory:
linux:~/tomcat/apache-tomcat-5.5.26/conf # ls
. Catalina catalina.policy logging.properties
server.xml web.xml
.. DBTest.xml catalina.properties server-minimal.xml
tomcat-users.xml
linux:~/tomcat/apache-tomcat-5.5.26/conf #
do I need to remove DBTest.xml and web.xml here?
Thanks
Sam
> ----- Original Message -----
> From: sam wun
> Sent: 03/09/08 11:13 am
> To: Tomcat Users List
> Subject: Re: Re: Can't execute servlet project
>
> After moved the context.xml file to
> /tomcat/apache-tomcat-5.5.26/conf/Catalina/localhost/
>
> with the content changed to:
>
> <Context>
>
> <!-- Default set of monitored resources -->
> <WatchedResource>WEB-INF/web.xml</WatchedResource>
>
> <!-- Uncomment this to disable session persistence across Tomcat
> restarts -->
> <!--
> <Manager pathname="" />
> -->
> <Resource name="jdbc/TestDB" auth="Container"
> type="javax.sql.DataSource"
> maxActive="100" maxIdle="30" maxWait="10000"
> username="javauser" password="javadude"
> driverClassName="com.mysql.jdbc.Driver"
> url="jdbc:mysql://localhost:3306/javatest"
> validationQuery="select 1" />
> </Context>
> (I have the exact db, table and username/password created like this).
>
> And I have removed the context.xml file in webapps/DBTest/WEB-INF/lib/
>
> My testdb.jsp in /tomcat/apache-tomcat-5.5.26/webapps/DBTest looks is
> shown
> below:
>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>
> <sql:query var="rs" dataSource="jdbc/TestDB">
> select id, foo, bar from testdata
> </sql:query>
>
> <html>
> <head>
> <title>DB Test</title>
> </head>
> <body>
>
> <h2>Results</h2>
>
> <c:forEach var="row" items="${rs.rows}">
> Foo ${row.foo}<br/>
> Bar ${row.bar}<br/>
> </c:forEach>
>
> </body>
> </html>
>
>
>
> Then shudown and restarted tomcat server.
>
>
> I m still getting the DataSource Invalid errors:
>
>
>
> HTTP Status 500 -
>
> type Exception report
>
> message
>
> description The server encountered an internal error () that prevented it
> from fulfilling this request.
>
> exception org.apache.jasper.JasperException: Unable to get connection,
> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> Cannot
> create JDBC driver of class '' for connect URL 'null'"
>
>
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
>
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
> 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)
>
> root cause javax.servlet.ServletException: Unable to get connection,
> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> Cannot
> create JDBC driver of class '' for connect URL 'null'"
>
>
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
>
>
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> 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)
>
> > ----- Original Message -----
> > From: David Smith
> > Sent: 03/09/08 03:06 am
> > To: Tomcat Users List
> > Subject: Re: Can't execute servlet project
> >
> > >
> > > Here is the mysql-connector jar file I got in the common/lib
> directory:
> > >
> > > linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls mysql*
> > > mysql-connector-java-5.1.3-rc-bin.jar
> > >
> > >
> > >
> > > Is thsi the correct mysql jar file?
> > >
> > Yes ... looks good. Just be sure this is the only place you have a
> > mysql JDBC driver installed. There should not be one in
> > webapps/DBTest/WEB-INF/lib if it exists here.
> >
> > > This is the only context.xml file I got in the tomcat (5.5.26)
> > directory:
> > >
> > > /tomcat/apache-tomcat-5.5.26/conf/context.xml: ...
> > That is the universal one. The context xml file should be either in
> > your webapp's META-INF folder named context.xml or in tomcat's
> > conf/Catalina/localhost named DBTest.xml. It only contains a <Context
> > ... > xml element and it's contents. Something like:
> >
> > <Context >
> > <Resource name="jdbc/TestDB" auth="Container"
> > type="javax.sql.DataSource"
> > maxActive="100" maxIdle="30" maxWait="10000"
> > username="javauser" password="javadude"
> > driverClassName="com.mysql.jdbc.Driver"
> > url="jdbc:mysql://localhost:3306/javatest"
> > validationQuery="select 1" />
> > </Context>
> >
> > Obviously replace the username, password, and URL with what's
> > appropriate to your database environment.
> >
> > You can read more on this at
> >
> >
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
> >
> > --David
> >
> > sam wun wrote:
> > > Here is the mysql-connector jar file I got in the common/lib
> directory:
> > >
> > > linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls mysql*
> > > mysql-connector-java-5.1.3-rc-bin.jar
> > >
> > >
> > >
> > > Is thsi the correct mysql jar file?
> > >
> > >
> > >
> > > Thanks
> > >
> > > Sam
> > >
> > >
> > >
> > >
> > >
> > >
> > >> ----- Original Message -----
> > >> From: David Smith
> > >> Sent: 03/09/08 01:49 am
> > >> To: Tomcat Users List
> > >> Subject: Re: Can't execute servlet project
> > >>
> > >> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> > >> Cannot create JDBC driver of class '' for connect URL 'null'"
> > >>
> > >> This error typically indicates the JNDI db pool hasn't been setup
> > >> correctly. Some config option isn't setup. What's in this webapp's
> > >> context xml file? Also what's in it's WEB-INF/web.xml? Lastly, you
> > >> should have your database driver jar file in tomcat's common/lib
> (for
> > >> tomcat v 5.5) or /lib (tomcat v 6).
> > >>
> > >> You can also take a look at tomcat's JDBC Datasource howto's on the
> > >> tomcat website for your version of tomcat which offer a lot of help.
> > >>
> > >> --David
> > >>
> > >> sam wun wrote:
> > >>
> > >>> Thanks David,
> > >>>
> > >>>
> > >>>
> > >>> After copied the jstl and standard dot jar files into the
> directory:
> > >>>
> > >>> linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/lib # ls
> > >>> . .. jstl.jar mysql-connector-java-5.1.3-rc-bin.jar
> standard.jar
> > >>>
> > >>>
> > >>>
> > >>> I got the following different errors:
> > >>>
> > >>> (In line 4, what is jdbc/TestDB? I have database called javatest,
> and
> > >>>
> > >> table
> > >>
> > >>> testdata. Should I rename it to jdbc/javatest?
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> HTTP Status 500 -
> > >>>
> > >>> type Exception report
> > >>>
> > >>> message
> > >>>
> > >>> description The server encountered an internal error () that
> > prevented
> > >>>
> > >> it
> > >>
> > >>> from fulfilling this request.
> > >>>
> > >>> exception org.apache.jasper.JasperException: Exception in JSP:
> > >>> /testdb.jsp:4
> > >>>
> > >>> 1: <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"
> %>
> > >>> 2: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> > >>> 3:
> > >>> 4: <sql:query var="rs" dataSource="jdbc/TestDB">
> > >>> 5: select id, foo, bar from testdata
> > >>> 6: </sql:query>
> > >>> 7:
> > >>>
> > >>>
> > >>> Stacktrace:
> > >>>
> > >>>
> > >>>
> > >>
> >
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
> > >>
> > >>>
> > >>>
> > >>>
> > >>
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
> > >>
> > >>>
> > >>>
> > >>
> >
> 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)
> > >>>
> > >>> root cause javax.servlet.ServletException: Unable to get
> connection,
> > >>> DataSource invalid:
> "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> > >>>
> > >> Cannot
> > >>
> > >>> create JDBC driver of class '' for connect URL 'null'"
> > >>>
> > >>>
> > >>>
> > >>
> >
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
> > >>
> > >>>
> > >>>
> > >>>
> > >>
> >
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> > >>
> > >>> org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
> > >>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> > >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> > >>>
> > >>>
> > >>>
> > >>
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> > >>
> > >>>
> > >>>
> > >>
> >
> 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)
> > >>>
> > >>> root cause javax.servlet.jsp.JspException: Unable to get
> connection,
> > >>> DataSource invalid:
> "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> > >>>
> > >> Cannot
> > >>
> > >>> create JDBC driver of class '' for connect URL 'null'"
> > >>>
> > >>>
> > >>>
> > >>
> >
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
> > >>
> > >>>
> > >>>
> > >>>
> > >>
> >
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
> > >>
> > >>>
> > >>>
> > >>>
> > >>
> >
> org.apache.jsp.testdb_jsp._jspx_meth_sql_005fquery_005f0(testdb_jsp.java:101)
> > >>
> > >>> org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:58)
> > >>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> > >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> > >>>
> > >>>
> > >>>
> > >>
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> > >>
> > >>>
> > >>>
> > >>
> >
> 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)
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
Re: Re: Can't execute servlet project - it works now
Posted by sam wun <sw...@gmx.com>.
After this final changed (renamed the context.xml file to DBTest.xml), it
works fine now.
Thank you very much for the help along the way.
Without your patient and effort, I wouldn't be able to get this going.
Thanks
Sam
> ----- Original Message -----
> From: David Smith
> Sent: 03/09/08 12:35 pm
> To: Tomcat Users List
> Subject: Re: Can't execute servlet project
>
> If the context xml file is in
> /tomcat/apache-tomcat-5.5.26/conf/Catalina/localhost, it should be named
> after your webapp (e.g.: DBTest.xml). It's only named context.xml when
> in your webapp's META-INF folder.
>
> --David
>
> sam wun wrote:
> > After moved the context.xml file to
> > /tomcat/apache-tomcat-5.5.26/conf/Catalina/localhost/
> >
> > with the content changed to:
> >
> > <Context>
> >
> > <!-- Default set of monitored resources -->
> > <WatchedResource>WEB-INF/web.xml</WatchedResource>
> >
> > <!-- Uncomment this to disable session persistence across Tomcat
> > restarts -->
> > <!--
> > <Manager pathname="" />
> > -->
> > <Resource name="jdbc/TestDB" auth="Container"
> > type="javax.sql.DataSource"
> > maxActive="100" maxIdle="30" maxWait="10000"
> > username="javauser" password="javadude"
> > driverClassName="com.mysql.jdbc.Driver"
> > url="jdbc:mysql://localhost:3306/javatest"
> > validationQuery="select 1" />
> > </Context>
> > (I have the exact db, table and username/password created like this).
> >
> > And I have removed the context.xml file in webapps/DBTest/WEB-INF/lib/
> >
> > My testdb.jsp in /tomcat/apache-tomcat-5.5.26/webapps/DBTest looks is
> shown
> > below:
> >
> > <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> > <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> >
> > <sql:query var="rs" dataSource="jdbc/TestDB">
> > select id, foo, bar from testdata
> > </sql:query>
> >
> > <html>
> > <head>
> > <title>DB Test</title>
> > </head>
> > <body>
> >
> > <h2>Results</h2>
> >
> > <c:forEach var="row" items="${rs.rows}">
> > Foo ${row.foo}<br/>
> > Bar ${row.bar}<br/>
> > </c:forEach>
> >
> > </body>
> > </html>
> >
> >
> >
> > Then shudown and restarted tomcat server.
> >
> >
> > I m still getting the DataSource Invalid errors:
> >
> >
> >
> > HTTP Status 500 -
> >
> > type Exception report
> >
> > message
> >
> > description The server encountered an internal error () that prevented
> it
> > from fulfilling this request.
> >
> > exception org.apache.jasper.JasperException: Unable to get connection,
> > DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> Cannot
> > create JDBC driver of class '' for connect URL 'null'"
> >
> >
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
> >
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
> >
> 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)
> >
> > root cause javax.servlet.ServletException: Unable to get connection,
> > DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> Cannot
> > create JDBC driver of class '' for connect URL 'null'"
> >
> >
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
> >
> >
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> > org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> >
> 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)
> >
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: Can't execute servlet project
Posted by David Smith <dn...@cornell.edu>.
If the context xml file is in
/tomcat/apache-tomcat-5.5.26/conf/Catalina/localhost, it should be named
after your webapp (e.g.: DBTest.xml). It's only named context.xml when
in your webapp's META-INF folder.
--David
sam wun wrote:
> After moved the context.xml file to
> /tomcat/apache-tomcat-5.5.26/conf/Catalina/localhost/
>
> with the content changed to:
>
> <Context>
>
> <!-- Default set of monitored resources -->
> <WatchedResource>WEB-INF/web.xml</WatchedResource>
>
> <!-- Uncomment this to disable session persistence across Tomcat
> restarts -->
> <!--
> <Manager pathname="" />
> -->
> <Resource name="jdbc/TestDB" auth="Container"
> type="javax.sql.DataSource"
> maxActive="100" maxIdle="30" maxWait="10000"
> username="javauser" password="javadude"
> driverClassName="com.mysql.jdbc.Driver"
> url="jdbc:mysql://localhost:3306/javatest"
> validationQuery="select 1" />
> </Context>
> (I have the exact db, table and username/password created like this).
>
> And I have removed the context.xml file in webapps/DBTest/WEB-INF/lib/
>
> My testdb.jsp in /tomcat/apache-tomcat-5.5.26/webapps/DBTest looks is shown
> below:
>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>
> <sql:query var="rs" dataSource="jdbc/TestDB">
> select id, foo, bar from testdata
> </sql:query>
>
> <html>
> <head>
> <title>DB Test</title>
> </head>
> <body>
>
> <h2>Results</h2>
>
> <c:forEach var="row" items="${rs.rows}">
> Foo ${row.foo}<br/>
> Bar ${row.bar}<br/>
> </c:forEach>
>
> </body>
> </html>
>
>
>
> Then shudown and restarted tomcat server.
>
>
> I m still getting the DataSource Invalid errors:
>
>
>
> HTTP Status 500 -
>
> type Exception report
>
> message
>
> description The server encountered an internal error () that prevented it
> from fulfilling this request.
>
> exception org.apache.jasper.JasperException: Unable to get connection,
> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
> create JDBC driver of class '' for connect URL 'null'"
>
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
> 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)
>
> root cause javax.servlet.ServletException: Unable to get connection,
> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
> create JDBC driver of class '' for connect URL 'null'"
>
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
>
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> 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)
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
After moved the context.xml file to
/tomcat/apache-tomcat-5.5.26/conf/Catalina/localhost/
with the content changed to:
<Context>
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat
restarts -->
<!--
<Manager pathname="" />
-->
<Resource name="jdbc/TestDB" auth="Container"
type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="javauser" password="javadude"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/javatest"
validationQuery="select 1" />
</Context>
(I have the exact db, table and username/password created like this).
And I have removed the context.xml file in webapps/DBTest/WEB-INF/lib/
My testdb.jsp in /tomcat/apache-tomcat-5.5.26/webapps/DBTest looks is shown
below:
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<sql:query var="rs" dataSource="jdbc/TestDB">
select id, foo, bar from testdata
</sql:query>
<html>
<head>
<title>DB Test</title>
</head>
<body>
<h2>Results</h2>
<c:forEach var="row" items="${rs.rows}">
Foo ${row.foo}<br/>
Bar ${row.bar}<br/>
</c:forEach>
</body>
</html>
Then shudown and restarted tomcat server.
I m still getting the DataSource Invalid errors:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception org.apache.jasper.JasperException: Unable to get connection,
DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
create JDBC driver of class '' for connect URL 'null'"
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
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)
root cause javax.servlet.ServletException: Unable to get connection,
DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
create JDBC driver of class '' for connect URL 'null'"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
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)
> ----- Original Message -----
> From: David Smith
> Sent: 03/09/08 03:06 am
> To: Tomcat Users List
> Subject: Re: Can't execute servlet project
>
> >
> > Here is the mysql-connector jar file I got in the common/lib directory:
> >
> > linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls mysql*
> > mysql-connector-java-5.1.3-rc-bin.jar
> >
> >
> >
> > Is thsi the correct mysql jar file?
> >
> Yes ... looks good. Just be sure this is the only place you have a
> mysql JDBC driver installed. There should not be one in
> webapps/DBTest/WEB-INF/lib if it exists here.
>
> > This is the only context.xml file I got in the tomcat (5.5.26)
> directory:
> >
> > /tomcat/apache-tomcat-5.5.26/conf/context.xml: ...
> That is the universal one. The context xml file should be either in
> your webapp's META-INF folder named context.xml or in tomcat's
> conf/Catalina/localhost named DBTest.xml. It only contains a <Context
> ... > xml element and it's contents. Something like:
>
> <Context >
> <Resource name="jdbc/TestDB" auth="Container"
> type="javax.sql.DataSource"
> maxActive="100" maxIdle="30" maxWait="10000"
> username="javauser" password="javadude"
> driverClassName="com.mysql.jdbc.Driver"
> url="jdbc:mysql://localhost:3306/javatest"
> validationQuery="select 1" />
> </Context>
>
> Obviously replace the username, password, and URL with what's
> appropriate to your database environment.
>
> You can read more on this at
>
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
>
> --David
>
> sam wun wrote:
> > Here is the mysql-connector jar file I got in the common/lib directory:
> >
> > linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls mysql*
> > mysql-connector-java-5.1.3-rc-bin.jar
> >
> >
> >
> > Is thsi the correct mysql jar file?
> >
> >
> >
> > Thanks
> >
> > Sam
> >
> >
> >
> >
> >
> >
> >> ----- Original Message -----
> >> From: David Smith
> >> Sent: 03/09/08 01:49 am
> >> To: Tomcat Users List
> >> Subject: Re: Can't execute servlet project
> >>
> >> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> >> Cannot create JDBC driver of class '' for connect URL 'null'"
> >>
> >> This error typically indicates the JNDI db pool hasn't been setup
> >> correctly. Some config option isn't setup. What's in this webapp's
> >> context xml file? Also what's in it's WEB-INF/web.xml? Lastly, you
> >> should have your database driver jar file in tomcat's common/lib (for
> >> tomcat v 5.5) or /lib (tomcat v 6).
> >>
> >> You can also take a look at tomcat's JDBC Datasource howto's on the
> >> tomcat website for your version of tomcat which offer a lot of help.
> >>
> >> --David
> >>
> >> sam wun wrote:
> >>
> >>> Thanks David,
> >>>
> >>>
> >>>
> >>> After copied the jstl and standard dot jar files into the directory:
> >>>
> >>> linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/lib # ls
> >>> . .. jstl.jar mysql-connector-java-5.1.3-rc-bin.jar standard.jar
> >>>
> >>>
> >>>
> >>> I got the following different errors:
> >>>
> >>> (In line 4, what is jdbc/TestDB? I have database called javatest, and
> >>>
> >> table
> >>
> >>> testdata. Should I rename it to jdbc/javatest?
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> HTTP Status 500 -
> >>>
> >>> type Exception report
> >>>
> >>> message
> >>>
> >>> description The server encountered an internal error () that
> prevented
> >>>
> >> it
> >>
> >>> from fulfilling this request.
> >>>
> >>> exception org.apache.jasper.JasperException: Exception in JSP:
> >>> /testdb.jsp:4
> >>>
> >>> 1: <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> >>> 2: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> >>> 3:
> >>> 4: <sql:query var="rs" dataSource="jdbc/TestDB">
> >>> 5: select id, foo, bar from testdata
> >>> 6: </sql:query>
> >>> 7:
> >>>
> >>>
> >>> Stacktrace:
> >>>
> >>>
> >>>
> >>
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
> >>
> >>>
> >>>
> >>>
> >>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
> >>
> >>>
> >>>
> >>
> 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)
> >>>
> >>> root cause javax.servlet.ServletException: Unable to get connection,
> >>> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> >>>
> >> Cannot
> >>
> >>> create JDBC driver of class '' for connect URL 'null'"
> >>>
> >>>
> >>>
> >>
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
> >>
> >>>
> >>>
> >>>
> >>
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> >>
> >>> org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
> >>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >>>
> >>>
> >>>
> >>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> >>
> >>>
> >>>
> >>
> 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)
> >>>
> >>> root cause javax.servlet.jsp.JspException: Unable to get connection,
> >>> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> >>>
> >> Cannot
> >>
> >>> create JDBC driver of class '' for connect URL 'null'"
> >>>
> >>>
> >>>
> >>
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
> >>
> >>>
> >>>
> >>>
> >>
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
> >>
> >>>
> >>>
> >>>
> >>
> org.apache.jsp.testdb_jsp._jspx_meth_sql_005fquery_005f0(testdb_jsp.java:101)
> >>
> >>> org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:58)
> >>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >>>
> >>>
> >>>
> >>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> >>
> >>>
> >>>
> >>
> 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)
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: Can't execute servlet project
Posted by David Smith <dn...@cornell.edu>.
>
> Here is the mysql-connector jar file I got in the common/lib directory:
>
> linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls mysql*
> mysql-connector-java-5.1.3-rc-bin.jar
>
>
>
> Is thsi the correct mysql jar file?
>
Yes ... looks good. Just be sure this is the only place you have a
mysql JDBC driver installed. There should not be one in
webapps/DBTest/WEB-INF/lib if it exists here.
> This is the only context.xml file I got in the tomcat (5.5.26) directory:
>
> /tomcat/apache-tomcat-5.5.26/conf/context.xml: ...
That is the universal one. The context xml file should be either in
your webapp's META-INF folder named context.xml or in tomcat's
conf/Catalina/localhost named DBTest.xml. It only contains a <Context
... > xml element and it's contents. Something like:
<Context >
<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="javauser" password="javadude"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/javatest"
validationQuery="select 1" />
</Context>
Obviously replace the username, password, and URL with what's
appropriate to your database environment.
You can read more on this at
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
--David
sam wun wrote:
> Here is the mysql-connector jar file I got in the common/lib directory:
>
> linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls mysql*
> mysql-connector-java-5.1.3-rc-bin.jar
>
>
>
> Is thsi the correct mysql jar file?
>
>
>
> Thanks
>
> Sam
>
>
>
>
>
>
>> ----- Original Message -----
>> From: David Smith
>> Sent: 03/09/08 01:49 am
>> To: Tomcat Users List
>> Subject: Re: Can't execute servlet project
>>
>> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
>> Cannot create JDBC driver of class '' for connect URL 'null'"
>>
>> This error typically indicates the JNDI db pool hasn't been setup
>> correctly. Some config option isn't setup. What's in this webapp's
>> context xml file? Also what's in it's WEB-INF/web.xml? Lastly, you
>> should have your database driver jar file in tomcat's common/lib (for
>> tomcat v 5.5) or /lib (tomcat v 6).
>>
>> You can also take a look at tomcat's JDBC Datasource howto's on the
>> tomcat website for your version of tomcat which offer a lot of help.
>>
>> --David
>>
>> sam wun wrote:
>>
>>> Thanks David,
>>>
>>>
>>>
>>> After copied the jstl and standard dot jar files into the directory:
>>>
>>> linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/lib # ls
>>> . .. jstl.jar mysql-connector-java-5.1.3-rc-bin.jar standard.jar
>>>
>>>
>>>
>>> I got the following different errors:
>>>
>>> (In line 4, what is jdbc/TestDB? I have database called javatest, and
>>>
>> table
>>
>>> testdata. Should I rename it to jdbc/javatest?
>>>
>>>
>>>
>>>
>>>
>>> HTTP Status 500 -
>>>
>>> type Exception report
>>>
>>> message
>>>
>>> description The server encountered an internal error () that prevented
>>>
>> it
>>
>>> from fulfilling this request.
>>>
>>> exception org.apache.jasper.JasperException: Exception in JSP:
>>> /testdb.jsp:4
>>>
>>> 1: <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
>>> 2: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>>> 3:
>>> 4: <sql:query var="rs" dataSource="jdbc/TestDB">
>>> 5: select id, foo, bar from testdata
>>> 6: </sql:query>
>>> 7:
>>>
>>>
>>> Stacktrace:
>>>
>>>
>>>
>> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
>>
>>>
>>>
>>>
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
>>
>>>
>>>
>> 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)
>>>
>>> root cause javax.servlet.ServletException: Unable to get connection,
>>> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
>>>
>> Cannot
>>
>>> create JDBC driver of class '' for connect URL 'null'"
>>>
>>>
>>>
>> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
>>
>>>
>>>
>>>
>> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
>>
>>> org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
>>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>>
>>>
>>>
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>>
>>>
>>>
>> 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)
>>>
>>> root cause javax.servlet.jsp.JspException: Unable to get connection,
>>> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
>>>
>> Cannot
>>
>>> create JDBC driver of class '' for connect URL 'null'"
>>>
>>>
>>>
>> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
>>
>>>
>>>
>>>
>> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
>>
>>>
>>>
>>>
>> org.apache.jsp.testdb_jsp._jspx_meth_sql_005fquery_005f0(testdb_jsp.java:101)
>>
>>> org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:58)
>>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>>
>>>
>>>
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>>
>>>
>>>
>> 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)
>>>
>>>
>>>
>>>
>>>
>>>
>>>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
Here is the mysql-connector jar file I got in the common/lib directory:
linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls mysql*
mysql-connector-java-5.1.3-rc-bin.jar
Is thsi the correct mysql jar file?
Thanks
Sam
> ----- Original Message -----
> From: David Smith
> Sent: 03/09/08 01:49 am
> To: Tomcat Users List
> Subject: Re: Can't execute servlet project
>
> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> Cannot create JDBC driver of class '' for connect URL 'null'"
>
> This error typically indicates the JNDI db pool hasn't been setup
> correctly. Some config option isn't setup. What's in this webapp's
> context xml file? Also what's in it's WEB-INF/web.xml? Lastly, you
> should have your database driver jar file in tomcat's common/lib (for
> tomcat v 5.5) or /lib (tomcat v 6).
>
> You can also take a look at tomcat's JDBC Datasource howto's on the
> tomcat website for your version of tomcat which offer a lot of help.
>
> --David
>
> sam wun wrote:
> > Thanks David,
> >
> >
> >
> > After copied the jstl and standard dot jar files into the directory:
> >
> > linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/lib # ls
> > . .. jstl.jar mysql-connector-java-5.1.3-rc-bin.jar standard.jar
> >
> >
> >
> > I got the following different errors:
> >
> > (In line 4, what is jdbc/TestDB? I have database called javatest, and
> table
> > testdata. Should I rename it to jdbc/javatest?
> >
> >
> >
> >
> >
> > HTTP Status 500 -
> >
> > type Exception report
> >
> > message
> >
> > description The server encountered an internal error () that prevented
> it
> > from fulfilling this request.
> >
> > exception org.apache.jasper.JasperException: Exception in JSP:
> > /testdb.jsp:4
> >
> > 1: <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> > 2: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> > 3:
> > 4: <sql:query var="rs" dataSource="jdbc/TestDB">
> > 5: select id, foo, bar from testdata
> > 6: </sql:query>
> > 7:
> >
> >
> > Stacktrace:
> >
> >
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
> >
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
> >
> 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)
> >
> > root cause javax.servlet.ServletException: Unable to get connection,
> > DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> Cannot
> > create JDBC driver of class '' for connect URL 'null'"
> >
> >
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
> >
> >
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> > org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> >
> 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)
> >
> > root cause javax.servlet.jsp.JspException: Unable to get connection,
> > DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> Cannot
> > create JDBC driver of class '' for connect URL 'null'"
> >
> >
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
> >
> >
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
> >
> >
> org.apache.jsp.testdb_jsp._jspx_meth_sql_005fquery_005f0(testdb_jsp.java:101)
> > org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:58)
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> >
> 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)
> >
> >
> >
> >
> >
> >
> >> ----- Original Message -----
> >> From: David Smith
> >> Sent: 03/09/08 01:23 am
> >> To: Tomcat Users List
> >> Subject: Re: Can't execute servlet project
> >>
> >> Download the binary zip file and expand it. Within it is a lib
> >> directory with just standard.jar and jstl.jar.
> >>
> >> --David
> >>
> >> sam wun wrote:
> >>
> >>> I just went to the website , very confused.
> >>>
> >>> The taglib file is not a jar file. they are binary or source file.
> >>>
> >>> And I couldn't find standard.jar file either.
> >>>
> >>>
> >>>
> >>> Thanks
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>> ----- Original Message -----
> >>>> From: David Smith
> >>>> Sent: 02/09/08 11:44 pm
> >>>> To: Tomcat Users List
> >>>> Subject: Re: Can't execute servlet project
> >>>>
> >>>> Hmmm... good question. I moved over to Maven and don't manually
> >>>> download these any more. This looks like it should do the trick:
> >>>>
> >>>> Try
> >>>>
> >>>>
> >>
> http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi
> >>
> >>>> --David
> >>>>
> >>>> sam wun wrote:
> >>>>
> >>>>
> >>>>> Hi David,
> >>>>>
> >>>>>
> >>>>>
> >>>>> No, I don't have this 2 jar files in the common/lib/ directory.
> >>>>>
> >>>>> where can I download it from?
> >>>>>
> >>>>>
> >>>>>
> >>>>> Thanks
> >>>>>
> >>>>> Sam
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>> ----- Original Message -----
> >>>>>> From: David Smith
> >>>>>> Sent: 02/09/08 10:39 pm
> >>>>>> To: Tomcat Users List
> >>>>>> Subject: Re: Can't execute servlet project
> >>>>>>
> >>>>>> Do you have jstl.jar and standard.jar in your WEB-INF/lib
> directory?
> >>>>>>
> >>>>>> --David
> >>>>>>
> >>>>>> sam wun wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> I have added testdb.jsp in the following path in Suse linux (the
> >>>>>>>
> >>>>>>>
> >>>> tomcat
> >>>>
> >>>>
> >>>>>>> server):
> >>>>>>>
> >>>>>>> /tomcat/apache-tomcat-5.5.26/webapps/DBTest/
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> The content of the testdb.jsp code is:
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> >>>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> >>>>>>>
> >>>>>>> <sql:query var="rs" dataSource="jdbc/TestDB">
> >>>>>>> select FIRST_NAME from DBTest.Customer
> >>>>>>> </sql:query>
> >>>>>>>
> >>>>>>> <html>
> >>>>>>> <head>
> >>>>>>> <title>DB Test</title>
> >>>>>>> </head>
> >>>>>>> <body>
> >>>>>>>
> >>>>>>> <h2>Results</h2>
> >>>>>>>
> >>>>>>> <c:forEach var="row" items="${rs.rows}">
> >>>>>>> Foo ${row.foo}<br/>
> >>>>>>> Bar ${row.bar}<br/>
> >>>>>>> </c:forEach>
> >>>>>>>
> >>>>>>> </body>
> >>>>>>> </html>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> when I execute url 10.1.9.1:8080/testdb.jsp in firefox web
> browser,
> >>>>>>>
> >>>>>>>
> >>>> it
> >>>>
> >>>>
> >>>>>>> shown the following error:
> >>>>>>>
> >>>>>>> HTTP Status 500 -
> >>>>>>>
> >>>>>>> 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)
> >>>>>>>
> >>>>>>> Here is the web.xml file I got:
> >>>>>>>
> >>>>>>> (in the path
> /tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/)
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> <?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>
> >>>>>>> Create customer servlet</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>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> Thanks
> >>>>>>>
> >>>>>>> Sam
> >>>>>>>
> >>>>>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>> ----- Original Message -----
> >>>>>>>> From: Martin Gainty
> >>>>>>>> Sent: 28/08/08 10:07 pm
> >>>>>>>> To: sw2018@gmx.com
> >>>>>>>> Subject: RE: Can't execute servlet project
> >>>>>>>>
> >>>>>>>> david's advice is correct..
> >>>>>>>>
> >>>>>>>> configure ./META-INF/ApplicationContext.xml
> >>>>>>>> <Context path="/DBTest" docBase="DBTest"
> >>>>>>>> debug="5" reloadable="true" crossContext="true">
> >>>>>>>>
> >>>>>>>> <!-- maxActive: Maximum number of dB connections in pool.
> Make
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> sure
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> you
> >>>>>>>> configure your mysqld max_connections large enough to
> >>>>>>>>
> >>>>>>>>
> >>>> handle
> >>>>
> >>>>
> >>>>>>>> all of your db connections. Set to 0 for no limit.
> >>>>>>>> -->
> >>>>>>>>
> >>>>>>>> <!-- maxIdle: Maximum number of idle dB connections to
> retain
> >>>>>>>>
> >> in
> >>
> >>>>>>>> pool.
> >>>>>>>> Set to -1 for no limit. See also the DBCP
> documentation
> >>>>>>>>
> >> on
> >>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> this
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> and the minEvictableIdleTimeMillis configuration
> >>>>>>>>
> >> parameter.
> >>
> >>>>>>>> -->
> >>>>>>>>
> >>>>>>>> <!-- maxWait: Maximum time to wait for a dB connection to
> >>>>>>>>
> >> become
> >>
> >>>>>>>> available
> >>>>>>>> in ms, in this example 10 seconds. An Exception is
> thrown
> >>>>>>>>
> >>>>>>>>
> >>>> if
> >>>>
> >>>>
> >>>>>>>> this timeout is exceeded. Set to -1 to wait
> >>>>>>>>
> >> indefinitely.
> >>
> >>>>>>>> -->
> >>>>>>>>
> >>>>>>>> <!-- username and password: MySQL dB username and password
> for
> >>>>>>>>
> >>>>>>>>
> >>>> dB
> >>>>
> >>>>
> >>>>>>>> connections -->
> >>>>>>>>
> >>>>>>>> <!-- driverClassName: Class name for the old mm.mysql JDBC
> >>>>>>>>
> >>>>>>>>
> >>>> driver
> >>>>
> >>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> is
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> org.gjt.mm.mysql.Driver - we recommend using
> Connector/J
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> though.
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> Class name for the official MySQL Connector/J driver is
> >>>>>>>> com.mysql.jdbc.Driver.
> >>>>>>>> -->
> >>>>>>>>
> >>>>>>>> <!-- url: The JDBC connection url for connecting to your
> MySQL
> >>>>>>>>
> >>>>>>>>
> >>>> dB.
> >>>>
> >>>>
> >>>>>>>> The autoReconnect=true argument to the url makes sure
> >>>>>>>>
> >> that
> >>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> the
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> mm.mysql JDBC Driver will automatically reconnect if
> >>>>>>>>
> >> mysqld
> >>
> >>>>>>>> closed the
> >>>>>>>> connection. mysqld by default closes idle connections
> >>>>>>>>
> >>>>>>>>
> >>>> after
> >>>>
> >>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> 8
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> hours.
> >>>>>>>> -->
> >>>>>>>>
> >>>>>>>> <Resource name="jdbc/TestDB" auth="Container"
> >>>>>>>> type="javax.sql.DataSource"
> >>>>>>>> maxActive="100" maxIdle="30" maxWait="10000"
> >>>>>>>> username="javauser" password="javadude"
> >>>>>>>> driverClassName="com.mysql.jdbc.Driver"
> >>>>>>>>
> >>>>>>>> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
> >>>>>>>>
> >>>>>>>> </Context>
> >>>>>>>> //sub in the username and password for the DB
> >>>>>>>> also in /WEB-INF/web.xml you would need this entry
> >>>>>>>> <web-app 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"
> >>>>>>>> version="2.4">
> >>>>>>>> <description>MySQL Test App</description>
> >>>>>>>> <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>
> >>>>>>>> then put in this test code changing :
> >>>>>>>> DBNAME to the name of your Database
> >>>>>>>> TABLE to the name of the table in DBNAME you want to query
> >>>>>>>> COLUMN for the specific attribute to query
> >>>>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"
> %>
> >>>>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> >>>>>>>>
> >>>>>>>> <sql:query var="rs" dataSource="jdbc/TestDB">
> >>>>>>>> select COLUMN from DBNAME.TABLE
> >>>>>>>> </sql:query>
> >>>>>>>>
> >>>>>>>> <html>
> >>>>>>>> <head>
> >>>>>>>> <title>DB Test</title>
> >>>>>>>> </head>
> >>>>>>>> <body>
> >>>>>>>>
> >>>>>>>> <h2>Results</h2>
> >>>>>>>>
> >>>>>>>> <c:forEach var="row" items="${rs.rows}">
> >>>>>>>> Foo ${row.foo}<br/>
> >>>>>>>> Bar ${row.bar}<br/>
> >>>>>>>> </c:forEach>
> >>>>>>>>
> >>>>>>>> </body>
> >>>>>>>> </html>
> >>>>>>>>
> >>>>>>>> if you need UNICODE support or Character Large Object (strings >
> >>>>>>>>
> >> 64k
> >>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> in
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> length) download JDBC 4 driver
> >>>>>>>> http://dev.mysql.com/downloads/connector/j/5.1.html
> >>>>>>>>
> >>>>>>>> personally I am using the 'older' version of MYSQL so I use the
> >>>>>>>>
> >> 3.1
> >>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> jar
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> which you can acquire here
> >>>>>>>> http://dev.mysql.com/downloads/connector/j
> >>>>>>>>
> >>>>>>>> location of driver classes:
> >>>>>>>>
> >>>>>>>> is located in $TOMCAT_HOME/common/lib
> >>>>>>>> personally I dont like putting anything in common since it will
> >>>>>>>>
> >>>>>>>>
> >>>> affect
> >>>>
> >>>>
> >>>>>>>> all webapps but i usually
> >>>>>>>> place in /WEB-INF/lib
> >>>>>>>>
> >>>>>>>> and please follow david's advice and read the tutorial
> >>>>>>>>
> >>>>>>>> Martin
> >>>>>>>> ______________________________________________
> >>>>>>>> Disclaimer and confidentiality note
> >>>>>>>> Everything in this e-mail and any attachments relates to the
> >>>>>>>>
> >>>>>>>>
> >>>> official
> >>>>
> >>>>
> >>>>>>>> business of Sender. This transmission is of a confidential
> nature
> >>>>>>>>
> >>>>>>>>
> >>>> and
> >>>>
> >>>>
> >>>>>>>> Sender does not endorse distribution to any party other than
> >>>>>>>>
> >>>>>>>>
> >>>> intended
> >>>>
> >>>>
> >>>>>>>> recipient. Sender does not necessarily endorse content contained
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>> within
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>> this transmission.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>> Date: Thu, 28 Aug 2008 11:02:52 +0200
> >>>>>>>>> From: sw2018@gmx.com
> >>>>>>>>> Subject: Re: Re: Can't execute servlet project
> >>>>>>>>> To: users@tomcat.apache.org; users@tomcat.apache.org
> >>>>>>>>>
> >>>>>>>>> Hi,
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> I couldn't find an installation document about installing the
> >>>>>>>>>
> >>>>>>>>>
> >>>> driver.
> >>>>
> >>>>
> >>>>>>>>> I;ve downloaded the driver:
> >>>>>>>>>
> >>>>>>>>> linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls
> >>>>>>>>> mysql-connector-java-5.1.3-rc-bin.jar
> >>>>>>>>> mysql-connector-java-5.1.3-rc-bin.jar
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Do you know how to configure tomcat to make use of it?
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Thanks
> >>>>>>>>>
> >>>>>>>>> Sam
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: Can't execute servlet project
Posted by David Smith <dn...@cornell.edu>.
DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException:
Cannot create JDBC driver of class '' for connect URL 'null'"
This error typically indicates the JNDI db pool hasn't been setup
correctly. Some config option isn't setup. What's in this webapp's
context xml file? Also what's in it's WEB-INF/web.xml? Lastly, you
should have your database driver jar file in tomcat's common/lib (for
tomcat v 5.5) or /lib (tomcat v 6).
You can also take a look at tomcat's JDBC Datasource howto's on the
tomcat website for your version of tomcat which offer a lot of help.
--David
sam wun wrote:
> Thanks David,
>
>
>
> After copied the jstl and standard dot jar files into the directory:
>
> linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/lib # ls
> . .. jstl.jar mysql-connector-java-5.1.3-rc-bin.jar standard.jar
>
>
>
> I got the following different errors:
>
> (In line 4, what is jdbc/TestDB? I have database called javatest, and table
> testdata. Should I rename it to jdbc/javatest?
>
>
>
>
>
> HTTP Status 500 -
>
> type Exception report
>
> message
>
> description The server encountered an internal error () that prevented it
> from fulfilling this request.
>
> exception org.apache.jasper.JasperException: Exception in JSP:
> /testdb.jsp:4
>
> 1: <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> 2: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> 3:
> 4: <sql:query var="rs" dataSource="jdbc/TestDB">
> 5: select id, foo, bar from testdata
> 6: </sql:query>
> 7:
>
>
> Stacktrace:
>
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
> 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)
>
> root cause javax.servlet.ServletException: Unable to get connection,
> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
> create JDBC driver of class '' for connect URL 'null'"
>
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
>
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> 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)
>
> root cause javax.servlet.jsp.JspException: Unable to get connection,
> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
> create JDBC driver of class '' for connect URL 'null'"
>
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
>
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
>
> org.apache.jsp.testdb_jsp._jspx_meth_sql_005fquery_005f0(testdb_jsp.java:101)
> org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:58)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> 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)
>
>
>
>
>
>
>> ----- Original Message -----
>> From: David Smith
>> Sent: 03/09/08 01:23 am
>> To: Tomcat Users List
>> Subject: Re: Can't execute servlet project
>>
>> Download the binary zip file and expand it. Within it is a lib
>> directory with just standard.jar and jstl.jar.
>>
>> --David
>>
>> sam wun wrote:
>>
>>> I just went to the website , very confused.
>>>
>>> The taglib file is not a jar file. they are binary or source file.
>>>
>>> And I couldn't find standard.jar file either.
>>>
>>>
>>>
>>> Thanks
>>>
>>>
>>>
>>>
>>>
>>>> ----- Original Message -----
>>>> From: David Smith
>>>> Sent: 02/09/08 11:44 pm
>>>> To: Tomcat Users List
>>>> Subject: Re: Can't execute servlet project
>>>>
>>>> Hmmm... good question. I moved over to Maven and don't manually
>>>> download these any more. This looks like it should do the trick:
>>>>
>>>> Try
>>>>
>>>>
>> http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi
>>
>>>> --David
>>>>
>>>> sam wun wrote:
>>>>
>>>>
>>>>> Hi David,
>>>>>
>>>>>
>>>>>
>>>>> No, I don't have this 2 jar files in the common/lib/ directory.
>>>>>
>>>>> where can I download it from?
>>>>>
>>>>>
>>>>>
>>>>> Thanks
>>>>>
>>>>> Sam
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> ----- Original Message -----
>>>>>> From: David Smith
>>>>>> Sent: 02/09/08 10:39 pm
>>>>>> To: Tomcat Users List
>>>>>> Subject: Re: Can't execute servlet project
>>>>>>
>>>>>> Do you have jstl.jar and standard.jar in your WEB-INF/lib directory?
>>>>>>
>>>>>> --David
>>>>>>
>>>>>> sam wun wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I have added testdb.jsp in the following path in Suse linux (the
>>>>>>>
>>>>>>>
>>>> tomcat
>>>>
>>>>
>>>>>>> server):
>>>>>>>
>>>>>>> /tomcat/apache-tomcat-5.5.26/webapps/DBTest/
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> The content of the testdb.jsp code is:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
>>>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>>>>>>>
>>>>>>> <sql:query var="rs" dataSource="jdbc/TestDB">
>>>>>>> select FIRST_NAME from DBTest.Customer
>>>>>>> </sql:query>
>>>>>>>
>>>>>>> <html>
>>>>>>> <head>
>>>>>>> <title>DB Test</title>
>>>>>>> </head>
>>>>>>> <body>
>>>>>>>
>>>>>>> <h2>Results</h2>
>>>>>>>
>>>>>>> <c:forEach var="row" items="${rs.rows}">
>>>>>>> Foo ${row.foo}<br/>
>>>>>>> Bar ${row.bar}<br/>
>>>>>>> </c:forEach>
>>>>>>>
>>>>>>> </body>
>>>>>>> </html>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> when I execute url 10.1.9.1:8080/testdb.jsp in firefox web browser,
>>>>>>>
>>>>>>>
>>>> it
>>>>
>>>>
>>>>>>> shown the following error:
>>>>>>>
>>>>>>> HTTP Status 500 -
>>>>>>>
>>>>>>> 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)
>>>>>>>
>>>>>>> Here is the web.xml file I got:
>>>>>>>
>>>>>>> (in the path /tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> <?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>
>>>>>>> Create customer servlet</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>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> Sam
>>>>>>>
>>>>>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> ----- Original Message -----
>>>>>>>> From: Martin Gainty
>>>>>>>> Sent: 28/08/08 10:07 pm
>>>>>>>> To: sw2018@gmx.com
>>>>>>>> Subject: RE: Can't execute servlet project
>>>>>>>>
>>>>>>>> david's advice is correct..
>>>>>>>>
>>>>>>>> configure ./META-INF/ApplicationContext.xml
>>>>>>>> <Context path="/DBTest" docBase="DBTest"
>>>>>>>> debug="5" reloadable="true" crossContext="true">
>>>>>>>>
>>>>>>>> <!-- maxActive: Maximum number of dB connections in pool. Make
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>> sure
>>>>>>
>>>>>>
>>>>>>
>>>>>>>> you
>>>>>>>> configure your mysqld max_connections large enough to
>>>>>>>>
>>>>>>>>
>>>> handle
>>>>
>>>>
>>>>>>>> all of your db connections. Set to 0 for no limit.
>>>>>>>> -->
>>>>>>>>
>>>>>>>> <!-- maxIdle: Maximum number of idle dB connections to retain
>>>>>>>>
>> in
>>
>>>>>>>> pool.
>>>>>>>> Set to -1 for no limit. See also the DBCP documentation
>>>>>>>>
>> on
>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>> this
>>>>>>
>>>>>>
>>>>>>
>>>>>>>> and the minEvictableIdleTimeMillis configuration
>>>>>>>>
>> parameter.
>>
>>>>>>>> -->
>>>>>>>>
>>>>>>>> <!-- maxWait: Maximum time to wait for a dB connection to
>>>>>>>>
>> become
>>
>>>>>>>> available
>>>>>>>> in ms, in this example 10 seconds. An Exception is thrown
>>>>>>>>
>>>>>>>>
>>>> if
>>>>
>>>>
>>>>>>>> this timeout is exceeded. Set to -1 to wait
>>>>>>>>
>> indefinitely.
>>
>>>>>>>> -->
>>>>>>>>
>>>>>>>> <!-- username and password: MySQL dB username and password for
>>>>>>>>
>>>>>>>>
>>>> dB
>>>>
>>>>
>>>>>>>> connections -->
>>>>>>>>
>>>>>>>> <!-- driverClassName: Class name for the old mm.mysql JDBC
>>>>>>>>
>>>>>>>>
>>>> driver
>>>>
>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>> is
>>>>>>
>>>>>>
>>>>>>
>>>>>>>> org.gjt.mm.mysql.Driver - we recommend using Connector/J
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>> though.
>>>>>>
>>>>>>
>>>>>>
>>>>>>>> Class name for the official MySQL Connector/J driver is
>>>>>>>> com.mysql.jdbc.Driver.
>>>>>>>> -->
>>>>>>>>
>>>>>>>> <!-- url: The JDBC connection url for connecting to your MySQL
>>>>>>>>
>>>>>>>>
>>>> dB.
>>>>
>>>>
>>>>>>>> The autoReconnect=true argument to the url makes sure
>>>>>>>>
>> that
>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>> the
>>>>>>
>>>>>>
>>>>>>
>>>>>>>> mm.mysql JDBC Driver will automatically reconnect if
>>>>>>>>
>> mysqld
>>
>>>>>>>> closed the
>>>>>>>> connection. mysqld by default closes idle connections
>>>>>>>>
>>>>>>>>
>>>> after
>>>>
>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>> 8
>>>>>>
>>>>>>
>>>>>>
>>>>>>>> hours.
>>>>>>>> -->
>>>>>>>>
>>>>>>>> <Resource name="jdbc/TestDB" auth="Container"
>>>>>>>> type="javax.sql.DataSource"
>>>>>>>> maxActive="100" maxIdle="30" maxWait="10000"
>>>>>>>> username="javauser" password="javadude"
>>>>>>>> driverClassName="com.mysql.jdbc.Driver"
>>>>>>>>
>>>>>>>> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
>>>>>>>>
>>>>>>>> </Context>
>>>>>>>> //sub in the username and password for the DB
>>>>>>>> also in /WEB-INF/web.xml you would need this entry
>>>>>>>> <web-app 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"
>>>>>>>> version="2.4">
>>>>>>>> <description>MySQL Test App</description>
>>>>>>>> <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>
>>>>>>>> then put in this test code changing :
>>>>>>>> DBNAME to the name of your Database
>>>>>>>> TABLE to the name of the table in DBNAME you want to query
>>>>>>>> COLUMN for the specific attribute to query
>>>>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
>>>>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>>>>>>>>
>>>>>>>> <sql:query var="rs" dataSource="jdbc/TestDB">
>>>>>>>> select COLUMN from DBNAME.TABLE
>>>>>>>> </sql:query>
>>>>>>>>
>>>>>>>> <html>
>>>>>>>> <head>
>>>>>>>> <title>DB Test</title>
>>>>>>>> </head>
>>>>>>>> <body>
>>>>>>>>
>>>>>>>> <h2>Results</h2>
>>>>>>>>
>>>>>>>> <c:forEach var="row" items="${rs.rows}">
>>>>>>>> Foo ${row.foo}<br/>
>>>>>>>> Bar ${row.bar}<br/>
>>>>>>>> </c:forEach>
>>>>>>>>
>>>>>>>> </body>
>>>>>>>> </html>
>>>>>>>>
>>>>>>>> if you need UNICODE support or Character Large Object (strings >
>>>>>>>>
>> 64k
>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>> in
>>>>>>
>>>>>>
>>>>>>
>>>>>>>> length) download JDBC 4 driver
>>>>>>>> http://dev.mysql.com/downloads/connector/j/5.1.html
>>>>>>>>
>>>>>>>> personally I am using the 'older' version of MYSQL so I use the
>>>>>>>>
>> 3.1
>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>> jar
>>>>>>
>>>>>>
>>>>>>
>>>>>>>> which you can acquire here
>>>>>>>> http://dev.mysql.com/downloads/connector/j
>>>>>>>>
>>>>>>>> location of driver classes:
>>>>>>>>
>>>>>>>> is located in $TOMCAT_HOME/common/lib
>>>>>>>> personally I dont like putting anything in common since it will
>>>>>>>>
>>>>>>>>
>>>> affect
>>>>
>>>>
>>>>>>>> all webapps but i usually
>>>>>>>> place in /WEB-INF/lib
>>>>>>>>
>>>>>>>> and please follow david's advice and read the tutorial
>>>>>>>>
>>>>>>>> Martin
>>>>>>>> ______________________________________________
>>>>>>>> Disclaimer and confidentiality note
>>>>>>>> Everything in this e-mail and any attachments relates to the
>>>>>>>>
>>>>>>>>
>>>> official
>>>>
>>>>
>>>>>>>> business of Sender. This transmission is of a confidential nature
>>>>>>>>
>>>>>>>>
>>>> and
>>>>
>>>>
>>>>>>>> Sender does not endorse distribution to any party other than
>>>>>>>>
>>>>>>>>
>>>> intended
>>>>
>>>>
>>>>>>>> recipient. Sender does not necessarily endorse content contained
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>> within
>>>>>>
>>>>>>
>>>>>>
>>>>>>>> this transmission.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> Date: Thu, 28 Aug 2008 11:02:52 +0200
>>>>>>>>> From: sw2018@gmx.com
>>>>>>>>> Subject: Re: Re: Can't execute servlet project
>>>>>>>>> To: users@tomcat.apache.org; users@tomcat.apache.org
>>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I couldn't find an installation document about installing the
>>>>>>>>>
>>>>>>>>>
>>>> driver.
>>>>
>>>>
>>>>>>>>> I;ve downloaded the driver:
>>>>>>>>>
>>>>>>>>> linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls
>>>>>>>>> mysql-connector-java-5.1.3-rc-bin.jar
>>>>>>>>> mysql-connector-java-5.1.3-rc-bin.jar
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Do you know how to configure tomcat to make use of it?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>>
>>>>>>>>> Sam
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
Thanks David,
After copied the jstl and standard dot jar files into the directory:
linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/lib # ls
. .. jstl.jar mysql-connector-java-5.1.3-rc-bin.jar standard.jar
I got the following different errors:
(In line 4, what is jdbc/TestDB? I have database called javatest, and table
testdata. Should I rename it to jdbc/javatest?
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception org.apache.jasper.JasperException: Exception in JSP:
/testdb.jsp:4
1: <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
2: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
3:
4: <sql:query var="rs" dataSource="jdbc/TestDB">
5: select id, foo, bar from testdata
6: </sql:query>
7:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
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)
root cause javax.servlet.ServletException: Unable to get connection,
DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
create JDBC driver of class '' for connect URL 'null'"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
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)
root cause javax.servlet.jsp.JspException: Unable to get connection,
DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
create JDBC driver of class '' for connect URL 'null'"
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
org.apache.jsp.testdb_jsp._jspx_meth_sql_005fquery_005f0(testdb_jsp.java:101)
org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:58)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
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)
> ----- Original Message -----
> From: David Smith
> Sent: 03/09/08 01:23 am
> To: Tomcat Users List
> Subject: Re: Can't execute servlet project
>
> Download the binary zip file and expand it. Within it is a lib
> directory with just standard.jar and jstl.jar.
>
> --David
>
> sam wun wrote:
> > I just went to the website , very confused.
> >
> > The taglib file is not a jar file. they are binary or source file.
> >
> > And I couldn't find standard.jar file either.
> >
> >
> >
> > Thanks
> >
> >
> >
> >
> >> ----- Original Message -----
> >> From: David Smith
> >> Sent: 02/09/08 11:44 pm
> >> To: Tomcat Users List
> >> Subject: Re: Can't execute servlet project
> >>
> >> Hmmm... good question. I moved over to Maven and don't manually
> >> download these any more. This looks like it should do the trick:
> >>
> >> Try
> >>
> http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi
> >>
> >> --David
> >>
> >> sam wun wrote:
> >>
> >>> Hi David,
> >>>
> >>>
> >>>
> >>> No, I don't have this 2 jar files in the common/lib/ directory.
> >>>
> >>> where can I download it from?
> >>>
> >>>
> >>>
> >>> Thanks
> >>>
> >>> Sam
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>> ----- Original Message -----
> >>>> From: David Smith
> >>>> Sent: 02/09/08 10:39 pm
> >>>> To: Tomcat Users List
> >>>> Subject: Re: Can't execute servlet project
> >>>>
> >>>> Do you have jstl.jar and standard.jar in your WEB-INF/lib directory?
> >>>>
> >>>> --David
> >>>>
> >>>> sam wun wrote:
> >>>>
> >>>>
> >>>>> Hi,
> >>>>>
> >>>>>
> >>>>>
> >>>>> I have added testdb.jsp in the following path in Suse linux (the
> >>>>>
> >> tomcat
> >>
> >>>>> server):
> >>>>>
> >>>>> /tomcat/apache-tomcat-5.5.26/webapps/DBTest/
> >>>>>
> >>>>>
> >>>>>
> >>>>> The content of the testdb.jsp code is:
> >>>>>
> >>>>>
> >>>>>
> >>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> >>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> >>>>>
> >>>>> <sql:query var="rs" dataSource="jdbc/TestDB">
> >>>>> select FIRST_NAME from DBTest.Customer
> >>>>> </sql:query>
> >>>>>
> >>>>> <html>
> >>>>> <head>
> >>>>> <title>DB Test</title>
> >>>>> </head>
> >>>>> <body>
> >>>>>
> >>>>> <h2>Results</h2>
> >>>>>
> >>>>> <c:forEach var="row" items="${rs.rows}">
> >>>>> Foo ${row.foo}<br/>
> >>>>> Bar ${row.bar}<br/>
> >>>>> </c:forEach>
> >>>>>
> >>>>> </body>
> >>>>> </html>
> >>>>>
> >>>>>
> >>>>>
> >>>>> when I execute url 10.1.9.1:8080/testdb.jsp in firefox web browser,
> >>>>>
> >> it
> >>
> >>>>> shown the following error:
> >>>>>
> >>>>> HTTP Status 500 -
> >>>>>
> >>>>> 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)
> >>>>>
> >>>>> Here is the web.xml file I got:
> >>>>>
> >>>>> (in the path /tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/)
> >>>>>
> >>>>>
> >>>>>
> >>>>> <?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>
> >>>>> Create customer servlet</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>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> Thanks
> >>>>>
> >>>>> Sam
> >>>>>
> >>>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>> ----- Original Message -----
> >>>>>> From: Martin Gainty
> >>>>>> Sent: 28/08/08 10:07 pm
> >>>>>> To: sw2018@gmx.com
> >>>>>> Subject: RE: Can't execute servlet project
> >>>>>>
> >>>>>> david's advice is correct..
> >>>>>>
> >>>>>> configure ./META-INF/ApplicationContext.xml
> >>>>>> <Context path="/DBTest" docBase="DBTest"
> >>>>>> debug="5" reloadable="true" crossContext="true">
> >>>>>>
> >>>>>> <!-- maxActive: Maximum number of dB connections in pool. Make
> >>>>>>
> >>>>>>
> >>>> sure
> >>>>
> >>>>
> >>>>>> you
> >>>>>> configure your mysqld max_connections large enough to
> >>>>>>
> >> handle
> >>
> >>>>>> all of your db connections. Set to 0 for no limit.
> >>>>>> -->
> >>>>>>
> >>>>>> <!-- maxIdle: Maximum number of idle dB connections to retain
> in
> >>>>>> pool.
> >>>>>> Set to -1 for no limit. See also the DBCP documentation
> on
> >>>>>>
> >>>>>>
> >>>> this
> >>>>
> >>>>
> >>>>>> and the minEvictableIdleTimeMillis configuration
> parameter.
> >>>>>> -->
> >>>>>>
> >>>>>> <!-- maxWait: Maximum time to wait for a dB connection to
> become
> >>>>>> available
> >>>>>> in ms, in this example 10 seconds. An Exception is thrown
> >>>>>>
> >> if
> >>
> >>>>>> this timeout is exceeded. Set to -1 to wait
> indefinitely.
> >>>>>> -->
> >>>>>>
> >>>>>> <!-- username and password: MySQL dB username and password for
> >>>>>>
> >> dB
> >>
> >>>>>> connections -->
> >>>>>>
> >>>>>> <!-- driverClassName: Class name for the old mm.mysql JDBC
> >>>>>>
> >> driver
> >>
> >>>>>>
> >>>>>>
> >>>> is
> >>>>
> >>>>
> >>>>>> org.gjt.mm.mysql.Driver - we recommend using Connector/J
> >>>>>>
> >>>>>>
> >>>> though.
> >>>>
> >>>>
> >>>>>> Class name for the official MySQL Connector/J driver is
> >>>>>> com.mysql.jdbc.Driver.
> >>>>>> -->
> >>>>>>
> >>>>>> <!-- url: The JDBC connection url for connecting to your MySQL
> >>>>>>
> >> dB.
> >>
> >>>>>> The autoReconnect=true argument to the url makes sure
> that
> >>>>>>
> >>>>>>
> >>>> the
> >>>>
> >>>>
> >>>>>> mm.mysql JDBC Driver will automatically reconnect if
> mysqld
> >>>>>> closed the
> >>>>>> connection. mysqld by default closes idle connections
> >>>>>>
> >> after
> >>
> >>>>>>
> >>>>>>
> >>>> 8
> >>>>
> >>>>
> >>>>>> hours.
> >>>>>> -->
> >>>>>>
> >>>>>> <Resource name="jdbc/TestDB" auth="Container"
> >>>>>> type="javax.sql.DataSource"
> >>>>>> maxActive="100" maxIdle="30" maxWait="10000"
> >>>>>> username="javauser" password="javadude"
> >>>>>> driverClassName="com.mysql.jdbc.Driver"
> >>>>>>
> >>>>>> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
> >>>>>>
> >>>>>> </Context>
> >>>>>> //sub in the username and password for the DB
> >>>>>> also in /WEB-INF/web.xml you would need this entry
> >>>>>> <web-app 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"
> >>>>>> version="2.4">
> >>>>>> <description>MySQL Test App</description>
> >>>>>> <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>
> >>>>>> then put in this test code changing :
> >>>>>> DBNAME to the name of your Database
> >>>>>> TABLE to the name of the table in DBNAME you want to query
> >>>>>> COLUMN for the specific attribute to query
> >>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> >>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> >>>>>>
> >>>>>> <sql:query var="rs" dataSource="jdbc/TestDB">
> >>>>>> select COLUMN from DBNAME.TABLE
> >>>>>> </sql:query>
> >>>>>>
> >>>>>> <html>
> >>>>>> <head>
> >>>>>> <title>DB Test</title>
> >>>>>> </head>
> >>>>>> <body>
> >>>>>>
> >>>>>> <h2>Results</h2>
> >>>>>>
> >>>>>> <c:forEach var="row" items="${rs.rows}">
> >>>>>> Foo ${row.foo}<br/>
> >>>>>> Bar ${row.bar}<br/>
> >>>>>> </c:forEach>
> >>>>>>
> >>>>>> </body>
> >>>>>> </html>
> >>>>>>
> >>>>>> if you need UNICODE support or Character Large Object (strings >
> 64k
> >>>>>>
> >>>>>>
> >>>> in
> >>>>
> >>>>
> >>>>>> length) download JDBC 4 driver
> >>>>>> http://dev.mysql.com/downloads/connector/j/5.1.html
> >>>>>>
> >>>>>> personally I am using the 'older' version of MYSQL so I use the
> 3.1
> >>>>>>
> >>>>>>
> >>>> jar
> >>>>
> >>>>
> >>>>>> which you can acquire here
> >>>>>> http://dev.mysql.com/downloads/connector/j
> >>>>>>
> >>>>>> location of driver classes:
> >>>>>>
> >>>>>> is located in $TOMCAT_HOME/common/lib
> >>>>>> personally I dont like putting anything in common since it will
> >>>>>>
> >> affect
> >>
> >>>>>> all webapps but i usually
> >>>>>> place in /WEB-INF/lib
> >>>>>>
> >>>>>> and please follow david's advice and read the tutorial
> >>>>>>
> >>>>>> Martin
> >>>>>> ______________________________________________
> >>>>>> Disclaimer and confidentiality note
> >>>>>> Everything in this e-mail and any attachments relates to the
> >>>>>>
> >> official
> >>
> >>>>>> business of Sender. This transmission is of a confidential nature
> >>>>>>
> >> and
> >>
> >>>>>> Sender does not endorse distribution to any party other than
> >>>>>>
> >> intended
> >>
> >>>>>> recipient. Sender does not necessarily endorse content contained
> >>>>>>
> >>>>>>
> >>>> within
> >>>>
> >>>>
> >>>>>> this transmission.
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> Date: Thu, 28 Aug 2008 11:02:52 +0200
> >>>>>>> From: sw2018@gmx.com
> >>>>>>> Subject: Re: Re: Can't execute servlet project
> >>>>>>> To: users@tomcat.apache.org; users@tomcat.apache.org
> >>>>>>>
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> I couldn't find an installation document about installing the
> >>>>>>>
> >> driver.
> >>
> >>>>>>> I;ve downloaded the driver:
> >>>>>>>
> >>>>>>> linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls
> >>>>>>> mysql-connector-java-5.1.3-rc-bin.jar
> >>>>>>> mysql-connector-java-5.1.3-rc-bin.jar
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> Do you know how to configure tomcat to make use of it?
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> Thanks
> >>>>>>>
> >>>>>>> Sam
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >> ---------------------------------------------------------------------
> >> To start a new topic, e-mail: users@tomcat.apache.org
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
> >
>
>
> --
> 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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: Can't execute servlet project
Posted by David Smith <dn...@cornell.edu>.
Download the binary zip file and expand it. Within it is a lib
directory with just standard.jar and jstl.jar.
--David
sam wun wrote:
> I just went to the website , very confused.
>
> The taglib file is not a jar file. they are binary or source file.
>
> And I couldn't find standard.jar file either.
>
>
>
> Thanks
>
>
>
>
>> ----- Original Message -----
>> From: David Smith
>> Sent: 02/09/08 11:44 pm
>> To: Tomcat Users List
>> Subject: Re: Can't execute servlet project
>>
>> Hmmm... good question. I moved over to Maven and don't manually
>> download these any more. This looks like it should do the trick:
>>
>> Try
>> http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi
>>
>> --David
>>
>> sam wun wrote:
>>
>>> Hi David,
>>>
>>>
>>>
>>> No, I don't have this 2 jar files in the common/lib/ directory.
>>>
>>> where can I download it from?
>>>
>>>
>>>
>>> Thanks
>>>
>>> Sam
>>>
>>>
>>>
>>>
>>>
>>>
>>>> ----- Original Message -----
>>>> From: David Smith
>>>> Sent: 02/09/08 10:39 pm
>>>> To: Tomcat Users List
>>>> Subject: Re: Can't execute servlet project
>>>>
>>>> Do you have jstl.jar and standard.jar in your WEB-INF/lib directory?
>>>>
>>>> --David
>>>>
>>>> sam wun wrote:
>>>>
>>>>
>>>>> Hi,
>>>>>
>>>>>
>>>>>
>>>>> I have added testdb.jsp in the following path in Suse linux (the
>>>>>
>> tomcat
>>
>>>>> server):
>>>>>
>>>>> /tomcat/apache-tomcat-5.5.26/webapps/DBTest/
>>>>>
>>>>>
>>>>>
>>>>> The content of the testdb.jsp code is:
>>>>>
>>>>>
>>>>>
>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>>>>>
>>>>> <sql:query var="rs" dataSource="jdbc/TestDB">
>>>>> select FIRST_NAME from DBTest.Customer
>>>>> </sql:query>
>>>>>
>>>>> <html>
>>>>> <head>
>>>>> <title>DB Test</title>
>>>>> </head>
>>>>> <body>
>>>>>
>>>>> <h2>Results</h2>
>>>>>
>>>>> <c:forEach var="row" items="${rs.rows}">
>>>>> Foo ${row.foo}<br/>
>>>>> Bar ${row.bar}<br/>
>>>>> </c:forEach>
>>>>>
>>>>> </body>
>>>>> </html>
>>>>>
>>>>>
>>>>>
>>>>> when I execute url 10.1.9.1:8080/testdb.jsp in firefox web browser,
>>>>>
>> it
>>
>>>>> shown the following error:
>>>>>
>>>>> HTTP Status 500 -
>>>>>
>>>>> 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)
>>>>>
>>>>> Here is the web.xml file I got:
>>>>>
>>>>> (in the path /tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/)
>>>>>
>>>>>
>>>>>
>>>>> <?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>
>>>>> Create customer servlet</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>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Thanks
>>>>>
>>>>> Sam
>>>>>
>>>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> ----- Original Message -----
>>>>>> From: Martin Gainty
>>>>>> Sent: 28/08/08 10:07 pm
>>>>>> To: sw2018@gmx.com
>>>>>> Subject: RE: Can't execute servlet project
>>>>>>
>>>>>> david's advice is correct..
>>>>>>
>>>>>> configure ./META-INF/ApplicationContext.xml
>>>>>> <Context path="/DBTest" docBase="DBTest"
>>>>>> debug="5" reloadable="true" crossContext="true">
>>>>>>
>>>>>> <!-- maxActive: Maximum number of dB connections in pool. Make
>>>>>>
>>>>>>
>>>> sure
>>>>
>>>>
>>>>>> you
>>>>>> configure your mysqld max_connections large enough to
>>>>>>
>> handle
>>
>>>>>> all of your db connections. Set to 0 for no limit.
>>>>>> -->
>>>>>>
>>>>>> <!-- maxIdle: Maximum number of idle dB connections to retain in
>>>>>> pool.
>>>>>> Set to -1 for no limit. See also the DBCP documentation on
>>>>>>
>>>>>>
>>>> this
>>>>
>>>>
>>>>>> and the minEvictableIdleTimeMillis configuration parameter.
>>>>>> -->
>>>>>>
>>>>>> <!-- maxWait: Maximum time to wait for a dB connection to become
>>>>>> available
>>>>>> in ms, in this example 10 seconds. An Exception is thrown
>>>>>>
>> if
>>
>>>>>> this timeout is exceeded. Set to -1 to wait indefinitely.
>>>>>> -->
>>>>>>
>>>>>> <!-- username and password: MySQL dB username and password for
>>>>>>
>> dB
>>
>>>>>> connections -->
>>>>>>
>>>>>> <!-- driverClassName: Class name for the old mm.mysql JDBC
>>>>>>
>> driver
>>
>>>>>>
>>>>>>
>>>> is
>>>>
>>>>
>>>>>> org.gjt.mm.mysql.Driver - we recommend using Connector/J
>>>>>>
>>>>>>
>>>> though.
>>>>
>>>>
>>>>>> Class name for the official MySQL Connector/J driver is
>>>>>> com.mysql.jdbc.Driver.
>>>>>> -->
>>>>>>
>>>>>> <!-- url: The JDBC connection url for connecting to your MySQL
>>>>>>
>> dB.
>>
>>>>>> The autoReconnect=true argument to the url makes sure that
>>>>>>
>>>>>>
>>>> the
>>>>
>>>>
>>>>>> mm.mysql JDBC Driver will automatically reconnect if mysqld
>>>>>> closed the
>>>>>> connection. mysqld by default closes idle connections
>>>>>>
>> after
>>
>>>>>>
>>>>>>
>>>> 8
>>>>
>>>>
>>>>>> hours.
>>>>>> -->
>>>>>>
>>>>>> <Resource name="jdbc/TestDB" auth="Container"
>>>>>> type="javax.sql.DataSource"
>>>>>> maxActive="100" maxIdle="30" maxWait="10000"
>>>>>> username="javauser" password="javadude"
>>>>>> driverClassName="com.mysql.jdbc.Driver"
>>>>>>
>>>>>> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
>>>>>>
>>>>>> </Context>
>>>>>> //sub in the username and password for the DB
>>>>>> also in /WEB-INF/web.xml you would need this entry
>>>>>> <web-app 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"
>>>>>> version="2.4">
>>>>>> <description>MySQL Test App</description>
>>>>>> <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>
>>>>>> then put in this test code changing :
>>>>>> DBNAME to the name of your Database
>>>>>> TABLE to the name of the table in DBNAME you want to query
>>>>>> COLUMN for the specific attribute to query
>>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
>>>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>>>>>>
>>>>>> <sql:query var="rs" dataSource="jdbc/TestDB">
>>>>>> select COLUMN from DBNAME.TABLE
>>>>>> </sql:query>
>>>>>>
>>>>>> <html>
>>>>>> <head>
>>>>>> <title>DB Test</title>
>>>>>> </head>
>>>>>> <body>
>>>>>>
>>>>>> <h2>Results</h2>
>>>>>>
>>>>>> <c:forEach var="row" items="${rs.rows}">
>>>>>> Foo ${row.foo}<br/>
>>>>>> Bar ${row.bar}<br/>
>>>>>> </c:forEach>
>>>>>>
>>>>>> </body>
>>>>>> </html>
>>>>>>
>>>>>> if you need UNICODE support or Character Large Object (strings > 64k
>>>>>>
>>>>>>
>>>> in
>>>>
>>>>
>>>>>> length) download JDBC 4 driver
>>>>>> http://dev.mysql.com/downloads/connector/j/5.1.html
>>>>>>
>>>>>> personally I am using the 'older' version of MYSQL so I use the 3.1
>>>>>>
>>>>>>
>>>> jar
>>>>
>>>>
>>>>>> which you can acquire here
>>>>>> http://dev.mysql.com/downloads/connector/j
>>>>>>
>>>>>> location of driver classes:
>>>>>>
>>>>>> is located in $TOMCAT_HOME/common/lib
>>>>>> personally I dont like putting anything in common since it will
>>>>>>
>> affect
>>
>>>>>> all webapps but i usually
>>>>>> place in /WEB-INF/lib
>>>>>>
>>>>>> and please follow david's advice and read the tutorial
>>>>>>
>>>>>> Martin
>>>>>> ______________________________________________
>>>>>> Disclaimer and confidentiality note
>>>>>> Everything in this e-mail and any attachments relates to the
>>>>>>
>> official
>>
>>>>>> business of Sender. This transmission is of a confidential nature
>>>>>>
>> and
>>
>>>>>> Sender does not endorse distribution to any party other than
>>>>>>
>> intended
>>
>>>>>> recipient. Sender does not necessarily endorse content contained
>>>>>>
>>>>>>
>>>> within
>>>>
>>>>
>>>>>> this transmission.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Date: Thu, 28 Aug 2008 11:02:52 +0200
>>>>>>> From: sw2018@gmx.com
>>>>>>> Subject: Re: Re: Can't execute servlet project
>>>>>>> To: users@tomcat.apache.org; users@tomcat.apache.org
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I couldn't find an installation document about installing the
>>>>>>>
>> driver.
>>
>>>>>>> I;ve downloaded the driver:
>>>>>>>
>>>>>>> linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls
>>>>>>> mysql-connector-java-5.1.3-rc-bin.jar
>>>>>>> mysql-connector-java-5.1.3-rc-bin.jar
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Do you know how to configure tomcat to make use of it?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> Sam
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
--
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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
I just went to the website , very confused.
The taglib file is not a jar file. they are binary or source file.
And I couldn't find standard.jar file either.
Thanks
> ----- Original Message -----
> From: David Smith
> Sent: 02/09/08 11:44 pm
> To: Tomcat Users List
> Subject: Re: Can't execute servlet project
>
> Hmmm... good question. I moved over to Maven and don't manually
> download these any more. This looks like it should do the trick:
>
> Try
> http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi
>
> --David
>
> sam wun wrote:
> > Hi David,
> >
> >
> >
> > No, I don't have this 2 jar files in the common/lib/ directory.
> >
> > where can I download it from?
> >
> >
> >
> > Thanks
> >
> > Sam
> >
> >
> >
> >
> >
> >> ----- Original Message -----
> >> From: David Smith
> >> Sent: 02/09/08 10:39 pm
> >> To: Tomcat Users List
> >> Subject: Re: Can't execute servlet project
> >>
> >> Do you have jstl.jar and standard.jar in your WEB-INF/lib directory?
> >>
> >> --David
> >>
> >> sam wun wrote:
> >>
> >>> Hi,
> >>>
> >>>
> >>>
> >>> I have added testdb.jsp in the following path in Suse linux (the
> tomcat
> >>> server):
> >>>
> >>> /tomcat/apache-tomcat-5.5.26/webapps/DBTest/
> >>>
> >>>
> >>>
> >>> The content of the testdb.jsp code is:
> >>>
> >>>
> >>>
> >>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> >>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> >>>
> >>> <sql:query var="rs" dataSource="jdbc/TestDB">
> >>> select FIRST_NAME from DBTest.Customer
> >>> </sql:query>
> >>>
> >>> <html>
> >>> <head>
> >>> <title>DB Test</title>
> >>> </head>
> >>> <body>
> >>>
> >>> <h2>Results</h2>
> >>>
> >>> <c:forEach var="row" items="${rs.rows}">
> >>> Foo ${row.foo}<br/>
> >>> Bar ${row.bar}<br/>
> >>> </c:forEach>
> >>>
> >>> </body>
> >>> </html>
> >>>
> >>>
> >>>
> >>> when I execute url 10.1.9.1:8080/testdb.jsp in firefox web browser,
> it
> >>> shown the following error:
> >>>
> >>> HTTP Status 500 -
> >>>
> >>> 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)
> >>>
> >>> Here is the web.xml file I got:
> >>>
> >>> (in the path /tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/)
> >>>
> >>>
> >>>
> >>> <?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>
> >>> Create customer servlet</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>
> >>>
> >>>
> >>>
> >>>
> >>> Thanks
> >>>
> >>> Sam
> >>>
> >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >>>
> >>>
> >>>
> >>>> ----- Original Message -----
> >>>> From: Martin Gainty
> >>>> Sent: 28/08/08 10:07 pm
> >>>> To: sw2018@gmx.com
> >>>> Subject: RE: Can't execute servlet project
> >>>>
> >>>> david's advice is correct..
> >>>>
> >>>> configure ./META-INF/ApplicationContext.xml
> >>>> <Context path="/DBTest" docBase="DBTest"
> >>>> debug="5" reloadable="true" crossContext="true">
> >>>>
> >>>> <!-- maxActive: Maximum number of dB connections in pool. Make
> >>>>
> >> sure
> >>
> >>>> you
> >>>> configure your mysqld max_connections large enough to
> handle
> >>>> all of your db connections. Set to 0 for no limit.
> >>>> -->
> >>>>
> >>>> <!-- maxIdle: Maximum number of idle dB connections to retain in
> >>>> pool.
> >>>> Set to -1 for no limit. See also the DBCP documentation on
> >>>>
> >> this
> >>
> >>>> and the minEvictableIdleTimeMillis configuration parameter.
> >>>> -->
> >>>>
> >>>> <!-- maxWait: Maximum time to wait for a dB connection to become
> >>>> available
> >>>> in ms, in this example 10 seconds. An Exception is thrown
> if
> >>>> this timeout is exceeded. Set to -1 to wait indefinitely.
> >>>> -->
> >>>>
> >>>> <!-- username and password: MySQL dB username and password for
> dB
> >>>> connections -->
> >>>>
> >>>> <!-- driverClassName: Class name for the old mm.mysql JDBC
> driver
> >>>>
> >> is
> >>
> >>>> org.gjt.mm.mysql.Driver - we recommend using Connector/J
> >>>>
> >> though.
> >>
> >>>> Class name for the official MySQL Connector/J driver is
> >>>> com.mysql.jdbc.Driver.
> >>>> -->
> >>>>
> >>>> <!-- url: The JDBC connection url for connecting to your MySQL
> dB.
> >>>> The autoReconnect=true argument to the url makes sure that
> >>>>
> >> the
> >>
> >>>> mm.mysql JDBC Driver will automatically reconnect if mysqld
> >>>> closed the
> >>>> connection. mysqld by default closes idle connections
> after
> >>>>
> >> 8
> >>
> >>>> hours.
> >>>> -->
> >>>>
> >>>> <Resource name="jdbc/TestDB" auth="Container"
> >>>> type="javax.sql.DataSource"
> >>>> maxActive="100" maxIdle="30" maxWait="10000"
> >>>> username="javauser" password="javadude"
> >>>> driverClassName="com.mysql.jdbc.Driver"
> >>>>
> >>>> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
> >>>>
> >>>> </Context>
> >>>> //sub in the username and password for the DB
> >>>> also in /WEB-INF/web.xml you would need this entry
> >>>> <web-app 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"
> >>>> version="2.4">
> >>>> <description>MySQL Test App</description>
> >>>> <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>
> >>>> then put in this test code changing :
> >>>> DBNAME to the name of your Database
> >>>> TABLE to the name of the table in DBNAME you want to query
> >>>> COLUMN for the specific attribute to query
> >>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> >>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> >>>>
> >>>> <sql:query var="rs" dataSource="jdbc/TestDB">
> >>>> select COLUMN from DBNAME.TABLE
> >>>> </sql:query>
> >>>>
> >>>> <html>
> >>>> <head>
> >>>> <title>DB Test</title>
> >>>> </head>
> >>>> <body>
> >>>>
> >>>> <h2>Results</h2>
> >>>>
> >>>> <c:forEach var="row" items="${rs.rows}">
> >>>> Foo ${row.foo}<br/>
> >>>> Bar ${row.bar}<br/>
> >>>> </c:forEach>
> >>>>
> >>>> </body>
> >>>> </html>
> >>>>
> >>>> if you need UNICODE support or Character Large Object (strings > 64k
> >>>>
> >> in
> >>
> >>>> length) download JDBC 4 driver
> >>>> http://dev.mysql.com/downloads/connector/j/5.1.html
> >>>>
> >>>> personally I am using the 'older' version of MYSQL so I use the 3.1
> >>>>
> >> jar
> >>
> >>>> which you can acquire here
> >>>> http://dev.mysql.com/downloads/connector/j
> >>>>
> >>>> location of driver classes:
> >>>>
> >>>> is located in $TOMCAT_HOME/common/lib
> >>>> personally I dont like putting anything in common since it will
> affect
> >>>> all webapps but i usually
> >>>> place in /WEB-INF/lib
> >>>>
> >>>> and please follow david's advice and read the tutorial
> >>>>
> >>>> Martin
> >>>> ______________________________________________
> >>>> Disclaimer and confidentiality note
> >>>> Everything in this e-mail and any attachments relates to the
> official
> >>>> business of Sender. This transmission is of a confidential nature
> and
> >>>> Sender does not endorse distribution to any party other than
> intended
> >>>> recipient. Sender does not necessarily endorse content contained
> >>>>
> >> within
> >>
> >>>> this transmission.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>> Date: Thu, 28 Aug 2008 11:02:52 +0200
> >>>>> From: sw2018@gmx.com
> >>>>> Subject: Re: Re: Can't execute servlet project
> >>>>> To: users@tomcat.apache.org; users@tomcat.apache.org
> >>>>>
> >>>>> Hi,
> >>>>>
> >>>>>
> >>>>>
> >>>>> I couldn't find an installation document about installing the
> driver.
> >>>>>
> >>>>> I;ve downloaded the driver:
> >>>>>
> >>>>> linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls
> >>>>> mysql-connector-java-5.1.3-rc-bin.jar
> >>>>> mysql-connector-java-5.1.3-rc-bin.jar
> >>>>>
> >>>>>
> >>>>>
> >>>>> Do you know how to configure tomcat to make use of it?
> >>>>>
> >>>>>
> >>>>>
> >>>>> Thanks
> >>>>>
> >>>>> Sam
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: Can't execute servlet project
Posted by David Smith <dn...@cornell.edu>.
Hmmm... good question. I moved over to Maven and don't manually
download these any more. This looks like it should do the trick:
Try http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi
--David
sam wun wrote:
> Hi David,
>
>
>
> No, I don't have this 2 jar files in the common/lib/ directory.
>
> where can I download it from?
>
>
>
> Thanks
>
> Sam
>
>
>
>
>
>> ----- Original Message -----
>> From: David Smith
>> Sent: 02/09/08 10:39 pm
>> To: Tomcat Users List
>> Subject: Re: Can't execute servlet project
>>
>> Do you have jstl.jar and standard.jar in your WEB-INF/lib directory?
>>
>> --David
>>
>> sam wun wrote:
>>
>>> Hi,
>>>
>>>
>>>
>>> I have added testdb.jsp in the following path in Suse linux (the tomcat
>>> server):
>>>
>>> /tomcat/apache-tomcat-5.5.26/webapps/DBTest/
>>>
>>>
>>>
>>> The content of the testdb.jsp code is:
>>>
>>>
>>>
>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>>>
>>> <sql:query var="rs" dataSource="jdbc/TestDB">
>>> select FIRST_NAME from DBTest.Customer
>>> </sql:query>
>>>
>>> <html>
>>> <head>
>>> <title>DB Test</title>
>>> </head>
>>> <body>
>>>
>>> <h2>Results</h2>
>>>
>>> <c:forEach var="row" items="${rs.rows}">
>>> Foo ${row.foo}<br/>
>>> Bar ${row.bar}<br/>
>>> </c:forEach>
>>>
>>> </body>
>>> </html>
>>>
>>>
>>>
>>> when I execute url 10.1.9.1:8080/testdb.jsp in firefox web browser, it
>>> shown the following error:
>>>
>>> HTTP Status 500 -
>>>
>>> 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)
>>>
>>> Here is the web.xml file I got:
>>>
>>> (in the path /tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/)
>>>
>>>
>>>
>>> <?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>
>>> Create customer servlet</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>
>>>
>>>
>>>
>>>
>>> Thanks
>>>
>>> Sam
>>>
>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>>
>>>
>>>
>>>> ----- Original Message -----
>>>> From: Martin Gainty
>>>> Sent: 28/08/08 10:07 pm
>>>> To: sw2018@gmx.com
>>>> Subject: RE: Can't execute servlet project
>>>>
>>>> david's advice is correct..
>>>>
>>>> configure ./META-INF/ApplicationContext.xml
>>>> <Context path="/DBTest" docBase="DBTest"
>>>> debug="5" reloadable="true" crossContext="true">
>>>>
>>>> <!-- maxActive: Maximum number of dB connections in pool. Make
>>>>
>> sure
>>
>>>> you
>>>> configure your mysqld max_connections large enough to handle
>>>> all of your db connections. Set to 0 for no limit.
>>>> -->
>>>>
>>>> <!-- maxIdle: Maximum number of idle dB connections to retain in
>>>> pool.
>>>> Set to -1 for no limit. See also the DBCP documentation on
>>>>
>> this
>>
>>>> and the minEvictableIdleTimeMillis configuration parameter.
>>>> -->
>>>>
>>>> <!-- maxWait: Maximum time to wait for a dB connection to become
>>>> available
>>>> in ms, in this example 10 seconds. An Exception is thrown if
>>>> this timeout is exceeded. Set to -1 to wait indefinitely.
>>>> -->
>>>>
>>>> <!-- username and password: MySQL dB username and password for dB
>>>> connections -->
>>>>
>>>> <!-- driverClassName: Class name for the old mm.mysql JDBC driver
>>>>
>> is
>>
>>>> org.gjt.mm.mysql.Driver - we recommend using Connector/J
>>>>
>> though.
>>
>>>> Class name for the official MySQL Connector/J driver is
>>>> com.mysql.jdbc.Driver.
>>>> -->
>>>>
>>>> <!-- url: The JDBC connection url for connecting to your MySQL dB.
>>>> The autoReconnect=true argument to the url makes sure that
>>>>
>> the
>>
>>>> mm.mysql JDBC Driver will automatically reconnect if mysqld
>>>> closed the
>>>> connection. mysqld by default closes idle connections after
>>>>
>> 8
>>
>>>> hours.
>>>> -->
>>>>
>>>> <Resource name="jdbc/TestDB" auth="Container"
>>>> type="javax.sql.DataSource"
>>>> maxActive="100" maxIdle="30" maxWait="10000"
>>>> username="javauser" password="javadude"
>>>> driverClassName="com.mysql.jdbc.Driver"
>>>>
>>>> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
>>>>
>>>> </Context>
>>>> //sub in the username and password for the DB
>>>> also in /WEB-INF/web.xml you would need this entry
>>>> <web-app 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"
>>>> version="2.4">
>>>> <description>MySQL Test App</description>
>>>> <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>
>>>> then put in this test code changing :
>>>> DBNAME to the name of your Database
>>>> TABLE to the name of the table in DBNAME you want to query
>>>> COLUMN for the specific attribute to query
>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>>>>
>>>> <sql:query var="rs" dataSource="jdbc/TestDB">
>>>> select COLUMN from DBNAME.TABLE
>>>> </sql:query>
>>>>
>>>> <html>
>>>> <head>
>>>> <title>DB Test</title>
>>>> </head>
>>>> <body>
>>>>
>>>> <h2>Results</h2>
>>>>
>>>> <c:forEach var="row" items="${rs.rows}">
>>>> Foo ${row.foo}<br/>
>>>> Bar ${row.bar}<br/>
>>>> </c:forEach>
>>>>
>>>> </body>
>>>> </html>
>>>>
>>>> if you need UNICODE support or Character Large Object (strings > 64k
>>>>
>> in
>>
>>>> length) download JDBC 4 driver
>>>> http://dev.mysql.com/downloads/connector/j/5.1.html
>>>>
>>>> personally I am using the 'older' version of MYSQL so I use the 3.1
>>>>
>> jar
>>
>>>> which you can acquire here
>>>> http://dev.mysql.com/downloads/connector/j
>>>>
>>>> location of driver classes:
>>>>
>>>> is located in $TOMCAT_HOME/common/lib
>>>> personally I dont like putting anything in common since it will affect
>>>> all webapps but i usually
>>>> place in /WEB-INF/lib
>>>>
>>>> and please follow david's advice and read the tutorial
>>>>
>>>> Martin
>>>> ______________________________________________
>>>> Disclaimer and confidentiality note
>>>> Everything in this e-mail and any attachments relates to the official
>>>> business of Sender. This transmission is of a confidential nature and
>>>> Sender does not endorse distribution to any party other than intended
>>>> recipient. Sender does not necessarily endorse content contained
>>>>
>> within
>>
>>>> this transmission.
>>>>
>>>>
>>>>
>>>>
>>>>> Date: Thu, 28 Aug 2008 11:02:52 +0200
>>>>> From: sw2018@gmx.com
>>>>> Subject: Re: Re: Can't execute servlet project
>>>>> To: users@tomcat.apache.org; users@tomcat.apache.org
>>>>>
>>>>> Hi,
>>>>>
>>>>>
>>>>>
>>>>> I couldn't find an installation document about installing the driver.
>>>>>
>>>>> I;ve downloaded the driver:
>>>>>
>>>>> linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls
>>>>> mysql-connector-java-5.1.3-rc-bin.jar
>>>>> mysql-connector-java-5.1.3-rc-bin.jar
>>>>>
>>>>>
>>>>>
>>>>> Do you know how to configure tomcat to make use of it?
>>>>>
>>>>>
>>>>>
>>>>> Thanks
>>>>>
>>>>> Sam
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
Hi David,
No, I don't have this 2 jar files in the common/lib/ directory.
where can I download it from?
Thanks
Sam
> ----- Original Message -----
> From: David Smith
> Sent: 02/09/08 10:39 pm
> To: Tomcat Users List
> Subject: Re: Can't execute servlet project
>
> Do you have jstl.jar and standard.jar in your WEB-INF/lib directory?
>
> --David
>
> sam wun wrote:
> > Hi,
> >
> >
> >
> > I have added testdb.jsp in the following path in Suse linux (the tomcat
> > server):
> >
> > /tomcat/apache-tomcat-5.5.26/webapps/DBTest/
> >
> >
> >
> > The content of the testdb.jsp code is:
> >
> >
> >
> > <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> > <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> >
> > <sql:query var="rs" dataSource="jdbc/TestDB">
> > select FIRST_NAME from DBTest.Customer
> > </sql:query>
> >
> > <html>
> > <head>
> > <title>DB Test</title>
> > </head>
> > <body>
> >
> > <h2>Results</h2>
> >
> > <c:forEach var="row" items="${rs.rows}">
> > Foo ${row.foo}<br/>
> > Bar ${row.bar}<br/>
> > </c:forEach>
> >
> > </body>
> > </html>
> >
> >
> >
> > when I execute url 10.1.9.1:8080/testdb.jsp in firefox web browser, it
> > shown the following error:
> >
> > HTTP Status 500 -
> >
> > 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)
> >
> > Here is the web.xml file I got:
> >
> > (in the path /tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/)
> >
> >
> >
> > <?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>
> > Create customer servlet</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>
> >
> >
> >
> >
> > Thanks
> >
> > Sam
> >
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >
> >
> >> ----- Original Message -----
> >> From: Martin Gainty
> >> Sent: 28/08/08 10:07 pm
> >> To: sw2018@gmx.com
> >> Subject: RE: Can't execute servlet project
> >>
> >> david's advice is correct..
> >>
> >> configure ./META-INF/ApplicationContext.xml
> >> <Context path="/DBTest" docBase="DBTest"
> >> debug="5" reloadable="true" crossContext="true">
> >>
> >> <!-- maxActive: Maximum number of dB connections in pool. Make
> sure
> >> you
> >> configure your mysqld max_connections large enough to handle
> >> all of your db connections. Set to 0 for no limit.
> >> -->
> >>
> >> <!-- maxIdle: Maximum number of idle dB connections to retain in
> >> pool.
> >> Set to -1 for no limit. See also the DBCP documentation on
> this
> >> and the minEvictableIdleTimeMillis configuration parameter.
> >> -->
> >>
> >> <!-- maxWait: Maximum time to wait for a dB connection to become
> >> available
> >> in ms, in this example 10 seconds. An Exception is thrown if
> >> this timeout is exceeded. Set to -1 to wait indefinitely.
> >> -->
> >>
> >> <!-- username and password: MySQL dB username and password for dB
> >> connections -->
> >>
> >> <!-- driverClassName: Class name for the old mm.mysql JDBC driver
> is
> >> org.gjt.mm.mysql.Driver - we recommend using Connector/J
> though.
> >> Class name for the official MySQL Connector/J driver is
> >> com.mysql.jdbc.Driver.
> >> -->
> >>
> >> <!-- url: The JDBC connection url for connecting to your MySQL dB.
> >> The autoReconnect=true argument to the url makes sure that
> the
> >> mm.mysql JDBC Driver will automatically reconnect if mysqld
> >> closed the
> >> connection. mysqld by default closes idle connections after
> 8
> >> hours.
> >> -->
> >>
> >> <Resource name="jdbc/TestDB" auth="Container"
> >> type="javax.sql.DataSource"
> >> maxActive="100" maxIdle="30" maxWait="10000"
> >> username="javauser" password="javadude"
> >> driverClassName="com.mysql.jdbc.Driver"
> >>
> >> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
> >>
> >> </Context>
> >> //sub in the username and password for the DB
> >> also in /WEB-INF/web.xml you would need this entry
> >> <web-app 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"
> >> version="2.4">
> >> <description>MySQL Test App</description>
> >> <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>
> >> then put in this test code changing :
> >> DBNAME to the name of your Database
> >> TABLE to the name of the table in DBNAME you want to query
> >> COLUMN for the specific attribute to query
> >> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> >> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> >>
> >> <sql:query var="rs" dataSource="jdbc/TestDB">
> >> select COLUMN from DBNAME.TABLE
> >> </sql:query>
> >>
> >> <html>
> >> <head>
> >> <title>DB Test</title>
> >> </head>
> >> <body>
> >>
> >> <h2>Results</h2>
> >>
> >> <c:forEach var="row" items="${rs.rows}">
> >> Foo ${row.foo}<br/>
> >> Bar ${row.bar}<br/>
> >> </c:forEach>
> >>
> >> </body>
> >> </html>
> >>
> >> if you need UNICODE support or Character Large Object (strings > 64k
> in
> >> length) download JDBC 4 driver
> >> http://dev.mysql.com/downloads/connector/j/5.1.html
> >>
> >> personally I am using the 'older' version of MYSQL so I use the 3.1
> jar
> >> which you can acquire here
> >> http://dev.mysql.com/downloads/connector/j
> >>
> >> location of driver classes:
> >>
> >> is located in $TOMCAT_HOME/common/lib
> >> personally I dont like putting anything in common since it will affect
> >> all webapps but i usually
> >> place in /WEB-INF/lib
> >>
> >> and please follow david's advice and read the tutorial
> >>
> >> Martin
> >> ______________________________________________
> >> Disclaimer and confidentiality note
> >> Everything in this e-mail and any attachments relates to the official
> >> business of Sender. This transmission is of a confidential nature and
> >> Sender does not endorse distribution to any party other than intended
> >> recipient. Sender does not necessarily endorse content contained
> within
> >> this transmission.
> >>
> >>
> >>
> >>> Date: Thu, 28 Aug 2008 11:02:52 +0200
> >>> From: sw2018@gmx.com
> >>> Subject: Re: Re: Can't execute servlet project
> >>> To: users@tomcat.apache.org; users@tomcat.apache.org
> >>>
> >>> Hi,
> >>>
> >>>
> >>>
> >>> I couldn't find an installation document about installing the driver.
> >>>
> >>> I;ve downloaded the driver:
> >>>
> >>> linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls
> >>> mysql-connector-java-5.1.3-rc-bin.jar
> >>> mysql-connector-java-5.1.3-rc-bin.jar
> >>>
> >>>
> >>>
> >>> Do you know how to configure tomcat to make use of it?
> >>>
> >>>
> >>>
> >>> Thanks
> >>>
> >>> Sam
> >>>
> >>>
> >>>
> >>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: Can't execute servlet project
Posted by David Smith <dn...@cornell.edu>.
Do you have jstl.jar and standard.jar in your WEB-INF/lib directory?
--David
sam wun wrote:
> Hi,
>
>
>
> I have added testdb.jsp in the following path in Suse linux (the tomcat
> server):
>
> /tomcat/apache-tomcat-5.5.26/webapps/DBTest/
>
>
>
> The content of the testdb.jsp code is:
>
>
>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>
> <sql:query var="rs" dataSource="jdbc/TestDB">
> select FIRST_NAME from DBTest.Customer
> </sql:query>
>
> <html>
> <head>
> <title>DB Test</title>
> </head>
> <body>
>
> <h2>Results</h2>
>
> <c:forEach var="row" items="${rs.rows}">
> Foo ${row.foo}<br/>
> Bar ${row.bar}<br/>
> </c:forEach>
>
> </body>
> </html>
>
>
>
> when I execute url 10.1.9.1:8080/testdb.jsp in firefox web browser, it
> shown the following error:
>
> HTTP Status 500 -
>
> 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)
>
> Here is the web.xml file I got:
>
> (in the path /tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/)
>
>
>
> <?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>
> Create customer servlet</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>
>
>
>
>
> Thanks
>
> Sam
>
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
>
>> ----- Original Message -----
>> From: Martin Gainty
>> Sent: 28/08/08 10:07 pm
>> To: sw2018@gmx.com
>> Subject: RE: Can't execute servlet project
>>
>> david's advice is correct..
>>
>> configure ./META-INF/ApplicationContext.xml
>> <Context path="/DBTest" docBase="DBTest"
>> debug="5" reloadable="true" crossContext="true">
>>
>> <!-- maxActive: Maximum number of dB connections in pool. Make sure
>> you
>> configure your mysqld max_connections large enough to handle
>> all of your db connections. Set to 0 for no limit.
>> -->
>>
>> <!-- maxIdle: Maximum number of idle dB connections to retain in
>> pool.
>> Set to -1 for no limit. See also the DBCP documentation on this
>> and the minEvictableIdleTimeMillis configuration parameter.
>> -->
>>
>> <!-- maxWait: Maximum time to wait for a dB connection to become
>> available
>> in ms, in this example 10 seconds. An Exception is thrown if
>> this timeout is exceeded. Set to -1 to wait indefinitely.
>> -->
>>
>> <!-- username and password: MySQL dB username and password for dB
>> connections -->
>>
>> <!-- driverClassName: Class name for the old mm.mysql JDBC driver is
>> org.gjt.mm.mysql.Driver - we recommend using Connector/J though.
>> Class name for the official MySQL Connector/J driver is
>> com.mysql.jdbc.Driver.
>> -->
>>
>> <!-- url: The JDBC connection url for connecting to your MySQL dB.
>> The autoReconnect=true argument to the url makes sure that the
>> mm.mysql JDBC Driver will automatically reconnect if mysqld
>> closed the
>> connection. mysqld by default closes idle connections after 8
>> hours.
>> -->
>>
>> <Resource name="jdbc/TestDB" auth="Container"
>> type="javax.sql.DataSource"
>> maxActive="100" maxIdle="30" maxWait="10000"
>> username="javauser" password="javadude"
>> driverClassName="com.mysql.jdbc.Driver"
>>
>> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
>>
>> </Context>
>> //sub in the username and password for the DB
>> also in /WEB-INF/web.xml you would need this entry
>> <web-app 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"
>> version="2.4">
>> <description>MySQL Test App</description>
>> <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>
>> then put in this test code changing :
>> DBNAME to the name of your Database
>> TABLE to the name of the table in DBNAME you want to query
>> COLUMN for the specific attribute to query
>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>>
>> <sql:query var="rs" dataSource="jdbc/TestDB">
>> select COLUMN from DBNAME.TABLE
>> </sql:query>
>>
>> <html>
>> <head>
>> <title>DB Test</title>
>> </head>
>> <body>
>>
>> <h2>Results</h2>
>>
>> <c:forEach var="row" items="${rs.rows}">
>> Foo ${row.foo}<br/>
>> Bar ${row.bar}<br/>
>> </c:forEach>
>>
>> </body>
>> </html>
>>
>> if you need UNICODE support or Character Large Object (strings > 64k in
>> length) download JDBC 4 driver
>> http://dev.mysql.com/downloads/connector/j/5.1.html
>>
>> personally I am using the 'older' version of MYSQL so I use the 3.1 jar
>> which you can acquire here
>> http://dev.mysql.com/downloads/connector/j
>>
>> location of driver classes:
>>
>> is located in $TOMCAT_HOME/common/lib
>> personally I dont like putting anything in common since it will affect
>> all webapps but i usually
>> place in /WEB-INF/lib
>>
>> and please follow david's advice and read the tutorial
>>
>> Martin
>> ______________________________________________
>> Disclaimer and confidentiality note
>> Everything in this e-mail and any attachments relates to the official
>> business of Sender. This transmission is of a confidential nature and
>> Sender does not endorse distribution to any party other than intended
>> recipient. Sender does not necessarily endorse content contained within
>> this transmission.
>>
>>
>>
>>> Date: Thu, 28 Aug 2008 11:02:52 +0200
>>> From: sw2018@gmx.com
>>> Subject: Re: Re: Can't execute servlet project
>>> To: users@tomcat.apache.org; users@tomcat.apache.org
>>>
>>> Hi,
>>>
>>>
>>>
>>> I couldn't find an installation document about installing the driver.
>>>
>>> I;ve downloaded the driver:
>>>
>>> linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls
>>> mysql-connector-java-5.1.3-rc-bin.jar
>>> mysql-connector-java-5.1.3-rc-bin.jar
>>>
>>>
>>>
>>> Do you know how to configure tomcat to make use of it?
>>>
>>>
>>>
>>> Thanks
>>>
>>> Sam
>>>
>>>
>>>
>>>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
Hi,
I have added testdb.jsp in the following path in Suse linux (the tomcat
server):
/tomcat/apache-tomcat-5.5.26/webapps/DBTest/
The content of the testdb.jsp code is:
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<sql:query var="rs" dataSource="jdbc/TestDB">
select FIRST_NAME from DBTest.Customer
</sql:query>
<html>
<head>
<title>DB Test</title>
</head>
<body>
<h2>Results</h2>
<c:forEach var="row" items="${rs.rows}">
Foo ${row.foo}<br/>
Bar ${row.bar}<br/>
</c:forEach>
</body>
</html>
when I execute url 10.1.9.1:8080/testdb.jsp in firefox web browser, it
shown the following error:
HTTP Status 500 -
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)
Here is the web.xml file I got:
(in the path /tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/)
<?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>
Create customer servlet</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>
Thanks
Sam
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> ----- Original Message -----
> From: Martin Gainty
> Sent: 28/08/08 10:07 pm
> To: sw2018@gmx.com
> Subject: RE: Can't execute servlet project
>
> david's advice is correct..
>
> configure ./META-INF/ApplicationContext.xml
> <Context path="/DBTest" docBase="DBTest"
> debug="5" reloadable="true" crossContext="true">
>
> <!-- maxActive: Maximum number of dB connections in pool. Make sure
> you
> configure your mysqld max_connections large enough to handle
> all of your db connections. Set to 0 for no limit.
> -->
>
> <!-- maxIdle: Maximum number of idle dB connections to retain in
> pool.
> Set to -1 for no limit. See also the DBCP documentation on this
> and the minEvictableIdleTimeMillis configuration parameter.
> -->
>
> <!-- maxWait: Maximum time to wait for a dB connection to become
> available
> in ms, in this example 10 seconds. An Exception is thrown if
> this timeout is exceeded. Set to -1 to wait indefinitely.
> -->
>
> <!-- username and password: MySQL dB username and password for dB
> connections -->
>
> <!-- driverClassName: Class name for the old mm.mysql JDBC driver is
> org.gjt.mm.mysql.Driver - we recommend using Connector/J though.
> Class name for the official MySQL Connector/J driver is
> com.mysql.jdbc.Driver.
> -->
>
> <!-- url: The JDBC connection url for connecting to your MySQL dB.
> The autoReconnect=true argument to the url makes sure that the
> mm.mysql JDBC Driver will automatically reconnect if mysqld
> closed the
> connection. mysqld by default closes idle connections after 8
> hours.
> -->
>
> <Resource name="jdbc/TestDB" auth="Container"
> type="javax.sql.DataSource"
> maxActive="100" maxIdle="30" maxWait="10000"
> username="javauser" password="javadude"
> driverClassName="com.mysql.jdbc.Driver"
>
> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
>
> </Context>
> //sub in the username and password for the DB
> also in /WEB-INF/web.xml you would need this entry
> <web-app 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"
> version="2.4">
> <description>MySQL Test App</description>
> <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>
> then put in this test code changing :
> DBNAME to the name of your Database
> TABLE to the name of the table in DBNAME you want to query
> COLUMN for the specific attribute to query
> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>
> <sql:query var="rs" dataSource="jdbc/TestDB">
> select COLUMN from DBNAME.TABLE
> </sql:query>
>
> <html>
> <head>
> <title>DB Test</title>
> </head>
> <body>
>
> <h2>Results</h2>
>
> <c:forEach var="row" items="${rs.rows}">
> Foo ${row.foo}<br/>
> Bar ${row.bar}<br/>
> </c:forEach>
>
> </body>
> </html>
>
> if you need UNICODE support or Character Large Object (strings > 64k in
> length) download JDBC 4 driver
> http://dev.mysql.com/downloads/connector/j/5.1.html
>
> personally I am using the 'older' version of MYSQL so I use the 3.1 jar
> which you can acquire here
> http://dev.mysql.com/downloads/connector/j
>
> location of driver classes:
>
> is located in $TOMCAT_HOME/common/lib
> personally I dont like putting anything in common since it will affect
> all webapps but i usually
> place in /WEB-INF/lib
>
> and please follow david's advice and read the tutorial
>
> Martin
> ______________________________________________
> Disclaimer and confidentiality note
> Everything in this e-mail and any attachments relates to the official
> business of Sender. This transmission is of a confidential nature and
> Sender does not endorse distribution to any party other than intended
> recipient. Sender does not necessarily endorse content contained within
> this transmission.
>
>
> > Date: Thu, 28 Aug 2008 11:02:52 +0200
> > From: sw2018@gmx.com
> > Subject: Re: Re: Can't execute servlet project
> > To: users@tomcat.apache.org; users@tomcat.apache.org
> >
> > Hi,
> >
> >
> >
> > I couldn't find an installation document about installing the driver.
> >
> > I;ve downloaded the driver:
> >
> > linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls
> > mysql-connector-java-5.1.3-rc-bin.jar
> > mysql-connector-java-5.1.3-rc-bin.jar
> >
> >
> >
> > Do you know how to configure tomcat to make use of it?
> >
> >
> >
> > Thanks
> >
> > Sam
> >
> >
> >
> > > ----- Original Message -----
> > > From: Pid
> > > Sent: 28/08/08 06:47 pm
> > > To: Tomcat Users List
> > > Subject: Re: Can't execute servlet project
> > >
> > > sam wun wrote:
> > > > Do I need to put mysql driver in the common/lib/ directory in
> linux?
> > >
> > > Yes, that's a basic requirement.
> > >
> > > > If I need to have that, where can I download it?
> > >
> > > The MySQL site - you could probably have guessed that.
> > >
> > > http://dev.mysql.com/usingmysql/java/
> > >
> > >
> > > > Thanks
> > > >
> > > >
> > > >
> > > >> ----- Original Message -----
> > > >> From: sam wun
> > > >> Sent: 28/08/08 04:44 pm
> > > >> To: Tomcat Users List
> > > >> Subject: Re: Re: Can't execute servlet project
> > > >>
> > > >> HI there,
> > > >>
> > > >>
> > > >>
> > > >> According to the tomcat online document, do I have to modify the
> > > >> context.xml file?
> > > >>
> > > >> $CATALINA_HOME/conf/context.xml
> > > >>
> > > >>
> > > >>
> > > >> with the following new setup: <Resource name="jdbc/TestDB"
> > > >> auth="Container"
> > > >> type="javax.sql.DataSource"
> > > >> maxActive="100" maxIdle="30" maxWait="10000"
> > > >> username="javauser" password="javadude"
> > > >> driverClassName="com.mysql.jdbc.Driver"
> > > >>
> > > >> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
> > > >>
> > > >>
> > > >>
> > > >> where username/password is the root/admin user/password of the
> mysql
> > > >> database?
> > > >>
> > > >>
> > > >>
> > > >> 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: users-unsubscribe@tomcat.apache.org
> > > >>>>> For additional commands, e-mail: users-help@tomcat.apache.org
> > > >>>>>
> > > >>>>>
> > > >>>>
> > > >>>
> > > >>> --
> > > >>> 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: users-unsubscribe@tomcat.apache.org
> > > >>> For additional commands, e-mail: users-help@tomcat.apache.org
> > > >>>
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To start a new topic, e-mail: users@tomcat.apache.org
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
>
> Get thousands of games on your PC, your mobile phone, and the web with
> Windows®. Game with Windows
Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
Hi,
I couldn't find an installation document about installing the driver.
I;ve downloaded the driver:
linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls
mysql-connector-java-5.1.3-rc-bin.jar
mysql-connector-java-5.1.3-rc-bin.jar
Do you know how to configure tomcat to make use of it?
Thanks
Sam
> ----- Original Message -----
> From: Pid
> Sent: 28/08/08 06:47 pm
> To: Tomcat Users List
> Subject: Re: Can't execute servlet project
>
> sam wun wrote:
> > Do I need to put mysql driver in the common/lib/ directory in linux?
>
> Yes, that's a basic requirement.
>
> > If I need to have that, where can I download it?
>
> The MySQL site - you could probably have guessed that.
>
> http://dev.mysql.com/usingmysql/java/
>
>
> > Thanks
> >
> >
> >
> >> ----- Original Message -----
> >> From: sam wun
> >> Sent: 28/08/08 04:44 pm
> >> To: Tomcat Users List
> >> Subject: Re: Re: Can't execute servlet project
> >>
> >> HI there,
> >>
> >>
> >>
> >> According to the tomcat online document, do I have to modify the
> >> context.xml file?
> >>
> >> $CATALINA_HOME/conf/context.xml
> >>
> >>
> >>
> >> with the following new setup: <Resource name="jdbc/TestDB"
> >> auth="Container"
> >> type="javax.sql.DataSource"
> >> maxActive="100" maxIdle="30" maxWait="10000"
> >> username="javauser" password="javadude"
> >> driverClassName="com.mysql.jdbc.Driver"
> >>
> >> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
> >>
> >>
> >>
> >> where username/password is the root/admin user/password of the mysql
> >> database?
> >>
> >>
> >>
> >> 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: users-unsubscribe@tomcat.apache.org
> >>>>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>>>
> >>>>>
> >>>>
> >>>
> >>> --
> >>> 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: users-unsubscribe@tomcat.apache.org
> >>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: Can't execute servlet project
Posted by Pid <p...@pidster.com>.
sam wun wrote:
> Do I need to put mysql driver in the common/lib/ directory in linux?
Yes, that's a basic requirement.
> If I need to have that, where can I download it?
The MySQL site - you could probably have guessed that.
http://dev.mysql.com/usingmysql/java/
> Thanks
>
>
>
>> ----- Original Message -----
>> From: sam wun
>> Sent: 28/08/08 04:44 pm
>> To: Tomcat Users List
>> Subject: Re: Re: Can't execute servlet project
>>
>> HI there,
>>
>>
>>
>> According to the tomcat online document, do I have to modify the
>> context.xml file?
>>
>> $CATALINA_HOME/conf/context.xml
>>
>>
>>
>> with the following new setup: <Resource name="jdbc/TestDB"
>> auth="Container"
>> type="javax.sql.DataSource"
>> maxActive="100" maxIdle="30" maxWait="10000"
>> username="javauser" password="javadude"
>> driverClassName="com.mysql.jdbc.Driver"
>>
>> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
>>
>>
>>
>> where username/password is the root/admin user/password of the mysql
>> database?
>>
>>
>>
>> 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: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>
>>>>>
>>>>
>>>
>>> --
>>> 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: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
Do I need to put mysql driver in the common/lib/ directory in linux?
Currently this tomcat server (in linux) has the following jar flies in the
common/lib/ folder:
linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls
. commons-el.jar jasper-compiler.jar
jsp-api.jar naming-factory.jar
servlet-api.jar
.. jasper-compiler-jdt.jar jasper-runtime.jar
naming-factory-dbcp.jar naming-resources.jar
If I need to have that, where can I download it?
Thanks
> ----- Original Message -----
> From: sam wun
> Sent: 28/08/08 04:44 pm
> To: Tomcat Users List
> Subject: Re: Re: Can't execute servlet project
>
> HI there,
>
>
>
> According to the tomcat online document, do I have to modify the
> context.xml file?
>
> $CATALINA_HOME/conf/context.xml
>
>
>
> with the following new setup: <Resource name="jdbc/TestDB"
> auth="Container"
> type="javax.sql.DataSource"
> maxActive="100" maxIdle="30" maxWait="10000"
> username="javauser" password="javadude"
> driverClassName="com.mysql.jdbc.Driver"
>
> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
>
>
>
> where username/password is the root/admin user/password of the mysql
> database?
>
>
>
> 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: users-unsubscribe@tomcat.apache.org
> > >> For additional commands, e-mail: users-help@tomcat.apache.org
> > >>
> > >>
> > >
> > >
> >
> >
> > --
> > 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: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
HI there,
According to the tomcat online document, do I have to modify the
context.xml file?
$CATALINA_HOME/conf/context.xml
with the following new setup: <Resource name="jdbc/TestDB" auth="Container"
type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="javauser" password="javadude"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
where username/password is the root/admin user/password of the mysql
database?
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: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
> >
>
>
> --
> 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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
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: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
> >
>
>
> --
> 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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: Can't execute servlet project
Posted by David Smith <dn...@cornell.edu>.
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: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
--
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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
RE: Re: Can't execute servlet project
Posted by Peter Crowther <Pe...@melandra.com>.
> From: sam wun [mailto:sw2018@gmx.com]
> OK, I followed your instruction to invoke the servlet class
> file, but I got errors.
[...]
> root cause java.lang.UnsupportedClassVersionError: Bad version number in
> .class file
You're compiling your class with a newer Java version than your Tomcat instance is running on. You probably want to find which JDK your Tomcat's running on, and change that to the same one that you're using for compilation.
- Peter
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
OK, I followed your instruction to invoke the servlet class file, but I got
errors.
the url is http://10.1.9.1:8080/DBTest/CreateCustomerServlet
Errors are:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception javax.servlet.ServletException: Error allocating a servlet
instance
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
java.lang.Thread.run(Unknown Source)
root cause java.lang.UnsupportedClassVersionError: Bad version number in
.class file
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(Unknown Source)
java.security.SecureClassLoader.defineClass(Unknown Source)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1853)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:875)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1330)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1209)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
java.lang.Thread.run(Unknown Source)
note The full stack trace of the root cause is available in the Apache
Tomcat/5.5.26 logs.
It looks like it invoked the class, but...
not sure...
Thanks
Sam
> ----- 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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: Can't execute servlet project
Posted by David Smith <dn...@cornell.edu>.
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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: Can't execute servlet project
Posted by David Smith <dn...@cornell.edu>.
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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
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
> >
> >
> >
> >
> >> ----- Original Message -----
> >> From: David Smith
> >> Sent: 26/08/08 11:28 pm
> >> To: Tomcat Users List
> >> Subject: Re: Can't execute servlet project
> >>
> >> 1. The 404 error accessing /DbTest/ -- define a welcome file in
> >> DBTest/WEB-INF/web.xml. Online docs at tomcat.apache.org and the
> >> servlet spec will help with this.
> >>
> >> 2. It would appear you need to do some more research on what you want
> to
> >> do. It looks like you are trying to expose an ArrayList stored in the
> >> request scope, but the jsp can't find it, hence the error. Where is
> >> this object supposed to come from if you didn't create a bean?
> >>
> >> --David
> >>
> >> sam wun wrote:
> >>
> >>> HI tere,
> >>>
> >>> I have completed a servlet project in Eclipse (3.4).
> >>> I also made a war.file by seleting the project name (DBTest in this
> >>>
> >> case)
> >>
> >>> and the export command from the Eclipse menu, and export it to the
> >>>
> >> Tomcat
> >>
> >>> 5.5.26 server in linux using manager.
> >>>
> >>> However when I click on the project name (/DBTest) in the manager
> >>>
> >> webpage,
> >>
> >>> it shown the following error:
> >>> =================================
> >>> HTTP Status 404 - /DBTest/
> >>> type Status report
> >>> message /DBTest/
> >>>
> >>> description The requested resource (/DBTest/) is not available.
> >>> Apache Tomcat/5.5.26
> >>> =================================
> >>>
> >>> Here is the jsp file in the tomcat server:
> >>> linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest # ls
> >>> . .. META-INF WEB-INF customers.jsp
> >>> its content is shown as below:
> >>> ----------------------------------------
> >>> linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest # vi customers.jsp
> >>> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
> >>> pageEncoding="ISO-8859-1"%>
> >>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> >>> <html>
> >>> <head>
> >>> <meta http-equiv="Content-Type" content="text/html;
> >>>
> >> charset=ISO-8859-1">
> >>
> >>> <title>Customers list</title>
> >>> </head>
> >>> <body>
> >>>
> >>> <jsp:useBean id="customers"
> type="java.util.ArrayList<domain.Customer>"
> >>> scope="request"/>
> >>>
> >>> <b>Registered Customers:</b><br>
> >>> <table border="1">
> >>> <tr>
> >>> <th>ID</th>
> >>> <th>First Name</th>
> >>> <th>Last Name</th>
> >>> <th>Address</th>
> >>> <th>Orders</th>
> >>> </tr>
> >>> <% for(domain.Customer c : customers) { %>
> >>> <tr>
> >>> <td><%= c.getId() %></td>
> >>> <td><%= c.getFirstName() %></td>
> >>> <td><%= c.getLastName() %></td>
> >>> <td><%= c.getAddress() %></td>
> >>> <td><a href="/DBTest/ListCustomerOrders?cust_id=<%=
> >>> c.getId() %>">Orders</a></td>
> >>> <% } %>
> >>>
> >>> </body>
> >>> </html>
> >>> --------------------------------------------
> >>>
> >>> If I execute a more specific url
> >>> (http://10.1.9.1:8080/DBTest/customers.jsp) from the web browser
> >>>
> >> (firefox),
> >>
> >>> it shows different errors:
> >>>
> >>> HTTP Status 500 -
> >>>
> >>> type Exception report
> >>>
> >>> message
> >>>
> >>> description The server encountered an internal error () that
> prevented
> >>>
> >> it
> >>
> >>> from fulfilling this request.
> >>>
> >>> exception
> >>>
> >>> org.apache.jasper.JasperException: Exception in JSP:
> /customers.jsp:11
> >>>
> >>> 8: </head>
> >>> 9: <body>
> >>> 10:
> >>> 11: <jsp:useBean id="customers"
> >>>
> >> type="java.util.ArrayList<domain.Customer>"
> >>
> >>> scope="request"/>
> >>> 12:
> >>> 13: <b>Registered Customers:</b><br>
> >>> 14: <table border="1">
> >>>
> >>>
> >>> Stacktrace:
> >>>
> >>>
> >>>
> >>
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
> >>
> >>>
> >>>
> >>>
> >>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
> >>
> >>>
> >>>
> >>>
> >>
> 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)
> >>>
> >>> root cause
> >>>
> >>> javax.servlet.ServletException: bean customers not found within scope
> >>>
> >>>
> >>>
> >>
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
> >>
> >>>
> >>>
> >>>
> >>
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> >>
> >>> org.apache.jsp.customers_jsp._jspService(customers_jsp.java:97)
> >>>
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >>>
> >>>
> >>>
> >>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> >>
> >>>
> >>>
> >>>
> >>
> 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)
> >>>
> >>> root cause
> >>>
> >>> java.lang.InstantiationException: bean customers not found within
> scope
> >>> org.apache.jsp.customers_jsp._jspService(customers_jsp.java:55)
> >>>
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >>>
> >>>
> >>>
> >>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> >>
> >>>
> >>>
> >>>
> >>
> 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)
> >>>
> >>> note The full stack trace of the root cause is available in the
> Apache
> >>> Tomcat/5.5.26 logs.
> >>>
> >>>
> >>> I haven't create any *bean*, but servlet only.
> >>> How to get fix problem?
> >>>
> >>> Your help is much appreciated.
> >>>
> >>> Thanks
> >>> Sam
> >>>
> >>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: Can't execute servlet project
Posted by David Smith <dn...@cornell.edu>.
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
>
>
>
>
>> ----- Original Message -----
>> From: David Smith
>> Sent: 26/08/08 11:28 pm
>> To: Tomcat Users List
>> Subject: Re: Can't execute servlet project
>>
>> 1. The 404 error accessing /DbTest/ -- define a welcome file in
>> DBTest/WEB-INF/web.xml. Online docs at tomcat.apache.org and the
>> servlet spec will help with this.
>>
>> 2. It would appear you need to do some more research on what you want to
>> do. It looks like you are trying to expose an ArrayList stored in the
>> request scope, but the jsp can't find it, hence the error. Where is
>> this object supposed to come from if you didn't create a bean?
>>
>> --David
>>
>> sam wun wrote:
>>
>>> HI tere,
>>>
>>> I have completed a servlet project in Eclipse (3.4).
>>> I also made a war.file by seleting the project name (DBTest in this
>>>
>> case)
>>
>>> and the export command from the Eclipse menu, and export it to the
>>>
>> Tomcat
>>
>>> 5.5.26 server in linux using manager.
>>>
>>> However when I click on the project name (/DBTest) in the manager
>>>
>> webpage,
>>
>>> it shown the following error:
>>> =================================
>>> HTTP Status 404 - /DBTest/
>>> type Status report
>>> message /DBTest/
>>>
>>> description The requested resource (/DBTest/) is not available.
>>> Apache Tomcat/5.5.26
>>> =================================
>>>
>>> Here is the jsp file in the tomcat server:
>>> linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest # ls
>>> . .. META-INF WEB-INF customers.jsp
>>> its content is shown as below:
>>> ----------------------------------------
>>> linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest # vi customers.jsp
>>> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
>>> pageEncoding="ISO-8859-1"%>
>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>> <html>
>>> <head>
>>> <meta http-equiv="Content-Type" content="text/html;
>>>
>> charset=ISO-8859-1">
>>
>>> <title>Customers list</title>
>>> </head>
>>> <body>
>>>
>>> <jsp:useBean id="customers" type="java.util.ArrayList<domain.Customer>"
>>> scope="request"/>
>>>
>>> <b>Registered Customers:</b><br>
>>> <table border="1">
>>> <tr>
>>> <th>ID</th>
>>> <th>First Name</th>
>>> <th>Last Name</th>
>>> <th>Address</th>
>>> <th>Orders</th>
>>> </tr>
>>> <% for(domain.Customer c : customers) { %>
>>> <tr>
>>> <td><%= c.getId() %></td>
>>> <td><%= c.getFirstName() %></td>
>>> <td><%= c.getLastName() %></td>
>>> <td><%= c.getAddress() %></td>
>>> <td><a href="/DBTest/ListCustomerOrders?cust_id=<%=
>>> c.getId() %>">Orders</a></td>
>>> <% } %>
>>>
>>> </body>
>>> </html>
>>> --------------------------------------------
>>>
>>> If I execute a more specific url
>>> (http://10.1.9.1:8080/DBTest/customers.jsp) from the web browser
>>>
>> (firefox),
>>
>>> it shows different errors:
>>>
>>> HTTP Status 500 -
>>>
>>> type Exception report
>>>
>>> message
>>>
>>> description The server encountered an internal error () that prevented
>>>
>> it
>>
>>> from fulfilling this request.
>>>
>>> exception
>>>
>>> org.apache.jasper.JasperException: Exception in JSP: /customers.jsp:11
>>>
>>> 8: </head>
>>> 9: <body>
>>> 10:
>>> 11: <jsp:useBean id="customers"
>>>
>> type="java.util.ArrayList<domain.Customer>"
>>
>>> scope="request"/>
>>> 12:
>>> 13: <b>Registered Customers:</b><br>
>>> 14: <table border="1">
>>>
>>>
>>> Stacktrace:
>>>
>>>
>>>
>> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
>>
>>>
>>>
>>>
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
>>
>>>
>>>
>>>
>> 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)
>>>
>>> root cause
>>>
>>> javax.servlet.ServletException: bean customers not found within scope
>>>
>>>
>>>
>> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
>>
>>>
>>>
>>>
>> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
>>
>>> org.apache.jsp.customers_jsp._jspService(customers_jsp.java:97)
>>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>>
>>>
>>>
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>>
>>>
>>>
>>>
>> 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)
>>>
>>> root cause
>>>
>>> java.lang.InstantiationException: bean customers not found within scope
>>> org.apache.jsp.customers_jsp._jspService(customers_jsp.java:55)
>>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>>
>>>
>>>
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>>
>>>
>>>
>>>
>> 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)
>>>
>>> note The full stack trace of the root cause is available in the Apache
>>> Tomcat/5.5.26 logs.
>>>
>>>
>>> I haven't create any *bean*, but servlet only.
>>> How to get fix problem?
>>>
>>> Your help is much appreciated.
>>>
>>> Thanks
>>> Sam
>>>
>>>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Re: Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
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
> ----- Original Message -----
> From: David Smith
> Sent: 26/08/08 11:28 pm
> To: Tomcat Users List
> Subject: Re: Can't execute servlet project
>
> 1. The 404 error accessing /DbTest/ -- define a welcome file in
> DBTest/WEB-INF/web.xml. Online docs at tomcat.apache.org and the
> servlet spec will help with this.
>
> 2. It would appear you need to do some more research on what you want to
> do. It looks like you are trying to expose an ArrayList stored in the
> request scope, but the jsp can't find it, hence the error. Where is
> this object supposed to come from if you didn't create a bean?
>
> --David
>
> sam wun wrote:
> > HI tere,
> >
> > I have completed a servlet project in Eclipse (3.4).
> > I also made a war.file by seleting the project name (DBTest in this
> case)
> > and the export command from the Eclipse menu, and export it to the
> Tomcat
> > 5.5.26 server in linux using manager.
> >
> > However when I click on the project name (/DBTest) in the manager
> webpage,
> > it shown the following error:
> > =================================
> > HTTP Status 404 - /DBTest/
> > type Status report
> > message /DBTest/
> >
> > description The requested resource (/DBTest/) is not available.
> > Apache Tomcat/5.5.26
> > =================================
> >
> > Here is the jsp file in the tomcat server:
> > linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest # ls
> > . .. META-INF WEB-INF customers.jsp
> > its content is shown as below:
> > ----------------------------------------
> > linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest # vi customers.jsp
> > <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
> > pageEncoding="ISO-8859-1"%>
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> > <html>
> > <head>
> > <meta http-equiv="Content-Type" content="text/html;
> charset=ISO-8859-1">
> > <title>Customers list</title>
> > </head>
> > <body>
> >
> > <jsp:useBean id="customers" type="java.util.ArrayList<domain.Customer>"
> > scope="request"/>
> >
> > <b>Registered Customers:</b><br>
> > <table border="1">
> > <tr>
> > <th>ID</th>
> > <th>First Name</th>
> > <th>Last Name</th>
> > <th>Address</th>
> > <th>Orders</th>
> > </tr>
> > <% for(domain.Customer c : customers) { %>
> > <tr>
> > <td><%= c.getId() %></td>
> > <td><%= c.getFirstName() %></td>
> > <td><%= c.getLastName() %></td>
> > <td><%= c.getAddress() %></td>
> > <td><a href="/DBTest/ListCustomerOrders?cust_id=<%=
> > c.getId() %>">Orders</a></td>
> > <% } %>
> >
> > </body>
> > </html>
> > --------------------------------------------
> >
> > If I execute a more specific url
> > (http://10.1.9.1:8080/DBTest/customers.jsp) from the web browser
> (firefox),
> > it shows different errors:
> >
> > HTTP Status 500 -
> >
> > type Exception report
> >
> > message
> >
> > description The server encountered an internal error () that prevented
> it
> > from fulfilling this request.
> >
> > exception
> >
> > org.apache.jasper.JasperException: Exception in JSP: /customers.jsp:11
> >
> > 8: </head>
> > 9: <body>
> > 10:
> > 11: <jsp:useBean id="customers"
> type="java.util.ArrayList<domain.Customer>"
> > scope="request"/>
> > 12:
> > 13: <b>Registered Customers:</b><br>
> > 14: <table border="1">
> >
> >
> > Stacktrace:
> >
> >
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
> >
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
> >
> >
> 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)
> >
> > root cause
> >
> > javax.servlet.ServletException: bean customers not found within scope
> >
> >
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
> >
> >
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> > org.apache.jsp.customers_jsp._jspService(customers_jsp.java:97)
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> >
> >
> 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)
> >
> > root cause
> >
> > java.lang.InstantiationException: bean customers not found within scope
> > org.apache.jsp.customers_jsp._jspService(customers_jsp.java:55)
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> >
> >
> 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)
> >
> > note The full stack trace of the root cause is available in the Apache
> > Tomcat/5.5.26 logs.
> >
> >
> > I haven't create any *bean*, but servlet only.
> > How to get fix problem?
> >
> > Your help is much appreciated.
> >
> > Thanks
> > Sam
> >
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Re: Can't execute servlet project
Posted by David Smith <dn...@cornell.edu>.
1. The 404 error accessing /DbTest/ -- define a welcome file in
DBTest/WEB-INF/web.xml. Online docs at tomcat.apache.org and the
servlet spec will help with this.
2. It would appear you need to do some more research on what you want to
do. It looks like you are trying to expose an ArrayList stored in the
request scope, but the jsp can't find it, hence the error. Where is
this object supposed to come from if you didn't create a bean?
--David
sam wun wrote:
> HI tere,
>
> I have completed a servlet project in Eclipse (3.4).
> I also made a war.file by seleting the project name (DBTest in this case)
> and the export command from the Eclipse menu, and export it to the Tomcat
> 5.5.26 server in linux using manager.
>
> However when I click on the project name (/DBTest) in the manager webpage,
> it shown the following error:
> =================================
> HTTP Status 404 - /DBTest/
> type Status report
> message /DBTest/
>
> description The requested resource (/DBTest/) is not available.
> Apache Tomcat/5.5.26
> =================================
>
> Here is the jsp file in the tomcat server:
> linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest # ls
> . .. META-INF WEB-INF customers.jsp
> its content is shown as below:
> ----------------------------------------
> linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest # vi customers.jsp
> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
> pageEncoding="ISO-8859-1"%>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> <title>Customers list</title>
> </head>
> <body>
>
> <jsp:useBean id="customers" type="java.util.ArrayList<domain.Customer>"
> scope="request"/>
>
> <b>Registered Customers:</b><br>
> <table border="1">
> <tr>
> <th>ID</th>
> <th>First Name</th>
> <th>Last Name</th>
> <th>Address</th>
> <th>Orders</th>
> </tr>
> <% for(domain.Customer c : customers) { %>
> <tr>
> <td><%= c.getId() %></td>
> <td><%= c.getFirstName() %></td>
> <td><%= c.getLastName() %></td>
> <td><%= c.getAddress() %></td>
> <td><a href="/DBTest/ListCustomerOrders?cust_id=<%=
> c.getId() %>">Orders</a></td>
> <% } %>
>
> </body>
> </html>
> --------------------------------------------
>
> If I execute a more specific url
> (http://10.1.9.1:8080/DBTest/customers.jsp) from the web browser (firefox),
> it shows different errors:
>
> HTTP Status 500 -
>
> type Exception report
>
> message
>
> description The server encountered an internal error () that prevented it
> from fulfilling this request.
>
> exception
>
> org.apache.jasper.JasperException: Exception in JSP: /customers.jsp:11
>
> 8: </head>
> 9: <body>
> 10:
> 11: <jsp:useBean id="customers" type="java.util.ArrayList<domain.Customer>"
> scope="request"/>
> 12:
> 13: <b>Registered Customers:</b><br>
> 14: <table border="1">
>
>
> Stacktrace:
>
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
>
> 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)
>
> root cause
>
> javax.servlet.ServletException: bean customers not found within scope
>
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
>
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> org.apache.jsp.customers_jsp._jspService(customers_jsp.java:97)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>
> 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)
>
> root cause
>
> java.lang.InstantiationException: bean customers not found within scope
> org.apache.jsp.customers_jsp._jspService(customers_jsp.java:55)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>
> 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)
>
> note The full stack trace of the root cause is available in the Apache
> Tomcat/5.5.26 logs.
>
>
> I haven't create any *bean*, but servlet only.
> How to get fix problem?
>
> Your help is much appreciated.
>
> Thanks
> Sam
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Can't execute servlet project
Posted by sam wun <sw...@gmx.com>.
HI tere,
I have completed a servlet project in Eclipse (3.4).
I also made a war.file by seleting the project name (DBTest in this case)
and the export command from the Eclipse menu, and export it to the Tomcat
5.5.26 server in linux using manager.
However when I click on the project name (/DBTest) in the manager webpage,
it shown the following error:
=================================
HTTP Status 404 - /DBTest/
type Status report
message /DBTest/
description The requested resource (/DBTest/) is not available.
Apache Tomcat/5.5.26
=================================
Here is the jsp file in the tomcat server:
linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest # ls
. .. META-INF WEB-INF customers.jsp
its content is shown as below:
----------------------------------------
linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest # vi customers.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Customers list</title>
</head>
<body>
<jsp:useBean id="customers" type="java.util.ArrayList<domain.Customer>"
scope="request"/>
<b>Registered Customers:</b><br>
<table border="1">
<tr>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Address</th>
<th>Orders</th>
</tr>
<% for(domain.Customer c : customers) { %>
<tr>
<td><%= c.getId() %></td>
<td><%= c.getFirstName() %></td>
<td><%= c.getLastName() %></td>
<td><%= c.getAddress() %></td>
<td><a href="/DBTest/ListCustomerOrders?cust_id=<%=
c.getId() %>">Orders</a></td>
<% } %>
</body>
</html>
--------------------------------------------
If I execute a more specific url
(http://10.1.9.1:8080/DBTest/customers.jsp) from the web browser (firefox),
it shows different errors:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /customers.jsp:11
8: </head>
9: <body>
10:
11: <jsp:useBean id="customers" type="java.util.ArrayList<domain.Customer>"
scope="request"/>
12:
13: <b>Registered Customers:</b><br>
14: <table border="1">
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
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)
root cause
javax.servlet.ServletException: bean customers not found within scope
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.customers_jsp._jspService(customers_jsp.java:97)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
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)
root cause
java.lang.InstantiationException: bean customers not found within scope
org.apache.jsp.customers_jsp._jspService(customers_jsp.java:55)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
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)
note The full stack trace of the root cause is available in the Apache
Tomcat/5.5.26 logs.
I haven't create any *bean*, but servlet only.
How to get fix problem?
Your help is much appreciated.
Thanks
Sam
Re: Can't generate class file from Interface
Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
----- Original Message -----
From: "sam wun" <sw...@gmx.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, August 26, 2008 2:02 PM
Subject: Can't generate class file from Interface
> Hi,
>
>
>
> In Eclipse 3.4 (not sure about the previous version), I have a project, in
> the src, there is a interface file called "DatabaseCommand.java". This
> file
> is an interface file.
>
> It s content is shown below:
>
> package command;
>
> import java.sql.Connection;
> import java.sql.SQLException;
>
> public interface DatabaseCommand {
> public Object executeDatabaseOperation(Connection conn) throws
> SQLException ;
> }
>
>
>
>
>
> Another file CreateOrder.java *implements* this interface.
>
> Its content shown as below:
>
>
>
> Package command;
**** NOT A KEY WORD ****
So they not in the same package, so there is no import
command.DatabaseCommand, so its unhappy ;)
Not really a tomcat thing... but we friendly ;)
>
> import java.sql.Connection;
> import java.sql.SQLException;
> import java.sql.Statement;
> import java.sql.ResultSet;
> import java.util.ArrayList;
> import domain.Customer;
>
> /**
> * List existing customers in the database
> */
>
> public class ListCustomers implements DatabaseCommand {
>
> public Object executeDatabaseOperation(Connection conn) throws
> SQLException {
> // List customers in the database
>
> ArrayList<Customer> list = new ArrayList<Customer>();
> Statement sta = conn.createStatement();
> ResultSet rs = sta.executeQuery("SELECT ID, FIRST_NAME,
> LAST_NAME, ADDRESS FROM CUSTOMER");
> while(rs.next()) {
> Customer cust = new Customer();
> cust.setId(rs.getInt(1));
> cust.setFirstName(rs.getString(2));
> cust.setLastName(rs.getString(3));
> cust.setAddress(rs.getString(4));
> list.add(cust);
> }
>
> rs.close();
> sta.close();
>
> return list;
> }
> }
>
>
>
> When I press Clt-B to build the project(All), DatabaseCommand.java does
> not
> get compiled, no DatabaseCommand.class generated in the
> build\classes\command\ directory. The syntax highlithed in the
> CreateOrder.java file indicated that DatabaseCommand is an unknown type,
> that meant no class found.
>
>
>
> How can I get around this issue? may be I should ask how to generate an
> interface dot class file (eg. DatabaseCommand.class in this instance)?
>
>
>
> Thanks
>
> Sam
---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Can't generate class file from Interface
Posted by Martin Gainty <mg...@hotmail.com>.
you need to use Eclipse import to import the package
right click on project
click Import
click File System
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.
> Date: Tue, 26 Aug 2008 14:02:59 +0200
> From: sw2018@gmx.com
> Subject: Can't generate class file from Interface
> To: users@tomcat.apache.org
>
> Hi,
>
>
>
> In Eclipse 3.4 (not sure about the previous version), I have a project, in
> the src, there is a interface file called "DatabaseCommand.java". This file
> is an interface file.
>
> It s content is shown below:
>
> package command;
>
> import java.sql.Connection;
> import java.sql.SQLException;
>
> public interface DatabaseCommand {
> public Object executeDatabaseOperation(Connection conn) throws
> SQLException ;
> }
>
>
>
>
>
> Another file CreateOrder.java *implements* this interface.
>
> Its content shown as below:
>
>
>
> Package command;
>
> import java.sql.Connection;
> import java.sql.SQLException;
> import java.sql.Statement;
> import java.sql.ResultSet;
> import java.util.ArrayList;
> import domain.Customer;
>
> /**
> * List existing customers in the database
> */
>
> public class ListCustomers implements DatabaseCommand {
>
> public Object executeDatabaseOperation(Connection conn) throws
> SQLException {
> // List customers in the database
>
> ArrayList<Customer> list = new ArrayList<Customer>();
> Statement sta = conn.createStatement();
> ResultSet rs = sta.executeQuery("SELECT ID, FIRST_NAME,
> LAST_NAME, ADDRESS FROM CUSTOMER");
> while(rs.next()) {
> Customer cust = new Customer();
> cust.setId(rs.getInt(1));
> cust.setFirstName(rs.getString(2));
> cust.setLastName(rs.getString(3));
> cust.setAddress(rs.getString(4));
> list.add(cust);
> }
>
> rs.close();
> sta.close();
>
> return list;
> }
> }
>
>
>
> When I press Clt-B to build the project(All), DatabaseCommand.java does not
> get compiled, no DatabaseCommand.class generated in the
> build\classes\command\ directory. The syntax highlithed in the
> CreateOrder.java file indicated that DatabaseCommand is an unknown type,
> that meant no class found.
>
>
>
> How can I get around this issue? may be I should ask how to generate an
> interface dot class file (eg. DatabaseCommand.class in this instance)?
>
>
>
> Thanks
>
> Sam
>
>
_________________________________________________________________
See what people are saying about Windows Live. Check out featured posts.
http://www.windowslive.com/connect?ocid=TXT_TAGLM_WL_connect2_082008
Re: Can't generate class file from Interface
Posted by Ch Praveena <ps...@gmail.com>.
Hi,
Make sure about all the classes like Customer, be accessable. And also be
careful in naming the packages.
2008/8/26 sam wun <sw...@gmx.com>
> Hi,
>
>
>
> In Eclipse 3.4 (not sure about the previous version), I have a project, in
> the src, there is a interface file called "DatabaseCommand.java". This file
> is an interface file.
>
> It s content is shown below:
>
> package command;
>
> import java.sql.Connection;
> import java.sql.SQLException;
>
> public interface DatabaseCommand {
> public Object executeDatabaseOperation(Connection conn) throws
> SQLException ;
> }
>
>
>
>
>
> Another file CreateOrder.java *implements* this interface.
>
> Its content shown as below:
>
>
>
> Package command;
>
> import java.sql.Connection;
> import java.sql.SQLException;
> import java.sql.Statement;
> import java.sql.ResultSet;
> import java.util.ArrayList;
> import domain.Customer;
>
> /**
> * List existing customers in the database
> */
>
> public class ListCustomers implements DatabaseCommand {
>
> public Object executeDatabaseOperation(Connection conn) throws
> SQLException {
> // List customers in the database
>
> ArrayList<Customer> list = new ArrayList<Customer>();
> Statement sta = conn.createStatement();
> ResultSet rs = sta.executeQuery("SELECT ID, FIRST_NAME,
> LAST_NAME, ADDRESS FROM CUSTOMER");
> while(rs.next()) {
> Customer cust = new Customer();
> cust.setId(rs.getInt(1));
> cust.setFirstName(rs.getString(2));
> cust.setLastName(rs.getString(3));
> cust.setAddress(rs.getString(4));
> list.add(cust);
> }
>
> rs.close();
> sta.close();
>
> return list;
> }
> }
>
>
>
> When I press Clt-B to build the project(All), DatabaseCommand.java does not
> get compiled, no DatabaseCommand.class generated in the
> build\classes\command\ directory. The syntax highlithed in the
> CreateOrder.java file indicated that DatabaseCommand is an unknown type,
> that meant no class found.
>
>
>
> How can I get around this issue? may be I should ask how to generate an
> interface dot class file (eg. DatabaseCommand.class in this instance)?
>
>
>
> Thanks
>
> Sam
>
>
>
--
-Coolest Regards,
Praveena Chalamcharla,
[OT] RE: Can't generate class file from Interface
Posted by Peter Crowther <Pe...@melandra.com>.
This is not a Tomcat question. Please find a more appropriate list.
- Peter
> -----Original Message-----
> From: sam wun [mailto:sw2018@gmx.com]
> Sent: 26 August 2008 13:03
> To: Tomcat Users List
> Subject: Can't generate class file from Interface
>
> Hi,
>
>
>
> In Eclipse 3.4 (not sure about the previous version), I have
> a project, in
> the src, there is a interface file called
> "DatabaseCommand.java". This file
> is an interface file.
>
> It s content is shown below:
>
> package command;
>
> import java.sql.Connection;
> import java.sql.SQLException;
>
> public interface DatabaseCommand {
> public Object executeDatabaseOperation(Connection conn) throws
> SQLException ;
> }
>
>
>
>
>
> Another file CreateOrder.java *implements* this interface.
>
> Its content shown as below:
>
>
>
> Package command;
>
> import java.sql.Connection;
> import java.sql.SQLException;
> import java.sql.Statement;
> import java.sql.ResultSet;
> import java.util.ArrayList;
> import domain.Customer;
>
> /**
> * List existing customers in the database
> */
>
> public class ListCustomers implements DatabaseCommand {
>
> public Object executeDatabaseOperation(Connection conn) throws
> SQLException {
> // List customers in the database
>
> ArrayList<Customer> list = new ArrayList<Customer>();
> Statement sta = conn.createStatement();
> ResultSet rs = sta.executeQuery("SELECT ID, FIRST_NAME,
> LAST_NAME, ADDRESS FROM CUSTOMER");
> while(rs.next()) {
> Customer cust = new Customer();
> cust.setId(rs.getInt(1));
> cust.setFirstName(rs.getString(2));
> cust.setLastName(rs.getString(3));
> cust.setAddress(rs.getString(4));
> list.add(cust);
> }
>
> rs.close();
> sta.close();
>
> return list;
> }
> }
>
>
>
> When I press Clt-B to build the project(All),
> DatabaseCommand.java does not
> get compiled, no DatabaseCommand.class generated in the
> build\classes\command\ directory. The syntax highlithed in the
> CreateOrder.java file indicated that DatabaseCommand is an
> unknown type,
> that meant no class found.
>
>
>
> How can I get around this issue? may be I should ask how to
> generate an
> interface dot class file (eg. DatabaseCommand.class in this instance)?
>
>
>
> Thanks
>
> Sam
>
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Can't generate class file from Interface
Posted by sam wun <sw...@gmx.com>.
Hi,
In Eclipse 3.4 (not sure about the previous version), I have a project, in
the src, there is a interface file called "DatabaseCommand.java". This file
is an interface file.
It s content is shown below:
package command;
import java.sql.Connection;
import java.sql.SQLException;
public interface DatabaseCommand {
public Object executeDatabaseOperation(Connection conn) throws
SQLException ;
}
Another file CreateOrder.java *implements* this interface.
Its content shown as below:
Package command;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;
import java.util.ArrayList;
import domain.Customer;
/**
* List existing customers in the database
*/
public class ListCustomers implements DatabaseCommand {
public Object executeDatabaseOperation(Connection conn) throws
SQLException {
// List customers in the database
ArrayList<Customer> list = new ArrayList<Customer>();
Statement sta = conn.createStatement();
ResultSet rs = sta.executeQuery("SELECT ID, FIRST_NAME,
LAST_NAME, ADDRESS FROM CUSTOMER");
while(rs.next()) {
Customer cust = new Customer();
cust.setId(rs.getInt(1));
cust.setFirstName(rs.getString(2));
cust.setLastName(rs.getString(3));
cust.setAddress(rs.getString(4));
list.add(cust);
}
rs.close();
sta.close();
return list;
}
}
When I press Clt-B to build the project(All), DatabaseCommand.java does not
get compiled, no DatabaseCommand.class generated in the
build\classes\command\ directory. The syntax highlithed in the
CreateOrder.java file indicated that DatabaseCommand is an unknown type,
that meant no class found.
How can I get around this issue? may be I should ask how to generate an
interface dot class file (eg. DatabaseCommand.class in this instance)?
Thanks
Sam
RE: Tomcat6 relative contexts
Posted by "trevor paterson (RI)" <tr...@roslin.ed.ac.uk>.
Mark
6.0.18 **does** unpack a foo#bar.war to a foo#bar directory
as long as you have enough disk space ( woops ;)
interestingly no error message to tell you if the unpack failed tho'....
I'm havng a little bit of trouble picking up local resources in my app
deployed as foo#bar, using the ClassLoader,
- but I'm sure I can fix this as the ClassLoader is picking up bundled
libraries OK
thanks again
Trevor Paterson PhD
new email trevor.paterson@roslin.ed.ac.uk
> -----Original Message-----
> From: Mark Thomas [mailto:markt@apache.org]
> Sent: 25 August 2008 17:37
> To: Tomcat Users List
> Subject: Re: Tomcat6 relative contexts
>
> trevor paterson (RI) wrote:
> > excellent thanks Mark - I changed to build 18 and
> foo#bar.war deploys
> > to context /foo/bar
> >
> > it doesn't seem to unpack? there may be a good reason for this??
>
> It should. There is some work on my todo list in that area.
> I'll add checking this to that list.
>
> Mark
>
> >
> > Trevor Paterson PhD
> > new email trevor.paterson@roslin.ed.ac.uk
> >
> > Bioinformatics
> > The Roslin Institute
> > Edinburgh University
> > Scotland EH25 9PS
> > phone +44 (0)131 5274477
> > http://www.roslin.ed.ac.uk
> > http://www.comparagrid.org
> > http://www.thearkdb.org
> >
> > Please consider the environment before printing this e-mail
> >
> > The University of Edinburgh is a charitable body, registered in
> > Scotland with registration number SC005336 Disclaimer:This
> e-mail and
> > any attachments are confidential and intended solely for the use of
> > the recipient(s) to whom they are addressed. If you have
> received it
> > in error, please destroy all copies and inform the sender.
> >
> >
> >
> >> -----Original Message-----
> >> From: Mark Thomas [mailto:markt@apache.org]
> >> Sent: 25 August 2008 16:45
> >> To: Tomcat Users List
> >> Subject: Re: Tomcat6 relative contexts
> >>
> >> trevor paterson (RI) wrote:
> >>> Prior to tomcat6 you could happily deploy a 'bar.war' to
> a context
> >>> like '/foo/bar' simply by including a context.xml file in
> >> the META-INF
> >>> directory of the war
> >>>
> >>> with content <Context path='/foo/bar'/>.
> >> Actually, that won't quite have done what you think it did.
> >> You normally would have ended up with double deployment.
> >>
> >>> we can no longer get this to work - the only way we can get a
> >>> subcontext recognized is by putting this Context element in the
> >>> server.xml (which then causes autodeployment to both '/bar'
> >> and '/foo/bar').
> >>>
> >>> We have tried using the TomcatClientDeployer aswell as
> deploying on
> >>> start up and through the web interface to manager to no avail
> >>>
> >>> are we missing some subtle change from tomcat5 to 6 that
> is causing
> >>> this?
> >> As of 6.0.18, you have a couple of options:
> >> 1. Deploy the war outside the appBase and use a
> foo#bar.xml context
> >> file 2. Name your war foo#bar.war 3. Deploy using a
> directory foo#bar
> >>
> >> 2 & 3 only work in 6.0.18 onwards
> >>
> >> See
> >> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
> >> for details
> >>
> >> Mark
> >>
> >>
> >>
> >>
> ---------------------------------------------------------------------
> >> To start a new topic, e-mail: users@tomcat.apache.org To
> unsubscribe,
> >> e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
> >
> ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org To
> unsubscribe,
> > e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org To
> unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat6 relative contexts
Posted by Mark Thomas <ma...@apache.org>.
trevor paterson (RI) wrote:
> excellent thanks Mark - I changed to build 18 and foo#bar.war deploys to
> context /foo/bar
>
> it doesn't seem to unpack? there may be a good reason for this??
It should. There is some work on my todo list in that area. I'll add
checking this to that list.
Mark
>
> Trevor Paterson PhD
> new email trevor.paterson@roslin.ed.ac.uk
>
> Bioinformatics
> The Roslin Institute
> Edinburgh University
> Scotland EH25 9PS
> phone +44 (0)131 5274477
> http://www.roslin.ed.ac.uk
> http://www.comparagrid.org
> http://www.thearkdb.org
>
> Please consider the environment before printing this e-mail
>
> The University of Edinburgh is a charitable body, registered in Scotland
> with registration number SC005336
> Disclaimer:This e-mail and any attachments are confidential and intended
> solely for the use of the recipient(s) to whom they are addressed. If
> you have received it in error, please destroy all copies and inform the
> sender.
>
>
>
>> -----Original Message-----
>> From: Mark Thomas [mailto:markt@apache.org]
>> Sent: 25 August 2008 16:45
>> To: Tomcat Users List
>> Subject: Re: Tomcat6 relative contexts
>>
>> trevor paterson (RI) wrote:
>>> Prior to tomcat6 you could happily deploy a 'bar.war' to a context
>>> like '/foo/bar' simply by including a context.xml file in
>> the META-INF
>>> directory of the war
>>>
>>> with content <Context path='/foo/bar'/>.
>> Actually, that won't quite have done what you think it did.
>> You normally would have ended up with double deployment.
>>
>>> we can no longer get this to work - the only way we can get a
>>> subcontext recognized is by putting this Context element in the
>>> server.xml (which then causes autodeployment to both '/bar'
>> and '/foo/bar').
>>>
>>> We have tried using the TomcatClientDeployer aswell as deploying on
>>> start up and through the web interface to manager to no avail
>>>
>>> are we missing some subtle change from tomcat5 to 6 that is causing
>>> this?
>> As of 6.0.18, you have a couple of options:
>> 1. Deploy the war outside the appBase and use a foo#bar.xml
>> context file 2. Name your war foo#bar.war 3. Deploy using a
>> directory foo#bar
>>
>> 2 & 3 only work in 6.0.18 onwards
>>
>> See
>> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
>> for details
>>
>> Mark
>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org To
>> unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat6 relative contexts
Posted by "trevor paterson (RI)" <tr...@roslin.ed.ac.uk>.
excellent thanks Mark - I changed to build 18 and foo#bar.war deploys to
context /foo/bar
it doesn't seem to unpack? there may be a good reason for this??
Trevor Paterson PhD
new email trevor.paterson@roslin.ed.ac.uk
Bioinformatics
The Roslin Institute
Edinburgh University
Scotland EH25 9PS
phone +44 (0)131 5274477
http://www.roslin.ed.ac.uk
http://www.comparagrid.org
http://www.thearkdb.org
Please consider the environment before printing this e-mail
The University of Edinburgh is a charitable body, registered in Scotland
with registration number SC005336
Disclaimer:This e-mail and any attachments are confidential and intended
solely for the use of the recipient(s) to whom they are addressed. If
you have received it in error, please destroy all copies and inform the
sender.
> -----Original Message-----
> From: Mark Thomas [mailto:markt@apache.org]
> Sent: 25 August 2008 16:45
> To: Tomcat Users List
> Subject: Re: Tomcat6 relative contexts
>
> trevor paterson (RI) wrote:
> > Prior to tomcat6 you could happily deploy a 'bar.war' to a context
> > like '/foo/bar' simply by including a context.xml file in
> the META-INF
> > directory of the war
> >
> > with content <Context path='/foo/bar'/>.
>
> Actually, that won't quite have done what you think it did.
> You normally would have ended up with double deployment.
>
> > we can no longer get this to work - the only way we can get a
> > subcontext recognized is by putting this Context element in the
> > server.xml (which then causes autodeployment to both '/bar'
> and '/foo/bar').
> >
> > We have tried using the TomcatClientDeployer aswell as deploying on
> > start up and through the web interface to manager to no avail
> >
> > are we missing some subtle change from tomcat5 to 6 that is causing
> > this?
>
> As of 6.0.18, you have a couple of options:
> 1. Deploy the war outside the appBase and use a foo#bar.xml
> context file 2. Name your war foo#bar.war 3. Deploy using a
> directory foo#bar
>
> 2 & 3 only work in 6.0.18 onwards
>
> See
> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
> for details
>
> Mark
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org To
> unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat6 relative contexts
Posted by Mark Thomas <ma...@apache.org>.
trevor paterson (RI) wrote:
> Prior to tomcat6 you could happily deploy a 'bar.war' to a context like
> '/foo/bar' simply by including a context.xml file in the META-INF
> directory of the war
>
> with content <Context path='/foo/bar'/>.
Actually, that won't quite have done what you think it did. You normally
would have ended up with double deployment.
> we can no longer get this to work - the only way we can get a subcontext
> recognized is by putting this Context element in the server.xml (which
> then causes autodeployment to both '/bar' and '/foo/bar').
>
> We have tried using the TomcatClientDeployer aswell as deploying on
> start up and through the web interface to manager to no avail
>
> are we missing some subtle change from tomcat5 to 6 that is causing
> this?
As of 6.0.18, you have a couple of options:
1. Deploy the war outside the appBase and use a foo#bar.xml context file
2. Name your war foo#bar.war
3. Deploy using a directory foo#bar
2 & 3 only work in 6.0.18 onwards
See http://tomcat.apache.org/tomcat-6.0-doc/config/context.html for details
Mark
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org