RE: Servlet overridden by Apache Tomcat welcome page?

2016-07-03 Thread Caldarale, Charles R
> From: Mark Eggers [mailto:its_toas...@yahoo.com.INVALID] 
> Subject: Re: Servlet  overridden by Apache Tomcat welcome 
> page?

> I just played with Eclipse Neon (newest release). It does copy over a
> Tomcat configuration into your workspace, and then runs Tomcat from that
> (sort of like RUNNING.txt).

I thought there was some way to disable such obnoxiousness, but I don't 
remember the details.

> That being said, Eclipse does not handle ROOT well at all by default. If
> I tell Maven to have a final name of ROOT, then Eclipse edits the
> workspace server.xml with:
> 
> path="/ROOT"
>reloadable="true"
>source="org.eclipse.jst.jee.server:CSEFive"/>
> 

Clearly broken.  (Also, there is no  attribute of "source".)

> If I name things normally, then the application comes up as CSEFive, and
> the portion of server.xml reads as follows:
> 
> docBase="CSEFive"
>path="/CSEFive"
>reloadable="true"
>source="org.eclipse.jst.jee.server:CSEFive"/>
> 

Other than the source attribute, at least that's legal.

> The only way that I know of to manage this from within Eclipse is the
> following:

> Right-mouse click on the project, and go the the following in the drop
> down menu:

> Properties->Web Project Settings

> Change the Context root to /

Strictly speaking, this isn't correct; the default webapp must have an empty 
path string.

> Run your project from within Eclipse, and it will come up as
> http://localhost:8080/

That's an accident, since the path attribute is not valid.

> Eclipse will rewrite the server.xml in your workspace to:
> 
> docBase="CSEFive"
>path="/"
>reloadable="true"
>source="org.eclipse.jst.jee.server:CSEFive"/>
> 

The path attribute is illegal.  You would think after this number of years, 
Eclipse would at least get the syntax right.

> In any case, once you move out of an Eclipse-controlled Tomcat,

Which seems to be highly desirable, given the mess Eclipse is making.

> the WAR file needs to be named ROOT.war (case matters, even on Windows).

As Hassan previously noted.

> You'll need to move Tomcat's default ROOT web application to another
> location.

Or just delete it.

> In short, it's an Eclipse artifact.

A seriously broken artifact.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


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



Re: Servlet overridden by Apache Tomcat welcome page?

2016-07-03 Thread Mark Eggers
Paul and Chuck,
On 7/3/2016 4:14 PM, Caldarale, Charles R wrote:
>> From: Paul Roubekas [mailto:paul@orthogroup.holdings] Subject: Re:
>> Servlet  overridden by Apache Tomcat welcome
>> page?
> 
>> After making the above suggested changes the desired behavior goes 
>> away.  Now instead of my application's landing page I get the
>> tomcat welcome page.
> 
> You appear to have ignored what Hassan S said earlier in this thread;
> I'll repeat it here:
> 
> "Assuming a default installation, you should see the index.jsp page 
> associated with the *default context*, which in Tomcat is named ROOT
> (case sensitive).
> 
> "You need to move or delete the existing ROOT and rename your own WAR
> file (or directory) to ROOT."
> 
> I suspect you did not delete the existing ROOT directory.
> 
>> I am using Eclipse Mars.2  Is it possible I simply implemented the
>> suggestions incorrectly?  Below is what eclipse did to the
>> server.xml file.
> 
>> > path="/ROOT##000" reloadable="true" 
>> source="org.eclipse.jst.jee.server:ROOT##000">
> 
> I'm not an Eclipse user, but any IDE that blindly updates
> configuration files without your explicit permission sounds extremely
> dangerous.  Others may have suggestions about how to stop such bad
> behavior.  You really, really do not want to put any 
> elements in server.xml.
> 
> - Chuck

I just played with Eclipse Neon (newest release). It does copy over a
Tomcat configuration into your workspace, and then runs Tomcat from that
(sort of like RUNNING.txt).

That being said, Eclipse does not handle ROOT well at all by default. If
I tell Maven to have a final name of ROOT, then Eclipse edits the
workspace server.xml with:





CSEFive is my actual application.

If I name things normally, then the application comes up as CSEFive, and
the portion of server.xml reads as follows:





The only way that I know of to manage this from within Eclipse is the
following:

Right-mouse click on the project, and go the the following in the drop
down menu:

Properties->Web Project Settings

Change the Context root to /

Run your project from within Eclipse, and it will come up as
http://localhost:8080/

Eclipse will rewrite the server.xml in your workspace to:





In any case, once you move out of an Eclipse-controlled Tomcat, the WAR
file needs to be named ROOT.war (case matters, even on Windows).

You'll need to move Tomcat's default ROOT web application to another
location.

In short, it's an Eclipse artifact.

. . . just my two cents
/mde/



signature.asc
Description: OpenPGP digital signature


RE: Servlet overridden by Apache Tomcat welcome page?

2016-07-03 Thread Caldarale, Charles R
> From: Paul Roubekas [mailto:paul@orthogroup.holdings] 
> Subject: Re: Servlet  overridden by Apache Tomcat welcome 
> page?

> After making the above suggested changes the desired behavior goes
> away.  Now instead of my application's landing page I get the tomcat
> welcome page.

You appear to have ignored what Hassan S said earlier in this thread; I'll 
repeat it here:

"Assuming a default installation, you should see the index.jsp page
associated with the *default context*, which in Tomcat is named
ROOT (case sensitive).

"You need to move or delete the existing ROOT and rename your
own WAR file (or directory) to ROOT."

I suspect you did not delete the existing ROOT directory.

> I am using Eclipse Mars.2  Is it possible I simply
> implemented the suggestions incorrectly?  Below is what eclipse did to
> the server.xml file.

>  path="/ROOT##000" reloadable="true"
> source="org.eclipse.jst.jee.server:ROOT##000">

I'm not an Eclipse user, but any IDE that blindly updates configuration files 
without your explicit permission sounds extremely dangerous.  Others may have 
suggestions about how to stop such bad behavior.  You really, really do not 
want to put any  elements in server.xml.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


-- 
The people that bring you Usque <http://Usque.software/>.

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



Re: Servlet overridden by Apache Tomcat welcome page?

2016-07-03 Thread Paul Roubekas
On 7/3/2016 5:21 PM, Paul Roubekas wrote:
> On 7/3/2016 4:41 PM, Mark Thomas wrote:
>> On 03/07/2016 18:37, Paul Roubekas wrote:
>>
>>> Changes that need to be made to the server.xml file
>>> The below list of changes are for the conf/server.xml file.  A new XML
>>> element needs to be added to the  XML stanza.
>>> Within the  element stands a  element needs to be added. 
>>> The path= attribute for the  element needs to be blank. 
>>> The docbase= attribute needs to be equal to the .WAR file root
>>> directory.  In this example Abc_Website03.  I'm not sure
>>> the debug= attribute needs to be in the context element.  But I wasn't
>>> going to spend time testing it.  I am also not sure
>>> if the reloadable= attribute is required. But once again in the interest
>>> of saving time it was not tested with the reloadable= attribute removed.
>>> .
>>> .
>>> .
>>>  >> unpackWARs="true" autoDeploy="true">
>>>
>>> >> reloadable="true">
>> That is very bad advice. It will result in double deployment of that web
>> application.
>>
>> If you want to deploy a web application as the default web application,
>> name it ROOT.war (ROOT if a directory) as per the docs. [1]
>>
>> If you want to retain some version identified in the name, use a Context
>> Version, e.g. ROOT##my-version-string.war
>>
>> Mark
>>
>>
>> [1] http://tomcat.apache.org/tomcat-9.0-doc/config/context.html#Naming
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
> Thank you very much for the correction Mark.  I will change my
> implementation and notes.  I did not run across the link you gave me
> during my research.
>
>
After making the above suggested changes the desired behavior goes
away.  Now instead of my application's landing page I get the tomcat
welcome page. I am using Eclipse Mars.2  Is it possible I simply
implemented the suggestions incorrectly?  Below is what eclipse did to
the server.xml file.

  


-- 
The people that bring you Usque .


Re: Servlet overridden by Apache Tomcat welcome page?

2016-07-03 Thread Paul Roubekas
On 7/3/2016 4:41 PM, Mark Thomas wrote:
> On 03/07/2016 18:37, Paul Roubekas wrote:
>
>> Changes that need to be made to the server.xml file
>> The below list of changes are for the conf/server.xml file.  A new XML
>> element needs to be added to the  XML stanza.
>> Within the  element stands a  element needs to be added. 
>> The path= attribute for the  element needs to be blank. 
>> The docbase= attribute needs to be equal to the .WAR file root
>> directory.  In this example Abc_Website03.  I'm not sure
>> the debug= attribute needs to be in the context element.  But I wasn't
>> going to spend time testing it.  I am also not sure
>> if the reloadable= attribute is required. But once again in the interest
>> of saving time it was not tested with the reloadable= attribute removed.
>> .
>> .
>> .
>>  > unpackWARs="true" autoDeploy="true">
>>
>> > reloadable="true">
> That is very bad advice. It will result in double deployment of that web
> application.
>
> If you want to deploy a web application as the default web application,
> name it ROOT.war (ROOT if a directory) as per the docs. [1]
>
> If you want to retain some version identified in the name, use a Context
> Version, e.g. ROOT##my-version-string.war
>
> Mark
>
>
> [1] http://tomcat.apache.org/tomcat-9.0-doc/config/context.html#Naming
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
Thank you very much for the correction Mark.  I will change my
implementation and notes.  I did not run across the link you gave me
during my research.


-- 
The people that bring you Usque .


Re: Servlet overridden by Apache Tomcat welcome page?

2016-07-03 Thread Mark Thomas
On 03/07/2016 18:37, Paul Roubekas wrote:

> Changes that need to be made to the server.xml file
> The below list of changes are for the conf/server.xml file.  A new XML
> element needs to be added to the  XML stanza.
> Within the  element stands a  element needs to be added. 
> The path= attribute for the  element needs to be blank. 
> The docbase= attribute needs to be equal to the .WAR file root
> directory.  In this example Abc_Website03.  I'm not sure
> the debug= attribute needs to be in the context element.  But I wasn't
> going to spend time testing it.  I am also not sure
> if the reloadable= attribute is required. But once again in the interest
> of saving time it was not tested with the reloadable= attribute removed.
> .
> .
> .
>   unpackWARs="true" autoDeploy="true">
> 
>  reloadable="true">

That is very bad advice. It will result in double deployment of that web
application.

If you want to deploy a web application as the default web application,
name it ROOT.war (ROOT if a directory) as per the docs. [1]

If you want to retain some version identified in the name, use a Context
Version, e.g. ROOT##my-version-string.war

Mark


[1] http://tomcat.apache.org/tomcat-9.0-doc/config/context.html#Naming

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



Re: Servlet overridden by Apache Tomcat welcome page?

2016-07-03 Thread Paul Roubekas
On 7/2/2016 4:24 PM, Paul Roubekas wrote:
> Servlet  overridden by Apache Tomcat welcome page?
>
>  
>
> Not sure I am using the proper name for what I am calling the "Apache
> Tomcat welcome page".  What I am calling the "Apache Tomcat welcome
> page" is the page that comes up when http://localhost:8080 is entered as
> the address on an internet browser.
>
>  
>
> Windows 7 (development workstation)
>
> Fedora 23 (web server)
>
> Apache Tomcat 7.0.68
>
> Apache TomEE 1.7.4
>
> Eclipse Mars 2 (4.5.2)
>
>  
>
> I have a single instance of Tomcat.  CATALINA_BASE is not used, just
> CATALINA_HOME.  The WEB-INF/web.xml has been configured as follows.
>
>  
>
> 
>
> http://www.w3.org/2001/XMLSchema-instance;
> xmlns="http://java.sun.com/xml/ns/javaee;
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd; id="WebApp_ID"
> version="3.0">
>
>  
>
> 
>
> 
>
> 
>
> Abc
>
> 
>
>The web site for Abc software
>
> 
>
>  
>
> 
>
> 
>
> 
>
> 
>
>HomeServlet
>
>software.Abc.website.HomeServlet
>
>1
>
>  
>
>  
>
> 
>
>  
>
>HomeServlet
>
>/AbcLandingPage
>
>  
>
>  
>
>  
>
>  
>
>  Protect Donation page
>
>  /DonateServlet
>
>  GET
>
>  POST   
>
>  
>
>  
>
>  CONFIDENTIAL
>
>  
>
>   
>
>  
>
>
>
> 
>
> 
>
> 
>
>  
>
> 
>
> 
>
> 
>
> 
>
> AbcLandingPage
>
> index.html
>
> index.htm
>
> index.jsp
>
> 
>
> 
>
>  
>
> As per these instructions
> (http://wiki.metawerx.net/wiki/HowToUseAServletAsYourMainWebPage) this
> configuration should result in the HomeServlet being the first page
> rendered when the URL http://myDomain.com is entered as the destination
> address in an internet browser.  But these instructions are generic for
> the Java Servlet 2.4 specification.  In this
> (http://wiki.apache.org/tomcat/HowTo#How_do_I_override_the_default_home_page_loaded_by_Tomcat.3F)FAQ
> for Tomcat it is suggest that meta tag refresh be used.  It seems the
> Tomcat meta tag refresh instruction were written before the Java Servlet
> 2.4 specification was written because other research
> (https://en.wikipedia.org/wiki/Meta_refresh) points out that the use of
> the meta tag refresh method is gone out of use because it can prevent
> the end user from being able to use the back button successfully and it
> is considered as one of the Un-ethical SEO process by the Search
> Engines.  The current version of the Java Servlet Specification is 3.0.
> (https://jcp.org/aboutJava/communityprocess/final/jsr315/index.html). 
>
>  
>
> Question 1) Is my assumption correct that the reason my web.xml is not
> working is because the Tomcat/Tomee welcome page is specified in such a
> way that it takes precedence over the web.xml settings in my websites
> .WAR file?
>
>  
>
> Question 2) Is there a way to have my .WAR file WEB-INF/web.xml take
> precedence over the Tomcat welcome page without uninstalling the Tomcat
> welcome page?

*For the sake of people who may search the forum archives, the answer is
provided below.*

There are changes that need to be made to the web.xml file and to the
server.xml file for this to work.

Changes that need to be made to the web.xml file.
The below list of changes are for the WEB-INF/web.xml file not the
server level conf/web.xml file.  A prerequisite is that the 
and  are in the  XML stanza.  The
 XML element is not required for the task at hand.  It
was added
so the first user, after a tomee restart, did not experience poor
performance.

   HomeServlet
   software.abc.website.HomeServlet
   1
 

A  XML stanza needs to be made also.  The
 in this  stanza must agree with the
 in the  stanza. The  does not need
to match the .  The  tag must
match the  tag in the  stanza.

 
   HomeServlet
   /AbcLandingPage
 

A  stanza must also be added.  The 
entries are processed in the order listed.  The value for the
 must match the value for the  in the
 stanza earlier in the configuration file. In
this example the value is AbcLandingPage.


AbcLandingPage
index.html
index.htm
index.jsp


A complete web.xml file is listed below.

http://www.w3.org/2001/XMLSchema-instance;
xmlns="http://java.sun.com/xml/ns/javaee;
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd; id="WebApp_ID"
version="3.0">




Abc

   The web site for Abc software






   HomeServlet
   software.abc.website.HomeServlet
   1
 


 
   HomeServlet
   /AbcLandingPage
 

 
 
 Protect Donation page
 

Re: Servlet overridden by Apache Tomcat welcome page?

2016-07-03 Thread Hassan Schroeder
On Sat, Jul 2, 2016 at 1:24 PM, Paul Roubekas  wrote:

> What I am calling the "Apache Tomcat welcome
> page" is the page that comes up when http://localhost:8080 is entered as
> the address on an internet browser.

Assuming a default installation, you should see the index.jsp page
associated with the *default context*, which in Tomcat is named
ROOT (case sensitive).

You need to move or delete the existing ROOT and rename your
own WAR file (or directory) to ROOT.

HTH,
-- 
Hassan Schroeder  hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Consulting Availability : Silicon Valley or remote

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