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)
BB

The doGet method works if you are sending data from a form using get method. It is better to use service method.

Similar Messages

  • XML file not being read by Accordion Demo

    I had this working last week and it was a beautiful thing. I
    subsequently added many more product items to the products.xml file
    and resent it, now the products.xml file is not being read by the
    index page. I have read all the posts and added all the suggested
    fixes -
    added {useCache: false} to result in var dsProductFeatures =
    new Spry.Data.XMLDataSet("products.xml", "products/product[name =
    '{dsProducts::name}']/features/feature",{useCache: false})
    added <cfheader name="Cache-Control" value= "no-cache">
    <cfheader name="Expires" value="0">
    <cfheader name="Pragma" value="no-cache"> to header
    added var d = new Date();
    var cToday = d.getSeconds();
    var spryURL = "
    http://localhost:8500/SpryMe/Sample1/employees.xml?cacheBuster="
    + cToday; to header
    but my xml file is not being read. The script is running
    because the little fields on the right are moving.
    Any suggestions would be greatly appreciated!

    Hi,
    What's happening if you open the xml page (employees.xml)
    directly in browser. Are you able to see all the records? Is the
    XML valid?
    Regards,
    Dragos.
    PS: do you have a public URL where we can see that?

  • Anybody know what's up with the menu.xml.files not being available for DW after installing on a new comp?

    Anybody know what's up with the menu.xml.files not being available for DW after installing on a new comp?

    Usually that error can be cleared up by renaming the personal config folder. Turn on your OS's hidden files and then go to...
    C: > Users > your username > AppData > Roaming > Dreamweaver (version) > your language > configuration
    Rename the configuration folder configuration-old and start DW up. That should create an entirely new configuration folder and correct the menu.xml file.

  • Help required in depolying EAR file. web.xml file not recognised.

    Hi All,
    I have created EAR project using WAR. While I'm trying to deploy the EAR file using SDM tool of J2EE engine. I'm getting the following error: bold com.sap.engine.services.servlets_jsp.server.exceptions.WebDeploymentException: Web application [redirectForm] does not contain "/WEB-INF/web.xml" file or it is spelt incorrectly bold . I have checked the WAR file, it has web.xml file. Please tell me how to resolve this error?
    Thanks in advance
    Srikant

    Hi Srikant,
    check the directory entry in your war file if it is woth upper case i.e. WEB-INF
    Best regards
    Bojidar

  • Crossdomain.xml file not being called by the SWF

    Hi,
    I'm serving an swf file compiled using flex builder 3.2 through plain HTTP, the SWF file calls a service in the same domain through HTTPS, as such, I put the following file in the root directory of my web server:
    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
    <cross-domain-policy>
        <allow-access-from domain="*" secure="false" />
    </cross-domain-policy>
    and name it crossdomain.xml
    When the service is invoked, I get the following error: [RPC Fault faultString="Security error accessing url" faultCode="Channel.Security.Error" faultDetail="Destination: DefaultHTTP"]
    When I check the access log files of my web server (Apache), there's no entry for crossdomain.xml (it is not being requested), why?
    When I serve the SWF through HTTPs it works OK ... any ideas?
    I have tried in several machines (different browsers, different versions of Flash player) and no success.

    I am also experiencing the exact same problem.  I'm not able to change the crossdomain.xml file located in the root directory and am going to try creating a new policy file in a sub directory.  The problem I'm having is that my web service is called from a virtual path and I do not know where to save this new policy file.
    Have you tried to load in a specific policy file?
    Security.loadPolicyFile( "http://yourdomain.com/policyFile.xml" );
    Also, you may want to check which sandbox your swf file is in.  flash.system.Security.sandboxType.  This could be another cause to the error.  My swf file is in the "remote" sandbox.

  • XML file not properly read from Appc Server. Partial records filled into IT

    Hi,
    I am reading an XML file from the application Server. only 2 records are comming to the Internal table. Other records are not coming to the Internal Table. It's giving Sy-Subrc 4 after 2 iterations. Below is my code. Kindly suggest.
    open dataset p_unix in text mode message msg.
        if sy-subrc <> 0.
          message i001(38) with 'Error on Open of File: ' msg.
        else.
          while sy-subrc = 0.
            read dataset p_unix into infile.
            check sy-subrc = 0.
            append infile.
          endwhile.
          close dataset p_unix.
    Thanks,
    Debi.

    Hi,
    this is probably because there's only one "end of line" character (probably after <?xml ... ?>). This is normal, but you must store the second line in a string data object, which will then receive the whole XML stream (except the xml header as it is stored in the first line). And that's done.
    BR
    Sandra

  • XML files are being read as PBEM game file format!!

    Hello,
    I am trying to edit some .xml files in Script Editor but everytime I try to open them I am told :
    'Script Editor cannot open files in the "PBEM game file" format'
    (Double clicking the .xml file opens up the Big Bang game)
    Does anyone know how to get round this? also is Script Editor the best application to use? I want to use an editor that has colours.
    Many thanks, rob

    Script Editor has one purpose - editing and compiling AppleScript.
    I can't account for the wording of the error message, but for sure I wouldn't expect it to handle XML files directly.
    You could use AppleScript to manipulate the XML data, but that's probably not ideal either.
    What you need is a text editor. BBEdit would be my first choice, or its cheaper (read: free) sibling TextWrangler.
    Both can handle any type of text file, including syntax highlighting for many structured files including programming source code.

  • Problems with WEB-INF files not being found.

    We are using Sun Java Web Server v6.1SP2. I have tried to install the struts example application into the docroot. The application makes use of tld files (tag libraries) that are stored in the WEB-INF directory.
    I receive the following error when starting the web server:
    [29/Oct/2004:15:11:30] failure (22379): for host 169.198.12.50 trying to GET /index.jsp, service-j2ee reports: S
    tandardWrapperValve[jsp]: WEB2792: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: WEB4059: can't find /WEB-INF/struts-bean.tld (File not found)
    The file IS in the directory.
    Thanks in advance for any assistance.
    TJ Herring
    [email protected]

    Web Server denies access to the WEB-INF directory.

  • Pdf files not being read in mac

    the pdf files i create in acrobat pro 9 are not able to be read by mac users. can anyone help me out with this?

    How are you sending them to Mac users? If by email, you might try to zip them first. If they are not able to receive zip files in the emails then you might try posting the pdf file to a web or ftp site.

  • Office 2013 ADMX files not being read by group policy editor?

    Okay so I'm having a real problem with the ADMX files for Office 2013. First of all we have a mix of 2012 R2 DCs with one 2008 R2 DC. The 2008 R2 is currently the primary DC. Here's what I've done so far:
    Downloaded the ADMX files both 32 and 64bit.
    Copied from my machine (Win7) to 2012R2 DC.
    Downloaded and copied directly to the 2012R2DC policy definitions location
    According to the research I've done, the Office 2013 template is supposed to appear under User Configuration\Policies\Administrative Templates. However it doesn't show up no matter what I do.
    I consider myself fairly knowledgeable with GPOs but I'm stumped on this one. Can someone tell me what I'm missing here?

    Hi, 
    Have you copied the ADML files to the language folder in the PolicyDefinitions folder?
    Checkout the below thread on similar discussion,
    office 2013 admx templates
    Regards,
    Gopi
    www.jijitechnologies.com

  • Changing the directory Structure of Jsp and web.xml files

    Hi,
    I am using the JDeveloper 11g preview. Can any one tell me how to change the Jsp and web.xml files ( not in WEB-INF directory of the application) to another directory.
    Thanks in Advance
    Gopal

    Hi Frank,
    Is it possible for me to change the folder structure which JDeveloper is providing for web project?
    By default JDeveloper is giving the following folder structure.
    In the project's root folder there is a public_html and src folder along with .jpr file.
    In public_html folder thre is an WEB-INF folder and a jsp file
    In WEB-INF folder there is an classes folder along with web.xml file.
    I need to have the following folder structure :
    The WEB-INF folder should be in root folder of project not in public_html folder
    src folder must be in WEB-INF folder.
    Thanks in Advance
    Anil Golla

  • Pages will not open a downloaded .pages document from iCloud because index.xml file not found?

    New to using iCloud.  I created a large pages document on Mac Air and saved it to my iCloud account.  Found it at home on desktop Mac and downloaded it.  No problem.  However, it will not open due to the index.xml file not being found.  What should I do to open this document?  I've tried several things and no luck yet.  Thanks for any tips!  :-)

    Options posted here: The required index.xml file is missing.
    William Farrar posted:
    Try this. It worked for me:
    1. Single click on the document. This will "highlight" the document icon, but not invoke the error message.
    2. Click on "File" in the menu.
    3. Scroll down to "Open With".
    4. One of my choices in the "Open With" selection is Pages (default) (5.0.1)
    5. Click on that choice and the document should open.
    In my "Open WIth" selection there is also a Pages (4.0.4), but that didn't work for me.
    Now, here is a caveat. If before you open your document you instead first click on an open Internet window, then the "Open With" selection disappears from the File menu. In that case just single click again on the document icon again and the "Open With" selection returns.
    fruhulda posted:
    Try this:
      1. Make a duplicate of the file (cmd D), just to be safe
      2. Select .pages on the copy and change to .zip
      3. When the System asks if you really want to do this, click Use .zip
      4. Double click the new .zip file
      5. It will now appear as a folder with no extension
      6. Append .pages to the end of the folder name
      7. Again click on Use .pages
      8. Double click on this file to open it in Pages.
    What you have done is extracted all the Pages resources from the .pages "package" and reconstructed it.
    or
    http://www.freeforum101.com/iworktipsntrick/viewtopic.php?t=308

  • How to read configuration data from an xml file (not web.xml)?

    Hi,
    I want to separate the application specific configuration parameters in a separate xml file and read them as and when they are needed? I know that I can use the wb.xml but I want to separate them in a different xml file because I don't want the web.xml file to be played around later after deployment. If any change is needed then it should be done in the application-config.xml.
    How can I read the parameters from this xml file in my jsp code and also what should be the location of this file if I have
    ../webapps/Root/application
    directoty structure ?
    Any help is greatly appreciated.

    can you give an example of a property file and also
    it is loaded in the jsp ?Hmm... loading properties in a JSP is not a very good idea. You should do it in a separate class, rather than mixing the logic with the display logic.
    Properties properties = new Properties();
    properties.load(UtilClass.class.getResourceAsStream("config.properties"));
    // Add a try - catch block around the load
    // for IOException...

  • JSP compiler reading the web.xml file?

    Hi,
              I am trying to use the weblogic JSP compiler (weblogic.jspc) to
              pre-compile some JSP that use custom tags. Does the compiler
              read the web.xml file if there is one? In particular the taglib
              elements in that file so that the compiler understands the
              <%@ taglib ... %> directive.
              In the JSP I try to compile I use this statement to declare a taglib:
              <%@ taglib uri="xyz/xyz-taglib" prefix="xyz" %>
              and in my web.xml I have:
              <taglib>
              <taglib-uri>xyz/xyz-taglib</taglib-uri>
              <taglib-location>/WEB-INF/tlds/xyz.tld</taglib-location>
              </taglib>
              When I try to compile the JSP I get the following error:
              Could not parse embedded JSP code: weblogic.utils.ParsingException: nested
              IOException: java.io.IOException: cannot resolve 'xyz/xyz-taglib' into a
              valid tag library.
              Any ideas how I can resolve this?
              In advance thank you for any help.
              Florian
              

    open it in a text editor and modify it.
    %

  • [svn] 1978: Bug: vendors. properties file which is used in vendor specific login commands was not being read properly and as a result some login related error messages were not being displayed correctly .

    Revision: 1978
    Author: [email protected]
    Date: 2008-06-06 08:05:34 -0700 (Fri, 06 Jun 2008)
    Log Message:
    Bug: vendors.properties file which is used in vendor specific login commands was not being read properly and as a result some login related error messages were not being displayed correctly.
    QA: Yes - we need automated tests to make sure that errors.properties and vendors.properties in BlazeDS/LCDS are loaded properly.
    Doc: No
    Modified Paths:
    blazeds/branches/3.0.x/modules/common/src/java/flex/messaging/util/PropertyStringResource Loader.java
    blazeds/branches/3.0.x/modules/opt/src/jrun/flex/messaging/security/JRunLoginCommand.java
    blazeds/branches/3.0.x/modules/opt/src/tomcat/flex/messaging/security/TomcatLoginCommand. java

    I have a lot of grief with this version of Windows Media Player.
    It is very buggy and frustrating to use.
    I have my Music library on a QNAP NAS, which is as reliable as they come.
    System notifications make it not save changes.  It also does not do a good job of interpreting albums and artists from folders.  Changes to track names are not saved, nor are tracks moved to other albums, renamed albums, changes to genre, artist
    or date.  It separates and merges albums/tracks without sense or reason.  Some changes I've made up to 4 times, then closed WMP and re-started my machine to check if it has/hasn't saved the changes.  Often it has not.
    This is the first time I've used WMP in this capacity, and I do not recommend it.
    New service pack please.

Maybe you are looking for