• 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
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Tomcat server setup

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
System: Mac OS X 10.95
Eclipse Mars 1 (release 4.5.1)
Java SE8, JDK 1.8
Tomcat 8
AngularJS 1.4.5

Hi all,

I am new to Java, Eclipse, Tomcat. I have been trying to run an AngularJS app on Eclipse which is integrated with Java app at the back end (and mySql). I set up my first project as a dynamic web project and developed all the angularJS files and all data are hardcoded till now. I ran my Angular project in plnkr.co and it works perfectly. Now the challenge is to run on a local server.

For that i am trying to use Tomcat.

1) I have installed Tomcat 8 on my /Applications/Tomcat directory
2) Running ./startup.sh starts up Tomcat server and the localhost:8080 gives me the Apache Tomcat homepage
3) When i try to go to Manage App (http://localhost:8080/manager/html) it gives me "401 Unauthorized You are not authorized to view this page....." error
4) I have created a new role for manager-gui and add a user tomcatadmin assigning all roles... in the tomcat-users.xml ..... but in vain, the login form keeps popping up.
5) When i go to my app index.html page (http://localhost:8080/MyApp/WebContent/index.html) it gives me "Failed to load resource: the server responded with a status of 404 (Not Found)"

So i went back to Eclipse and checked all the server configuration.

6) Eclipse->Preferences->Java->Installed JREs->Java SE8
7) Eclipse->Preferences->Server->Runtime Environment-> Apache Tomcat v8.0
8) On the server tab in Eclipse..... i created a new server by right clicking. In the Define a new server, i selected Apache->Tomcat v8.0 server
------- in the same "Define a new Server" form, at the bottom There are 3 fields (and sometimes there are only two) namely: Server's Host Name, Server Name, Server Runtime Environment (this last option is not available sometime). I am guessing that is because the server is detected from our previous configuration in Eclipse->Preferences->Server->Runtime Environment-> Apache Tomcat v8.0.
9) After setting up the server and when i try to run (from eclipse) i get "everal ports (8080, 8009) required by Tomcat v8.0 Server at localhost (2) are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).".

10) I noticed that the Tomcat ./startup.sh that i successfully ran was assigned to another process and not my main App. I have been looking at tutorial to change the port numbers but i dont understand why i need to do that since i don't want to run any other apps anyway. I just want to configure this tomcat server for one app only.

11) So i shut down my already started Tomcat from terminal (./shutdown.sh) and then use the "Start the server" play button on Eclipse. Now the server is started from Eclipse and the status says "[started, synchronized].

12) So i went back to localhost:8080 and found no page "HTTP Status 404 - / type Status report message / description The requested resource is not available."


I realized i am not configuring my environment properly..... i am new to this.. Can anyone help me set this up please? I will be developing Java back end too, with mySQL as database. Any help is appreciated. Let me know if i should clarify further.

 
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to CodeRanch !

The index.html URL - http://localhost:8080/MyApp/WebContent/index.html - doesn't look correct. It should be http://localhost:8080/MyApp/index.html (without the "WebContent/").
The WebContent directory is used only by Eclipse and itself isn't copied over into the WAR file, only the files under it are copied into WAR.
 
Ibobi Ok
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Katrhik,

Thanks for the response. I have figured out why the Tomcat Manage App page was not accepting my user credentials. And boy... did i spend a day trying to figure out what's wrong...

In case someone face the same issue in future:

the problem was when i edited the tomcat-users.xml using TextEdit in Mac OS... the editor automatically deleted some of the " " (quotes). So when i inserted the Quotes "" from my keyboard it was inserting as an italicised version (apparently it has a different unicode character; U+201D) when it should be the straight character type (unicode U+0022).


Boy..... i spent a day trying to figure out what's wrong with these things

I am going to dig in further tomorrow (starting my new projects on Java). I hope everything works out good after this fiasco. Will drop by to seek more knowledge.

 
Karthik Shiraly
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup, software development can sometimes be frustrating for the silliest of reasons. Bad news is, it doesn't stop being silly now and then even after years of experience!
Glad you worked it out. Good luck with next step!
 
Saloon Keeper
Posts: 28486
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
The "italicized quotes" from TextEdit come from the fact that it was trying to do word processing, not text editing.

What you really got was the distinct open and close quote characters that typesetters use instead of the vertical (straight) quotes that the basic ASCII character set provides. Typesetters quotes are prettier than vertical quotes. They wrap themselves around the quoted text, as was the original intention when quotes were hand-written. But computer programming didn't originally come with such a rich character set, so they went with the only quote available. You'll also see this with the single-quote character (apostrophe).

It isn't just TextEdit that will insert the wrong sort of quote characters. Microsoft Word does this as well. Word never claimed to be a text editor - it's very definitely a word processor.

So for editing computer text files, such as Java source code, XML, and so forth, either use a "dumb" text editor or use the IDE.
 
To get a wish, you need a genie. To get a genie, you need a lamp. To get a lamp, you need a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic