Thank you so much for your detailed feedback Mark, it helped me a lot

On Sat, Jul 22, 2017 at 10:25 PM, Mark Eggers
<its_toas...@yahoo.com.invalid> wrote:
> Roparzh,
>
> This is going to be very long. I just wrote this, but have NOT done more
> than a cursory proof-reading.
>
> I hope that you find it useful.
>
> On 7/22/2017 12:14 AM, Roparzh Hemon wrote:
>> On my Mac 10.11.3 I've installed the Eclipse JEE IDE (Version: Neon.3
>> Release (4.6.3)) I also installed apache-tomcat 9 on my Mac, using the
>> following commands :
>>
>> sudo mkdir -p /usr/local sudo mv ~/Downloads/apache-tomcat-9.0.0.M21
>> /usr/local sudo rm-f /Library/Tomcat sudo ln -s
>> /usr/local/apache-tomcat-9.0.0.M21/ /Library/Tomcat sudo chown -R
>> roparzhhemon /Library/Tomcat sudo chmod +x /Library/Tomcat/bin/*.sh
>>
>> When I try "Run as server" on a minimal html file in JEE, I get the
>> following error message :
>>
>> Could not load the Tomcat server configuration at /Servers/Tomcat v9.0
>> Sever at localhost-config. The configuration may be corrupt or
>> incomplete.
>
> This is going to be very long, and I'm going to split this into two
> parts. Part A will be a straightforward (I hope) set of instructions.
> Part B will reference Part A and give some rational (I hope) reasons for
> why I do the things the way I do.
>
> Please note that I don't have a Macintosh (yet). Please also note that I
> prefer NetBeans. However since the environment I build at $work has to
> support both NetBeans and Eclipse, I am a little familiar with Eclipse.
> I'll try to keep the soapbox stuff to a minimum.
>
> The instructions will be for UNIX-like systems (MacOS, Linux), The
> Windows instructions are similar, only the locations and commands will
> be changed to reflect the operating system.
>
> Let's get started.
>
> Part A - Quick Installation
> ===========================
>
> 0. JDK - Needed if you use Maven
>
> 1. Install Tomcat
>
> a. mkdir ~[user-name]/Apache
> b. cp ~[user-name]Downloads/apache-tomcat-xxxx.tar.gz \
>    ~[user-name]/Apache
>    xxxx is the version that you want
> c. cd ~[user-name]/Apache; tar xvfz apache-tomcat-xxxx.tar.gz
>
> 2. Install Maven (not required, but nice to have)
>
> a. cp ~[user-name]/Downloads/apache-maven-3.5.0-bin.tar.gz \
>    ~[user-name]/Apache
> b. cd ~[user-name]/Apache; tar xvfz apache-maven-3.5.0-bin.tar.gz
> c. ln -s ~[user-name]/Apache/apache-maven-3.5.0 \
>    ~[user-name]/Apache/maven
> d. edit .bash_profile (create if needed)
>    PATH=$PATH:$HOME/Apache/maven/bin
>    export PATH
>
> 3. Install Eclipse
>
> You're on your own here. It looks like Eclipse for the Macintosh is
> significantly different than Eclipse for Linux.
>
> 4. Install Eclipse Plugins
>
> You will use the Eclipse Marketplace plugin to install the following:
>
> a. JBoss tools (required for adding Tomcat 9 to Eclipse)
> b. Log Viewer (nice to have for viewing log files)
> c. Glassfish tools (nice to have for J2EE documentation)
>
> 5. Configuring Eclipse
>
> This is going to be really difficult to show without screen captures.
> However, I'll give it a shot.
>
> a. JVM - required if you use Maven
> 1. Navigate to Windows->Preferences->Java->Installed JREs
> 2. Click on the Add button
> 3. Select Standard VM and clieck the Next button
> 4. Click on the Directory button
> 5. Browse to the JRE included with the JDK
>    It will be underneath the JDK directory
> 6. Click the Finish button
> 7. Click the checkbox next to the new JRE (JDK) to make it the default
>
> b. External Maven - if you use Maven
> 1. Navigate to Windows->Maven->Installations
> 2. Click on the Add button
> 3. Leave the External radio button selected
> 4. Click on the Directory button
> 5. Browse to ~[user]/Apache/maven
> 6. Click on the Finish button
> 7. Click the checkbox next to the new Maven to make it the default
>
> c. Tomcat servers
> 1. In the bottom panel, select the Servers tab
> 2. Right-mouse click in the empty window (how is this done on a
>    Macintosh?)
> 3. Select New->Server from popup menu
> 4. Browse to Tomcat v9.0 Server in the Select the server type
> 5. Change the name (not necessary) to Tomcat v9.0.0.M22
> 6. Click the Next button
> 7. Click on the Browse button
> 8. Browse to ~[user]/Apache/
> 9. Select apache-tomcat-9.0.0.M22
> 10. Click OK
> 11. Click Finish
> 12. Repeat the above for each type of Tomcat server you want to install
>
> Part B - Notes
> ===============
>
> 1. Install Tomcat
>
> It's been my philosophy to never use a system Tomcat for development
> work. You will run into multiple permissions problems, including not
> being able to start / stop Tomcat easily, read log files, modify server
> configurations, or have it controlled by the IDE.
>
> If you have a system-wide Tomcat running on the default ports (8005,
> 8009, 8080), you'll have to change your locally installed Tomcat ports.
> It's different in Eclipse, using the standard server setup.
>
> Here's how you do this in Eclipse:
>
> a. In the bottom panel, select the Servers tab
> b. Select the server you wish to work on
> c. Hit F3 to open the server configuration
> d. Make sure that you are on the Overview tab
> e. Find the server ports on the right hand side
> f. Edit them
> g. Ctrl-S to save the configuration
> h. Close the file
>
> This by default edits server metadata and DOES NOT alter your Tomcat
> installation. In other words, if you launch Tomcat from the command line
> using startup.sh, it will still use the original ports.
>
> You have the option of allowing Eclipse to take control of your Tomcat
> installation, but I've always been a bit leery about that.
>
> 2. Install Maven
>
> This step wasn't necessary, but it's nice to use the latest version of
> Maven. The installation instructions above make it easy to upgrade and
> roll back your local copy of Maven.
>
> In my development environments (RedHat - based Linux) I make the Maven
> globally available. This is done by adding some paths to
> /etc/profile.d/custom.sh. I don't know how this is accomplished on the
> Macintosh.
>
> That being said, the Eclipse lifecycle and Maven lifecycle are not
> really compatible. Progress has been made to synchronize the two, but
> you'll still run into problems. In order to get around this, there are
> some m2e-lifecycle plugins available for doing the following:
>
> 1. handling the YUI Maven compressor plugin
> 2. handling annotations
> 3. handling the Maven dependency plugin (which we use at $work)
>
> Install 'em if ya need 'em.
>
> Part C - Using this Mess
> ========================
>
> 1. Maven Gotchas
>
> Eclipse and Maven really don't get along very well. It's gotten better
> over the years (thanks to the fine team of m2e developers).
>
> The challenge centers around different views of the development
> lifecycle. Occasionally Eclipse doesn't register what Maven has done to
> the workspace, so you'll need to occasionally refresh the workspace.
>
> a. Select the project that seems to be out of sync
> b. Hit F5
>
> This will reread the workspace and update Eclipse. It's especially
> necessary when you run a maven commend outside of the IDE.
>
> 2. Creating a new Maven Project
>
> a. File->New-Maven Project
>    1. You might not see Maven Project as an option
>    2. If not, select Other
>    3. Use the New Wizard and type maven in the text filter box
>    4. Select Maven Project
>    5. Click Next
> b. Click Next
> c. Leave the Use default  Workspace location checked for now
>    1. I usually store my projects in a separate directory
>    2. Makes them easier to access in multiple IDEs - a $work requirement
> d. Click the Next button
> e. You'll get a huge list of archetypes (read about those)
> f. Use the Filter and type webapp
> g. Scroll down and find the webapp-javaee7 archetype by codehaus
>    1. you can also choose the webapp-javaee6 archetype
>    2. or the webapp-jee5 archetype
> h. Click on the Next button
> i. Fill in the form
>    1. group id - I use org.mdeggers for personal, com.$work for
>       professional
>    2. artifact id - pick a name, maybe myhello
>    3. version - I really hate 0.0.1-SNAPSHOT - so I use 1.0.0-SNAPSHOT
>    4. SNAPSHOT is important - read about it on the Maven site
>    5. leave the default package as is for now
> j. Click the Finish button
>
> The resulting project will be flagged with an error due to the fact that
> no ${endorsed} directory is available (yah Eclipse!). To fix this, you
> follow the instructions found by mousing over the red circle with the
> white "X" in it:
>
> To whit: You may need to perform a maven command line build in order to
> create it.
>
> To do that:
>
> a. cd to the project (workspace/myhello)
> b. mvn package
> c. then refresh the project (F5)
>
> Unfortunately, this uses the Maven dependency plugin, which doesn't fit
> well with the Eclipse lifecycle. Even with the m2e lifecycle plugin for
> the Maven dependency plugin installed, I still get an error.
>
> You have two choices:
>
> a. Delete the endorsed stuff - OK if you're not using it
>    1. remove the dependency plugin from the plugins node
>    2. remove the compiler configuration from the compiler plugin
>    3. remove the property from the properties node
> b. Keep the endorsed stuff
>   1. needed if you use the endorsed mechanism
>   2. classes in the endorsed directory may not show up in the Eclipse
>      IDE
>
> BTW - this works fine with NetBeans.
>
> Finally, we can work with the project!!
>
> In src/main/webapp, there should be an index.html.
>
> a. double-click on it
> b. this should open in the editor
>
> If JBoss Tools works on the Macintosh like it does on Windows, you'll
> get two panes by default.
>
> a. source pane
> b. display pane
>
> You don't even have to run the server if this occurs. If not, we can
> then run it on the server by doing the following.
>
> a. Run as -> Run on Server
> b. Select Tomcat v9.0.0.M22
> c. Click Next
> d. Click Finish
>
> A "Hello World!" page should pop up as a separate tab in the Eclipse IDE.
>
> Addendum
> ========
>
> While the Tomcat log files are displayed in the console window at the
> bottom of the IDE, it won't display any application logging. Application
> logging is a good thing (we use commons-logging and log4j at $work), and
> you should do this for all application logging needs. It makes your
> system administrators (me) happy so that they don't have to sort
> application errors from Tomcat errors.
>
> This is where the Log Viewer plugin comes in handy. The tricky part of
> this is finding out where the logs are stored.
>
> When you set up Tomcat in Eclipse, you used the default setup which
> means that Eclipse does not take over the Tomcat installation. One of
> the downsides of that is finding the log files.
>
> The log files are found in:
>
> workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmpN/logs
>
> where N is a number reflecting on which server started up first. In this
> case, since you're only running 1 server, the location would be:
>
> workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/logs
>
> You can then use the Log Viewer to tail, search, and otherwise monitor
> your log files.
>
> Configuration for the Log viewer is found in
>
> Windows->Preferences->Log Viewer
>
> Hopefully this will get you started, and welcome to the wonderful, wacky
> world of Java web application development.
>
> . . . just my (longwinded) two cents
> /mde/
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to