Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » running 2 projects without stopping tomcat
running 2 projects without stopping tomcat [message #216772] Fri, 04 July 2008 01:19 Go to next message
Eclipse UserFriend
Originally posted by: cuco2772.gmail.com

Hi, this may be a totally dumb question. I have 2 very simple projects
running
on Ganymede. All they are is just a couple jsps that invoke a servlet and
print
something akin to 'Hello World'. I'm right clicking on the jsp and choosing
'Run on Server', which loads the jsp and then I hit submit and that
invokes a servlet in both instances which just has a print statement.

I noticed that if I run one project and then run the other without
stopping the
server first, I get the familiar HTTP 404 error when running the second.
I guess my question is, why do I have to stop the server every time ?
Is there a way to not have to do that ? Just curious, thanks.
Re: running 2 projects without stopping tomcat [message #216783 is a reply to message #216772] Fri, 04 July 2008 03:27 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

Adam Posner wrote:
> Hi, this may be a totally dumb question. I have 2 very simple projects
> running
> on Ganymede. All they are is just a couple jsps that invoke a servlet
> and print
> something akin to 'Hello World'. I'm right clicking on the jsp and choosing
> 'Run on Server', which loads the jsp and then I hit submit and that
> invokes a servlet in both instances which just has a print statement.
> I noticed that if I run one project and then run the other without
> stopping the
> server first, I get the familiar HTTP 404 error when running the second.
> I guess my question is, why do I have to stop the server every time ?
> Is there a way to not have to do that ? Just curious, thanks.
>
Do you run the project by right-clicking on the JSP of one and choosing
Run As... (which gets you running in Eclipse's internal browser) and
then run the second in the same way?

In my experience, typing http://localhost:8008/Project/thing.jsp into an
external browser afterward gets the result you want.

Launching the server (right-click on server in tab at bottom of the
Eclipse workbench and choosing Start or Restart) followed by hand-typing
http://localhost:8008/Project/thing.jsp into Firefox then separately
typing http://localhost:8008/Project2/thing2.jsp should work as you expect.

The console output window at the bottom of the workbench should show the
server launching on both projects or so has been my experience.

Russ Bateman

(Incidentally, Windofkeltia is just the name Eclipse newsgroups
hoodwinked me into using when I joined. I misanswered a question. It was
unintentional and I just haven't withdrawn to rejoin.)
Re: running 2 projects without stopping tomcat [message #216824 is a reply to message #216783] Fri, 04 July 2008 23:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cuco2772.gmail.com

Yes, you're right. If I run it externally it doesn't do that.
On the internal browser, if I rt click on the project and run the
server,and do that again with a second project without stopping the server
first, I get the 404. But if I stop it and start it again, its ok.
Re: running 2 projects without stopping tomcat [message #216904 is a reply to message #216824] Mon, 07 July 2008 12:49 Go to previous message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
Adam Posner wrote:
> Yes, you're right. If I run it externally it doesn't do that.
> On the internal browser, if I rt click on the project and run the
> server,and do that again with a second project without stopping the
> server first, I get the 404. But if I stop it and start it again, its ok.

The default behavior is to put the <Context> elements for added projects
in the server.xml for reasons explained here:

http://wiki.eclipse.org/WTP_Tomcat_FAQ#Why_are_.3CContext.3E _elements_added_to_server.xml_when_Dynamic_Web_Projects_are_ added_to_the_Tomcat_server.3F

Tomcat does not automatically pickup changes made to server.xml while it
is running, so a restart is required to have the added project seen by
Tomcat.

You could enable the "Publish module contexts to separate XML files"
option in the server editor. This causes the <Context> elements to be
placed in separate files down under the "conf/Catalina/<typically
localhost>" directory. Tomcat is able to pickup changes here so the
added project should get served. You will still likely get a 404 error
when using "Run on Server". Since the server is already running, the
browser will open immediately, before Tomcat is able to start the added
context. If you wait a moment and then refresh the browser you should
see the page.

For more detail about adding and removing projects while Tomcat is
running, see:

http://wiki.eclipse.org/WTP_Tomcat_FAQ#Can_I_add_or_remove_a _project_from_a_server.2C_or_publish_changes_for_a_project_a lready_on_a_server.2C_while_that_server_is_running.3F

Cheers,
Larry
Previous Topic:Static Web projects: where to find the features listed in the documentation?
Next Topic:Could not load the Tomcat server configuration
Goto Forum:
  


Current Time: Thu Apr 25 12:42:51 GMT 2024

Powered by FUDForum. Page generated in 0.03420 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top