본문 바로가기

IT/Was

[Jboss] standalone 모드에서 애플리케이션 배포

JBoss의 애플리케이션 배포 방식은 크게 Managed 방식과 Unmanaged 방식이 있고 또, Archive 방식과 Exploded 방식이 있다. JSP 파일 등 특정 파일만 변경하여 배포하고자 할 경우에는 Exploded 방식을 사용한다.

 

 

 

배포 방법에는 크게 3가지 방법이 있다.

 

  • 배포 스캐너를 통한 배포 (standalone 모드만 지원)
  • CLI 를 통한 배포
  • Management Console 을 통한 배포

 

 

먼저, 배포스캐너를 통한 배포를 위해 JBoss 서버가 설치 된 디렉토리의 /standalone/configuration/standalone.xml 파일을 확인한다.

<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">

    <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000"/>

</subsystem>

 

deployment-scanner  서브시스템에 명시 된 경로를 일정 간격으로 스캔하여 자동으로 배포를 수행한다. 즉 배포할 애플리케이션을 해당 폴더에 복사해서 붙여넣기만 하면 알아서 배포가 되는 것이다. deployments 폴더는 서버 default 옵션이며, 사용자가 별도의 외부 확장 폴더를 지정하여 스캔하도록 설정도 가능하다.

만약 Archive 방식이 아닌 Exploded 방식으로 배포를 할 경우, 폴더명을 확장자까지 붙여줘야 하는 것으로 알고 있다. 예를 들어 폴더명을 jboss-helloworld.war 와 같이 정해주는 것이다.

두번째 방법은, CLI를 통한 배포 방법이다. 아래와 같은 명령어를 입력한다.

[standalone@localhost:9999 //deployment=jboss-helloworld.war:add(runtime-name=“jboss-helloworld.war”,

content=[{“path”=>/home/admin/Downloads/jboss-helloworld.war”, “archive”=>false}])

 

  • runtime-name: 실제 배포될 이름
  • name: JBoss 에서 관리하는 이름
  • path: 실제 파일 경로
  • archive: 압축(war, jar or other) 파일 여부

 

#배포

[standalone@localhost:9999 //deployment=jboss-helloworld.war:deploy

#배포중지

[standalone@localhost:9999 //deployment=jboss-helloworld.war:undeploy

#배포 파일 삭제

[standalone@localhost:9999 /]/deployment=jboss-helloworld.war:remove

 

출처: http://www.iamkyu.com/85