tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Eggers <its_toas...@yahoo.com>
Subject Re: Tomcat deployment webapps and the whole stew
Date Thu, 27 Jun 2013 20:37:24 GMT
Comments in line:

On 6/27/2013 1:07 PM, Narahari 'n' Savitha wrote:
> Thank You for your answers and your valid critique (aka rants)
>
>> In your document, you failed to mention Tomcat version, JRE version, or OS
>> version. I'm going to assume that from the following path
>>
>> /opt/narahari/paas/webapps
>>
>> that you're running on some sort of Linux / UNIX / MacOS (ie, not Windows).
>>
>
> Yes to the above sentence, I am on SLES 11.2

Thanks for the information - this helps.
>
>>
>> I'm going to further assume that you're running a version of Tomcat
>> downloaded from tomcat.apache.org (probably a bad assumption), and that
>> you're running some variant of Tomcat 7 (probably a less bad assumption).
>>
>
> Yes apache-tomcat-7.0.37 from tomcat.apache.org for the above sentence.

Great - although upgrading to 7.0.41 is probably a good idea. I 
understand from below that you're not in charge of running the Tomcat 
server, so that will have to be left up to the powers that be.

>
>>
>> For those people who didn't read the linked document:
>>
>> Here's what you tried:
>>
>> <Context docBase="/opt/adp/paas/**webapps/ptl"
>>           antiResourceLocking="false" />
>>
>> <Context docBase="/opt/adp/paas/**webapps/ptl#cts"
>>           antiResourceLocking="false" />
>>
>> And your complaint is:
>>
>> sh$>/opt/narahari/paas/adp-**tomcat/work/Catalina/**localhost/ptl_cts
>>      /WEB-INF> ll
>> total 8
>> drwxr-x--- 4 virtual wheel 4096 2013-06-27 14:01 classes
>> drwxr-x--- 2 virtual wheel 4096 2013-06-27 14:01 lib
>>
>> None of the other stuff is getting unpacked.
>>
>> 1. Why are you looking in the WORK folder?
>>
>
> For the above question, I really dont know why but colleague said that wars
> are unarchived there.  So I presume from your answer it is of no value to
> look there.

This is correct.

>
> 2. Why are you using such a convoluted way of deploying your apps?
>>
>
> Not really convoluted, we want to put our wars outside of tomcat's inbuilt
> webapps dir (another team owns and installs tomcat and not as root)
>
>

This is certainly one way of managing your deployments. It does have the 
advantage of making Tomcat upgrades easier.

It has the disadvantage of making your deployments platform-specific. 
This of course will be a pain for developers, source code control, and 
continuous integration.

You might want to bring up the possibility of using CATALINA_BASE and 
CATALINA_HOME. Read the RUNNING.txt file in the base directory of your 
Tomcat installation. We use one CATALINA_HOME to support multiple 
CATALINA_BASE installations. Updating is easier, and we use ant scripts 
to crank out new service installations (takes about 2 seconds). I spend 
more time writing out the properties files and documenting than I do 
adding a new Tomcat platform and service.

You could then use the manager application or ant tasks to deploy to the 
standard appBase, easing life for developers, source code control, and 
continuous integration (as well as administrators).

>> 3. Are you running your Tomcat as root? (don't do this)
>>
>
> For the above question , no it is not run as root.

OK, I saw 'wheel' and got a little bit concerned. It is in general a bad 
practice to run services from a privileged account.

>
>
>>  From the fine Tomcat documentation
>>
>> http://tomcat.apache.org/**tomcat-7.0-doc/config/host.**html<http://tomcat.apache.org/tomcat-7.0-doc/config/host.html>
>> http://tomcat.apache.org/**tomcat-7.0-doc/config/context.**html<http://tomcat.apache.org/tomcat-7.0-doc/config/context.html>
>>
>> there are two things to note.
>>
>> 1. docBase is only valid if it points to a location outside of the
>>     Host's appBase
>>
>
> For the above, are you saying that docBase should point to folder other
> than <Host> element's app base location (in my case it is appBase="webapps"
> ) and my docBase=/opt/narahari/paas/webapps which is outside of
> CATALINA_BASE and CATALINA_HOME folders.
>
>>
>> Failure to do so will result in partial deployments, double deployments,
>> and all sorts of unpleasantness. I haven't actually tried breaking the
>> rules, so I don't know exactly what happens.
>>
>> 2. WAR files outside of appBase are not exploded
>>
>> This was changed in Tomcat 7 (see the following -
>> http://tomcat.apache.org/**migration-7.html#Deployment<http://tomcat.apache.org/migration-7.html#Deployment>
>> )
>>
>> In short, the docBase must point to either the WAR file or an exploded
>> directory.
>>
>> Again, if a docBase is used, it must point to a location outside of the
>> Host's appBase. If it points to a directory, the web application must be
>> exploded. Otherwise, it must point to a WAR file, and the application will
>> be run from that WAR file.
>>
>> For the above point, I put the artifact as a WAR file in the
> /opt/narahari/paas/webapps folder but when tomcat starts and tries to to
> run from the ptl#cts.war, I see the following error.  Our app is trying to
> read WEB-INF/faces-config.xml (JSF app) but error occurs as below.
>
> 16:04:22,878 INFO  [ConfigServlet] com.alp.rev.config.ConfigServlet.init():
> Entering.
> 16:04:22,878 INFO  [ConfigServlet] com.alp.rev.config.ConfigServlet.init():
> FILEINPUTSTREAM VERSION 1.0
> 16:04:22,878 INFO  [ConfigServlet]
> com.alp.rev.config.ConfigServlet.init(): configFiles
> = [/WEB-INF/faces-config.xml]
> 16:04:22,878 INFO  [ConfigServlet] com.alp.rev.config.ConfigServlet.init():
> Full path to Faces configuration file [null]
> 16:04:22,878 ERROR [ConfigServlet] com.alp.rev.config.ConfigServlet.init():
> Error trying to read file [null]. Exception =
> [java.lang.NullPointerException]
> java.lang.NullPointerException
>          at java.io.FileInputStream.<init>(FileInputStream.java:116)
>          at java.io.FileInputStream.<init>(FileInputStream.java:79)
>          at com.adp.revit.config.ConfigServlet.init(ConfigServlet.java:59)
>          at
> org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
>          at
> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
>          at
> org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
>
> Thank you for your help and suggestions on incomplet information when I
> posted.
>
> -Narahari
>
> PS: On the other hand, if I manually expand ptl#cts.war manually and then
> point to expanded folder in the docBase attribute, I dont see exceptions.
>   Just a point for  your reference
>

Exactly. I probably didn't state things quite as clearly as I could.

In your $CATALINA_HOME/conf/Catalina/localhost/ptl.xml file, try putting 
in the following to see what happens:

<Context docBase="/opt/adp/paas/webapps/ptl.war"
          antiResourceLocking="false" />

In $CATALINA_HOME/conf/Catalina/localhost/ptl#ctx.xml, try putting in 
the following to see what happens:

<Context docBase="/opt/adp/paas/webapps/ptl#cts.war"
          antiResourceLocking="false" />

Hopefully everything will run, but again you won't see an exploded 
directory.

As an aside, antiResourceLocking is normally only needed on a Windows 
platform when resources are not released cleanly. I've not seen this 
needed on Linux platforms.

. . . just my two cents
/mde/

PS - And thanks for adding the information!

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


Mime
View raw message