• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

my servlet is running without tomcat7

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
My servlets are running fine, but I haven't installed tomcat7. I haven't done something like 'sudo apt-get install tomcat7'.
All I did was browse and give the path to tomcat at the time of creating a 'New Server RunTime Environment'.

So what I'm observing is :
1. sudo service tomcat7 does not give anything
2. My servlet page at http://localhost:8080/HelloWorldProject/FirstPage shows the correct output, but when I just type http://localhost:8080/ on the browser, it says 'HTTP Status 404 - /'. It does not show me the Apache Tomcat home page.

So my question is :
1. How am I able to run my servlet although apache tomcat is not installed and there is no such service?
2. Assuming that eclipse installed tomcat7, why am I not seeing the tomcat7 home page, though I can see the servlet.

Please advise.
Thanks.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apparently whatever "creating a 'New Server RunTime Environment'" does entails installing a servlet container.

The home page is served by a web app (the ROOT web app); it's likely that Eclipse only runs your web app, not any others that may happen to ship with a default Tomcat installation.
 
Marshal
Posts: 5666
333
IntelliJ IDE Python TypeScript Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Aftab Hassan wrote:New Server RunTime Environment


I'm guessing that this is an option you found in Eclipse?

I'm also guessing by the 'apt-get' reference that you're using Linux. In which case if you run the command "ps -ef | grep java" and look for the process that looks like your application then you'll most likely be able to find out what servlet container is being used. It'll be the one bundled in with Eclipse, probably Jetty or Tomcat.
 
Aftab Hassan
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:Apparently whatever "creating a 'New Server RunTime Environment'" does entails installing a servlet container.


Ulf Dittmer, thank you for the reply.
But I need a bit more explanation for the line above. If creating a 'New Server RunTime Environment is similar to installing tomcat7, then why am I not seeing it in the services in ubuntu when it is running?

Generally, do servlet developers install tomcat7 instead of 'creating a 'New Server RunTime Environment'?

Please see the attached images to see the procedure I followed to create the new serve runtime environment.
1.png
[Thumbnail for 1.png]
2.png
[Thumbnail for 2.png]
 
Aftab Hassan
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Cooke wrote:It'll be the one bundled in with Eclipse, probably Jetty or Tomcat.


Thanks for the reply Tim.
It is tomcat since I gave the path to Tomcat 7 at the time of creating a new Server.

My question is, why am I not able to see it outside of eclipse. Yes, the servlet works fine from a browser, but why can't I see it as a service with it's process id/port number etc from a linux command?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're not seeing it as a service because it's not installed as a service. And you may not be seeing it as a separate process because it's running in-process with Eclipse. That's just speculation on my part, I have no idea what Eclipse does.

And I have anyway found that using IDE-integrated servlet containers causes more problems than it solves. So I advise you to install Tomcat as a standalone server, and to use that instead of whatever Eclipse does.
 
Aftab Hassan
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:You're not seeing it as a service because it's not installed as a service. And you may not be seeing it as a separate process because it's running in-process with Eclipse. That's just speculation on my part, I have no idea what Eclipse does.

And I have anyway found that using IDE-integrated servlet containers causes more problems than it solves. So I advise you to install Tomcat as a standalone server, and to use that instead of whatever Eclipse does.


Thanks Ulf Dittmer, do I have time for a quick last question. So I understand that basically tomcat is running within the scope of eclipse.

But how am I able to see the servlet in a browser even outside of eclipse(I mean the normal browser, not the one that comes integrated with eclipse) when eclipse is on(server is running)
The moment I close eclipse, I cannot see the same page on the browser I was seeing when eclipse was on.

So looks like tomcat is controlled by eclipse?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The choice of browser is irrelevant. As long as some process is serving something on port 8080 you can point a browser at it.
 
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At last count, none of the official Eclipse spins - including the JEE ones - did not include Tomcat, Jetty or any other webapp container.

There are a number of reasons why it didn't and shouldn't and not the least of them is that Tomcat and Jetty are not full-stack JEE servers. Another is that Eclipse is supposed to be product-neutral. If not Tomcat, why not bundle WebLogic, WebSphere, JBoss/WildFly, JoNaS, or one of the other servers, instead?

You should be able to get a clue on what's happening by pointing your browser to a port 8080 page and supplying a dummy URL. Most webapp servers identify who they are on their default implementations of the 404 page. Knowing that, it should be relatively easy to scan your system's running process status/task manager and see what its parent process is.
 
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic