I'd be really remiss if I didn't provide the obligatory note regarding <Context ... /> elements in server.xml. It's posted frequently on the tomcat-user list as a result of people suggesting exactly the kind of stuff posted below.

Please do not place <Context ... /> elements in server.xml. The problem is it locks you into restarting your server and downing all your other webapps every time you want to add/remove/edit a webapp context. It's far better to provide a context xml file named in one or two places:


1) A file literally named context.xml in the META-INF folder of the magnolia webapp. If doing this, don't specify a path or docBase attribute. This is limited to deploying magnolia in tomcat's webapps directory. Both path and docBase will be assumed to be the webapp's folder name in tomcat's webapps folder.


2) A context xml file named after magnolia's context path (and I'll use the first <Host ...>...</Host> element below for my example) in tomcat's conf/[engine name]/[host name] folder. In the case of the server.xml file below, the context xml file would be named ROOT.xml and placed in conf/Catalina/www.xyz.com. ROOT (all caps required) is the special name of the default webapp -- the one that accepts any request not matching any other webapp's context path. If you change the name attribute in a <Host> element, the folder you put your context xml file will have to follow


Either 1 or 2 above allows you to stop, unload, make alterations, whatever to a specific webapp without having to bounce the tomcat server and disrupting any/all the other webapps running on that tomcat instance. Just go into the manager webapp, stop the webapp, make any alterations you need -- update jars, etc., ... and then start the webapp again in the manager webapp.


--David


Deepak Mittal wrote:
I was also getting the same problem as described by Charles and Ganesh -
the same web-app was being deployed twice. I did the following steps to stop this from happening -
1. I removed the default host from server.xml by removing the following
lines


    <Host name="localhost" appBase="webapps"
        unpackWARs="true" autoDeploy="true"
        xmlValidation="false" xmlNamespaceAware="false">
    </Host>

2. I moved the WAR file from the default location in tomcat ("webapps"
folder) to a different location; and added the WAR file explicitly in
server.xml.

      <Host name="www.xyz.com"
        appBase="/opt/servers/tomcat5.5/webappsPublic"
        unpackWARs="true"
        autoDeploy="false"
        xmlValidation="false"
        xmlNamespaceAware="false"
        debug="0"
        reloable="false">
        <Alias>
            www.xyz.com
        </Alias>
        <Context path=""
            docBase="magnoliaPublic"
            reloadable="false"
            swallowOutput="false"
            debug="0"
        />
    </Host>

      <Host name="author.xyz.com"
        appBase="/opt/servers/tomcat5.5/webappsAuthor"
        unpackWARs="true"
        autoDeploy="false"
        xmlValidation="false"
        xmlNamespaceAware="false"
        debug="0"
        reloable="false">
        <Alias>
            author.xyz.com
        </Alias>
        <Context path=""
            docBase="magnoliaAuthor"
            reloadable="false"
            swallowOutput="false"
            debug="0"
        />
    </Host>


By doing the above-mentioned steps, I was able to get rid of the problem
caused by twice deployment and I was also able to have author and public
on the same machine.

Let me know if you need any further details.

Cheers!

-Deepak Mittal
http://www.IntelliGrape.com




On Wed, 2008-03-12 at 09:36 +0530, Ganesh Gembali wrote:
Hi Charles,
Are you using Tomcat as application server. If so , what David said is the cause of lock error. This is because , If you have a look at your server.xml and catlina.out log you can see your application getting deployed twice. I have faced the same problem. Then I have removed some default stuff in server.xml and it started working fine for me.

Please let me know if you need any other information.

Regards,
Ganesh.

Charles Johnson wrote:
Well thanks David, but I can assure you that I only installed one Magnolia ;-) There *was* Jackrabbit (which worked fine) but I got rid of it to prevent confusion.

Oh and once I accessed the repository from a Java app, but then that was some time back


Charles

David Smith wrote:
Ok ... deeper look at the log suggests you have two Magnolia instances attempting to access the same repository. Maybe you've inadvertently attempted to map the same webapp to two separate contexts which would create this sort of double launch.


--David


Charles Johnson wrote:
Thanks David.

I suspect that Magnolia is trying to create the lock file more than once, since I delete the lock file and then restart Tomcat. No change. Plain Jackrabbit doesn't seem to have any problems.

Charles

David Smith wrote:
.lock file errors typically show up when tomcat is shutdown badly because of a JVM crash, server crash, or tomcat was forcefully closed w/ a kill command. If the last successful run of tomcat died badly, just delete the .lock files and start tomcat. Things will come back to life normally.

--David

Charles Johnson wrote:
I'm using Debian Etch, Tomcat 6 and magnolia-bundled-webapp-3.5.4

I can't start the app since there seems to be an issue with a lock file in the repository directory. I googled on the error string, and although it seems to be a known issue, I couldn't see a clear solution. How can I correct this?

Please see the server log file at http://www.cehjohnson.btinternet.co.uk/misc/catalina.out

Charles

----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------


----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------

Reply via email to