aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse/Tomcat just won't work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse/Tomcat just won Watch "Eclipse/Tomcat just won New topic
Author

Eclipse/Tomcat just won't work

Jack Moore Iii
Ranch Hand

Joined: Jun 07, 2012
Posts: 76
I'm trying to set this up so I can learn JSP and Servlets. I'm using the tutorial:

http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html

When I get to the test-app deal, it just won't load in a browser. I have to change the port to 8080, and then when I load the test-app sample, and get the server running, I enter "http://localhost:8080/test-app/" into the browser URL, and I get nothing but "The requested resource is not available". What's the deal, anyone know?...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

Personally, I never run the container from within the IDE. It's just too finicky and doesn't represent the real world enough for my tastes. I use the IDE as an intelligent editor and run a standalone Tomcat instance for running the web apps.

Just my 2¢.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jack Moore Iii
Ranch Hand

Joined: Jun 07, 2012
Posts: 76
Yeah, well, I'm completely stupid on the concept right now and don't even know how to run the program, so I just need something that works so I can practice code. Anyone have a setup tutorial suggestion?...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

For setting up standalone Tomcat or eclipse?

If the former, Tomcat comes with extensive documentation. For eclipse, someone else may be able help you as I do not use it.
Jack Moore Iii
Ranch Hand

Joined: Jun 07, 2012
Posts: 76
I don't mean this to sound idiotic, but when I practice my java programs, I type it in note pad, and I compile it with javac in DOS. How do I do that with JSP crap, not in the same fashion of course, but with tomcat and/or eclipse. Is there a better method to practice code with?...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

If you are trying to write web apps, you need to write web apps. So is that the "code" you are talking about?

If you are just trying to run "normal" Java apps in eclipse, you don't need Tomcat.

But since you mention JSP, I assume you are talking about web apps. In that case, you will find that web apps are very special and have to have a folder and file structure that follows strict rules.

You should find a good tutorial on structuring web apps. In a nutshell, you need to create a folder that serves as the web root (IDEs may have extra rules about this), create a WEB-INF folder in the web root, and create a deployment descriptor (web.xml) in WEB-INF. The class hierarchy needs to be rooted at WEB-INF/classes. And so on...

If you want the horse's mouth, the Servlet Specification spells it all out.
Jack Moore Iii
Ranch Hand

Joined: Jun 07, 2012
Posts: 76
Yes, I'm trying to learn Servlets and JSP, now that I have most of the basic Java syntax and concepts under my belt. I suppose I'll attempt to follow the documentation, but I have bad feelings of failure even now. Trying desperately to prepare myself for an entry level Java developer job (future one, have not been offered anything yet) and I want to get in all the practice code I can. Thanks for the info...
Jack Moore Iii
Ranch Hand

Joined: Jun 07, 2012
Posts: 76
Okay, I've been trying to follow the manual setup for tomcat, but I'm like beating my head against a wall here. Maybe because I have a cold right now and the world is but a shadow to me. I set the classpath, I already had java SDK installed and working. I go to click on the startup.bat and nothing happens on localhost or localhost:8080, when I type it in the browser. With Eclipse, I at least had the server running fine. Is there something missing here "http://www.coreservlets.com/Apache-Tomcat-Tutorial/development-environment.html#Set-CLASSPATH" that is important to do, or are those solid set up instructions and I'm simply going astray?...

EDIT- I doubled back and tried the .exe install of tomcat 7, followed those instructions, and still have no clue what is going on with ant and CVS added into the mix. Is it possible that it's better for me, as a beginner, to start out with Eclipse or something, because I'm spending mass amounts of time here trying to learn how to install these things rather than coding.
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 867
    
    5
The Netbeans EE version is nicely integrated with the Tomcat server it comes with.

I admittedly had no cold when I tried it...
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5827
    
    7

I never use the .exe to install Tomcat. I just download the zip file, unzip it into some location (I usually pick anything that doesn't have a space in the path, thus I avoid Program Files and Documents and Settings - mine usually goes into c:/apps/java/apache-tomcat-7.x.x).

I recommend that you don't click start.bat; instead, open a command prompt window, cd to the Tomcat bin directory and run startup.bat from there.

When you run startup.bat, a second command prompt window should open that displays console log output. I usually dislike that and instead edit the startup.bat file, changing this line near the end of the file:



to instead read



then the console log output shows in the same command prompt window. Oh, and then to shut it down, I CTRL-C in the command prompt window - Tomcat has a hook to catch CTRL-C and shut down gracefully so there is not issue using that mechanism to shut it down.

Of course, to run Tomcat from Eclipse you have to first install Tomcat. And it usually helps to get it running from the command prompt first. Once that is working, you can create a server in Eclipse, pointing to your Tomcat directory. Good documentation appears in the Eclipse help under Help > Help Contents > Web Tools Platform User Guide > Creating Web Applications > Web Projects


JBoss In Action
Jack Moore Iii
Ranch Hand

Joined: Jun 07, 2012
Posts: 76
Ivan Jozsef Balazs wrote:The Netbeans EE version is nicely integrated with the Tomcat server it comes with.

I admittedly had no cold when I tried it...


Well, I tried downloading that and installing it, and it seems to just work. I loaded up one of the servlet example projects, made a new servlet, ran it, and it opened a browser page to localhost:8080 and it worked. I suppose this kind of program does a lot for you that you should know how to do yourself, but at least I'll be able to write code and test it out without going crazy trying to get just the apache server working. Thanks for the tip...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Eclipse/Tomcat just won't work