Tomcat Tutorial: HelloWorld for Complete Fools [English]

The following tutorial was translated into English from the German original on this site, which is also available here. Please excuse me for my poor english skills, I am not a native speaker.

Update 26.02.2007: Note, that this Article, though technically still relevant and valid, is not up to date with the progress of the eclipse platform. I created a screencast to reflect the changes that took place and to show you development with the Eclipse WTP. Click here for the article.

I know quite a number of java developers who, despite their good knowledge of the java platform, somehow failed to successfully deploy a new Servlet to a Apache Tomcat installation. I stress, that they did not fail because of their inferior skills, but because of the fact, that there is no comprehensive
resource out there that explains the Tomcat deployment procedure:

  • in a nutshell
  • with pictures
  • without going into details that aren’t of direct interest

So, without much further ado, I will try to explain how to install tomcat, create a deployment structure using Eclipse and writing a simple HelloWorld Servlet.

In theory, deploying a Servlet is a really straightforward task – that is, if you know somebody who is willing to introduce you into the deployment mysticisms of the Apache Tomcat development. Unfortunately, I knew nobody who was really adroit with that. So I spent a really long time running into every single ambush Tomcat has to offer for blue eyed newbies. Hence I can rightly say, that Tomcat’s configuration is a pain in the rear if you don’t have an expert person who guides you through your very first steps. Even if you know your Google search words cold, you won’t find a single document that makes your task seem trivial.

So I figured, it would be best for newbies and the like, if you could just follow an example with pictures in it. In the following tutorial, I will try to explain the deployment procedure from the very beginning in step-by-step fashion to build a standard “Hello World” Servlet. To accomplish this, I will use the Eclipse IDE and Eclipse specific plugins, but I hope that one can understand the general proceeding that is necessary for other IDEs as well. I will assume that you are familiar with the installation of eclipse and eclipse plugins.

The following software will be neccessary to follow the tutorial:

The Server

Especially for Windows users it’s pretty easy to install Tomcat, because there it has a straightforward installer script that rids you of most of the configuration work. Everything you have to do is set the Administrator password (and remember it!) and the installation directory (and remember it!).

The Plugin

The Sysdeo Tomcat Plugin is our best friend. After you have installed it, you will notice these buttons and menues in your IDE.

The left button starts Tomcat, the middle button stops it, the right button restarts Tomcat. Right now, they won’t work if you press them. To enable them, you first need to configure a few things. Go to the menu “Window-> Preferences” there, you will see this dialogue box.

Enlarge

Now you need to go to the menu item “Tomcat” and select your Tomcat version. At the time of writing that would be the 4.1 5.x version. Now we adjust the field “Tomcat Home” to point to the install directory that we selected before at install time. The Sysdeo plugin now knows where to look for the server.xml file and automatically assumes the standard path to look for the file. Eclipse is now able to manage this configuration file, i.e. add a new <context> for a new application.


The Tomcat servlet container, features multiple user roles, such as the “Administrator” that we have already added to the user configuration upon installation. All users and passwords are found (in plain text, so take care to handle this safely) in the conf/tomcat-users.xml file. We now need to add another user called “Manager” that was not added to the file at installation time. Therefor we scroll down the menu point “Tomcat” and click the item “Tomcat Manager App”. Now we can add a username and a password for the manager. Subsequently we click on “Add user to tomcat-users.xml” and leave the configuration menu.


Enlarge
Now we are ready to test start our Tomcat server. Click on the start button in the Tomcat menu and watch the console output. If Tomcat boots up without any stacktraces open your browser, and try to open the following address http://localhost:8080/ . If you see an image
that is similar, to the one below everything is working okay. If it doesn’t you might want to Google on what might have caused the stacktrace.

Hello World

For now, we stop out Tomcat server and take a look at our very own, first servlet. First, we need to open a new project in the navigator window.


In the project window we select “Tomcat Project”…

…click on the Next button and call our new project “Hello World”


After a click on the next Button we now can adjust under which URI (Uniform Resource Identifier) we want our new application to respond to our requests. To illustrate what part of the URL this is, just take a look at the fat part in the following address: http://localhost:8080/HelloWorld/hello.
The default adjustments on the other controls should be fine by now, so we don’t bother to adjust them. They should look similar to following image.


Enlarge

If we now “Finish” the Wizard, we can see, that Eclipse has created a whole bunch of new directories. It should look similar to this:


Now we can create a new class named HelloServlet in the directory WEB-INF/src. Now we can copy and paste following code into this class.

import java.io.*;

import javax.servlet.http.*;
import javax.servlet.*;

public class HelloServlet extends HttpServlet {
  public void doGet (HttpServletRequest req,
                                         HttpServletResponse res)
        throws ServletException, IOException
  {
        PrintWriter out = res.getWriter();
        out.println("Hello, Brave new World!");
        out.close();
  }
}

Our View should now look like this:



Enlarge
Unfortunately we are not yet finished. We still need to create the web.xml descriptor, which contains certain elements of configuration specific to our application and the server behaviour. So we create the file web.xml in the directory WEB-INF (Note: not in the directory WEB-INF/src !!!). For our simple application, the following parameters should be fine.

<!DOCTYPE web-app PUBLIC
  '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN'
  'http://java.sun.com/dtd/web-app_2_3.dtd'>
<web-app>
  <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>HelloServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/hello</url-pattern>
  </servlet-mapping>
</web-app>

What follows now is a little explanation of what we just copied and pasted into web.xml . The Doctype is an xml specific item that tells the xml parser where to look
for the dtd consistency rules for our xml document. The dtd ensures that no wrong parameter combinations are entered. The main tag &lt;web-app&gt; contains all preferences for our servlet. The &lt;servlet&gt; tag basically contains the name (&lt;servlet-name&gt;) that will be used throughout the xml document to reference our servlet and its linked class (&lt;servlet-class&gt;) . The tag &lt;servlet-mapping&gt; is responsible for telling the server, to what document name in the URL our application should respond to. Note, that the correct order of these tags has to be retained to form a valid web.xml descriptor. If we followed all steps correctly, we should now be able to fire up Tomcat again. Our workspace should now look like that:

Enlarge

So, if we now enter the right combination of URI and resource name into the address bar of our browser (in our case this would actually be http://localhost:8080/HelloWorld/hello) we should be able to see the output from our very first servlet. Congratulations, now you are in the game ;-)

Enlarge

Oh, yeah – if you want to enable your Tomcat engine to serve JSPs too, you just have to add the following lines to the web.xml file and put the jsp files in the top level directory of your eclipse project.

    <servlet>
        <servlet-name>jspAssign</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
            <param-name>logVerbosityLevel</param-name>
            <param-value>WARNING</param-value>
        </init-param>
        <init-param>
            <param-name>fork</param-name>
            <param-value>false</param-value>
        </init-param>
        <load-on-startup>3</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>jspAssign</servlet-name>
        <url-pattern>/*.jsp</url-pattern>
    </servlet-mapping>

For further reading, I recommend following Sites:

Tomcat 4.1 Documentation
Advanced JSP and Servlet Tutorial

87 Responses to “Tomcat Tutorial: HelloWorld for Complete Fools [English]”


  1. 1 Anonymous

    Thanx very much… I had

    Thanx very much… I had exactly the same problems as you, and this tutorial solved them all.
    Also big thanx for the plugin tip…..
    /Glenn

  2. 2 Anonymous

    This was an outstanding tutorial!

    The

    This was an outstanding tutorial!

    The screenshots were really helpful. I will point J2EE newbies at this for a true beginner lesson.

    One question. I did notice that your next to last screenshot had the following package in the work dir:

    org.pache.jsp.

    I didn’t have that. Was that something I missed?

    I’m putting a link here to a screenshot of my eclipse workspace/desktop/view.

    http://www.weibust.net/erik/images/eclipse_screenshot.png

    Erik

  3. 3 Anonymous

    Thanks a lot, Erik! I

    Thanks a lot, Erik! I appreciate your enthusiasm.
    Actually, I don’t know why the org.apache.jsp
    package name did not appear on your screenshot, but
    I don’t think that this is really that important.
    After all it’s only a predefined package name with
    no content. I would attribute that change to some
    new version of the Plugin. Never mind.

  4. 4 Anonymous

    Just what I was looking

    Just what I was looking for! Nicely done! Thanks

  5. 5 Anonymous

    Did something change in this

    Did something change in this tutorial?

    I’m following it here at work (on my lunch hour) and having a few problems. For starters I don’t see any way to start/stop my Tomcat server from Eclipse.

    Erik

  6. 6 Anonymous

    Heh ;-) Yeah, I added

    Heh ;-) Yeah, I added a note stating: “Keep in mind, that the Eclipse 3 Milestones are still not at release stage and keep behaving pretty strange sometimes.” Which actually might be your problem at work. ;)

  7. 7 Anonymous

    Great job! I was able

    Great job! I was able to get my site (Hello world!) up and running in a little less than 30 minutes from startup using your tutorial.

  8. 8 Anonymous

    great tutorial…but, as with Keld

    great tutorial…but, as with Keld Hansen’s one here – http://javaboutique.internet.com/tutorials/three/ – i can’t for the life of me get the actual jsp or servlet to run… get “The requested resource (/HelloWorld/hello) is not available”…. sysdeo installs fine, can run tomcat (4.x) fine but i dunno, am i missing something – where’s the link between the eclipse project dir and the real tomcat webapps dir? it’s as if the jsp or servlet in your (fine) tutorials’ cases simply aren’t on the hard drive, as far as tomcat is concerned.

    tried installing that sysdeo patch for tomcat 4.x but that stopped any and all JSPs from running at all – from within or outside of eclipse!!

    regards
    ok

  9. 9 Anonymous

    You should install patch jasperDebugPatchV4.1.24.zip

    You should install patch jasperDebugPatchV4.1.24.zip which can be downloaded from sysdeo

  10. 10 Anonymous

    and you should copy a

    and you should copy a web.xml from tomcat servlet and modify it. the given web.xml may be not correct.The following is my web.xml

    hello
    HelloServlet

    hello
    /hello

  11. 11 Anonymous

    <?xml version=”1.0″ encoding=”ISO-8859-1″?>
    &ltDO

    <?xml version=”1.0″ encoding=”ISO-8859-1″?>
    &ltDOCTYPE web-app
    PUBLIC “-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN”
    http://java.sun.com/dtd/web-app_2_3.dtd“>
    <web-app>
    <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>HelloServlet</servlet-class>
    </servlet>

    <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/hello</url-pattern>
    </servlet-mapping>
    </web-app>

  12. 12 Anonymous

    Fanwy_2003 is right. If you

    Fanwy_2003 is right. If you want to use JSPs it is more convenient to install the JasperDebug Patch from the sysdeo site. This will allow you to review the generated servlet code with no compile errors because of wrong package definitions. Thanks for pointing that out.

    But actually I can not confirm that the web.xml is wrong, it works fine for me. But if you experience any problems you might want to check out his web.xml Hint: Add a <?xml version=”1.0″ encoding=”ISO-8859-1″?> line on top of the file.

  13. 13 Anonymous

    Thanks to Fanwy_2003 and Toni

    Thanks to Fanwy_2003 and Toni for their kind replies, but, as i state in my original post, i already tried the plug-in. Is there another step after the creation of the files Toni? e.g., build all, save all, running the app etc? do u simply start tomcat and that’s it? Sorry to ask, but then again you did address the likes of me in your title :-) !

  14. 14 Anonymous

    ps: the following entry IS

    ps: the following entry IS getting written to the localhost’s server.xml:

    thanks again!

  15. 15 Anonymous

    here’s that entry again…

    <Context path=”/HelloWo

    here’s that entry again…

    <Context path=”/HelloWorld” reloadable=”true” docBase=”C:\apps\dev\eclipse\workspace\HelloWorld” workDir=”C:\apps\dev\eclipse\workspace\HelloWorld\work\org\apache\jsp” />

  16. 16 Anonymous

    Thanks,
    It’s simple and

    Thanks,
    It’s simple and great. I was trying to create a Eclipse tomcat project for the past two days but failed. This tutorial hepled me out of the problem.
    Thanks & regards.
    Chaitanya V.

  17. 17 Anonymous

    thanks a lot for your

    thanks a lot for your example, but how to display
    chinese characters, it looks like ????? .

  18. 18 Anonymous

    Excellent tutorial – thi has

    Excellent tutorial – thi has helped me get up and running with Eclipse – until I found this I’d been having to edit in vi – not the worst editor in the world, but it’s great to have an IDE.

    Thanks again,
    Mike

  19. 19 Anonymous

    Can’t seem to find how

    Can’t seem to find how to make this work with jboss 3.2.3 which doesn’t have a separate Tomcat directory anymore. Any help would be appreciated.

  20. 20 Anonymous

    Just learn how to use

    Just learn how to use Eclipse and Tomcat deployment.
    Thank you very much.

  21. 21 Anonymous

    Hi, i found your tutorial

    Hi, i found your tutorial extremely useful as i am sure everyone else here did, it did however seem to miss an important issue, the actual deployment. After some messing around, i did find a solution which i ‘d like to share………….
    In the package explorer, right click on the project and chose properties->tomcat and the third option- “Export to WAR settings” on here name the war file you want your project deployed to and ideally have it in the webapps dir of you TOMCAT_HOME. Now when you are ready to deploy your file just right click the project–> Tomcat Project–> Export to the War file in project properties. Tomcat redeploys your project without the need to restart.

    Hope this solution solves everyone’s problems on using tomcat in eclipse.
    Otu

  22. 22 Anonymous

    A very clear and concise

    A very clear and concise tutorial. Thanx a lot.

  23. 23 Anonymous

    Thanks for this tutorial. I

    Thanks for this tutorial. I know Java but JSP is new to me. Thank for explaining the web.xml file and the JSP servlet sample.

  24. 24 Anonymous

    The screenshots helped more and

    The screenshots helped more and a new pros can learn without much of effort. I appreciate the way written and can be understood by anyone.

    Great effort.
    Thanks again,
    Niranjan

  25. 25 Anonymous

    awesome tutorial .. to the

    awesome tutorial .. to the point .. i spent 1/2 a day on getting this servlet stuff done .. but ur tutorial took me 5 mins to wrap it up .. cool .. thanks man ..

  26. 26 Anonymous

    Hi,
    Your tutorial is

    Hi,
    Your tutorial is great. I am able to start and stop tomcat using eclipse but I am not able to create tomcat new project. new—>project—>tomcat then I am not getting next screen.

    Can you explain what is the problem.
    thanks

  27. 27 Anonymous

    hi,excellent tutorials and good english

    hi,excellent tutorials and good english too…;-)
    very nicley laid out steps..it worked fine for me — i was using Eclipse 3.0M7 build with the tomcat sysdeo plugin..

  28. 28 Anonymous

    Thank you!!! Excellent tutorial

    Thank you!!! Excellent tutorial

  29. 29 Anonymous

    Thanks a lot of your

    Thanks a lot of your Tutorial, however i hava a question. in your tutorial, there have no compile process, so how could be .java to .class. or i should use another window (ie.Dos) to compile it and copy .class to classese directory. thanks

  30. 30 Anonymous

    Mike (mailto:lyu_zheng@hotmail.com), Tomcat will compile

    Mike (mailto:lyu_zheng@hotmail.com), Tomcat will compile for you. You just need to configure the Sysdeo plugin

  31. 31 Anonymous

    Thanks a lot for the

    Thanks a lot for the article. Two hours and I’m up and running: Tomcat+Eclipse+my first servlet.

  32. 32 Anonymous

    HI,

    HI,
    Thanks a lot for the article and now I am able to run servlets. But I am not able to run servlets which are in a package. For example I created a package name coreservlets in a project name Hello. I wrote a Hello1.java servlet in coreservlet package. I am not able to view this servlet through webbrowser. Can you suggest me How can I write web.xml file and where I have to keep that file.
    thanks.

  33. 33 Anonymous

    Thanks for the page. In

    Thanks for the page. In your statement:
    ‘If it doesn’t you might want to Google on what might have caused the stacktrace.’ May i add a hint that might save people a lot of agrivation?
    Here it is: Check the trace for the number 8080, if you see complaints about it being in use, then most likely( in windows )you have the ‘World Wide Web Publishing Service’ from windows running and that uses the same port to publish web pages. to solve this problem do: start > control panel >
    services . at the end you will see the service. If it is running you can stop it and try again.( you can always restart the service. Stopping it won’t damage anything.)
    Good luck

  34. 34 Anonymous

    You da man.

    Very nice tutorial:

    You da man.

    Very nice tutorial: short, sweet and no nonsense.

    NOTES:

    Used Version: 2.1.3, Build id: 200403101828
    Worked with previously installed Tomcat 3.3.1
    The web.xml file sample in the tutorial was bad, and Tomcat startup crapped out. I added these lines and started Tomcat successfully, ran servlet successfully:

  35. 35 Anonymous

    Hi,

    thank you for this “tutorial

    Hi,

    thank you for this “tutorial for Fools”. It was what I was looking for! I have heard that there is another way of doing the same thing. If I am not mistaken you can run tomcat in Eclipse but as an “stand-alone” application. Do you know anything about this?

    regards Alvaro

  36. 36 Anonymous

    Hi

    Can we integrate dreamweaver

    Hi

    Can we integrate dreamweaver with eclipse.

    bye
    nitin

  37. 37 Anonymous

    I just want to add

    I just want to add my name to the list of raving fan. Excellent tutorial. Spend half a day trying to do it on my own. Found your tutorial and corrected my mistakes, and was up nand running in 15 minutes.
    Cheers
    Howard

  38. 38 Anonymous

    Thanks for the tutorial.

    I am

    Thanks for the tutorial.

    I am using Eclipse 3.0 on Solaris 8 and have Tomcat 4.1 installed. I have loaded the Tomcat plugin. But when I attempt to change the Tomcat properties (version, homedir, base, etc) using
    Windows -> Preferences -> Tomcat and hit OK, I always get the popup message:

    “An error occurred. Check the logs”

    And the Tomcat preferences remain unchanged. Because of this I cannot start Tomcat and not even create a Tomcat project.

    Why am I getting this error?
    Where are the logs? The Eclipse logs do not show any info.

    Please help!

    Thanks,

    Rk

  39. 39 Anonymous

    Why am I getting this

    Why am I getting this error?

    You should check the logs for that question.

    Where are the logs?

    [ECLIPSE_DIR]/workspace/.metadata/.log

  40. 40 Anonymous

    Follow up to my question

    Follow up to my question above: I get the following stack trace when I attempt to set the Tomcat parameters in Windows -> Preferences -> Tomcat.

    What does this stack trace indicate? Is this a defect or am I doing something wrong?

    Thanks, Rk

    !ENTRY org.eclipse.core.runtime 4 0 Jun 23, 2004 20:48:44.516
    !MESSAGE java.lang.NullPointerException
    !STACK 0
    java.lang.NullPointerException
    at com.sysdeo.eclipse.tomcat.TomcatPreferencePage.performOk(TomcatPreference
    Page.java:160)
    at org.eclipse.jface.preference.PreferenceDialog$11.run(PreferenceDialog.jav
    a:745)
    at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.j
    ava:615)
    at org.eclipse.core.runtime.Platform.run(Platform.java:758)
    at org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.
    java:728)
    at org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDia
    log.java:199)
    at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.buttonPressed(W
    orkbenchPreferenceDialog.java:75)
    at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:506)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:731)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2938)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2642)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:668)
    at org.eclipse.jface.window.Window.open(Window.java:648)
    at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.j
    ava:72)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:881)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(Act
    ionContributionItem.java:915)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributi
    onItem.java:866)
    at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionContr
    ibutionItem.java:785)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:731)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2938)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2642)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1363)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1334)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:25
    3)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivat
    or.java:334)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:2
    73)

  41. 41 Anonymous

    Great job! I have finished

    Great job! I have finished the HelloWorld servlet using the tutorial and everything was okey.thanks a lot.

    I have one question.If I want to create a new JSP page(not servlet),which dir should I put it? And need I change the web.xml?

  42. 42 Anonymous

    I just added a new

    I just added a new section at the end of the tutorial outlining how to enable jsp use in Tomcat.

  43. 43 Anonymous

    EXCELLENT tutorial!!!
    thanks.
    one q:

    EXCELLENT tutorial!!!
    thanks.
    one q: i manged to do verything [got the msg: If you're seeing this page via a web browser, it means you've setup Tomcat successfully. Congratulations!]

    HOWEVER, while trying to run the HelloWorld I get this msg on the browser:

    type Status report

    message /HelloWorld/hello

    description The requested resource (/HelloWorld/hello) is not available.

    WHY?

  44. 44 Anonymous

    Any one can help me

    Any one can help me to solve the problem.
    I am running Eclipse-3 with Tomcat 5
    I have installed every thing, but the problem is when u am running Tomcat in Eclipse-3 I am getting some thing like this tomcat-user.xml.new

    2004-jul-08 12:02:05 org.apache.coyote.http11.Http11Protocol init
    INFO: Initializing Coyote HTTP/1.1 on http-8080
    2004-jul-08 12:02:05 org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 1328 ms
    2004-jul-08 12:02:05 org.apache.naming.NamingContext lookup
    VARNING: Unexpected exception resolving reference
    java.io.FileNotFoundException: C:\Program\Apache Software Foundation\Tomcat 5.0\bin\conf omcat-users.xml.new (Det går inte att hitta sökvägen)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.(Unknown Source)
    at java.io.FileOutputStream.(Unknown Source)
    at org.apache.catalina.users.MemoryUserDatabase.save(MemoryUserDatabase.java:462)
    at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:98)
    at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:129)
    at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:791)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:155)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:125)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:97)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:2291)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
    2004-jul-08 12:02:05 org.apache.catalina.mbeans.GlobalResourcesLifecycleListener createMBeans
    ALLVARLIG: Exception processing Global JNDI Resources
    javax.naming.NamingException: C:\Program\Apache Software Foundation\Tomcat 5.0\bin\conf omcat-users.xml.new (Det går inte att hitta sökvägen)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:155)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:125)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:97)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:2291)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
    2004-jul-08 12:02:05 org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina
    2004-jul-08 12:02:05 org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/5.0.25
    2004-jul-08 12:02:05 org.apache.naming.NamingContext lookup
    VARNING: Unexpected exception resolving reference
    java.io.FileNotFoundException: C:\Program\Apache Software Foundation\Tomcat 5.0\bin\conf omcat-users.xml.new (Det går inte att hitta sökvägen)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.(Unknown Source)
    at java.io.FileOutputStream.(Unknown Source)
    at org.apache.catalina.users.MemoryUserDatabase.save(MemoryUserDatabase.java:462)
    at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:98)
    at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:129)
    at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:791)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
    at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:252)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
    at org.apache.catalina.core.StandardService.start(StandardService.java:476)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:2298)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
    javax.naming.NamingException: C:\Program\Apache Software Foundation\Tomcat 5.0\bin\conf omcat-users.xml.new (Det går inte att hitta sökvägen)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
    at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:252)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
    at org.apache.catalina.core.StandardService.start(StandardService.java:476)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:2298)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
    2004-jul-08 12:02:05 org.apache.catalina.startup.Catalina start
    ALLVARLIG: Catalina.start:
    LifecycleException: No UserDatabase component found under key UserDatabase
    at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:259)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
    at org.apache.catalina.core.StandardService.start(StandardService.java:476)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:2298)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
    2004-jul-08 12:02:05 org.apache.catalina.startup.Catalina start
    INFO: Server startup in 172 ms

  45. 45 Anonymous

    Any one can help me

    Any one can help me to solve the problem.
    I am running Eclipse-3 with Tomcat 5
    I have installed every thing, but the problem is when u am running Tomcat in Eclipse-3 I am getting some thing like this tomcat-user.xml.new

    2004-jul-08 12:02:05 org.apache.coyote.http11.Http11Protocol init
    INFO: Initializing Coyote HTTP/1.1 on http-8080
    2004-jul-08 12:02:05 org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 1328 ms
    2004-jul-08 12:02:05 org.apache.naming.NamingContext lookup
    VARNING: Unexpected exception resolving reference
    java.io.FileNotFoundException: C:\Program\Apache Software Foundation\Tomcat 5.0\bin\conf omcat-users.xml.new (Det går inte att hitta sökvägen)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.(Unknown Source)
    at java.io.FileOutputStream.(Unknown Source)
    at org.apache.catalina.users.MemoryUserDatabase.save(MemoryUserDatabase.java:462)
    at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:98)
    at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:129)
    at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:791)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:155)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:125)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:97)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:2291)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
    2004-jul-08 12:02:05 org.apache.catalina.mbeans.GlobalResourcesLifecycleListener createMBeans
    ALLVARLIG: Exception processing Global JNDI Resources
    javax.naming.NamingException: C:\Program\Apache Software Foundation\Tomcat 5.0\bin\conf omcat-users.xml.new (Det går inte att hitta sökvägen)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:155)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:125)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:97)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:2291)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
    2004-jul-08 12:02:05 org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina
    2004-jul-08 12:02:05 org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/5.0.25
    2004-jul-08 12:02:05 org.apache.naming.NamingContext lookup
    VARNING: Unexpected exception resolving reference
    java.io.FileNotFoundException: C:\Program\Apache Software Foundation\Tomcat 5.0\bin\conf omcat-users.xml.new (Det går inte att hitta sökvägen)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.(Unknown Source)
    at java.io.FileOutputStream.(Unknown Source)
    at org.apache.catalina.users.MemoryUserDatabase.save(MemoryUserDatabase.java:462)
    at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:98)
    at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:129)
    at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:791)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
    at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:252)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
    at org.apache.catalina.core.StandardService.start(StandardService.java:476)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:2298)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
    javax.naming.NamingException: C:\Program\Apache Software Foundation\Tomcat 5.0\bin\conf omcat-users.xml.new (Det går inte att hitta sökvägen)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
    at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:252)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
    at org.apache.catalina.core.StandardService.start(StandardService.java:476)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:2298)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
    2004-jul-08 12:02:05 org.apache.catalina.startup.Catalina start
    ALLVARLIG: Catalina.start:
    LifecycleException: No UserDatabase component found under key UserDatabase
    at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:259)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
    at org.apache.catalina.core.StandardService.start(StandardService.java:476)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:2298)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
    2004-jul-08 12:02:05 org.apache.catalina.startup.Catalina start
    INFO: Server startup in 172 ms

  46. 46 Anonymous

    When I install eclipse 3.0,

    When I install eclipse 3.0, and run with tomcat 5.0.25 I am unable to debug. Should the debugger just popup, or is there a way to run in debugger mode?

    Thanks,
    John

  47. 47 Anonymous

    i code my non-servlet java

    i code my non-servlet java source code, which are referenced
    by my servlets, in web-inf/src then copy their classes to the
    ‘root’ directory in order for
    my servlets to find these classes at run time.
    eclipse does not compile java source code in the
    ‘root’ directory. i must be missing something?
    your help is appreciated–thanks,
    hugh

  48. 48 Anonymous

    Was the problem relating to

    Was the problem relating to the 2 stack traces above solved? I’m experiencing the same thing and really in need of the solution

  49. 49 Anonymous

    Great tutorial!!
    Thanks a lot!!!

    Bernak

    Great tutorial!!
    Thanks a lot!!!

    Bernak

  50. 50 Anonymous

    Answer?
    Hi

    Was this ever resolved? I am now seeing this same error, but could not find a site on the net that had help for this. I am running Tomcat 4.1.29 and Eclipse 3.0 (all on a Windows 2000 box). The plugin I am using is the 2.1 version from sysdeo.

    Thanks!
    Ron Boutell
    ron_boutell@stercomm.com

  51. 51 Anonymous

    not native
    Hi,
    You wrote “xcuse me for my poor english skills, I am not a native speaker”.
    So you are not native, then you must me “emulated”, aren’t you? :-)
    Me not native too.

    Good tutorial. There are several similar tutorials, this one has added value bacause it addresses to web.wml configuration step.

    Anyway it didn’t work for me. For some reason is keeps returning a “not available” Tomcat error page:
    “El recurso requerido (/HelloWorld/hello) no está¡ disponible” (The requested resource blah not available).
    Most other tutorials did the same. I can’t find out what the reason is.

    Juan Lanus
    TECNOSOL
    Argentina

  52. 52 Anonymous

    not native again
    Hi,
    After writing my former comment I deleted all of the eclipse and tomcat files in my disk and reinstalled it all disregarding prior configuration files.
    Then it worked like a charm saludating this brave neue welt!
    It’s Eclipsr Version: 3.0.1 Build id: 200409161125, Tomcat 5.0.30 and Sysdeo’s Tomcat plugin version 3 as of 2004-11-26.
    Thanks a lot!

    Juan Lanus
    TECNOSOL
    Argentina

  53. 53 Anonymous

    “No UserDatabase component found under key UserDatabase” solved
    I had the same problem. Got “No UserDatabase component found under key UserDatabase” after messing around with Eclipse. I run tomcat5 on CentOS and Eclipse on WindowsXP.

    It was some sort of permission problem. This solved it for me:

    chown -R tomcat4:tomcat4 /usr/share/tomcat5

  54. 54 Anonymous

    Tomcat problem
    java.lang.NullPointerException
    at com.sysdeo.eclipse.tomcat.TomcatPreferencePage.performOk

    Didi you solve teh problem ?
    What was the solution/fix/workaround ?

    thanks / Massimo

  55. 55 Anonymous

    regardin web.xm
    The tomcat project does not create automatically web.xml file.
    We are made to make web.xml file manually and make entries for the servlet.
    Is this the right behaviour of the tomcat plugins.

  56. 56 Anonymous

    Errors when setting the Tomcat preferences in Eclipse

    I have the very same problem.
    Did you solve it ?
    What was teh solution/workaround to solve it ?
    Just let me have a feedback ..

    thakns / regards / Massimo

    SDK :
    C:\j2sdk1.4.2_05

    Sysdeo Tomcat Launcher: version 2.2.1

    Eclipse Platform Version: 3.0.2

    Tomcat Version: Apache Tomcat/5.0.30
    Using CATALINA_TMPDIR: C:\jetspeed\jakarta-tomca
    (Jetspeed 2, M3 on Tomcat 5.0.30)

    Hi,

    I have problems (Null Pointer Exception) when trying to set the Tomcat preferences in Eclipse (Window –> Preferences –> Tomcat).

    Sometimes, already by clicking on “Tomcat” an exception occours
    (see Ex.1 here below) then when saving the settings (on “OK”)
    another exception occours (see Ex.2 here below).

    Do you know the reasons ? already experienced ? any solution ?

    ***************************
    Ex. 1
    ***************************

    ERROR MESSAGE IN ERROR DIALOG on “Tomcat”:
    “The currently displayed page containes invalid values”

    ERROR MESSAGE IN ERROR LOG on “Tomcat”:

    java.lang.NullPointerException

    java.lang.NullPointerException
    at com.sysdeo.eclipse.tomcat.TomcatPreferencePage.performOk(TomcatPreferencePage.java:160)
    at org.eclipse.jface.preference.PreferenceDialog$11.run(PreferenceDialog.java:746)
    at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:616)
    at org.eclipse.core.runtime.Platform.run(Platform.java:747)
    at org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.java:728)
    at org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDialog.java:199)
    at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.buttonPressed(WorkbenchPreferenceDialog.java:75)
    at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:506)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2773)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2432)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:668)
    at org.eclipse.jface.window.Window.open(Window.java:648)
    at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:72)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:881)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:915)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:866)
    at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionContributionItem.java:785)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2773)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2432)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
    at org.eclipse.core.launcher.Main.run(Main.java:704)
    at org.eclipse.core.launcher.Main.main(Main.java:688)

    ***************************
    Ex. 2
    ***************************

    ERROR MESSAGE IN ERROR DIALOG on “OK”:
    “An error has occoured. See error log for more details.”

    ERROR MESSAGE IN ERROR LOG on “OK”:

    Problems occurred when invoking code from plug-in: “org.eclipse.core.runtime”.

    java.lang.NoSuchMethodError: org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField.setElements(Ljava/util/List;)V
    at com.sysdeo.eclipse.tomcat.editors.ProjectListEditor.updateProjectsList(ProjectListEditor.java:65)
    at com.sysdeo.eclipse.tomcat.editors.ProjectListEditor.(ProjectListEditor.java:39)
    at com.sysdeo.eclipse.tomcat.TomcatPreferencePage.createContents(TomcatPreferencePage.java:123)
    at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:217)
    at org.eclipse.jface.preference.PreferenceDialog$12.run(PreferenceDialog.java:1008)
    at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:616)
    at org.eclipse.core.runtime.Platform.run(Platform.java:747)
    at org.eclipse.jface.preference.PreferenceDialog.showPage(PreferenceDialog.java:1003)
    at org.eclipse.jface.preference.PreferenceDialog$8.selectionChanged(PreferenceDialog.java:529)
    at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:450)
    at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:616)
    at org.eclipse.core.runtime.Platform.run(Platform.java:747)
    at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:448)
    at org.eclipse.jface.viewers.StructuredViewer.handlePostSelect(StructuredViewer.java:708)
    at org.eclipse.jface.viewers.StructuredViewer$5.widgetSelected(StructuredViewer.java:726)
    at org.eclipse.jface.util.OpenStrategy.firePostSelectionEvent(OpenStrategy.java:200)
    at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:195)
    at org.eclipse.jface.util.OpenStrategy$3.run(OpenStrategy.java:349)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:106)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2750)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2435)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:668)
    at org.eclipse.jface.window.Window.open(Window.java:648)
    at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:72)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:881)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:915)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:866)
    at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionContributionItem.java:785)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2773)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2432)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
    at org.eclipse.core.launcher.Main.run(Main.java:704)
    at org.eclipse.core.launcher.Main.main(Main.java:688)

  57. 57 Anonymous

    this is the best it solve my servlet problem

  58. 58 Mario

    I am using eclipse Version: 3.3.1, and Tomcat/5.5.17.

    I was getting the following error with my web.xml
    Unexpected element “{}web-app” {antlib:org.apache.tools.ant}web-app
    and it looked like eclipse was interpretting this file as an ant file versus a web file descriptor.

    My servlet was not coming up so I searched for a while and did not find an answer.
    I did find from another guy who apparently got distracted by this message that to run the servlet directly you needed to add the servlet keyword in the URL.

    That ended up working for me, than I realized that by playing with the object name I had tricked myself. Long story short, there are two URLs I could use to run the servlet and the error above did not seem to be significant.

    In my case since I used “MytomcatProject” as the name of my project, myHello as a servlet name and MyServletPattern as mapping name so I can direct link to it.

    Here is my web.xml file

    myHello
    HelloServlet

    myHello
    /MyServletPattern

    Here are the two URLs that will run the servlet:

    http://localhost:8080/MytomcatProject/MyServletPattern

    or directly without the mapping set in web.xml

    http://localhost:8080/MytomcatProject/servlet/myHello

    and using the class name also works

    http://localhost:8080/MytomcatProject/servlet/HelloServlet

    cheers,

  59. 59 Liviu

    Hello. I’m using tomcat and I followed the tutorial. GREAT TUTORIAL! But there seems to be an error in the web.xml file in the section

    jspAssign
    /*.jsp

    I had to change url-pattern from /*.jsp to *.jsp in order for tomcat to start, otherwise it would’n start do to “severe errors”.

  60. 60 Aania

    Real gud tutoial dude…

    I’ve followed all ur steps…

    But am still getting the below lines…

    HTTP Status 404 – /HelloWorld/hello

    ——————————————————————————–

    type Status report

    message /HelloWorld/hello

    description The requested resource (/HelloWorld/hello) is not available.

    Wud be real nice if smeone cud come up wit some solution for tht…

  61. 61 Mitch

    Hi,
    I am using apache and eclipse for the first time. I am running into an issue. When I create the HelloServlet.java class, a yellow icon with a question mark appears on top on my web-inf, package, and class. I also notice a yellow line appears under the class name HelloWorld. I place the curso on top of it, and I saw the message below:
    “The serializable class HelloServlet does not declare a static final serialVersionUID field of type long”. I am not sure what I did wrong. When I paste the url in the browser, it does not show the message. It shows me an error 404.
    I am using eclipse 3 with tomcat 6 and java 5.
    P.S. I started tomcat, and all the jsp and html samples are working fine.

  62. 62 Mahesh

    Hi,
    This is really a good Tutorial for the Learners.Thanks for the Tutorial.

  63. 63 janakadalugama

    Thank you , I did and got idea how tomcat plug with eclipse and
    and develop a project.

  64. 64 olly

    thanks. excellent tutorial – well communicated – went very smooth!

  65. 65 d and j

    THANK YOU THANK YOU THANK YOU THANK YOU!!!!!
    You just saved us numerous hours of work! more time for pizza!

    Thanks again!

  66. 66 anoymous

    THANK YOU!!!!!!! Very concise and very easy to follow…

  67. 67 Vasily

    Hi,

    I’ve been using Tomcat plugin for a while and I’ve just noticed that eclipse console output is not respecting System.out/err color settings.

    Here is simple example:
    System.out.println(“test out”);
    System.err.println(“test err”);

    If you run this code as stand alone java app than output would be:
    test out <– black
    test err <– red

    If you run it within your webapp running with tomcat plugin output would be:
    test 1 out <– black
    test 1 err <– black

    Do you know why?

    Thank you,
    Vasily

  68. 68 peter

    Hi,

    is there any way to define the OS-user under which the tomcat process will run?
    Under Lunix this plugin does not work because tomcat runs under the login-user und not the tomcat-user.

  69. 69 Karen

    Thank you soooo much! This make it so much simpler.
    I did have to look under /conf/Catalina/localhost to get the correct reference of my project to then enter in localhost:8080//hello (from your example).
    Thank you again! I have been programming in Java for years and years, but setting up a tomcat server with eclipse I found to be surprisingly tricky :o )

  70. 70 Nguon TAING

    Hi,

    it is a good tutorial. thanks BIG BIG

    Nguon

  71. 71 Wang Zhi

    Very good!

  72. 72 Mariem

    Hi,

    Thx a lot for this tutorial

    Mariem

  73. 73 Naresh

    great tutorial..i was just lookin for this kind of tutorial..web app development demystified for newbies..

  74. 74 Mals

    I tried to create the Project and I am unable to view the classes folder under WEB-INF directory from eclipse and also the Web.xml doesnt display with XML icon and infact when i tried to invoke from browser it displays Page not found error.(404) Can some one help me to solve this problem

  75. 75 Thank You Very Much..

    Hi…
    Thanks alot. Really, I was fighting for long time but I could not build a single App. Screen shots are really helpful.

  76. 76 Uma

    Hi! very helpful tutorial…but I have a problem when I am trying to run this HelloWorld I am getting an error saying “The archive: C:/Program Files/Apache Software Foundation/Tomcat 4.1/bin/bin/bootstrap.jar which is referenced by the classpath, does not exist.” I guess I messed up while setting the paths …can u pls help me out…am new to this servlet programming and tomcat..
    Thanx in advance

  77. 77 Nick

    Works perfect.
    That tomcat plugin is exactly what i needed.

  78. 78 shwetha

    Thanks it helped me to run my helloworld using Eclipse

    Can you tell how to run servlet if it is in some package .as in this case it is in default package in web-inf folder

  79. 79 Dee

    Awesome Tutorial man.

    I followed your instructions and have created my first servlet. A quick note for those who apparently did everything right but got a “resource HelloWorld/hello could not be found” message.

    Check for spelling error – Don’t forget the space between “Hello” and “World” when typing in the URI.

    Also, if you didn’t set Eclipse workspace to point to the webapps directory in your Tomcat installation folder, be sure to copy the Hello World application from the workspace and paste it inside the webapps directory.

    These may save some people precious hours.

  80. 80 Stanislav

    This helped me get started, thank you!

  81. 81 Dorel de la Craiova

    Thanks a lot, it was extremly useful, I have a deadline and this tutorial save mai a$$ in record time. Well done !

  82. 82 Tech Freaks
  83. 83 Dorothy

    Thanks so much for this beginner tutorial. I didn’t know where to start and this has got me up and running very quickly.

  84. 84 Nahuel

    Great tutorial. I was all the morning try to do it by my own and with this 10 minutes!!! Great explanation

  85. 85 dana

    which is the link where I can find the Sysdeo Eclipse Tomcat Launcher plugin?

  86. 86 Michelle

    This tutorial answered some problems I had, but I did this after some reading. I understood the file directory structures and the servlet and xml file necessity. I could have done it w/o any background, but it was a great tutorial for step by step application of the theory I read.

  1. 1 Développer et debuguer une servlet avec Eclipse et Tomcat et Sysdeo | Zoonix

Leave a Reply






Bad Behavior has blocked 880 access attempts in the last 7 days.

FireStats iconPowered by FireStats