tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Prashant Kadam" <pra_ka...@hotmail.com>
Subject need Help
Date Wed, 23 Jul 2003 18:52:28 GMT


I have installed tomcat 4.1.6
I have created "Prashant" folder under  "webApps"

My Folder structure is

webapps-
	|_Prashant
		|_Web-inf
		                 |_Classes-----
		                 |_ web.xml     |_myservlet

in server.xml. I  added
<context path="/Prashant" docBase="Prashant"
debug="0" reloadable="true" crossContext="true" />

I could run JSP pages with URL "http://localhost:8080/Prashant/myjsp.jsp"
but my servlets are not runnng.
To run this servlet I entered URL"http://localhost:8080/Prashant/MyServlet"
I added following lines to web.xml files

<servlet>
	<servlet-name>MyServlet</servlet-name>
	<servlet-class>testServlet</servlet-class>
</servlet>
<servlet-mapping>
	<servlet-name>MyServlet</servlet-name>
	<url-pattern>/MyServlet</url-pattern>
</servlet-mapping>

What should I do to run this servlet.

I my trying to use JDBC in JSP file, I added following lines to my 
servler.xml

<context path="/Prashant" docBase="Prashant"
	debug="0" reloadable="true" crossContext="true" >
	<NamingResources>
		<Resource name="jdbc/conversion" auth="Container"
                   		type="javax.sql.DataSource"/>

		<ResourceParams name="jdbc/conversion">
  			<parameter>
   				<name>usernane</name>
   				<value>sa</value>
  			</parameter>
  			<parameter>
   				<name>password</name>
   				<value></value>
  			</parameter>
  			<parameter>
   				<name>driverClassName</name>
   				<value>sun.jdbc.odbc.JdbcOdbcDriver</value>
  			</parameter>
  			<parameter>
   				<name>url</name>
   				<value>jdbc:odbc:test</value>
  			</parameter>
		</ResourceParams>
	</NamingResources>
</context>

&
in web.xml
<Resource name="jdbc/conversion" auth="Container"
                  type="javax.sql.DataSource"/>

But it throws Exception and gives message "Name jdbc is not bound in this 
Context"
following codes are written in JSP files

Context init = new InitialContext();
Context ctx = (Context) init.lookup("java:comp/env");
DataSource ds = (DataSource) ctx.lookup("jdbc/conversion");
Connection conn = ds.getConnection();

What else  should I do to run these applications successfuly

can anybody help me. My mail id is pra_kadam@hotmail.com

_________________________________________________________________
Travel plans? Click here. http://www.msn.co.in/Travel Sit back & relax!


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message