My web.xml

can anyone see anything wrong with my web.xml??it uses jndi to connect to a database
the resource is called jdbc/Airline and the code i call in my beans for connecting to the database is
public void connect()
         try{
          Context ctx = new InitialContext();
             if(ctx == null )
                     throw new Exception("Boom - No Context");
               ds = (DataSource)ctx.lookup("java:comp/env/jdbc/Airline");
                if (ds != null)
                      conn = ds.getConnection();
                if(conn != null)
                 conn.close();
<?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">
<resource-ref>
  <description>
   JNDI DataSource that implements connection pooling for airline.jsp
  </description>
  <res-ref-name>jdbc/Airline</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
  <res-sharing-scope>Sharable</res-sharing-scope>
</resource-ref>
</web-app>for some reason this works like a charm on my tomcat server 5.0.19 but when i move it to another server tomcat 5.0 on a web domain, it dosent read or write to the database at all , also i know the database url user name and password are all correct. can anyone suggest a reason as to why this would happen??

Yes, it is possible with Tomcat 4.1.29 and higher to deploy without having to touch the server.xml.
I've got a Web app in a WAR file named MyApp.war.
Here's the pertinent part of my web.xml:
    <resource-ref>
        <description>Access System DSN datasource for testing</description>
        <res-ref-name>jdbc/MyDataSource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>Here's what's in MyApp.xml:
<Context    path="/MyApp"
            docBase="MyApp.war"
            debug="1"
            reloadable="true"
            crossContext="true"
            useNaming="true">
    <Logger className="org.apache.catalina.logger.FileLogger"
            prefix="localhost-api-prototype-log."
            suffix=".txt"
            timestamp="true"/>
    <Resource   name="jdbc/MyDataSource"
                auth="Container"
                type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/MyDataSource">
        <parameter>
            <name>factory</name>
            <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
        </parameter>
        <parameter>
            <name>driverClassName</name>
            <value>oracle.jdbc.driver.OracleDriver</value>
        </parameter>
        <parameter>
            <name>url</name>
            <value>jdbc:oracle:thin:@host:1521:database</value>
        </parameter>
        <parameter>
            <name>username</name>
            <value>MyUsername</value>
        </parameter>
        <parameter>
            <name>password</name>
            <value>MyPassword</value>
        </parameter>
        <parameter>
            <name>maxActive</name>
            <value>20</value>
        </parameter>
        <parameter>
            <name>maxIdle</name>
            <value>0</value>
        </parameter>
        <parameter>
            <name>maxWait</name>
            <value>60000</value>
        </parameter>
        <parameter>
            <name>removeAbandoned</name>
            <value>true</value>
        </parameter>
        <parameter>
            <name>logAbandoned</name>
            <value>true</value>
        </parameter>
        <parameter>
            <name>removeAbandonedTimeout</name>
            <value>300</value>
        </parameter>
    </ResourceParams>
</Context>If I put MyApp.war and MyApp.xml in TOMCAT_HOME/webapps, that's enough to deploy my app. No edits to server.xml needed. I can do it without contacting an admin or forcing them to do things for me. I have all the 3rd party JARs I need in WEB-INF/lib, so I don't depend on anything in TOMCAT_HOME/common/lib except for what ships with Tomcat.

Similar Messages

  • WEB.XML gives me an error while deploying a Web Application in Weblogic 5.1

    I have a Web.xml which I copied the one from their documentation and edited for my servlet specific data. When I try to deploy it I am getting the following error.
              Wed Nov 15 17:10:37 EST 2000:<E> <HTTP> Error reading Web application 'C:/tomcat
              /webapps/La/'
              java.net.UnknownHostException: java.sun.com
              Can you throw some light on this? I have included the first three lines from the WEB,XML file where weblogic is choking.
              <?xml version="1.0" encoding="UTF-8"?>
              <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN'
              'http://java.sun.com/j2ee/dtds/webapp_2_2.dtd'>
              Thank You
              Trisula P. Siripurapu
              

              Hi Jacek,
              Thank you for your suggestion. I changed the Web App version to 1.2 instead of 2.2. It worked. Thanks once again for the timely response. I really do appreciate it.
              Trisula Pani Siripurapu.
              Jacek Laskowski <[email protected]> wrote:
              >"Trisula P. Siripurapu" wrote:
              >>
              >> I have a Web.xml which I copied the one from their documentation and edited for my servlet specific data. When I try to deploy it I am getting the following error.
              >> Wed Nov 15 17:10:37 EST 2000:<E> <HTTP> Error reading Web application 'C:/tomcat
              >> /webapps/La/'
              >> java.net.UnknownHostException: java.sun.com
              >
              >I remember having the same problem before I added the latest service
              >pack (SP 6). If you don't want to download it, just change DOCTYPE to
              >
              ><!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application
              >1.2//EN' 'http://java.sun.com/j2ee/dtds/webapp_2_2.dtd'>
              >
              >and it should work. Notice the change of Web Application version - 1.2
              >rather then 2.2. I'm (almost) sure, I saw one example - examples/webapp
              >(?) - with this header. Take a look at the accompanying examples.
              >
              >When you apply SP6, things should work as they suppose to.
              >
              >> Trisula P. Siripurapu
              >
              >Jacek Laskowski
              

  • Web application and web.xml

    i have a web application consisting of 1 servlet and 5 jsps.
    the start point would be index.jsp
    i use firmwide login page. after login, i want the browser to display index.jsp page.
    In web.xml, i have defined -
    <welcome-file-list>          <welcome-file>/jsp/index.jsp</welcome-file>     </welcome-file-list>       <servlet>        <servlet-name>UtilitiesServlet</servlet-name>        <servlet-class>com.gs.fw.sox404.utilities.UtilitiesServlet</servlet-class>             <init-param>             <param-name>util-log4j-init-file</param-name>             <param-value>/WEB-INF/classes/util_log4j.properties</param-value>          </init-param>        <load-on-startup>1</load-on-startup>    </servlet>     <servlet-mapping>        <servlet-name>UtilitiesServlet</servlet-name>        <url-pattern>/UtilitiesServlet</url-pattern>    </servlet-mapping>if i define it as just index.jsp in the welcome file list, after successful login, it displays the dir structure of the web app.
    if i define it as jsp/index.jsp, then in some of the pages, it tries to find the servlet inside jsp folder.
    What would be the best way to get around this?

    Well, yes, it's not able to find it because you've not understood the mechanism of how it works clearly. You have to put your welcome file under every directory you want it to be used from. Like I said, it's not a path, it's a filename. So if the container sees that your request URL is for a directory, it'll look for the welcome files from the welcome file list, one by one, in the order of declaration. Whichever one it finds first, it'll serve that. If it doesn't find any, then it'll either give a 404 or a directory listing depending on the server and it's settings.
    So your problem is that you've put your index.jsp in your JSP folder but expect it to be served for all URLs. That won't happen, you'll have to put one file named index.jsp into every directory. The reasoning is pretty simple, what if you want different behaviour for each folder?
    This should fix your problem :)
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    ----------------------------------------------------------------

  • How do you modify the web.xml to lock down the pages from a user role

    how do you modify the web.xml to lock down the pages from a user role

    I'll make a stab at your question:
    The following is an example of where a URL is protected within a web.xml deployment descriptor. In this example, the URL /protectedA within the application is protected:
    <!-- security constraints -->
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>protectedA</web-resource-name>
    <url-pattern>/protectedA</url-pattern>
    </web-resource-collection>
    <!-- authorization -->
    <auth-constraint>
    <role-name>sr_developer</role-name>
    </auth-constraint>
    </security-constraint>
    Sun's explaination here:
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/Security4.html

  • Need help to set values from web.xml in a jsp class

    Hey :-)
    I`m trying to get value from my web.xml file into a jsp class. The problem is that the value always retur null. My web.xml file is replaced in the WEB-INF directory where should be. Here is my web.xml
    <servlet>
    <servlet-name>Html</servlet-name>
    <servlet-class>Html</servlet-class>
    <init-param>
    <param-name>html_test</param-name>
    <param-value>Value I want have in my jsp class
    </param-value>
    </init-param>
    </servlet>
    And her i my java class who don`t work:
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    import javax.servlet.ServletConfig;
    public class Html extends BodyTagSupport
    String title="";
    String html_test;
    ServletConfig config;
    public void doInitBody() throws JspException
    html_test = config.getInitParameter("html_test");
    }//End of method doInitBody()
    public int doStartTag() throws JspException
    try
    JspWriter out = pageContext.getOut();
    out.print( "<HTML>\n" );
    out.print( "<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" );
    out.print( "<BODY>\n" );
    out.print( "<BR><H1>" + html_test + "</H1>" );
    And here are my html_test variable return null.
    I hope somone can help me, duke dollars will be given away for the solution answer.
    paulsep

    Nothing seems to work, have change the string and rewritten the web.xml file to:
    <?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>
              <context-param>
                   <param-name>html_test</param-name>
                   <param-value>Value I want have in my jsp class</param-value>
              </context-param>
    </web-app>

  • How can I get the context-parm from a web.xml file using struts?

    Hello:
    I need get the context-param from the web.xml file of my web project using struts. I want configurate the jdbc datasource connection pooling here. For example:
    <context-param>
    <param-name>datasource</param-name>
    <param-value>jdbc/formacion</param-value>
    <description>Jdbc datasource</description>
    </context-param>
    and then from any Action class get this parameter.
    Similar using a simple server can be:
    /** Initiates new XServlet */
    public void init(ServletConfig config) throws ServletException {
              for (Enumeration e = config.getInitParameterNames(); e.hasMoreElements();) {
                   System.out.println(e.nextElement());
              super.init(config);
              String str = config.getInitParameter("datasource");
              System.out.println(str);
         public void doPost(HttpServletRequest req, HttpServletResponse res)
              throws ServletException, IOException {
              // res.setContentType( );
              System.out.println("Got post request in XServlet");
              PrintWriter out = res.getWriter();
              out.println("nada");
              out.flush();
              out.close();
    but only this works for init-params, if I use
    <servlet>
         <servlet-name>MyServlet</servlet-name>
         <display-name>MyServlet</display-name>
         <servlet-class>myExamples.servlet.MyServlet</servlet-class>
         <init-param>
         <param-name>datasource</param-name>
         <param-value>jdbc/formacion</param-value>
    </init-param>
    </servlet>
    inside my web.xml. I need something similar, but using struts inside the action class for that I can get the context-params and call my database.
    Thank you

    To get context parameters from your web.xml file you can simply get the ActionServlet object from an implementing action object class. In the perform (or execute) method make the following call.
    ServletContext context = getServlet().getServletContext();
    String tempContextVar =
    context.getInitParameter("<your context param >");

  • Problem with web.xml, while migratig application from JBOSS 5.0 to JBOSS5.1

    Hi ,
    Earlier my application was running fine on JBOSS 5.0 .
    In that web.xml was like
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd"
         id="WebApp_ID" version="2.4">
         <servlet>
              <servlet-name>action</servlet-name>
              <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
              <init-param>
                   <param-name>config</param-name>
                   <param-value>/WEB-INF/struts-config.xml</param-value>
              </init-param>
              <load-on-startup>1</load-on-startup>
         </servlet>
         <!-- Timer Details -->
         <servlet>
              <servlet-name>perfMonCollector</servlet-name>
              <servlet-class>com.dbag.optimise.performancemonitor.timer.PerfMonitorCollector</servlet-class>
              <load-on-startup>4</load-on-startup>
              <init-param>
                   <param-name>cronExpr</param-name>
                   <param-value>0 0 0 */1 * ?</param-value>
                   <!--<param-value>0 */10 * * * ?</param-value> -->
              </init-param>
         </servlet>
         <servlet>
              <servlet-name>TransAnalysisCollector</servlet-name>
              <servlet-class>com.dbag.optimise.performancemonitor.timer.TransAnalysisCollector</servlet-class>
              <load-on-startup>3</load-on-startup>
              <init-param>
                   <param-name>cronExprTransAnalysis</param-name>
                   <param-value>*/30 * * * * ?</param-value>
              </init-param>
         </servlet>
         <!-- Timer Details -->
         <!-- PerfMonPoints Cache Generation on Server Startup -->
         <servlet>
              <servlet-name>perfMonGenerator</servlet-name>
              <servlet-class>com.dbag.optimise.performancemonitor.timer.PerfMonPointsGenerator</servlet-class>
              <load-on-startup>2</load-on-startup>
         </servlet>
         <!-- PerfMonPoints Cache Generation on Server Startup -->
         <!-- Standard Action Servlet Mapping -->
         <servlet-mapping>
              <servlet-name>action</servlet-name>
              <url-pattern>*.do</url-pattern>
         </servlet-mapping>
         <!-- The Usual Welcome File List -->
         <welcome-file-list>
              <welcome-file>jsp/index.jsp</welcome-file>
         </welcome-file-list>
    But now i have deployed my application on JBOSS 5.1 GA version.
    Now its giving exception.
    Caused by:
    org.xml.sax.SAXException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'init-param'. One of '{"http://java.sun.com/xml/ns/javaee":run-as, "http://java.sun.com/xml/ns/javaee":security-role-ref}' is expected. @ vfsfile:/local/dubeavi/jboss-5.1.0.GA/server/default/deploy/PerformanceMonitoringISE-1.0/WEB-INF/web.xml[28,15]
    at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$MetaDataErrorHandler.error(SaxJBossXBParser.java:426)
    at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
    at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:199)
    ... 41 more

    My new web.xml is like..
    <web-app
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         id="WebApp_ID"
         version="2.5">
         <servlet>
              <servlet-name>action</servlet-name>
              <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
              <init-param>
                   <param-name>config</param-name>
                   <param-value>/WEB-INF/struts-config.xml</param-value>
              </init-param>
              <load-on-startup>1</load-on-startup>
         </servlet>

  • How to give relative path in web.xml?

    Hi All,
    Im creating a servlet which has to load the properties file.
    I don't want to give the location of the properties file as ABSOLUTE PATH. But I'm unable to provide the same as RELATIVE PATH.
    When I give the path is given as ABSOLUTE PATH (drive:/dir/) it is working. But if I give the RELATIVE PATH(../), the same is not working.
    Kindly help me in this.
    Regards,
    Kumar Madhavan.
    My web.xml file is:
    <?xml version="1.0"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
         <display-name>NGT - ASCII</display-name>
         <description>Application for Safety Critical Information vIew.</description>
         <welcome-file-list>
              <welcome-file>ASCII.html</welcome-file>
         </welcome-file-list>
         <context-param>
              <param-name>asciifiledir</param-name>
    <!-- This is the tag in which I would like to
              <param-value>../</param-value>
         </context-param>
    </web-app

    Hi.
    Exclude the directory path from the <param-value/> in
    the web.xml and just keep the property file name.
    Place the property file in the classpath and load it
    like this from the servlet:
    Properties props = new Properties();
    String propFileName = "" // Read param-value from web.xml
    try {
    InputStream is = TheServlet.class.getResourceAsStream(propFileName);
    props.load(is);
    } catch (Exception ex) {
    System.out.println("Prop file not in classpath!");
    /Jesper

  • How to use dynamic file as welcome-file-list in web.xml

    I have configured my web.xml file as this,
    <web-app>
    <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
    </context-param>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>login.jsf</welcome-file>
    </welcome-file-list>
    </web-app>
    and my login.xhtml file as this,
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:c="http://java.sun.com/jstl/core"
    xmlns:f="http://java.sun.com/jsf/core">
    <body>
    <f:view>
    <h:form>
    UserName:<h:inputText id="userName"
    value="#{bean.userName}" rendered="true"
    required="true"/>
    Password:<h:inputText id="password"
    value="#{bean.password}" rendered="true"
    required="true"/>
    <h:commandButton id="submit" value="Submit" action="#{bean.authenticate}" />
    </h:form>
    </f:view>
    </body>
    </html>
    but when i deploy this using tomcat and try to put url as this,
    http://localhost:8080/project
    Its not identifying welcome file from web.xml
    I am getting error like this,
    The requested resource (/project/) is not available.
    How to resolve this,
    Thanks,
    Vinutha

    This might help:
    http://forum.java.sun.com/thread.jspa?threadID=696586
    As well, you might have to change the servlet-mapping in your web.xml. The url-pattern, I think, needs to be .xhtml. Your login.jsf file in the welcome list will need to be renamed to login.xhtml.
    CowKing

  • Replacing web.xml values with a deployment plan.  Not working on WL 10.3.2

    Hi All-
    I am trying to replace a value from web.xml with one in a weblogic deployment plan. I deployed the application on WL 10.3.2 and used the deployment plan below. No matter what I do it doesn't seem to want to take the value.
    web.xml:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!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>
    <context-param>
    <param-name>TokenGroup</param-name>
    <param-value>oldvalue</param-value>
    </context-param>
    </web-app>
    Deployment Plan:
    <?xml version='1.0' encoding='UTF-8'?>
    <deployment-plan xmlns="http://xmlns.oracle.com/weblogic/deployment-plan"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.oracle.com/weblogic/deployment-plan http://xmlns.oracle.com/weblogic/deployment-plan/1.0/deployment-plan.xsd"
    global-variables="false">
    <application-name>APPName</application-name>
    <variable-definition>
    <variable>
    <name>TokenGroup</name>
    <value>Key123456</value>
    </variable>
    </variable-definition>
    <module-override>
    <module-name>APPName.war</module-name>
    <module-type>war</module-type>
    <module-descriptor external="false">
    <root-element>web-app</root-element>
    <uri>WEB-INF/web.xml</uri>
    <variable-assignment>
    <name>TokenGroup</name>
    <xpath>/web-app/context-param/[param-name="TokenGroup"]/param-value</xpath>
    <operation>replace</operation>
    </variable-assignment>
    </module-descriptor>
    </module-override>
    </deployment-plan>
    I've also tried other formats for the xpath such as:
    /web-app/context-param/{param-name="TokenGroup"}/param-value
    /web-app/context-param[param-name="TokenGroup"]/param-value
    Any ideas why this doesnt work?
    Thanks,
    Joe

    "web.xml"
    <?xml version='1.0' encoding='WINDOWS-1252'?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <context-param>
    <param-name>name</param-name>
    <param-value>Joe</param-value>
    </context-param>
    <context-param>
    <param-name>password</param-name>
    <param-value>password</param-value>
    </context-param>
    <servlet>
    <servlet-name>ParameterServlet</servlet-name>
    <servlet-class>ParameterServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ParameterServlet</servlet-name>
    <url-pattern>/ParameterServlet</url-pattern>
    </servlet-mapping>
    </web-app>
    ParameterServlet
    import java.io.IOException;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.ServletOutputStream;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class ParameterServlet extends HttpServlet {
    private String dbName = "";
    private String dbPassword = "";
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    ServletContext context = getServletContext();
    dbName = context.getInitParameter("name");
    dbPassword = context.getInitParameter("password");
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    throws IOException {
    ServletOutputStream out = res.getOutputStream();
    res.setContentType("text/html");
    out.println("<html><head><title>Basic Servlet</title></head>");
    out.println("<body>Database username is <b>" + dbName);
    out.println("</b><br>Database password is <b>" + dbPassword + "</b>");
    out.println("</body></html>");
    "Plan.xml"
    <?xml version='1.0' encoding='UTF-8'?>
    <deployment-plan xmlns="http://xmlns.oracle.com/weblogic/deployment-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/deployment-plan http://xmlns.oracle.com/weblogic/deployment-plan/1.0/deployment-plan.xsd" global-variables="false">
    <application-name>virtual</application-name>
    <variable-definition>
    <variable>
         <name>name</name>
         <value>akshay1</value>
         </variable>
         <variable>
         <name>password</name>
         <value>koul1</value>
         </variable>
    </variable-definition>
    <module-override>
    <module-name>virtual</module-name>
    <module-type>war</module-type>
    <module-descriptor external="false">
    <root-element>web-app</root-element>
    <uri>WEB-INF/web.xml</uri>
         <variable-assignment>
              <name>name</name>
              <xpath>/web-app/context-param/[param-name="name"]/param-value</xpath>
              <operation>replace</operation>
         </variable-assignment>
         <variable-assignment>
              <name>password</name>
              <xpath>/web-app/context-param/[param-name="password"]/param-value</xpath>
              <operation>replace</operation>
         </variable-assignment>
    </module-descriptor>
    </module-override>
    <config-root>C:\DOCUME~1\user\LOCALS~1\Temp\user\.\config\deployments\virtual\plan</config-root>
    </deployment-plan>
    It works for me... I think your "web.xml" is causing the issue.
    Try replacing
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!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>
    with
    <?xml version='1.0' encoding='WINDOWS-1252'?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    Hope this helps.
    -Akshay

  • Web.xml mapping not working

    I have a servlet located at com.conversion.web called leftNavReader.java
    I'm trying to access this servlet on my localhost with the following URL: http://localhost:8080/Conversion/start
    but I keep getting this error:
    HTTP Status 404 - /Conversion/start
    type Status report
    message /Conversion/start
    description The requested resource (/Conversion/start) is not available.
    Here is what my web.xml looks like:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app>
         <display-name>DataConversionWeb</display-name>
         <servlet>
              <servlet-name>start</servlet-name>
              <display-name>Start</display-name>
              <servlet-class>com.conversion.web.leftNavReader</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>start</servlet-name>
              <url-pattern>/start</url-pattern>
         </servlet-mapping>
    </web-app>
    Does anyone have any idea why I'm getting this error?

    Since the spaces may cause problems and I have
    everything in the My Projects directory, I decide to
    just start from scratch. Very good.
    But... someone else
    installed eclipse for me and set that up, so I may
    need some help with that, not sure if you can help.As far as I know Eclipse can also be Unzipped to any folder, and
    theres a file called eclipse.exe , one would simply double click on that to invoke eclipse. I don't think you would have to re-install Eclipse.
    You could create a new project, and set
    C:\dev\projects\Conversion\ as your Eclipse Workspace .
    But lets put Eclipse on hold for now, we can still configure this whole project manually without Eclipse, which will help you understand what's going on under the hood. Also, in the beginning it's simpler to configure independent of the IDE.
    So I recommend that you save your work, uninstall
    Tomcat 6.0.x and re-install it on a path thatdoesn't
    have any spaces in it.
    For example:
    C:\dev\tomcat\ So I've uninstalled tomcat and re-installed in
    c:\dev\tomcat as recommended...Good, I assume that immediately under C:\dev\tomcat\ folder you see folders like bin, conf, webapps etc
    Assuming that Tomcat was Unzipped to the above
    folder. and there isn't another main folder underthe
    above folder, set you system envrionment variable
    CATALINA_HOME to the above folder.How do I do this?On MS Windows, click Start ---> Settings ----> Control Panel
    Look for System , --> Doubl Click on System -----> Click on the Advanced tab ----> then under the "System Variables" panel ------> Click on New button -------->
    in the Variable Name: type CATALINA_HOME
    in the Variable Value: type C:\dev\tomcat
    Then click Ok , that will set CATALINA_HOME to C:\dev\tomcat
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    There's a RUNNING.txt file under Tomcat's folderthat
    explains configuring it. Tomcat expects JAVA_HOMEto
    be set to your JDK's root folder . Again if JDK is
    installed on a path that has spaces then Irecommend
    installing it on a path with no spaces forexample:
    C:\dev\jdk\
    Similarly , follow the above steps to set JAVA_HOME to C:\dev\jdk
    Also, under System Variables you may see a variable called Path
    If it doesn't exist , then create a new one, if it already exists then add the following to the Path variable. (notice how the semi colon is used as a separater)
    ;%JAVA_HOME%/bin;%CATALINA_HOME%/bin;
    By setting the above you will be able to call
    java , javac and Tomcat's startup.bat and shutdown.bat from anywhere on the DOS Command line.
    >>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~I've moved the jdk to the director as recommended,
    but not sure hot to set the JAVA_HOME.See above...
    I haven't even gotten through the rest of your post
    yet, as I need to work on getting Eclipse set up
    again too Leave Eclipse for later ---- it will just complicate things for now.
    Once you have the project runnun under Tomcat we can figure out Eclipse.
    and I figure I might as well set up my
    "new" project using Virtual Hosts from the beginningLeave Virtual Host for later ------ it is easy to understand , I will explain it later , once you have the above basic set up running.
    and do this right... This is quite the learning
    experience ;)First , second and third time it is... but if you do this often, it will get much easier.

  • Client-cert auth impl in web.xml does not work in Oracle Application Server

    Hi,
    I am new to implementing security features on the web applications.. I have developed a new web service using jdev1012 and deployed in OAS 10.1.2. Its working fine according to the business requirements, but I am in need of implementing client-cert authentication to enable the web service available to only those who have client certificate.
    My server details are:
    Oracle Application Server 10g Release 2 (10.1.2)
    Server certificate is in place and SSL mode have been already enabled.. able to access my web service through https://<mydomain.com>/myws/TreqWS as well able to see the WSDL file through https://<mydomain.com>/myws/TreqWS?WSDL.
    I tried to include the following in my web.xml file as part of implementing CLIENT-CERT authentication.
    <security-constraint>
    <display-name>SecurityConstraint</display-name>
    <web-resource-collection>
    <web-resource-name>WSCollection</web-resource-name>
    <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
    </security-constraint>
    <login-config>
    <auth-method>CLIENT-CERT</auth-method>
    <realm-name>WSCollection</realm-name> <!-- am not sure about this realm-name and its purpose -->
    </login-config>
    It is not woking as expected, though I have restarted my oc4j container after including this content to the web.xml file. i.e, I am able to invoke the web service though my sample java client program, though I donot have client certificate/keystore.
    I believe I am missing something..Can anyone help me in this regard to implement CLIENT-CERT authentication successfully?
    Thanks,
    Ms

    I am having the same problem with doc and xsl. I have added this
    <mime-mapping>
    <extension>xls</extension>
    <mime-type>application/vnd.ms-excel</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>doc</extension>
    <mime-type>application/msword</mime-type>
    </mime-mapping>
    to my web.xml. I even restarted the server. I still see doc and xsl in binary.
    Is there some other setting that needs to take place?
    I am using WL6.1 with fixpack 1.
    I can see the doc and excel files in the browser if I don't go through the weblogic
    server. That just confirms it's not my browser.
    Kumar Allamraju <[email protected]> wrote:
    <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
    <html>
    It works fine for me in 6.1 SP1.
    <br><br>
    If the following doesn't work , can you
    <br>try application/winword instead of application/msword?
    <p>--
    <br>Kumar
    <p>Siming Mu wrote:
    <blockquote TYPE=CITE>Hi,
    <p>I setup in my web.xml a mime mapping as follows,
    <p><mime-mapping>
    <br><extension>doc</extension><mime-type>application/msword</mime-type>
    <br></mime-mapping>
    <p>When I specify a test.doc url, the doc file appears in my browser
    as
    binary data
    <br>instead of download.
    <p>Please reference change request 055002, which decribes this problem. 
    According
    <br>to edocs, it has been fixed in wls6.1sp1.
    <p>But I am seeing it fixed.  Am I doing anything wrong? Thanks.
    <p>Siming</blockquote>
    </html>

  • Unable to load descriptor .../web.xml - DescriptorException - Java EE6 war

    Deploying a simple Java EE 6 war into WebLogic 10.3.3 fails with <Unable to load descriptor /root/Oracle/Middleware/user_projects/domains/palis1/servers/AdminServer/upload/SimpleEE6App.war/WEB-INF/web.xml of module SimpleEE6App.war. The error is weblogic.descriptor.DescriptorException: VALIDATION PROBLEMS WERE FOUND
    problem: cvc-enumeration-valid: string value '3.0' is not a valid enumeration value for web-app-versionType in namespace http://java.sun.com/xml/ns/javaee:<null>
    The web app consists of one JSF 2 web dialog, one managed bean, one stateless session bean and one entity bean. In GlassFish v3 the app works fine. Then I installed the actual version of WebLogic server in order to check whether I can run EE6 apps there to. But deploying the war using WebLogic admin console fails with
    ... <AdminServer> <main> <<WLS Kernel>> <> <> <1273649525966> <BEA-000360> <Server started in RUNNING mode>
    ... <AdminServer> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <admin> <> <> <1273649790693> <BEA-160197> <Unable to load descriptor /root/Oracle/Middleware/user_projects/domains/palis1/servers/AdminServer/upload/SimpleEE6App.war/WEB-INF/web.xml of module SimpleEE6App.war. The error is weblogic.descriptor.DescriptorException: VALIDATION PROBLEMS WERE FOUND
    problem: cvc-enumeration-valid: string value '3.0' is not a valid enumeration value for web-app-versionType in namespace http://java.sun.com/xml/ns/javaee:<null>
    at weblogic.descriptor.internal.MarshallerFactory$1.evaluateResults(MarshallerFactory.java:245)
    at weblogic.descriptor.internal.MarshallerFactory$1.evaluateResults(MarshallerFactory.java:231)
    at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:155)
    at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:323)
    at weblogic.application.descriptor.AbstractDescriptorLoader2.getDescriptorBeanFromReader(AbstractDescriptorLoader2.java:788)
    at weblogic.application.descriptor.AbstractDescriptorLoader2.createDescriptorBean(AbstractDescriptorLoader2.java:409)
    at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBeanWithoutPlan(AbstractDescriptorLoader2.java:759)
    at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBean(AbstractDescriptorLoader2.java:768)
    at weblogic.servlet.internal.WebAppDescriptor.getWebAppBean(WebAppDescriptor.java:141)
    at weblogic.servlet.utils.WarUtils.getWebAppBean(WarUtils.java:124)
    at weblogic.application.compiler.WARModule.processLibraries(WARModule.java:413)
    at weblogic.application.compiler.WARModule.merge(WARModule.java:455)
    at weblogic.application.compiler.flow.SingleModuleMergeFlow.proecessModule(SingleModuleMergeFlow.java:16)
    at weblogic.application.compiler.flow.SingleModuleFlow.compile(SingleModuleFlow.java:36)
    at weblogic.application.compiler.FlowDriver$FlowStateChange.next(FlowDriver.java:69)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
    at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:36)
    at weblogic.application.compiler.FlowDriver$CompilerFlowDriver.compile(FlowDriver.java:96)
    at weblogic.application.compiler.ReadOnlyWarMerger.merge(ReadOnlyWarMerger.java:27)
    at weblogic.application.compiler.flow.AppMergerFlow.mergeInput(AppMergerFlow.java:88)
    at weblogic.application.compiler.flow.AppMergerFlow.compile(AppMergerFlow.java:41)
    at weblogic.application.compiler.FlowDriver$FlowStateChange.next(FlowDriver.java:69)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
    at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:36)
    at weblogic.application.compiler.FlowDriver$CompilerFlowDriver.compile(FlowDriver.java:96)
    at weblogic.application.compiler.AppMerge.runBody(AppMerge.java:157)
    at weblogic.utils.compiler.Tool.run(Tool.java:158)
    at weblogic.utils.compiler.Tool.run(Tool.java:115)
    at weblogic.application.compiler.AppMerge.merge(AppMerge.java:169)
    at weblogic.deploy.api.internal.utils.AppMerger.merge(AppMerger.java:88)
    at weblogic.deploy.api.internal.utils.AppMerger.getMergedApp(AppMerger.java:63)
    at weblogic.deploy.api.model.internal.WebLogicDeployableObjectFactoryImpl.createDeployableObject(WebLogicDeployableObjectFactoryImpl.java:181)
    at weblogic.deploy.api.model.internal.WebLogicDeployableObjectFactoryImpl.createLazyDeployableObject(WebLogicDeployableObjectFactoryImpl.java:156)
    at weblogic.deploy.api.tools.SessionHelper.inspect(SessionHelper.java:661)
    at com.bea.console.actions.app.install.Flow$2.execute(Flow.java:469)
    at com.bea.console.utils.DeploymentUtils.runDeploymentAction(DeploymentUtils.java:5000)
    at com.bea.console.actions.app.install.Flow.appSelected(Flow.java:467)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:870)
    at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:809)
    at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:478)
    at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:306)
    at org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:336)
    The web.xml is
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
    </context-param>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>
    30
    </session-timeout>
    </session-config>
    <welcome-file-list>
    <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>
    </web-app>
    After changing the version number I got the same error message with the differing number. I also tryed to deploy the web-app_3_0.xsd into the server. This also did not solve the problem.
    Any ideas?
    Thanks in advance
    Axel Burghof

    The web app consists of one JSF 2 web dialog, one managed bean, one stateless session bean and one entity bean. In GlassFish v3 the app works fine. Then I installed the actual version of WebLogic server in order to check whether I can run EE6 apps there to. But deploying the war using WebLogic admin console fails with ...
    Hey Axel -
    WLS 10.3.x does not implement Java EE 6 -- it's a Java EE 5 based server.
    While we have added support for a few independent Java EE 6 specifications where we can -- such as JSF 2.0 in WLS 10.3.3 and JPA 2.0/JAX-RS 1.1 with WLS 10.3.4 that is coming in the next patchset -- we don't support all of the Java EE 6 model and thus you can't use any of the EJB 3.1, Servlet 3.0 changes and you can't deploy EJBs (and JPA entities) inside of a WAR file. Our next major release will be a Java EE 6 implementation, where this will be possible.
    -steve-

  • Web service and servlets in the same project...web.xml?

    Hello, I have a problem with my web service.
    I have a server, which displays a web service. I programmed this service with JAXRPC.
    I have a client, in another directory. I succeded in compiling, deploying and running the web service.
    The problem is that after I tried to integrate this service in an existing project. This project contains servlets. In these servlets, I'm using sessions.
    These servlets are on the same side as the server of the web service. Because of the implementation of my code, I'd like to use in the class that represents the server of the service, the same session as the one I'm using in the servlets.
    But of course, it's not working by itself. I know there's something to do with the web.xml files.
    The thing is that I created a web.xml file for the service, and another for the servlets.
    I was thinking of joining both of them in one xml file, but everything crashes then...
    Could someone tell me how to create a project with a web service and servlets, and mostly how to configure the xml file??
    Thanks for any help
    Philippe

    Hello, I have a problem with my web service.
    I have a server, which displays a web service. I programmed this service with JAXRPC.
    I have a client, in another directory. I succeded in compiling, deploying and running the web service.
    The problem is that after I tried to integrate this service in an existing project. This project contains servlets. In these servlets, I'm using sessions.
    These servlets are on the same side as the server of the web service. Because of the implementation of my code, I'd like to use in the class that represents the server of the service, the same session as the one I'm using in the servlets.
    But of course, it's not working by itself. I know there's something to do with the web.xml files.
    The thing is that I created a web.xml file for the service, and another for the servlets.
    I was thinking of joining both of them in one xml file, but everything crashes then...
    Could someone tell me how to create a project with a web service and servlets, and mostly how to configure the xml file??
    Thanks for any help
    Philippe

  • Error trying to update web.xml

    I'm trying to update  web.xml via these instructions:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d0eb8120-b66c-2910-5795-894f384fc054
    The upload fails, and I see this excetpion in the log:
    Caused by: java.rmi.RemoteException: Error occurred during single file update of
           application sap.com/irj. Reason: Updating the security information in the
           deployment descriptors is not allowed in this operation.; nested exception is:
         com.sap.engine.services.servlets_jsp.server.exceptions.WebDeploymentException:
           Updating the security information in the deployment descriptors is not
           allowed in this operation.
    Ideas?  I'm signing in as Administrator, so why would the operation not be allowed?
    This is a 7.0 system, and the instructions are for a nw2004 system.  We've successfully uploaded the web.xml file before, so I'm thinking that something has changed in 7.0 that's preventing the upload.

    This page of the documentation indicates that the technique is the correct case:
    http://help.sap.com/saphelp_nw70/helpdata/en/6e/8590f1d6d349c9adc34c6a8085189b/frameset.htm
    So, one of two things has happened:
    1. The documentation is in error, or
    2. A bug has been introduced.
    I'm hoping it's #2....

  • How to chage the welcome file in web.xml using creator?

    Hi guys,
    I want to set the welcome file in web.xml to index.html but every time I run my project in creator, creator replaces index.html by faces/index.jsp. I need the index.html to check if the browser enables cookies & javascript and then I redirect to index.jsp. If I change the web.xml in a common editor, build the war-file with ant and deploy the project with tomcat, everything is fine. but how can I change it in creator?
    thanks in advance

    Sorry, that doesn't make much sense.
    The XML you gave is a configuration file for txt2xml utility. It doesn't represent the output format.
    Are you a user of this utility?

Maybe you are looking for

  • Help with old iMac G3

    Hey! I've been using Macs since...well, don't ask LOL. I am stumped with a problem I know I should have found a solution...but duh... :/ I just picked up a cherry iMac G3/500 with OS 9.2.2. After cleaning up the system, it really kicks butt on the G3

  • Color Profiled Screen and ACR or Lightroom (Vista)

    Hi, My screen is calibrated and works with an .icc profile. I have set up the proofing colors in Photoshop to be my .icc profile. I do not attach any profiles to my pictures when I edit them in Photoshop and so they look the same in Photoshop and in

  • Sapscript : Printing Text In same line

    Hi Friends,            I have created 2 standard text.            I want to print the follwing in the same line -            First standard text + <A hard coded value> + Second standard text. <b>           I have coded like this -</b>            /:  

  • Please help  about HSinglelineEntry

    hi all I am trying to use org.havi.ui.HSinglelineEntry to implement username and password entry but it does not work. I am using Xletview 0.3.6. any help will be appriciated. please give me snippet of code or any reference. Thanks Cody

  • LabVIEW laplacian filter

    I just loaded LabVIEW 2013 and the Vision Module 2013, although I have used LabVIEW for years. I have a project requiring machine vision. I started up the Vision Assistant, and used some of the tools to see what would work. I found that applying the