2

During fast prototyping I don’t care about consistency and safety of the database (I use only test files). However, I would like to know the best practices for later use. At the moment, I can’t figure out how to stop eXist with the bin/shutdown.sh script if the app does not run on http://localhost:8080.

I was able to set another port for Jetty and it works. Of course, I start the app with bin/startup.sh. However, if I try to stop Jetty + eXist with bin/shutdown.sh, I got this error:

ERROR: HTTP server returned unexpected status: Origin http://localhost:8080 is not configured, perhaps you wanted http://[my IP]:8080
CAUSE: HTTP server returned unexpected status: Origin http://localhost:8080 is not configured, perhaps you wanted http://[my IP]:8080

I have tried to install the wrapper and eXist really runs since the system startup but I still can’t stop it safely (I can only kill it).

My app runs on port 8081, Ubuntu 14.04 machine.

UPDATE

If I run the app inside a screen session, than quit the session and use bin/shutdown.sh, it logs:

/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Xms128m -Xmx512m -Dfile.encoding=UTF-8 -Djava.endorsed.dirs=/home/honza/eXist-db/lib/endorsed -Dexist.home=/home/honza/eXist-db -jar /home/honza/eXist-db/start.jar shutdown
ERROR: HTTP server returned unexpected status: Not Found
CAUSE: HTTP server returned unexpected status: Not Found

If I use: java -jar start.jar shutdown --uri=xmldb:exist://[my IP]:8081/xmlrpc, it logs:

/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Xms128m -Xmx512m -Dfile.encoding=UTF-8 -Djava.endorsed.dirs=/home/honza/eXist-db/lib/endorsed -Dexist.home=/home/honza/eXist-db -jar /home/honza/eXist-db/start.jar shutdown
ERROR: HTTP server returned unexpected status: Not Found
CAUSE: HTTP server returned unexpected status: Not Found

If is use the wrapper method, which means eXist starts during the server startup and runs on the background, and use bin/shutdown.sh, it still logs the same.

If is use the wrapper method and try to shutdown the app with sudo java -jar start.jar shutdown --uri=xmldb:exist://[my IP]:8081/xmlrpc, it still logs the same. If I don’t use the static IP and use localhost instead, it still logs the same.

The only one working method is for me ctrl-c, according to @joewiz.

Honza Hejzl
  • 874
  • 8
  • 23
  • It looks like you do not have access to the remote-server on port 8080 via XML-RPC, or that you are actually accessing the wrong remote-server – adamretter Apr 11 '16 at 04:01
  • The problem could be I am running it on a virtual machine, which means it runs on a static IP instead of `localhost` (any app running there has to be configured to use the IP). And I am running it on port 8081, if that matters. – Honza Hejzl Apr 11 '16 at 07:29
  • I have updated the question with additional information, if that could help. Thanks! – Honza Hejzl Apr 11 '16 at 07:43
  • 2
    So, if you want to use a different hostname/ip and/or port number for the remote server, you should edit the client.properties file, and make the changes in there, this will be used by the shutdown.sh command. – adamretter Apr 11 '16 at 21:37
  • So close! It seems it works. The only one problem is when eXist starts during the server’s startup, `sudo bin/shutdown.sh` throws `ERROR: HTTP server returned unexpected status: Unauthorized \\ CAUSE: HTTP server returned unexpected status: Unauthorized`. I think it is the most reasonable scenario (to run it on startup and if needed, to terminate it safely). – Honza Hejzl Apr 12 '16 at 07:10
  • You need to pass the password as an argument to the shutdown script. e.g. `bin/shutdown.sh -p your-admin-password` – adamretter Apr 13 '16 at 16:03

1 Answers1

4

See "Shutting Down the Database" at http://exist-db.org/exist/apps/doc/deployment.xml#D2.2.5.8 for specifying a port:

java -jar start.jar shutdown --uri=xmldb:exist://localhost:8081/xmlrpc

Alternatively, use ctrl-c to stop the bin/startup.sh process.

Joe Wicentowski
  • 5,159
  • 16
  • 26
  • Thanks, actually, I was using the `ctrl-c` method but was convinced it is not safety and could corrupt the database. Yes, I checked the Documentation but it did not helped :) – Honza Hejzl Apr 06 '16 at 13:11
  • Sorry, do you mean the `java... shutdown` command suggestion did not shut down the database? – Joe Wicentowski Apr 07 '16 at 17:39
  • It is a bit complex thing. This command is useful if eXist runs on the background. At the moment, I can't remember what was the problem, I only know it did not stop the whole app smoothly (I was trying to start it via wrapper on startup). For me, it is fine to run eXist within a terminal session (or screen session) and stop it with `ctrl-c`. – Honza Hejzl Apr 07 '16 at 18:32
  • Actually, I was not able to run eXist on background, the classic `startup.sh &` only separated a part of the proces, it has stopped logging but `startup.sh &` was still hanging and prevented next input. Than I tried the wrapper and tried to stop with `shutdown.sh`, it resulted in the error mentioned. I am conviced it was the same with the command you suggested, only the error log was a bit shorter (I am not 100% sure, have to try that again). However, I wonder whether `ctrl-c` is safe. Isn't it a bit brutal? Does that stop (and sychronize) all at once? – Honza Hejzl Apr 07 '16 at 18:58
  • 1
    I have had a similar experience starting with `bin/startup.sh` in screen, in which stopping the database via shutdown.sh (using the default port, 8080) doesn't work. I used to start eXist on remote servers via wrapper, but the Tanuki libc memory leak bug moved me to `bin/startup.sh`. I find `ctrl-c` reliable for shutdown. On my Mac I start eXist with `open start.jar` and quit it via menu bar, without any problems. Perhaps someone could report the issue with `shutdown.sh` and `java -jar start.jar shutdown` and restore these consistent, reliable methods of shutdown. – Joe Wicentowski Apr 07 '16 at 19:02