(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 :-)

Similar Messages

  • Question about replacing corrupted file in windows 7

    hi,
    I read in windows 7 bible that if a system file is corrupted , I can replace it with system recovery tool (at command prompt) if I have onother computer with windows 7 installed. 
    my question is here , if I replace any file with copy the file from computer to dvd and replac it on my computer ,  does the windows version must be the same for 64 bit or it doesn't a matter.
    thanks
    johan
    h.david

    Hi,
    Yes, the version must be the same. You may be able to get a known good copy of the system file from another computer that is
    running the same version of Windows with your computer. For different versions there may be different configuration settings in the files that you operating on which if replaced with the wrong version might cause new issues.
    More information regarding How to manually replace a corrupted system file with a known good copy of the file, please check it in the link:Use
    the System File Checker tool to repair missing or corrupted system files
    Hope this may help
    Best regards
    Michael
    If you have any feedback on our support, please click
    here.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Question about multiple class files

    I just started learning JAVA a couple of days ago and the first program I wrote had two classes in one file. here is the program :
    class fib_num {
    public int value;
    public boolean is_even;
    class Fibonacci {
    /** Print the Fibonacci sequence for values < MAX and mark even numbers with an asterick */
    private static final int MAX = 50;
    private static final String Title = "The Fibonacci sequence for values less than " + MAX + ":";
    private static fib_num[] fib = new fib_num[MAX];//This is actually an array of object
    //references to objects of the fib_num class
    public static void main(String[] args) {
    System.out.println(Title);
    //We must initialize each element of the array also !!!!
    for (int i = 0; i < fib.length; i += 1) {
    fib = new fib_num();
    int lo = 1, hi = 1;
    fib[0].value = lo;
    fib[0].is_even = false;
    fib[1].value = hi;
    fib[1].is_even = false;
    for (int i = 2; i < fib.length; i += 1) {
    //create the next Fibonacci number and then save the previous Fibonacci number
    hi = lo + hi;
    lo = hi - lo;
    fib.value = hi;
    //now indicate if the Fibonacci number is even/odd
    if (fib.value % 2 == 0) {
    fib.is_even = true;
    }else {
    fib.is_even = false;
    print (fib);
    //This method prints an array of Fibonacci numbers
    public static void print(fib_num[] array) {
    if (array == null || array.length == 0)
    throw new IllegalArgumentException();
    String mark;
    for (int i = 0; array.value < MAX; i += 1) {
    if (array.is_even) {
    mark = "*";
    }else {
    mark = "";
    System.out.println((i + 1) + ": " + array.value + mark);
    I ran the program and everything went fine. But today I started to write another program with two classes. However the file will not compile and I get an error about interfacing or something. here is the program:
    Note: it's not nearly complete.
    class enumerate {
    //print out all permutations of a list of integers
    public static final int MAX = 4;
    public static int[] initialize(int[] nums) {
    for (int i = 0; i < nums.length; i++) {
    nums = i + 1;
    return nums;
    public static void print(int[] nums) {
    for (int i = 0; i < nums.length; i++) {
    System.out.print(nums);
    System.out.println("");
    public static void swap (int[] nums, int i, int j) {
    int temp = nums;
    nums = nums[j];
    nums[j] = temp;
    public static void main (String[] args) {
    int[] list = new int[MAX];
    list = initialize(list);
    PermutationGenerator x = new PermutationGenerator(5);
    // Systematically generate permutations.
    import java.math.BigInteger;
    public class PermutationGenerator {
    private int[] a;
    private BigInteger numLeft;
    private BigInteger total;
    // Constructor. WARNING: Don't make n too large.
    // Recall that the number of permutations is n!
    // which can be very large, even when n is as small as 20 --
    // 20! = 2,432,902,008,176,640,000 and
    // 21! is too big to fit into a Java long, which is
    // why we use BigInteger instead.
    public PermutationGenerator (int n) {
    if (n < 1) {
    throw new IllegalArgumentException ("Min 1");
    a = new int[n];
    total = getFactorial (n);
    reset ();
    // Reset
    public void reset () {
    for (int i = 0; i < a.length; i++) {
    a = i;
    numLeft = new BigInteger (total.toString ());
    // Return number of permutations not yet generated
    public BigInteger getNumLeft () {
    return numLeft;
    // Return total number of permutations
    public BigInteger getTotal () {
    return total;
    // Are there more permutations?
    public boolean hasMore () {
    return numLeft.compareTo (BigInteger.ZERO) == 1;
    // Compute factorial
    private static BigInteger getFactorial (int n) {
    BigInteger fact = BigInteger.ONE;
    for (int i = n; i > 1; i--) {
    fact = fact.multiply (new BigInteger (Integer.toString (i)));
    return fact;
    // Generate next permutation (algorithm from Rosen p. 284)
    public int[] getNext () {
    if (numLeft.equals (total)) {
    numLeft = numLeft.subtract (BigInteger.ONE);
    return a;
    int temp;
    // Find largest index j with a[j] < a[j+1]
    int j = a.length - 2;
    while (a[j] > a[j+1]) {
    j--;
    // Find index k such that a[k] is smallest integer
    // greater than a[j] to the right of a[j]
    int k = a.length - 1;
    while (a[j] > a[k]) {
    k--;
    // Interchange a[j] and a[k]
    temp = a[k];
    a[k] = a[j];
    a[j] = temp;
    // Put tail end of permutation after jth position in increasing order
    int r = a.length - 1;
    int s = j + 1;
    while (r > s) {
    temp = a[s];
    a[s] = a[r];
    a[r] = temp;
    r--;
    s++;
    numLeft = numLeft.subtract (BigInteger.ONE);
    return a;
    I thought the error had somethin to do with only having one class per .java file since the compiler creates a .class file. But how come my first program had two classes and it was OK. Is it b/c the second class was merely a collection of fields, almost like a simple struct in C?
    Any help would be appreciated. Thanks

    Move the import java.math.BigInteger line to the start of the file.
    Use the "[ code ] [ /code ]" tags around your code when you post, it makes reading it a lot easier.

  • Newbie Question - Accessing Servlet Class file

    im trying to run my servlet class file but am not able to do so. I've compiled my servlet and the class file generated is under build...web-inf/classes as it should be. Now how i do access this through the browser , isnt it just not localhost:29080/MyWebApp/HelloServlet. Thanks
    -newbie

    Hi There,
    Are you using Java Studio Creator to develop your application? If so this tutorial will help you get started.
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/jscintro.html
    Please also visit the tutorials page at
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/index.jsp
    Thanks
    K

  • Newbie questions about Database replication, "backups", and sql version

    Just created my first Sql Database using the "SQL Database Management Portal". A blast but three questions come to mind:
    1. Is this DB automatically
    "replicated"? (In other words,  is DB "failover" or clustering,  a feature of all newly created Azure databases?) 
    2. Our on-premise model is to make a daily DB backup which is saved to a nightly tape. If needed, we can restore a two-month old database backup under a new name to compare it with the current one. Does Sql Azure support this capability
    or not? Can it be requested?
    3.  Which on-premise version of sql is "Sql Azure" closest to? (2014?)
    TIA,
    edm2
    P.S. My database was created using the "web" edition.

    Hi edm,
    According to your description, you create a SQL Azure database in Azure platform. The replication feature is not supported by Microsoft Azure SQL database. If you want to sync the SQL Azure database and local database, you can use SQL Azure Data Sync service.
    For more information, see:
    http://blogs.technet.com/b/the_cloud_pilot/archive/2011/10/24/your-first-sql-azure-data-sync-step-by-step.aspx
    In addition, if you have Web or Business Edition databases, you must create your own backup strategy. You can use database copy or Import and Export services to create copies of the data and export the file to an Microsoft Azure storage account. Meanwile,
    Windows Azure SQL Database provides a mechanism for automating the process for exporting a database to BACPAC files on a set interval and frequency. For more information, see:
    Schedule an Automated Export:
    http://msdn.microsoft.com/en-us/library/hh335292.aspx#automate
    Windows Azure SQL Database Backup and Restore strategy:
    http://www.mssqltips.com/sqlservertip/3057/windows-azure-sql-database-backup-and-restore-strategy/
    Currently, Azure uses a special version of Microsoft SQL Server as its backend. It provides high availability by storing multiple copies of databases, elastic scale and rapid provisioning, when we check the version of SQL Server, it shows as follows.
    Microsoft SQL Azure (RTM) - 11.0.9216.62
    Regards,
    Sofiya Li
    If you have any feedback on our support, please click
    here.
    Sofiya Li
    TechNet Community Support

  • Newbie question about Oracle Parallel Server and Real Application Cluster

    I am trying to find out what kind of storage system is supported by the 9i Real Applicaton cluster. I have looked at the 8i Oracle Parallel Server which requires raw partitions and therefore NAS (network attached storage) that provides an interface at the file level will not work. Does anyone know if the 9i Real Application cluster has a similar requirement for raw partitions? any suggestions of whether SAN or other technology will be suitable? pointers to more information is appreciated.
    Robert

    Hi Derik,
    I know this is a really broad question. No, it happens all the time! Here is a similar issue:
    http://blog.tuningknife.com/2008/09/26/oracle-11g-performance-issue/
    +"In the end, nothing I tried could dissuade 11g from emitting the “PARSING IN CURSOR #d+” message for each insert statement. I filed a service request with Oracle Support on this issue and they ultimately referred the issue to development as a bug. Note that Support couldn’t reproduce the slowness I was seeing, but their trace files did reflect the parsing messages I observed."+
    I would:
    1 - Start by examining historical SQL execution plans (stats$sql_plan or dba_hist_sql_plan). Try to isolate the exact nature of the decreased performance.
    Are different indexes being used? Are you geting more full-table scans?
    2 - Migrate-in your old 10g CBO statistics
    3 - Confirm that all init.ora parms are identical
    4 - Drill into each SQL with a different execution plan . . .
    Raid 5 Don't believe that crap that all RAID-5 is evil. . . .
    http://www.dba-oracle.com/t_raid5_acceptable_oracle.htm
    But at the same time, consider using the Oracle standard, RAID-10 . . .
    Hope this helps . . .
    Donald K. Burleson
    Oracle Press author
    Author of "Oracle Tuning: The Definitive Reference"
    http://www.rampant-books.com/t_oracle_tuning_book.htm
    "Time flies like an arrow; Fruit flies like a banana".

  • Question about CSS classes, subclasses and Dreamweaver

    Hi there,
    I've following code in my .css file:
    ul.unordered {
    clear: both;
    padding: 0;
    padding-top: 1px;
    padding-left: 1em;
    margin: 0;
    list-style-image: none;
    list-style-type: none;
    ul.unordered li  {
    padding:0 0 1em 25px;
    background-position: 0 1px;
    background-repeat:no-repeat;
    ul.unordered.medium li {background-image:url(../images/icons/diamonds_m.png);}
    ul.unordered.small li {background-image:url(../images/icons/diamonds_s.png);}
    ul.unordered.large li {background-image:url(../images/icons/diamonds_l.png);}
    In Dreamweaver CS5, code hinting will not show 'large' but shows small and medium. If I type by hand 'large' in my html, it works. I'm quite consfused as why  code hinting will show medium and small but not large.
    Any clues?
    Thanks
    Joe Green

    In Dreamweaver CS5, code hinting will not show 'large' but shows small and medium. If I type by hand 'large' in my html, it works. I'm quite consfused as why  code hinting will show medium and small but not large.
    Any clues?
    It could be that at the time of looking at the code hint or at the time of entering a new css code, your page wasn't saved or that "large" class and related html was not entered in the body section of the page.
    Without seeing your html code, it is difficult to say why.  It all boils down to what is already in the HTML code of the page when it is saved.

  • Question about replacement hard drives and clean win7 install fo x61

    We are getting a X61-7674 from my wife's job- they are removing the original hard drive so I need to get a new one and do a fresh install of Windows 7.
    Two questions-  can I get any laptop hard drive or are there certain brands that won't work with the x61- I have looked at the prices on the Lenovo site vs. newegg so would like to be able to buy a generic 2.5 drive.
    second question- in terms of doing a clean install of windows 7, what is the sequence for installing drivers- assume I load w7 first- what drivers will I need to load- do I have to put them on a thumb drive to load them? Basically wondering what will work once I have loaded W7 and what drivers i'll need to download.
    Would appreciate any help on either question-
    Thanks.

    1) you can use any 2.5 inch sata hdd of 9.5 mm thickness.
    2) Windows update should pick up most of the hardware and install the correct drivers for them. However, there are still some stuffs that you have to install yourself. Such as:
    http://forum.lenovo.com/t5/Windows-7-Knowledge-Base/Will-the-ThinkPad-X301-run-Win7-x64/ta-p/325173
    Regards,
    Jin Li
    May this year, be the year of 'DO'!
    I am a volunteer, and not a paid staff of Lenovo or Microsoft

  • Another NewB question about Cubase LE / monitoring and click

    I am using Tascam 1804 and Cubase LE on windows XP.
    I want to record analog signal on Cubase LE, but hear monitoring from Tascam. That goes well as long I want to hear CLICK as well through Tascam. Is this possible? How?
    I have tried to utilize ASIO, no result. I can see that Tascam received click by MIDI (green light blinks according to click), but no click sound from headphones.
    Please advice, how to make clicking to Tascam in a simple way.
    Thanks,
    Jani

    What you need to do to monitor VST effects in Cubase in real time whilst recording.
    This is Applicable to all EMU patchmix soundcards eg. EMU 0404, 1212.
    1. Switch off Direct monitoring in Cubase.
    2. Switch off Direct monitoring in patchmix: Mute the input channel(s) you are using in patchmix.
    Q. Why does this work?
    A. You currently can not hear the effects whilst recording because Cubase is using the unprocessed signal as the monitor signal. What you want it to do is to hear the processed signal. Therefore Switch Off Direct Monitoring.
    HOW-TO
    = Switch off Direct Monitoring in Cubase =
    1. On the toolbar Click on Devices=>Device Setup
    2. In Device Setup Click on VST multitrack
    3. Untick Direct Monitoring
    4. Click on Control Panel Button
    5. Set ASIO Buffer Latency to a low figure. Say 5ms
    (The lower the Buffer Latency the more the 'responsive' the computer.)
    6. Press OK (Your Back in Device Setup)
    7. Press OK
    HOW-TO
    = Mute Input channel(s) you are using in patchmix =
    1. Run the patchmix software
    2. Click on the M button@ bottem of fader to mute the input channels.
    Done :-)
    dG

  • Question about filter-mappings in the web.xml

    I'm a bit new this so apologies if this is a stupid question but want to write a filter mapping that captures /image/<identifier here> and /image/<identifier here>/size/<size here>
    I would have assumed <url-pattern>/image/*</url-pattern> would do this but it doesn't. When I try a URL with /size/ in it, I get a File not found error.
    So I tried adding a second mapping that uses <url-pattern>/image/*/size/*</url-pattern> and that doesn't work either.
    What would be the best way to write a filter mapping that captures both /image/<identifier here> and /image/<identifier here>/size/<size here> ?

    Thanks for the reply.
    I did end up doing something like that in the end. I think I just couldn't get my mind into gear as usual on Monday.
    What's happening is taking a nice neat human readable URL and converting it to the horrible URL used by the system. The reason it's a filter is because someone had written a tiny filter would might only execute 20 lines of code and I think someone felt it was easier to just lump about 240 more lines to execute on each request, which, even if it isn't a huge strain on the system it's nasty and most of the code is unnecessary the vast majority of the time. I'm splitting it up the whole lot based on the various tasks.
    This particular functionality could be a servlet. I probably would have done it that if given the task from scratch but I think sometimes I put too much faith in the fact those with more experience should know better. I think I'll try it as a servlet and if someone has concerns about it then I'll ask them to explain to me why it can't be one.

  • 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

  • Basic question about importing wma files

    Hi, I have a basic question about importing wma files. I ripped some cd's on a Mindows computer using Media Player, but now want to copy them to my Mac and use them in iTunes on my Mac. when I use Import in iTunes, nothing happens and I cant even seem to copy them one by one using the Music folder.
    Can someone help me?
    thanks
    eMac   Mac OS X (10.4.4)  

    iTunes for Mac doesn't support .wma files.
    If you can use a PC to convert them, you can use one of many freeware applications. Google for 'wma to mp3'.
    For the Mac there's the shareware program EasyWMA that can convert them.
    Hope this helps.
    M
    17' iMac fp 800 MHz 768 MB RAM   Mac OS X (10.3.9)   Several ext. HD (backup and data)

  • A question about Object Class

    I got a question about Object class in AS3 recently.
    I typed some testing codes as following:
    var cls:Class = Object;
    var cst:* = Object.prototype.constructor;
    trace( cls === cst); // true
    so cls & cst are the same thing ( the Object ).
    var obj:Object = new Object();
    var cst2:* = obj.constructor.constructor;
    var cst3:* = obj.constructor.constructor.c.constructor;
    var cst5:* = Object.prototype.constructoronstructor;
    var cst4:* = Object.prototype.constructor.constructor.constructor;
    var cst6:* = cls.constructor;
    trace(cst2 === cst3 && cst3 === cst4 && cst4 === cst5 && cst5 === cst6); //true
    trace( cst == cst2) // false
    I debugged into these codes and found that cst & cst2 had the same content but not the same object,
    so why cst & cst2 don't point to the same object?
    Also, I can create an object by
    " var obj:Object = new cst();"
    but
    " var obj:Object = new cst2();"
    throws an exception said that cst2 is not a constructor.
    Anyone can help? many thanks!

    I used "describeType" and found that "cst2" is actually "Class" class.
    So,
    trace(cst2 === Class); // true
    That's what I want to know, Thank you.

  • Question about replacing hard drive

    Hey everyone. I had a question about replacing a hard drive for a 2012 midyear pro. I have replaced hard drives before on windows machines, but this is the first mac I have owned. It didn't come with a hard drive when I bought it, but I do have mavericks installed on a usb. As far as a new hard drive, will any 2.5 laptop hard drive work? I read it needs to be 9.5mm thick. Is that correct? As far as I am concerned, hardware is hardware and should be the same as replacing a hard drive on a dell laptop but wanted to see if apple has any weird restrictions.
    Also, is there anything I need to consider or be aware of when putting in a new hard drive? Or can I just hook up the hard drive and plug in the USB and install the software onto the hard drive. Thanks
    Excuse and ny ignorance as I am new to macs.

    scottrf8 wrote:
    As far as a new hard drive, will any 2.5 laptop hard drive work? I read it needs to be 9.5mm thick. Is that correct?
    Yes.  Any SATA drive will do with those specifications.
    Also, is there anything I need to consider or be aware of when putting in a new hard drive? Or can I just hook up the hard drive and plug in the USB and install the software onto the hard drive.
    Assuming that the installer is functioning correctly, install the HDD in the MBP and engage the installer.  You should come across a 4 option menu.  Select Disk Utility from it.  Open Disk Utility>Erase and format the HDD to Mac OS Extended (Journlaled).  One you finish that, you may install the OSX.
    Ciao.

  • HT201263 What will i do?screenshot There is a problem with your iPhone. Please visit the Service Answer Center to find answers to all your questions about service options, warranty and other processes in your country. To find your nearest Apple Store, cli

    What will i do? ITune screenshot is as follows >
    There is a problem with your iPhone. Please visit the Service Answer Center to find answers to all your questions about service options, warranty and other processes in your country. To find your nearest Apple Store, click here.

    Do what it said to do.
    "Please visit the Service Answer Center to find answers to all your questions about service options, warranty and other processes in your country. "

Maybe you are looking for

  • Internal error occured when writing

    Hi all I successfully imported an APO planning area into the quality systems, however the same request ends with error 12 in the production system. Landscape is SCM 5.0 sp8 with BI 7.0 sp12. When i checked the import job RDDEXECL (user DDIC), it show

  • Some images are not given date folders upon import

    I have the date chosen as an import preference and most of the time the images are placed into the dated subfolder.  However, not all of the time.  I recently imported 331 photos with 12 dates of photos.  First, none of the photos were put into the c

  • Getting back original image

    Hello. I am using Labview 2010 version to develop a program to load an image and process them using threshold.  I would like to compare the original image with the threshold image. Can anybody help me to show me some guides how to find back the origi

  • Examples database for a demo

    Hi, Do you know where I can download the excel that is used in the Indian Population's video? The one that is posted in the home  (http://www.microsoft.com/en-us/powerBI/default.aspx) with Visualize title. Altough if there're more downloads like the

  • Is it possible to edit from external hard drive?

    I have some 60 GB of material to edit a 15 min. movie out of it, but I don't have enought space on internal hard disk of my MacBook. Is there any way to use external drive?