Where to save web.xml file in apache jserv with servlet 2.0
hi,
we are using apache jserv which included servlet 2.0 we are able to run .class files and
jsp files,but we are using web.xml file for connection pooling which we were used in tomcat
but we are unable to find web-inf folder in apache/jserv to save the file.
please help me out in this problem,
please guide us is there any other method of connection pooling apache jserv,we are using backend
as oracle9i
i will be greatfull to u in this regards
laiq
Hi,
Just create WEB-INF folder and copy the web.xml.
good luck !
...san :-)
Similar Messages
-
Where is the web.xml file in Tomcat 5.5
hi folks,
i made a small appl in Tomcat 5.5 named "Name". I made a WEB-INF folder inside the Name folder (which obv is inside the webapps folder), which inside had the classes and lib folder. After running the application where do i look for the web.xml file controlling my appl?
thanx in advance..well, the web.xml file must be done for you. Its specific to your project, you wont find in on other folders of tomcat.
-
Console WAR deployment editor tool damage my web.xml file
I put many servlet and servlet-mapping items in web.xml file. When I deployed my
web app into weblogic 7.0 SP1 server, I use the console to open the deployment
description, and change some parameters for the servlet. After I clicked the persist
button, the web.xml file was changed, but some servlet and servlet-mapping items
was removed unexpected.
Why?
When I start the server in Development mode, this error occured rather often.
In the product mode, this error occured a few times.
My operation steps:
1. undeploy the original app from console
2. copy the new war file to the applications directory, overwrite the old one
3. use the console to open the deployment description, make the changes
4. persist the changes
5. re-deploy the web app
Please give the solution as soon as possibleThe tag
<target name="deploy" depends="clover-yes, clover-no">...is never closed.
close that tag:
<target name="deploy" depends="clover-yes, clover-no">
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpath="${libs}" debug="off" optimize="on" deprecation="on" compiler="${compiler}">
<include name="org/apache/commons/fileupload/**/*.java" />
<include name="com/portalbook/portlets/**/*.java" />
<include name="com/portalbook/portlets/content/**/*.java" />
</javac>
</target>Second error is that the depends in there (clover-yes, clover-no) are not existing as targets in your xml. -
(newbie) Question about replacing .class files and web.xml file
I'm new to servlets and I have two quick questions...
Do I absolutely need a web.xml file to define all my servlets, or can I simply place .class files into the WEB-INF directory and expect them to run?
If my application server (for example Tomcat) is running and I replace a servlet .class file, do I need to restart the server for the new .class file to take effect?
...or are both of these questions specific to the application server I'm using?Hi,
From an article I read:
With Tomcat 3.x, by default servlet container was set up to allow invoking a servet through a common mapping under the /servlet/ directory.
A servlet could be accessed by simply using an url like this one:
http://[domain]:[port]/[context]/servlet/[servlet full qualified name].
The mapping was set inside the web application descriptor (web.xml), located under $TOMCAT_HOME/conf.
With Tomcat 4.x the Jakarta developers have decided to stop allowing this by default. The <servlet-mapping> tag that sets this mapping up, has been commented inside the default web application descriptor (web.xml), located under $CATALINA_HOME/conf:
<!-- The mapping for the invoker servlet -->
<!--
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
-->
A developer can simply map all the servlet inside the web application descriptor of its own web application (that is highly suggested), or simply uncomment that mapping (that is highly discouraged).
It is important to notice that the /servlet/ isn't part of Servlet 2.3 specifications so there are no guarantee that the container will support that. So, if the developer decides to uncomment that mapping, the application will loose portabiliy.
And declangallagher, I will use caution in future :-) -
Init parameters in web.xml file
Hi,
I have a query related to the init parameters defined in web.xml file.
When does a servlet read these parameters?
Also, how does servlet use these parameters while processing the client's request?
Thanks in advance......hai,
In order to make servlet flexible we must avoid hard-coding(writing-directly).so there are two ways in that one one way is init param's.
create ServletConfig object as show below
ServletConfig config=getServletConfig();then retrieve the init param value in to your servlet us getInitParameter(..) method as show below
String something=config.getInitParameter("init param name"); -
Can i run a servlet without a web.xml file for servlet mapping?
Hello everyone.
The code i want to run compiles and everythink looks ok.
It produces the .class file.
I run Tomcat 4.1 and i build my Web site with Dreamweaver.
I have a form in a page and i want to send the data upon form completion to a database i already have build with MySql.
The database is up and running and the server is set-up ok.
I have changed the port in Tomcat to run on port 80.
The directory i have my site is
Tomcat41\webapps\ROOT\se
and the directory where i keep the servlet class is
Tomcat41\webapps\ROOT\se\WEB-INF\servlet
I have a web.xml file to map the servlet and placed it in
Tomcat41\webapps\ROOT\se\WEB-INF
In the Form action i write action:"/servlets/Classes/GroupRegistration"
and I RECEIVE AN 404 ERROR FROM APACHE.
Somethink is wrong .
The following is the code from the GroupRegistration.java file
and follws the web.xml file.
Please Help.
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class GroupRegistration extends HttpServlet
Connection con;
public void doPost (HttpServletRequest req, HttpServletResponse res)
throws ServletException, java.io.IOException
handleForm(req, res);
public void init() throws ServletException {
try{
/* Loading the driver for the database */
Class.forName("com.mysql.jdbc.Driver");
Connection Con = DriverManager.getConnection("jdbc:mysql://localhost/se?user=luser&password=");
catch (ClassNotFoundException e) {
throw new UnavailableException("Couldn't load JdbcOdbcDriver");
catch (SQLException e) {
throw new UnavailableException("Couldn't get db connection");
private void handleForm(HttpServletRequest req, HttpServletResponse res)
throws ServletException {
//ServletOutputStream out = res.OutputStream();
//res.setContentType("text/html");
//Extract the form Data Here
String group = req.getParameter("GroupNo");
String Name1 = req.getParameter("Name1");
String LoginID1 = req.getParameter("LoginID1");
String Name2 = req.getParameter("Name2");
String LoginID2 = req.getParameter("LoginID2");
String Name3 = req.getParameter("Name3");
String LoginID3 = req.getParameter("LoginID3");
String Name4 = req.getParameter("Name4");
String LoginID4 = req.getParameter("LoginID4");
String URL = req.getParameter("URL");
String Title2 = req.getParameter("Title2");
String date = req.getParameter("date");
String INSERT = "INSERT INTO registration (groupno, name1, loginid1, name2, loginid2, name3, loginid3, name4, loginid4, url, topic, date) VALUES (" + group + "," + Name1 + "," + LoginID2 + "," + Name2 + "," + LoginID2 + "," + Name3 + "," + LoginID3 + "," + Name4 + "," + LoginID4 + "," + URL + "," + Title2 + "," + date + ")";
PreparedStatement pstmt = null;
try{
pstmt = con.prepareStatement(INSERT);
pstmt.executeUpdate();
catch (SQLException e) {
throw new ServletException(e);
finally {
try {
if (pstmt != null)pstmt.close();
catch (SQLException ignored){
The web.xml file
<?xml version="1.0" encoding="ISO-8859-1"?>
<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">
<servlet>
<servlet-name>GroupRegistration</servlet-name>
<servlet-class>GroupRegistration</servlet-class>
</servlet>
<servlet-maping>
<servlet-name>GroupRegistration</servlet-name>
<url-pattern>/myGroupRegistration</url-patern>
</servlet-mapping>
</web-app>
I apreciate your time.
Thanks for any help.and the directory where i keep the servlet class is
Tomcat41\webapps\ROOT\se\WEB-INF\servletOthers have pointed out that "servlet" should be "classes", but there is another mistake that hasn't been spotted. If you want your servlet to appear in the root context, you should use:
Tomcat41\webapps\ROOT\WEB-INF\classes
If you want your servlet to appear under the /se context, then you should use:
Tomcat41\webapps\se\WEB-INF\classes
and also, in the latter case, your form action should be /se/myGroupRegistration. -
Taw web xml file ADMINREADCC8 context parameter
when I run the scipt for CCA the Useme.sql I only see the ADMINCC8 user I don't see the ADMINREADCC8 so I'm not sure what to put on the following context for web.xml
<!-- Needs to be removed for MSSQL-->
<!--<context-param>-->
<!--<param-name>databaseSchemaReadOnly</param-name>-->
<!--<param-value>ADMINCCREAD813</param-value>-->
<!--</context-param>-->This is the eclipse error
The content of element type "web-app" must match "(icon?,display-
name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-
mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-
ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-
ref*)".
Web.xml file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>tapestryHiber Tapestry 5 Application</display-name>
<context-param>
<!-- The only significant configuration for Tapestry 5, this informs Tapestry
of where to look for pages, components and mixins. -->
<param-name>tapestry.app-package</param-name>
<param-value>com.kids.crm</param-value>
</context-param>
<filter>
<filter-name>app</filter-name>
<filter-class>org.apache.tapestry5.TapestryFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>app</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/spring-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
Edited by: csckid on Aug 29, 2011 5:51 AM -
How to setup web.xml files in Tomcat 4.0.6
Hi, I'm to new to Java Servlets. i am trying to run my first servlet but it's not showing up..can anyone help me out please!!!
I created a folders like this:
webapps/sumitapps/WEB-INF\classes\Forms\login.class
under sumitapps: i'm puttin all of my .html files(Logins.html)
under WEB-INF: i put web.xml file and classes folder
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>Forms.login</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/Forms.login</url-pattern>
</servlet-mapping>
</web-app>
<Context path="/sumitapps" docBase="webapps/sumitapps" crossContext="true" debug="0" reloadable="true" trusted="false" >
</Context>
under my classes folder i put folder Forms where i'm keeping all of my .class files. my class file name is login.class
can anyone tell me why i cant run my servlets
<FORM method="POST" action="Forms.login"
name=userinfo onsubmit="return checkData()">
please help me out here
i can access my html page like this:
http://lcoalhost:8080/sumitapps/Logins.html
but when i enter userid and password it doesnt show anything..it takes me to http://localhost:8080/sumitapps/Forms.login
and shows cannot be displayedhave a look at www.moreservlets.com. There you can find a free pdf (part of the book, a whole chapter) that explains in deep the use of web.xml.
-
Help on web.xml file, what if the parameters contains key words ?
Hi:
I am just wondering what should I do if I want to include key words suchs
as <param> in web.xml file for a servlet config.
Example:
<servlet>
<servlet-name>testServlet</servlet-name>
<parameter>
<param-name>some name</param-name>
<param-value>some value</param-value>
</parameter>
</servlet>
What should I do if I want to repleace 'some value' with '</param-value>some
value' and still to prevent the engine to terminate parsing the param-value
at the fake ending? Is there a standard way in XML to distanguish that?
(in URL format it can be replaced %xx for some chars).
ie,
<param-value> </param-value>some value</param-value>
where the second </param-value> is the real ending.
Thank you!
GangHi!
You can use "& lt ;" and "& gt ;" xml entities for that. Or wrap text element in <![CDATA[...]]> section.
Regards,
Ignat. -
How to configure a JNDI ressource in the web.xml file
Hi,
does someone know if there is a way to configure a JNDI ressource with its parameters only in the web.xml file ?
In my case, the JNDI ressouce is an oracle database an its conenction paramters: driverClassName, username, password, etc...
Actually, I put everything in the configuration file of Tomcat but I would like my war file to be 100% independent of the application server.
Thanks in advance.
Fred.I wrestled with this for a long time. I may have done something wrong, but to get my mySQL JDNI reference to work, I had to add it to the server.xml file. You can try with web.xml, but I eventually just got frustrated and put it in server.xml.
The following is between two <context> tags:
<Resource name="jdbc/instance_name_goes_here"
auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/same_instance_name_here">
<parameter>
<name>username</name>
<value>user_name_goes_here</value>
</parameter>
<parameter>
<name>password</name>
<value>password_goes_here</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>jdbc_fully_qualified_class_name</value>
</parameter>
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc_connect_url_database_vendor_specific</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>8</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>8</value>
</parameter>
</ResourceParams>
- Saish
"My karma ran over your dogma." - Anon -
Configuring a JNDI ressource in the web.xml file
Hi,
does someone know if there is a way to configure a JNDI ressource with its parameters only in the web.xml file ?
In my case, the JNDI ressouce is an oracle database an its conenction paramters: driverClassName, username, password, etc...
Actually, I put everything in the configuration file of Tomcat but I would like my war file to be 100% independent of the application server.
Thanks in advance.
Fred.I'm pretty sure you can't do it that way round. The logic of the thing is that database access URLs etc. tend to depend on the where the server is. The whole idea of these resources is to put the stuff that's specific to the server in server.xml and refer to it using names that should remain the same if you deploy your webapp on another server. Of, for example, you have test, stage and production servers running the same webapps but connecting to different databases.
-
About Tomact's Web.xml file
Starting service Tomcat-Standalone
Apache Tomcat/4.0.1
PARSE error at line 38 column 11
org.xml.sax.SAXParseException: The content of element type "web-app" must match "(icon?,display-name?,description?,
distributable?,context-param*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page
*,taglib*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*)".
Starting service Tomcat-Apache
Apache Tomcat/4.0.1
I am getting this message when i keep web.xml file in web-inf folder.that is after starting tomcat.Hi
The elements in web.xml file must follow a specific order, it the one tomcat prints in the error-message. (It should also tell THIS IS THE REQUESTED ORDER)
I made the same problem before... ;)
Made you have a <servlet-mapping> tag before a <servlet> tag? That is not correct! Hope this solves your problems. :)
/Tobias -
Automate creation of web.xml file for tomcat 4.1.29
hi , this is with ref to Tomcat 4.1.29, if i am correct, each Servlet in the application has to be mentioned in the web.xml file for the Tomcat to know about it. Is there any way to automate the creation of web.xml file , depending on the contents of the Servlet folder of the application. Any way to escape from writing each Servlet name in web.xml file.
rcHello,
Maybe you should check if you can use Ant tool to do
that. I am not sure if it can help u.
Zeph.
http://ant.apache.org/
It will, specially if used in conjunction with XDoclets :
http://xdoclet.sourceforge.net/
XDoclet has Ant tasks to generate web.xml files. -
Maintaining Portal Desk top URL aliases in web.xml file
Hi All,
I am planning to configure portal url alias i.e http://localhost:53000/irj/portal/finance
should take me directly to finance portal desk top.
1) Created a Desktop named finance_desktop
2) Master rule has been set for URL Alias.
3) I need to set URL alias name: finance in web.xml file
4) path for the web.xml file is C:\usr\sap\SID\JCXX\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\web.xml
5) Where exactly i have to change web.xml file
Infact i have seen a pdf "How to configure the J2ee engine deployment descriptor"
Thanks in advance
Regards,
MuraliHi
indeed one small copy/paste mistake from me ... sorry for that...
After you copyed the large chunk of code (as i discribe in step 1 and 2) you must rename:
<param-name>portal</param-name>
to
<param-name>portal/finance</param-name>
so then that part of the web.xml will look like this:
<init-param>
<param-name>portal</param-name>
<param-value>
anonymous=0,proxy=0,low_bandwidth=0,include_in_url=1,include_application_name_in_url=1
</param-value>
</init-param>
<init-param>
<param-name>portal/finance</param-name>
<param-value>
anonymous=0,proxy=0,low_bandwidth=0,include_in_url=1,include_application_name_in_url=1
</param-value>
</init-param>
Good luck again...
Cheers,
Benjamin Houttuin
Message was edited by:
Benjamin Houttuin -
Web.xml file not being read
Hello, I did a quick search but could not find an answer to my specific problem. (this is also my first night tackling servlets) i hope this hasnt been answered before. here goes...
i'm using Tomcat 4.1 and this is my file structure where i put my servlets:<intstall dir>/webappps/ROOT/WEB-INF/classes/TestPackage.
this is my code for the servlet
package TestPackage;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
/** Example using servlet initialization. Here the message
* to print and the number of times the message should be
* repeated is taken from the init parameters.
public class ShowMessage extends HttpServlet
private String message;
private String defaultMessage = "No message.";
private int repeats = 1;
public void init(ServletConfig config) throws ServletException
//Always call super.init
super.init(config);
message = config.getInitParameter("message");
if (message == null)
message = defaultMessage;
try
String repeatString = config.getInitParameter("repeats");
repeats = Integer.parseInt(repeatString);
catch(NumberFormatException nfe)
//do nothing
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String title = "The ShowMessage Servlet";
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">\n" +
"<HTML>\n" +
"<body bgcolor=\"#FDF5E6\">\n" +
"<h1 align=center>" + title + "</h1>");
for(int i=0; i<repeats; i++)
out.println(message + "<br>");
out.println("</body></html>");
}my web.xml file is in <intstall dir>/webappps/ROOT/WEB-INF. it looks like:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>
<servlet>
<servlet-name>
ShowMsg
</servlet-name>
<servlet-class>
TestPackage.ShowMessage
</servlet-class>
<init-param>
<param-name>
message
</param-name>
<param-value>
Shibboleth
</param-value>
</init-param>
<init-param>
<param-name>
repeats
</param-name>
<param-value>
5
</param-value>
</init-param>
</servlet>
</web-app>when i access the servlet i get "No message" one time which is the default message. Any ideas as to why its not picking up the init parameters. I've restarted my laptop and started and stopped Tomcat a few times and i always get the default message...i also tried ShowMessage in replace of ShowMsg as the <servlet-name>, to no avail. I also tried removing the package name in the <servlet-class>, still nothing. Is there another web.xml file some where else that i need to update?
Thanks! (sorry for the long code)
BBThe doGet method works if you are sending data from a form using get method. It is better to use service method.
Maybe you are looking for
-
Download Error after paying for music
I have paid for two albums off of Blackberry World. When I go into the downloading area all that shows is download error under the progress bar. I have tried canceling the downloads, battery pulls, clearing out the cache, etc. I have not been able to
-
I'm having trouble synchronizing my iCalendar between my desktop Mac and my iPhone 4S. Preferences for both devices are set to enable iCal in iCloud (or so I think) but items entered in one don't appear in the other unless I plug the devices togeth
-
Printer not working after update on macbook pro
After updating my Macbook Pro to the latest version, OS X 10.9.5 I now cannot print to my wireless printer which is a Canon MG6350. The wireless connection to the printer is fine and the wireless connection to the Macbook is fine but they are not co
-
Why can't I delete photos in iPhoto album?
I have been happily deleting unwanted photos but now find that iPhoto will no longer allow me to do that. I have tried rebooting to no avail. And no, i haven't had any recent updates or made any changes myself. Help!
-
Error de actualización U44M1P7
Al intentar actualizar las apps me da el siguiente error: Fallo en la actualizacion Errores encontrados durante la instalacion.(U44M1P7) ¿alguien sabe la solucion?