docker jboss7 war commit.服务器启动以不可恢复的方式失败

2022-09-04 19:20:01

有没有办法将 .war 文件部署到在 Docker 容器内运行的 Jboss-as7 中

因为我的jboss服务器似乎在docker提交后失败了。

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

我试过了

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

参考:

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

现在,如果我停止 docker 容器,我必须部署 war 文件,并且在此之后不要执行 docker 提交。

我正在使用在流浪汉上运行的ubuntu 12.04

我使用主管来运行ssh和jboss7。

我的主管文件:

[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

接下来的步骤:

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]

任何建议都值得赞赏。谢谢


更新

我将一个 Dockerfile 和一个 ROOT.war 文件上传到 github 到空文件夹中

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"]

步骤:

构建泊坞窗映像

docker build -t poseidonjm/empty .

运行容器

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

部署 .war 文件

ifconfig
scp -P 10022 ROOT.war root@172.17.42.1:/usr/local/share/jboss/standalone/deployments/ROOT.war
user:root
password:rhemubuntu

第一次测试

http://127.0.0.1:18080/
Hello empty project

OK

停止容器

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

提交更改

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

再次运行

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

第二次测试

http://127.0.0.1:18080/
Fail

检查 jboss 日志

ssh root@172.17.42.1 -p 10022
vim /usr/local/share/jboss/standalone/log/server.log

答案 1

我有同样的问题,并通过删除来修复它

/standalone/configuration/standalone_xml_history/current

尝试在 docker 文件中添加此行

RUN rm -rf /usr/local/share/jboss/standalone/configuration/standalone_xml_history/current

答案 2

这不是一个真正的解决方案,而是一个解决方法:

  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(或其他时间戳)
  4. 退出 ssh
  5. docker commit -run='{"Cmd": ["/usr/bin/supervisord"]}' `dl` secondversion

该映像(第二版本)如果启动它,则运行良好。


推荐