jboss eap 6 deep dive(compare with weblogic)

62
JBoss Enterprise Application Platform 6 주식회사 오픈 소스 컨설팅

Upload: ji-woong-choi

Post on 05-Dec-2014

2.059 views

Category:

Technology


2 download

DESCRIPTION

Detail about JBoss EAP 6 including WebLogic comparision, JMX, JMX, CLI Scripts, etc.

TRANSCRIPT

Page 1: JBoss EAP 6 Deep Dive(Compare with WebLogic)

JBoss Enterprise Application Platform 6

주식회사 오픈 소스 컨설팅

Page 2: JBoss EAP 6 Deep Dive(Compare with WebLogic)

2 - Internal Use Only -

JBoss Overview

JBoss AS 3.2.0

2003 2004 2005 2006 2007 2008 2009 2010 2011 2012

JBoss AS 4.0.0 – 4.0.5

JBoss AS 4.2.0 – 4.2.3

J2EE 1.4 Certification JBoss EAP 5.0.0

JBoss EAP 5.1.0 – 5.1.2

JBoss EAP 6

JavaEE 5 Certification, JDK5

JavaEE 5 Certification, JDK5, JDK6

JavaEE 6 Full Certification, JDK6

2012

Page 3: JBoss EAP 6 Deep Dive(Compare with WebLogic)

3 - Internal Use Only -

Community vs Commercial

JBoss.org Community JBoss Enterprise Middleware

Page 4: JBoss EAP 6 Deep Dive(Compare with WebLogic)

4 - Internal Use Only -

JBoss 제품화 과정

Platform Candidate Release(s)

Quality Assurance

JBoss.org 프로젝트

1

제품 요구 사항 정의

제품 관리

2

플랫폼 테스팅, 인증, 문서화

JBoss QA, 문서화팀, 인증된 파트너

4

JBoss Enterprise Platform

플랫폼 컴포넌트 구성 및 통합

JBoss 제품화 담당 엔지니어

3 5

플랫폼 발표 (General Availability)

JBoss Release Engineering

Del

iver

y P

has

e P

roduc

tizat

ion

Tea

m

Page 5: JBoss EAP 6 Deep Dive(Compare with WebLogic)

5 - Internal Use Only -

JBoss 참고 자료

제품 문서

http://docs.redhat.com

Page 6: JBoss EAP 6 Deep Dive(Compare with WebLogic)

6 - Internal Use Only -

JBoss 설치

Red Hat 고객 포탈을 통한 다운로드

레드햇 서브스크립션을 구매한 고객을 위한 다운로드 사이트이며, 발급된 계정으로 로그인을 수행하

면 다운로드 받을 수 있습니다.

다운로드 URL: http://access.redhat.com

Page 7: JBoss EAP 6 Deep Dive(Compare with WebLogic)

7 - Internal Use Only -

JBoss 설치

JBoss 설치 형태

community : zip 압축 파일로 제공

EAP : zip, jar, platform binary, linux rpm 형태로 제공

Extracting the ZIP Download Binary File을 받아서 원하는 경로에 압축을 해제하는 설치 방법입니다. # unzip jboss-eap-6.1.1.zip

RPM 설치 RHEL 6.x Plaform을 이용하여 설치이며 서브스크립트이 필요한 설치 방법입니다.

# yum groupinstall jboss-eap6

GUI Installer Linux GUI 환경에서 설치하는 방법이며 설치 중 원하는 구성을 손쉽게 설정할 수 있는 설치 방법입니다.

# java -jar jboss-eap-6.1.1-installer.jar

Console Installation Linux GUI 환경이 안 되는 상황에서 터미널창을 이용하여 Text 방식으로 설치할 수 있는 설치 방법입니다.

# java -jar jboss-eap-6.1.1-installer.jar –console

Page 8: JBoss EAP 6 Deep Dive(Compare with WebLogic)

8 - Internal Use Only -

JBoss 설치

JBoss unzip

/opt/was/ 폴더로 해당 파일을 업로드 한 후 압축 해제

ls –al 명령어를 통해 압축 해제 내용을 확인

[jboss@server /opt/was] unzip jboss-eap-6.1.1.zip

[jboss@server /opt/was] rm -f jboss-eap-6.1.1.zip

[jboss@server /opt/was]# ls -al

total 52

drwxr-xr-x. 13 jboss jboss 4096 Oct 24 07:54 .

dr-xr-xr-x. 27 jboss jboss 4096 Jun 12 02:00 ..

lrwxrwxrwx 1 jboss jboss 19 Oct 24 07:54 jboss-eap-6.1

Page 9: JBoss EAP 6 Deep Dive(Compare with WebLogic)

9 - Internal Use Only -

지원 애플리케이션

지원되는 애플리케이션

웹 애플리케이션(.war)

EJB 애플리케이션(.jar)

Enterprise 애플리케이션(.ear)

Resource Adapter (.rar)

웹서비스애플리케이션(.wsr)

JBoss 서비스(.sar)

Page 10: JBoss EAP 6 Deep Dive(Compare with WebLogic)

10 - Internal Use Only -

애플리케이션 디플로이 설정

애플리케이션 디플로이 수행 방법

CLI Tool

애플리케이션 copy 후 파일 생성을 통한 디플로이

deployments 폴더에 a.war 라는 애플리케이션이 있을 경우 a.war.dodeploy 라는

파일을 생성하여 deploy 하는 방법

관리자 콘솔을 통한 디플로이

CLI Tool을 이용한 디플로이

Web Console

Page 11: JBoss EAP 6 Deep Dive(Compare with WebLogic)

11 - Internal Use Only -

디플로이 스캐너

애플리케이션 copy 후 파일 생성을 통한 디플로이

subsystem deployments-scanner service

특정 디렉토리에 애플리케이션패키지 및 deploy 지시 관련 파일을 참조하여

디플로이를 수행시켜주는 jboss subsystem ( 서버 default 옵션 )

설정 파일 : $SERVER_HOME/configuration/standalone.xml

검색 위치 : $SERVER_HOME/deployments

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

relative-to="jboss.server.base.dir" scan-interval="5000"/>

</subsystem>

Page 12: JBoss EAP 6 Deep Dive(Compare with WebLogic)

12 - Internal Use Only -

디플로이 상태

애플리케이션 copy 후 파일 생성을 통한 디플로이 (계속)

디플로이 요청 지시어

디플로이 상태 확인

설정 설명

dodeploy deploy scanner에게 deploy를 하게 요청하게 하는 지시어

설정 설명

isdeploying 서버에 애플리케이션을 배포하는 상태

deployed 정상적으로 서버에 애플리케이션이 배포 완료

isundeploying 서버에서 애플리케이션 배포를 취소(삭제) 하고 있는 상태

undeployed 정상적으로 서버에서 애플리케이션 배포 취소(삭제) 완료

failed 서버에 애플리케이션 배포작업 중 에러가 발생한 상태

pending 서버에 애플리케이션 배포작업이 지연중인 상태

Page 13: JBoss EAP 6 Deep Dive(Compare with WebLogic)

13 - Internal Use Only -

WAR 디플로이

애플리케이션 copy 후 파일 생성을 통한 디플로이 (계속)

첨부된 test.war 파일을 standalone 서버의 deployments 폴더에 upload 시킵니다.

touch 명령을 통해 test.war.dodeploy 라는 이름의 파일을 생성합니다.

[jboss@host1 /opt/was/servers/standalone_ha_11/deployments] ls –al total 20 -rw-r--r-- 1 jboss jboss 8870 Nov 1 10:15 README.txt -rw-r--r-- 4 jboss jboss 4096 Nov 2 12:39 test.war

[jboss@host1 /opt/was/servers/standalone_ha_11/deployments] touch test.war.dodeploy total 20 -rw-r--r-- 1 jboss jboss 8870 Nov 1 10:15 README.txt -rw-r--r-- 4 jboss jboss 4096 Nov 2 12:39 test.war -rw-rw-r-- 1 jboss jboss 8 Nov 2 12:39 test.war.dodeploy

Page 14: JBoss EAP 6 Deep Dive(Compare with WebLogic)

14 - Internal Use Only -

WAR 디플로이(계속)

애플리케이션 copy 후 파일 생성을 통한 디플로이 (계속)

잠시 후 test.war.dodeploy test.war.deployed 로 변경된 것을 확인

서버 로그에서 애플리케이션 정상 디플로이 여부 확인

[jboss@host1 /opt/was/servers/standalone_ha_11/deployments] touch test.war.dodeploy total 20 -rw-r--r-- 1 jboss jboss 8870 Nov 1 10:15 README.txt -rw-r--r-- 4 jboss jboss 4096 Nov 2 12:39 test.war -rw-rw-r-- 1 jboss jboss 8 Nov 2 12:39 test.war.deployed

13:02:12,618 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 2) JBAS010281: Started default-host/test cache from web container 13:02:12,619 INFO [org.jboss.web] (ServerService Thread Pool -- 2) JBAS018210: Register web context: /test 13:02:12,719 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "test.war" (runtime-name : "test.war")

Page 15: JBoss EAP 6 Deep Dive(Compare with WebLogic)

15 - Internal Use Only -

외부 디플로이 디렉토리

external directory 설정

external directory란

jboss deployments subsystem 에서 기본 scanner가 동작 폴더는 jboss.server.base.dir 하부의 deployments라는 폴더임

external directory 는 말 그대로 기본 deployments 디렉토리가 아닌 외부 확장 폴더를 scanner 영역에서 지정하여 애플리케이션 등록 여부를 확인 할 수 있게 지정하는 애플리케이션 외부확장 검색 디렉토리

Page 16: JBoss EAP 6 Deep Dive(Compare with WebLogic)

16 - Internal Use Only -

외부 디플로이 디렉토리(계속)

external directory 설정

subsystem deployments-scanner service에 external directory 추가

설정 파일 : $SERVER_HOME/configuration/standalone.xml

검색 위치 : $SERVER_HOME/deployments

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

relative-to="jboss.server.base.dir" scan-interval="5000"/>

<deployment-scanner name="externalDeploy" path="/opt/was/app" scan-interval="5000"/> </subsystem>

Page 17: JBoss EAP 6 Deep Dive(Compare with WebLogic)

17 - Internal Use Only -

CLI 활용 디플로이

JBoss Command Line Interface를 이용한 Deploy

CLI 접속 가능 여부 확인

서버가 정상 기동시 아래와 같이 관리자 Port를 통해 CLI 관리자 Tool을 이용할 수 있다.

Command Line Interface Port : 10099

… 중략

16:23:12,284 INFO [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100: Listening on 192.168.0.172:10099

16:23:12,285 INFO [org.jboss.as.remoting] (MSC service thread 1-7) JBAS017100: Listening on 0.0.0.0:4547

16:23:12,572 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on

http://192.168.0.172:10090/management

16:23:12,572 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://192.168.0.172:10090

16:23:12,572 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.1.1.GA (AS 7.3.0.Final-redhat-8) started

in 2156ms - Started 168 of 284 services (115 services are passive or on-demand)

Page 18: JBoss EAP 6 Deep Dive(Compare with WebLogic)

18 - Internal Use Only -

CLI 접속

CLI 접속 방법

CLI 접속을 하기 위해서는 다음의 명령어를 통해 접속

$JBOSS_HOME/bin/jboss-cli.sh --controller=$SERVER_IP:10099 --connect

[jboss@host1 /opt/was/servers/standalone_ha_11/bin]$ /opt/was/jboss-eap-6.1/bin/jboss-cli.sh --

controller=192.168.0.172:10099 --connect

[[email protected]:10099 /]

Page 19: JBoss EAP 6 Deep Dive(Compare with WebLogic)

19 - Internal Use Only -

CLI 활용 디플로이

CLI을 통한 디플로이

CLI 접속이 완료가 된 이후에 Deploy 작업을 진행한다.

본 내용에서는 /opt/was/app/test.war 파일이 있는걸 가정하고 진행

Deploy 요청이 정상적으로 수행이 되면 server 로그 부분에 결과가 표시

[[email protected]:10099 /] deploy/was/app/test.war

[[email protected]:10099 /]

16:39:16,290 INFO [org.jboss.as.repository] (management-handler-thread - 5) JBAS014900: Content added at location

/opt/was/servers/standalone_ha_11/data/content/d9/0e2d6e3bad2a5cb22edc747e1774200eecd14e/content

16:39:16,292 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015876: Starting deployment of “test.war"

(runtime-name: “test.war")

16:39:16,324 INFO [org.jboss.web] (ServerService Thread Pool -- 57) JBAS018210: Register web context:

16:39:16,432 INFO [org.jboss.as.server] (management-handler-thread - 5) JBAS018559: Deployed “test.war" (runtime-name :

“test.war")

Page 20: JBoss EAP 6 Deep Dive(Compare with WebLogic)

20 - Internal Use Only -

관리 콘솔 확인

CLI을 통한 deploy (계속)

관리자 콘솔에서 CLI를 통해 deploy 된 Content의 현 상태를 확인 가능

Page 21: JBoss EAP 6 Deep Dive(Compare with WebLogic)

21 - Internal Use Only -

애플리케이션 확인

CLI을 통한 deploy (계속)

실제 http service port 를 통해 deploy 된 Web application Content를 확인

Page 22: JBoss EAP 6 Deep Dive(Compare with WebLogic)

22 - Internal Use Only -

EAP6 Architecture

Core Infrastructure

Subsystems

Co

nn

ect

or

Dat

a So

urc

e

EJB

We

bB

ean

s

JPA

Me

ssag

ing

Nam

ing

OSG

i

Re

mo

tin

g

SAR

Secu

rity

We

b

JAX

-RS

JMX

JTA

Deployer VFS Jandex Reflect Cache Repository

Service Controller Service

MSC JBoss

Modules DMR Controller Threads

Page 23: JBoss EAP 6 Deep Dive(Compare with WebLogic)

23 - Internal Use Only -

Domain Structure

Host #1

Host #2

Host Controller

Server #1

Host #3

Host Controller

Server #3

Host #4

Host Controller

Server #5

Database

Database

Domain Controller (Master Host Controllre)

Server #2

Sever #4

Page 24: JBoss EAP 6 Deep Dive(Compare with WebLogic)

24 - Internal Use Only -

JBoss 설치

JBoss의 주요 디렉토리 구조

Jboss-eap-6.x

bin

standalone.conf

standalone.sh

domain.sh

jboss-cli.sh

modules

standalone

configuration

deployments

logs

data

Standalone mode JVM parameters

Standalone mode

Domain mode

Command Line Interface

Static JBoss Module Definitions

Standalone Configuration

File SystemDeployments

Internal Data(includes Repository)

Page 25: JBoss EAP 6 Deep Dive(Compare with WebLogic)

25 - Internal Use Only -

JBoss 설치

JBoss의 주요 디렉토리 구조

Jboss-eap-6.x

domain

domain.xml

servers

server-one

logs

data

appclient

configuration

Domain Wide Unified Configuration

Server “One” JVM Instance

EE Application Client Configuration

configuration

host.xml Host Controller Configuration

appclient.xml

Page 26: JBoss EAP 6 Deep Dive(Compare with WebLogic)

26 - Internal Use Only -

Management Interface

Tools

• Command Line Interface

• Web Console

• Products - JBoss ON

Management APIs

• JMX – JSR-77/160

• Java(DMR)

• REST

Page 27: JBoss EAP 6 Deep Dive(Compare with WebLogic)

27 - Internal Use Only -

Container Services Relationship

ServiceManagerEJB

service.jar

CustomerManagerEJB

customer.jar Remoting

JNDIName: serviceM

JNDIName: customerM

ManagerServlet

manager.war Web Server

Foo DataSource

JNDIName: dsFoo <module name=“com.lge”>

<main-class name=“com.lge.Main”/>

<resources>

<resource-root path=“mymain.jar”/>

</resources>

<dependencies>

<module name=“org.slf4j”/>

<module name=“javax.api”/>

<module name=“org.junit”/>

</dependencies>

</module>

Everything is a Service

Services have start and stop task

Services have dependencies

Module class loading

Similar to IDE projects or modules

Page 28: JBoss EAP 6 Deep Dive(Compare with WebLogic)

28 - Internal Use Only -

Modular EE Class Loading

WAR Deployment Module

MANIFEST.MF

Dependency: com.hana Class-Path: /foo/bar.jar Extension-List: myext

javax.api

javaee.api javax.servlet

Implicit dependency

EJB Sibling Deployment Module

com.hana

external./foo/bar.jar

extension.myext

Explicit dependency

Page 29: JBoss EAP 6 Deep Dive(Compare with WebLogic)

29 - Internal Use Only -

JBoss and Mobile

[The HTML5/REST Architecture support]

Page 30: JBoss EAP 6 Deep Dive(Compare with WebLogic)

30 - Internal Use Only -

Class Loader – WebLogic

BootClassLoader(native)

ExtensionClassLoader

SystemClassLoader

Call-by-Reference Call-by-Reference

WebApp Classloader

Application Classloader

EJB1 EJB2 EJB3

JSP1 JSP2

Application Classloader

JSP1 JSP2

WebApp Classloader

Call-by-Value

J2EE Application Unit J2EE Application Unit

각 애플리케이션의 클래스 로더를 통해 클래스 로딩

Page 31: JBoss EAP 6 Deep Dive(Compare with WebLogic)

31 - Internal Use Only -

Class Loader – JBoss EAP5 vs EAP6

계층형 클래스로더

애플리케이션 마다 클래스로더를 만들수 있고, 클래스

재로드 가능

복잡/ 클래스 검색이 늦음

중복 배치에 의한 오류 발생

클래스 공유

문제를 회피하기 위한 구조가 더 복잡도를 높여 악순환

모듈형 클래스로더

모듈 하나에 대해서 하나의 클래스로더

각 모듈은 런타임으로 필요로 하는 모듈의

의존성을 정의

계층형이 아닌 그래프 구조

「클래스 패스」 불필요

단순하여 초고속

Page 32: JBoss EAP 6 Deep Dive(Compare with WebLogic)

32 - Internal Use Only -

Thread Pooling

웹로직은 Multiplexer, JBoss은 개별 컴포넌트로 구성

WLS JBoss

Page 33: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

WLS vs JBoss 세션 복제의 차이

WLS JBoss

Page 34: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

웹로직 클러스터링– 최초 연결

Client Proxy

M1

A

M2

A’

M3

M4

클라이언트 요청 전송

라운드 로빈 알고리즘 사용하여 live 인스턴스 찾음

M1 인스턴스가 이 세션에 대한 primary로 지정. 복제관리자는 M2를 secondary로 지정하고 추적 쿠키 정보를 갱신

1 2

3

복제 관리자는 M2로 해당 세션을 복제

4

최종 추적 쿠키 Cookie(Primary=M1;Secondary=M2)

5

WLS Tracking Cookie Format: sessionid!primary_JVMID!secondary_JVMID

Page 35: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

웹로직 클러스터링 – Failover

Client Proxy

M1

A

M2

A’

M3

M4

클라이언트 요청 추적 쿠키:

Cookie(Primary=M1;Secondary=M2)

인스턴스 M1 정상, 요청을 전달함

복제 관리자는 M1에 있는 세션을 제거하도록 통지 1 2

7

M2가 이 세션에 대한 primary로 전환. 복제관리자는 M3를 secondary로 지정하고 추적 쿠키 정보를 갱신

5

최종 추적 쿠키 Cookie(Primary=M2;Secondary=M3)

8

연결 문제 발생 (연결에러, 타임아웃)

3

Proxy는 장애를 감지하고, secondary 인스턴스 M2로 접속을 시도

4

복제 관리자는 해당 세션을 M3로 복제시킴

6

A’

Page 36: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

JBoss Clustering Architecture

JBoss AS5, AS6, EAP5 (EAP)

JBoss

Embedded

Infinispan

App

JBoss

Embedded

Infinispan

App

JBoss

Embedded

Infinispan

App

JGroups JGroups

JBoss AS7, EAP6

JBoss

JBoss Cache

App

JBoss

JBoss Cache

App

JBoss

JBoss Cache

App

JGroups JGroups

Page 37: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

JBoss 클러스터링 – 최초 연결(All to All)

Client 웹 서버

플러그인

M1

A

M2

A’

M3

M4

클라이언트 요청 전송

플러그인 알고리즘 사용하여 live

인스턴스 찾음

M1 인스턴스가 이 세션을 저장 1 2

3

Jgroups를 통해 세션이 모든 서버에 복제

4

최종 추적 쿠키 Cookie(sessionid_M1)

5

JBoss Tracking Cookie Format: jsessionid__JvmRoute1)

1) jvmRoute: 서버의 설정 값으로써 웹 서버 플러그인과 인스턴스를 맵핑시킴

A’

A’

CAUTION: 서버당 100M 세션이 있을 경우 M1~M4서버 총 400M의 저장공간 필요!

Page 38: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

JBoss 클러스터링 – Failover(All to All)

Client 웹 서버

플러그인

M1

A

M2

A’

M3

M4

클라이언트 요청 전송

Cookie(sessionid_M1)

인스턴스 M1 에게 요청을 전달함

1 2

최종 추적 쿠키 Cookie(sessionid_M2)

5

A’

A’

연결 문제 발생 (연결에러, 타임아웃)

3

플러그인는 장애를 감지하고, 알고리즘에 의해 다른 서버 연결을 시도

4

M2의 jvmRoute값을 이용하여 추적 쿠키의 값을 M2 인스턴스로 갱신

5

Page 39: JBoss EAP 6 Deep Dive(Compare with WebLogic)

39 - Internal Use Only -

웹 서버 커넥터(WEB/WAS 구간)

Apache Tomcat Connector

Tomcat, JBoss 와 연동을 하기 위한 웹 서버 플러그인 모듈 ( Apache 재단 )

지원 웹서버

Apache

IIS

Netscape/SunOne Web Server

AJPv13 프로토콜 사용

http://tomcat.apache.org/connectors-doc/ajp/ajpv13a.html

다운로드

http://tomcat.apache.org/connectors-doc/

Page 40: JBoss EAP 6 Deep Dive(Compare with WebLogic)

40 - Internal Use Only -

웹 서버 커넥터(WEB/WAS 구간)

Apache Tomcat Connector : mod_jk, mod_proxy, mod_cluster

3가지 아파치 모듈 연결 방식

mod_jk – 가장 오래되고 안정적

mod_proxy – Apache 2.2 이상에서 가능

mod_proxy_ajp, mod_proxy_balancer등이 필요

mod_cluster – 새로운 형태의 모듈 multicast 방식으로 자동 발견 기능 제공

Page 41: JBoss EAP 6 Deep Dive(Compare with WebLogic)

41 - Internal Use Only -

JBoss Database 연동 설정

JDBC 드라이버 등록 방법

JDBC 드라이버는 다음의 형태를 통해 사용할 수 있습니다.

설정 설명

modules JDBC 드라이버를 jboss의 module.xml 형태의 모듈화하여 사용하는 방법

library Jar 파일의 형식의 deploy를 통한 모듈 등록

Page 42: JBoss EAP 6 Deep Dive(Compare with WebLogic)

42 - Internal Use Only -

JBoss Database 연동 설정

JDBC 드라이버 등록 설정

$JBOSS_HOME/modules.ext 디렉토리에 하위 디렉토리를 만들고 jar 파일을 복사한 후

module.xml 파일을 작성합니다.

Page 43: JBoss EAP 6 Deep Dive(Compare with WebLogic)

43 - Internal Use Only -

JBoss Database 연동 설정

JDBC 드라이버 모듈화 설정 (계속)

module.xml <module xmlns="urn:jboss:module:1.1" name="com.mysql"> <properties> <property name="jboss.api" value="unsupported"/> </properties> <resources> <resource-root path="mysql-connector-java-commercial-5.1.26-bin.jar"/> </resources> <dependencies> <module name="javax.api"/> <module name="javax.transaction.api"/> </dependencies> </module>

Page 44: JBoss EAP 6 Deep Dive(Compare with WebLogic)

44 - Internal Use Only -

JBoss Database 연동 설정

JBoss Server 인스턴스의 설정 파일(standalone-ha.xml)에 jdbc 드라이버를 등록

module.xml 의 name 과 driver의 module 부분은 동일하여야 함. (module.xml)

<datasources> <datasource jndi-name="java:jboss/datasources/ExampleDS"

pool-name="ExampleDS" enabled="true" use-java-context="true">

…중략… </datasource> <drivers>

<driver name="h2" module="com.h2database.h2"> <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>

</driver> <driver name="mysql" module="com.mysql">

<driver-class>com.mysql.jdbc.Driver</driver-class> </driver>

</drivers> </datasources>

JBoss 인스턴스 설정 파일에 해당 JDBC 모듈 추가

<module xmlns="urn:jboss:module:1.1" name="com.mysql">

Page 45: JBoss EAP 6 Deep Dive(Compare with WebLogic)

45 - Internal Use Only -

JBoss Database 연동 설정

Datasource 설정

standalone Instance 에서 사용되는 configuration 파일(standalone-ha.xml)에 Datasource 부분을

설정합니다.

EAP 5.x 대의 *-ds.xml 파일은 가급적 사용을 하지 않도록 합니다. (Console, CLI 에서 접근 할 수 없음.)

<datasources> <datasource

jndi-name="java:jboss/datasources/MysqlDS" pool-name="MysqlDS" enabled="true" use-java-context="true"> <connection-url>jdbc:mysql://localhost:3306/mydb</connection-url> <driver>com.mysql</driver> <security>

<user-name>dbuser</user-name> <password>dbpasswd</password>

</security> <validation>

<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"> </valid-connection-checker>

</validation> </datasource>

</datasources>

Page 46: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

Potential Receiver 2

Potential Receiver 1 메시지 1

메시지 2

- Point-to-Point 모델에서는 Sender에 의해 발생된 메시지가 Queue라는 채널에 전달되고, 이 메시지는 Queue에 의해 자동으로 Receiver에 전달

- Publisher/Subscriber 모델과 다른 점은 Queue에 전달된 하나의 메시지는 오직 하나의 Receiver에만 전달되고 다수의 Receiver 에 전달되지 않음

- Sender에 의해 Queue에 전달된 메시지1은 Queue에 의해 Receiver1에 전달되고, Sender에 의해 전달된 메시지2는 Queue에 의해 Receiver2에 전달

- Publisher/Subscriber 모델처럼 동일한 메시지가 서로 다른 Receiver에 전달되지 않음

Sender

Queue

메시지2

메시지1

JMS Queue

Page 47: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

- Publisher/Subscriber 모델에서는 Publisher가 하나의 메시지를 다수의 Subscriber(Consumer)에게 Topic 이라는 채널을 통하여 전달

- 모든 Subscriber는 Publisher가 Topic에 보낸 하나의 메시지의 사본을 전달 받게 되며, 이와 같은 메시지 전달은 Topic에 의해 자동으로 Subscriber에 전달

- Publisher 에 의해 전달된 메시지1은 동시에 Subscriber1, Subscriber2 에 전달되며, Publisher에 의해 전달된 2번째 메시지인 메시지2 도 Subscriber1, Subscriber2에 전달

Publisher

Topic

Subscriber

Subscriber

메시지2

메시지1

메시지 1 메시지 2

메시지 1 메시지 2

JMS Topic

Page 48: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

?

Sender Receiver Connection

Session

Producer

Consumer

JBoss Netty

Core

Client-side Delegates

Client-side aspects

Server-side aspects

Server-side endpoints

JBoss JMS 핵심 기능

JMS 1.1 스펙 준수 및 JBoss AS의 런타임 라이브러리로 사용.

성능, 신뢰성, 안정성 및 낮은 응답시간 등에 초점을 둠.

SOA의 초기 단계인 JBoss ESB의 핵심 모듈로서 사용

Netty 기반의 고성능 자바 엔진(LDAP, DNS, Keberos, etc)

Page 49: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

JBoss Netty – 고성능 네트워크 클라이언트/서버 프레임워크

이벤트 기반 비동기 네트워크 애플리케이션 프레임워크

Interceptor Chain 패턴

• 손쉽게 다단계 State machine 구현

• 암복호화 + 전문 해석 + 스레드 풀링 + 비즈니스 로직

• 조립 가능한 컴포넌트 다수 제공

과부하 및 DoS 방어 메커니즘

Old · New I/O 모두 지원

NIO 구현·벤더별 최적화

Page 51: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

JMS Queue 생성

Naming이 java:jboss/exported/ 로 시작되지 않으면 글로벌 JNDI에 바인딩되지 않음

Page 52: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

JMS 사용자 생성

C:\Java\jboss-eap-6.1\bin>add-user.bat

JAVA_HOME is not set. Unexpected results may occur.

Set JAVA_HOME to the directory of your local JDK to avoid this message.

What type of user do you wish to add?

a) Management User (mgmt-users.properties)

b) Application User (application-users.properties)

(a): b

Enter the details of the new user to add.

Realm (ApplicationRealm) :

Username (testuser) : ienvyou

Password : !test123

Re-enter Password : !test123

What roles do you want this user to belong to? (Please enter a comma separated list, or leave blank for

none)[ ]: testrole

About to add user 'ienvyou' for realm 'ApplicationRealm'

Is this correct yes/no? yes

Added user 'ienvyou' to file 'C:\Java\jboss-eap-6.1\standalone\configuration\application-users.properties'

Added user 'ienvyou' to file 'C:\Java\jboss-eap-6.1\domain\configuration\application-users.properties'

Added user 'ienvyou' with roles testrole to file 'C:\Java\jboss-eap-

6.1\standalone\configuration\application-roles.properties'

Added user 'ienvyou' with roles testrole to file 'C:\Java\jboss-eap-6.1\domain\configuration\application-

roles.properties'

Is this new user going to be used for one AS process to connect to another AS process?

e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server

EJB calls.

yes/no?

JMS 접근 사용자 생성

Page 53: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

송수신 권한 설정

<security-settings>

<security-setting match="#">

<permission type="send" roles="guest"/>

<permission type="consume" roles="guest"/>

<permission type="createNonDurableQueue" roles="guest"/>

<permission type="deleteNonDurableQueue" roles="guest"/>

</security-setting>

</security-settings>

<security-settings>

<security-setting match="#">

<permission type="send" roles="guest testrole"/>

<permission type="consume" roles="guest testrole"/>

<permission type="createNonDurableQueue" roles="guest"/>

<permission type="deleteNonDurableQueue" roles="guest"/>

</security-setting>

</security-settings>

standalone-full.xml<before>

standalone-full.xml<after>

Page 54: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

애플리케이션을 통한 테스트

try {

Hashtable<String, String> properties = new Hashtable<String, String>();

properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

properties.put(Context.PROVIDER_URL, "remote://localhost:4447");

properties.put(Context.SECURITY_PRINCIPAL, "admin");

properties.put(Context.SECURITY_CREDENTIALS, "!test123");

Context ctx = new InitialContext(properties);

ConnectionFactory cf = (ConnectionFactory) ic.lookup("jms/RemoteConnectionFactory"); Queue queue = (Queue) ic.lookup(destinationName);

System.out.println("Queue " + destinationName + " exists");

Connection connection = cf.createConnection("ienvyou", "!test123"); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

MessageProducer sender = session.createProducer(queue);

sender.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

TextMessage message = session.createTextMessage("Hello!");

sender.send(message);

System.out.println("The message was successfully sent to the " + queue.getQueueName() + " queue");

connection.start();

} catch(Exception e) {

}

closeConnection(connection);

Page 55: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

Firewall hardware

Server

Web server software

Server Application

DB server software

Management console

Management console

Management console

Management console

Management console

Before JMX

Before JMX

벤더 고유의 관리 콘솔을 제공

일반적으로 웹 브라우저를 통하여 접근하도록 설계

API를 제공해주지 않을 경우 해당 관리 객체에 접근하기 어려움

Page 56: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

With JMX(Java Management Extension)

Firewall hardware

Server

Web server software

Server Application

DB server software Management console

JMX Agent

Adapter

= JMX MBean

http://www.jcp.org/en/jsr/detail?id=255 JSR 255: JavaTM Management Extensions (JMXTM) Specification, version 2.0

JMX를 이용할 경우 소프트웨어 관리 포인트를 한 곳으로 집중할 수 있다는 장점이 발생.(JSR-255)

• 모든 리소스는 MBean을 사용하여 관리.

• JMX Agent (or group of agents)상의 모든 MBean은 하나의 관리 콘솔에서 모두 처리

Page 57: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

WebLogic JMX 적용 예

------------------------------------------------------------------------------------------------------------------

com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean

ServerRuntimes

------------------------------------------------------------------------------------------------------------------

Server Name

Server State

Server JVMRuntime Name

Server JVMRuntime HeapSizeCurrent

Server JVMRuntime HeapFreeCurrent

Server JMSRuntime JMSServers Name

Server JMSRuntime JMSServers Destinations Name

Server JMSRuntime JMSServers Destinations ConsumersCurrentCount

Server JMSRuntime JMSServers Destinations ConsumersHighCount

Server JMSRuntime JMSServers Destinations ConsumersTotalCount

Server JMSRuntime JMSServers Destinations MessagesCurrentCount

Server JMSRuntime JMSServers Destinations MessagesHighCount

Server JMSRuntime JMSServers Destinations MessagesPendingCount

Server JMSRuntime JMSServers Destinations MessagesReceivedCount ------------------------------------------------------------------------------------------------------------------

com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean

DomainConfiguration

------------------------------------------------------------------------------------------------------------------

Domain JMSSystemResources JMSResource Name

Domain JMSSystemResources JMSResource Queues Name

Domain JMSSystemResources JMSResource Queues JNDIName

Domain JMSSystemResources JMSResource DistributedQueues Name

Domain JMSSystemResources JMSResource DistributedQueues JNDIName

Domain JMSSystemResources JMSResource DistributedQueues DistributedQueueMembers Name

DomainRuntimeMBean을 통한 현재 JVM 및 JMS 상태 정보

JMS 관련 Queue 설정 정보 확인

Page 58: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

JMX Object Name 수집

C:\Java\jboss-eap-6.1\bin> standalone.bat -c standalone-full

C:\Java\jboss-eap-6.1\bin> jconsole.bat

Page 59: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

JVM Heap ObjectName

Page 60: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

JMS ObjectName

Page 61: JBoss EAP 6 Deep Dive(Compare with WebLogic)

- Internal Use Only -

JMX Code Example

import java.util.HashMap;

import javax.management.MBeanServerConnection;

import javax.management.openmbean.CompositeDataSupport;

import javax.management.openmbean.CompositeType;

import javax.management.remote.JMXConnector;

import javax.management.remote.JMXConnectorFactory;

import javax.management.remote.JMXServiceURL;

import javax.management.*;

public class HeapAccess {

public static void main(String[] args) throws Exception {

String host = "127.0.0.1"; // Your JBoss Bind Address default is localhost

int port = 9999; // JBoss remoting port

String urlString ="service:jmx:remoting-jmx://" + host + ":" + port;

System.out.println(" \n\n\t**** urlString: "+urlString);

HashMap environment = new HashMap();

String[] credentials = new String[] {"test", "!test123"};

environment.put (JMXConnector.CREDENTIALS, credentials);

JMXServiceURL serviceURL = new JMXServiceURL(urlString);

JMXConnector jmxConnector = JMXConnectorFactory.connect(serviceURL, environment);

MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();

ObjectName objectName=new ObjectName("java.lang:type=Memory");

CompositeDataSupport heapMemoryUsage =(CompositeDataSupport)connection.getAttribute(objectName, "HeapMemoryUsage");

System.out.println(" committed = " + heapMemoryUsage.get("committed"));

System.out.println(" init = " + heapMemoryUsage.get("init"));

System.out.println(" max = " + heapMemoryUsage.get("max"));

System.out.println(" used = " + heapMemoryUsage.get("used"));

jmxConnector.close();

}

}

Page 62: JBoss EAP 6 Deep Dive(Compare with WebLogic)

62 - Internal Use Only -

요약

OPEN

SHARE

CONTRIBUTE

ADOPT

REUSE