.lock file detected. Repository was not shut down properly.

1,274 views
Skip to first unread message

b.leunis

unread,
Jan 13, 2014, 6:03:24 AM1/13/14
to hippo-c...@googlegroups.com
Hi Hippos,

During local development, after a restart with the same repository, I always get this warning in the tomcat log:

WARN  main [RepositoryLock.acquire:134] Existing lock file C:\workspaces\myhippoproject\target\storage\.lock detected. Repository was not shut down properly.

You see I run the project on Windows. When using CTRL-C in the command window tomcat is shut down in such a way that the .lock file in the storage folder is not removed. It is not blocking the restart, so there is no major problem. But does anyone know a way to do a proper shutdown that removes the .lock file?

Thanks,
Bert

Wouter Danes

unread,
Jan 13, 2014, 6:28:33 AM1/13/14
to hippo-c...@googlegroups.com
AFAIK there’s a tomcat tool to send it a “SIGTERM” or something. That’ll probably do a proper shutdown.
The real problem is of course the whole “running under Windows” part… :-p j/k

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
Most Hippo developers are active here and/or follow the Stackoverflow [hippo-cms] tag.
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/groups/opt_out.

Jasper Floor

unread,
Jan 13, 2014, 7:41:36 AM1/13/14
to hippo-c...@googlegroups.com

Regular tomcat distributions come with shutdown script.  This can be reached via a port or via the JVM. I don't know if the shutdown port is disabled in the cargo profile. I also don't think we include an application to talk to the tomcat server, but again not sure. As you say, it isn't really a problem, but there should be a proper way to do this. We could add a dashboard command to shutdown the server, or perhaps a separate app which only operations is allowed to access.

mvg,
Jasper

Robert de Vries

unread,
Jan 13, 2014, 8:18:43 AM1/13/14
to hippo-c...@googlegroups.com
The shutdown script is located under target\cargo\installs\apache-tomcat-6.0-latest\apache-tomcat-6.0.37\bin. Your version of tomcat may differ. If you run it, you get the exception "java.net.ConnectException: Connection refused: connect". It seems to me that the shutdown port is disabled in the cargo profile.

Kind regards,
Robert de Vries

Van: hippo-c...@googlegroups.com [hippo-c...@googlegroups.com] namens Jasper Floor [j.f...@onehippo.com]
Verzonden: maandag 13 januari 2014 13:41
To: hippo-c...@googlegroups.com
Onderwerp: Re: [hippo-community] .lock file detected. Repository was not shut down properly.

Olivier Bourgeois

unread,
Jan 13, 2014, 8:26:44 AM1/13/14
to hippo-c...@googlegroups.com
There is a shutdown task in the Cargo Maven plugin:  cargo:stop 
But since the cargo:run task is launched in a profile, that would require to change the POMs to use cargo:run and cargo:stop. But doing so I guess that you won't have the Tomcat logs on the command prompt anymore.

OTOH, I have never really bothered about this .lock file not removed as it seems to be innocuous. 

Jasper Floor

unread,
Jan 13, 2014, 8:29:53 AM1/13/14
to hippo-c...@googlegroups.com
On Mon, Jan 13, 2014 at 2:18 PM, Robert de Vries <Robert....@hinttech.com> wrote:
The shutdown script is located under target\cargo\installs\apache-tomcat-6.0-latest\apache-tomcat-6.0.37\bin. Your version of tomcat may differ. If you run it, you get the exception "java.net.ConnectException: Connection refused: connect". It seems to me that the shutdown port is disabled in the cargo profile.\\

Which I would've found if I used find instead of my deficient brain. Looking there I also see commons-daemon. Which would start tomcat as a daemon or service, if used.

Using my brain a bit less and google a bit more teaches me that cargo actually has a stop command "cargo:stop".

mvg,
Jasper

Olivier Bourgeois

unread,
Jan 13, 2014, 8:30:11 AM1/13/14
to hippo-c...@googlegroups.com
On Mon, Jan 13, 2014 at 2:18 PM, Robert de Vries <Robert....@hinttech.com> wrote:
The shutdown script is located under target\cargo\installs\apache-tomcat-6.0-latest\apache-tomcat-6.0.37\bin. Your version of tomcat may differ. If you run it, you get the exception "java.net.ConnectException: Connection refused: connect". It seems to me that the shutdown port is disabled in the cargo profile.

Kind regards,
Robert de Vries

I think it is here: you can telnet 8009 which is the default Tomcat AJP port  (we could even send the signal like that if it was a text protocol).

Jasper Floor

unread,
Jan 13, 2014, 8:50:24 AM1/13/14
to hippo-c...@googlegroups.com
On Mon, Jan 13, 2014 at 2:30 PM, Olivier Bourgeois <o.bou...@onehippo.com> wrote:
On Mon, Jan 13, 2014 at 2:18 PM, Robert de Vries <Robert....@hinttech.com> wrote:
The shutdown script is located under target\cargo\installs\apache-tomcat-6.0-latest\apache-tomcat-6.0.37\bin. Your version of tomcat may differ. If you run it, you get the exception "java.net.ConnectException: Connection refused: connect". It seems to me that the shutdown port is disabled in the cargo profile.

I think it is here: you can telnet 8009 which is the default Tomcat AJP port  (we could even send the signal like that if it was a text protocol).


The shutdown port is different from the AJP port.
In ".../cargo/installs/apache-tomcat-7.0.47/apache-tomcat-7.0.47/conf/server.xml" :
<Server port="8005" shutdown="SHUTDOWN">

So the shutdown port is 8005 and the command is SHUTDOWN and it is a string according to the docs.

mvg,
Jasper

Olivier Bourgeois

unread,
Jan 13, 2014, 10:11:40 AM1/13/14
to hippo-c...@googlegroups.com

Oh I see. Then I don’t know how to activate this with Cargo, but for sure the port is not opened on my machine.

Anyway I thought of another way to do it: use the JMX management beans of Tomcat. Just add this to the Cargo profile:

               <systemProperties>
                  <java.rmi.server.hostname>127.0.0.1</java.rmi.server.hostname>
                  <com.sun.management.jmxremote.port>8888</com.sun.management.jmxremote.port>
                  <com.sun.management.jmxremote.ssl>false</com.sun.management.jmxremote.ssl>
                  <com.sun.management.jmxremote.authenticate>false</com.sun.management.jmxremote.authenticate>
                </systemProperties>

I tried with the jconsole and it worked fine: if you call stop() on the Server bean the .lock file disappears. There’s just one catch: you still have to hit CTRL-C :)

This Groovy script will stop the server without leaving a .lock file:

import javax.management.remote.JMXConnectorFactory as JmxFactory
import javax.management.remote.JMXServiceURL as JmxUrl

def serverUrl = 'service:jmx:rmi:///jndi/rmi://localhost:8888/jmxrmi'
def server = JmxFactory.connect(new JmxUrl(serverUrl)).MBeanServerConnection
def serverInfo = new GroovyMBean(server, 'Catalina:type=Server').serverInfo
println "Connected to: $serverInfo"

def engine = new GroovyMBean(server, 'Catalina:type=Engine')
println "Stopping Tomcat..." + engine.stop()

And I don’t have the warning anymore. Now I just need to find a way to stop the Cargo script as well.

Bert Leunis

unread,
Jan 15, 2014, 1:11:23 PM1/15/14
to hippo-c...@googlegroups.com
Thanks all for sharing your insights. So there is no straightforward way to stop the web app, tomcat and cargo in one go, and prevent the warning at a restart. Not really a problem (as stated), but good to know more about the details now.


With kind regards/Met vriendelijke groet,
Bert Leunis

Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 101 Main Street, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
Reply all
Reply to author
Forward
0 new messages