Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker jboss7 war commit. Server boot failed in an unrecoverable manner

Tags:

java

docker

jboss

Is there some way to deploy .war files into Jboss-as7 running inside a docker container

Because my jboss server seems to fail after a docker commit.

Could not rename    /usr/local/share/jboss/standalone/configuration/standalone_xml_history/current to  /usr/local/share/jboss/standalone/configuration/standalone_xml_history/20140107-050049692

I tried

chmod +w usr/local/share/jboss/standalone/configuration/standalone_xml_history

reference:

https://docs.jboss.org/author/display/AS7/Configuration+file+history

For now if I stop the docker container I have to deploy the war file and don´t do a docker commit after that.

I am using ubuntu 12.04 running on vagrant

I use a supervisor to run ssh and jboss7.

My supervisor file:

[supervisord]
nodaemon=true

[program:sshd]
command=/usr/sbin/sshd -D
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
autorestart=true

[program:jboss]

command=/usr/local/share/jboss/bin/./standalone.sh -Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
autorestart=true

Next my steps:

vagrant up
[default] Forwarding ports...
[default] -- 10022 => 10022 (adapter 1)
[default] -- 8080 => 18080 (adapter 1)

Jboss-as7 log:

05:00:49,135 INFO  [org.jboss.as.remoting] (MSC service thread 1-4) JBAS017100: Listening on /0.0.0.0:4447
05:00:49,155 INFO  [org.jboss.as.remoting] (MSC service thread 1-3) JBAS017100: Listening on /0.0.0.0:9999
05:00:49,253 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) JBAS015012: Started     FileSystemDeploymentService for directory /usr/local/share/jboss/standalone/deployments
05:00:49,646 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
05:00:49,695 ERROR [org.jboss.as.server] (Controller Boot Thread) JBAS015956: Caught exception during boot:     java.lang.IllegalStateException: JBAS014647: Could not rename     /usr/local/share/jboss/standalone/configuration/standalone_xml_history/current to     /usr/local/share/jboss/standalone/configuration/standalone_xml_history/20140107-050049692
 at org.jboss.as.controller.persistence.ConfigurationFile.createHistoryDirectory(ConfigurationFile.java:414) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
     at org.jboss.as.controller.persistence.ConfigurationFile.successfulBoot(ConfigurationFile.java:273) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
     at org.jboss.as.controller.persistence.BackupXmlConfigurationPersister.successfulBoot(BackupXmlConfigurationPersister.java:65) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
     at org.jboss.as.controller.AbstractControllerService.finishBoot(AbstractControllerService.java:195) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
     at org.jboss.as.server.ServerService.boot(ServerService.java:268) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
     at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:155) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
     at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24]

05:00:49,719 FATAL [org.jboss.as.server] (Controller Boot Thread) JBAS015957: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
05:00:49,725 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "ROOT.war"
05:00:49,765 INFO  [org.jboss.as.osgi] (MSC service thread 1-3) JBAS011942: Stopping OSGi Framework
05:00:49,777 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service     jboss.deployment.unit."ROOT.war": org.jboss.msc.service.StartException in service jboss.deployment.unit."ROOT.war": Failed to start     service
     at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-    1.0.2.GA.jar:1.0.2.GA]
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.6.0_24]
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_24]
     at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24]
Caused by: java.lang.IllegalStateException: Container is down
     at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:508) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
     at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
     at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-    1.0.2.GA.jar:1.0.2.GA]
     at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:307) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
     at org.jboss.as.server.deployment.AbstractDeploymentUnitService.start(AbstractDeploymentUnitService.java:77) [jboss-as-    server-7.1.1.Final.jar:7.1.1.Final]
     at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-    1.0.2.GA.jar:1.0.2.GA]
     at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-        1.0.2.GA.jar:1.0.2.GA]

Any suggestion is appreciated. Thanks


UPDATED

I uploaded a Dockerfile and a ROOT.war file to github into the empty folder

https://github.com/poseidonjm/docker-files/

Dockerfile

FROM mhamel/jboss7

RUN apt-get update

RUN apt-get install -y supervisor openssh-server

RUN mkdir -p /var/run/sshd
RUN mkdir -p /var/log/supervisor

ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf

RUN echo 'root:rhemubuntu' | chpasswd

RUN sed -i 's/enable-welcome-root="true"/enable-welcome-root="false"/' /usr/local/share/jboss/standalone/configuration/standalone.xml

CMD ["/usr/bin/supervisord"]

steps:

Build the docker image

docker build -t poseidonjm/empty .

Run the container

docker run -d -p 8080:8080 -p 10022:22 poseidonjm/empty

Deploy .war file

ifconfig
scp -P 10022 ROOT.war [email protected]:/usr/local/share/jboss/standalone/deployments/ROOT.war
user:root
password:rhemubuntu

First test

http://127.0.0.1:18080/
Hello empty project

OK

Stop the container

alias dl='docker ps -l -q'
docker stop `dl`

Commit changes

docker commit -run='{"Cmd": ["/usr/bin/supervisord"]}' `dl` poseidonjm/empty

Run again

docker run -d -p 8080:8080 -p 10022:22 poseidonjm/empty

Second test

http://127.0.0.1:18080/
Fail

Check jboss logs

ssh [email protected] -p 10022
vim /usr/local/share/jboss/standalone/log/server.log
like image 776
Juan Rojas Avatar asked Jan 07 '14 06:01

Juan Rojas


2 Answers

I had the same problem and fixed it by deleting

/standalone/configuration/standalone_xml_history/current

Try adding this line in your docker file

RUN rm -rf /usr/local/share/jboss/standalone/configuration/standalone_xml_history/current
like image 71
Bogdan.Nourescu Avatar answered Sep 26 '22 12:09

Bogdan.Nourescu


Not a real solution, but a workaround:

  1. ssh in
  2. supervisorctl stop jboss
  3. mv /usr/local/share/jboss/standalone/configuration/standalone_xml_history/current /usr/local/share/jboss/standalone/configuration/standalone_xml_history/20140116-034913551 (or some other timestamp)
  4. exit the ssh
  5. docker commit -run='{"Cmd": ["/usr/bin/supervisord"]}' `dl` secondversion

That image (secondversion) then runs fine if you start it up.

like image 38
Andy Avatar answered Sep 22 '22 12:09

Andy