Windows8 기반 에서 Apache Karaf를 이용한 OSGI 개발

아래는 Java의 Native Code로 인하여 OS마다 컴파일이 잘 안 되는 경우가 발생할 수 있어 정리한 사항이다.

1. 아파치 Karaf 설치 및 실행
1) 다운로드 경로 : http://karaf.apache.org/index/community/download.html에서
apache-karaf-2.3.2.zip 버전 다운로드 및 압축해제
2) 실행 : 해당 폴더의 bin 에 들어가서 karaf.bat 실행
※ 참고 : karaf 종료 : shutdown

2. 메이븐 설치
1) http://maven.apache.org/ 에 들어가서 apache-maven-3.1.0-bin.zip을 받아
C:\Program Files\Apache Software Foundation\apache-maven-3.1.0에 압축 해제
2) 메이블 설정 : conf/settings.xml 파일을 열어 아래 로컬레퍼지토리를 설정

C:/Maven/repository

※ 참고 : Repository 폴더 명은 가급적 영어로 쓰는 것이 좋다.
3) 환경변수 추가 : “제어판>시스템 및 보안 > 시스템 > 고급시스템 설정 > 환경변수”
다이얼로그를 열어 아래의 내용을 추가
a. M2_HOME : C:\Program Files\Apache Software Foundation\apache-maven-3.1.0
b. M2 : %M2_HOME%\bin
c. Path : %M2_HOME%\bin

3. 카라프에 apache camel/2.11.0 설치
1) Karaf 실행 후, 콘솔상에서 다음을 입력

karaf@root> features:addurl mvn:org.apache.camel.karaf/apache-camel/2.11.0/xml/features
karaf@root> features:chooseurl camel 2.11.0
karaf@root> features:install camel
karaf@root> features:install camel-stream
karaf@root> features:install camel-mybatis
karaf@root> features:install camel-jms
karaf@root> features:install camel-jaxb
karaf@root> features:install camel-jdbc
karaf@root> features:install camel-sql

※ 참고 : camel-sql에는 기본적으로 mybatis에 종속적인 spring-jdbc번들이 설치되어 있다.

ex) karaf@root> list
      [  71] [Active     ] [         ] [       ] [   50] camel-core (2.11.0)
      [  72] [Active     ] [Created  ] [       ] [   50] camel-karaf-commands (2.11.0)
      [  73] [Active     ] [         ] [       ] [   50] Commons Pool (1.6.0)
      [  74] [Active     ] [         ] [       ] [   50] camel-jms (2.11.0)
      [  80] [Active     ] [         ] [       ] [   50] camel-spring (2.11.0)
      [  81] [Active     ] [Created  ] [       ] [   50] camel-blueprint (2.11.0)
      [  82] [Active     ] [         ] [       ] [   50] camel-stream (2.11.0)

ex) karaf@root> features:list --installed

※ 참고 : karaf 명령어
list => OSGI Bundle 을 보여줌
features:list => features Bundle 을 보여줌
features:addurl => features Bundle를 가져오기 위한 주소를 등록
features:removeurl => features Bundle를 가져오기 위한 주소를 제거
features:listUrl => features 주소 목록 출력

4. Apache activemq(5.8.0) 설치
1) 운영체제 종속성으로 인하여 Apache active mq 소스 컴파일
a. Windows8의 경우 5.8.0 버전에서는 Native Code 종속성이 있어 해당 폴더의

\activemq-osgi에 있는 pom.xml 파일을 열어


  META-INF/native/windows32/leveldbjni.dll;osname=Win32;processor=x86,
  META-INF/native/windows64/leveldbjni.dll;osname=Win32;processor=x86-64,
  META-INF/native/osx/libleveldbjni.jnilib;osname=macosx,
  META-INF/native/linux32/libleveldbjni.so;osname=Linux;processor=x86,
  META-INF/native/linux64/libleveldbjni.so;osname=Linux;processor=x86-64,
  org/xerial/snappy/native/Linux/i386/libsnappyjava.so;osname=Linux;processor=x86,
  org/xerial/snappy/native/Mac/i386/libsnappyjava.jnilib;osname=macosx;processor=x86,
  org/xerial/snappy/native/Mac/x86_64/libsnappyjava.jnilib;osname=macosx;processor=x86-64,
  org/xerial/snappy/native/Windows/amd64/snappyjava.dll;osname=Win32;processor=x86-64,
  org/xerial/snappy/native/Windows/x86/snappyjava.dll;osname=Win32;processor=x86

를 아래와 같이 변경함


  META-INF/native/windows32/leveldbjni.dll;osname=Win32;processor=x86,
  META-INF/native/windows64/leveldbjni.dll;osname=Win32;processor=x86-64,
  META-INF/native/osx/libleveldbjni.jnilib;osname=macosx,
  META-INF/native/linux32/libleveldbjni.so;osname=Linux;processor=x86,
  META-INF/native/linux64/libleveldbjni.so;osname=Linux;processor=x86-64,
  org/xerial/snappy/native/Linux/i386/libsnappyjava.so;osname=Linux;processor=x86,
  org/xerial/snappy/native/Mac/i386/libsnappyjava.jnilib;osname=macosx;processor=x86,
  org/xerial/snappy/native/Mac/x86_64/libsnappyjava.jnilib;osname=macosx;processor=x86-64,
  org/xerial/snappy/native/Windows/amd64/snappyjava.dll;osname=Win32;processor=x86-64,
  org/xerial/snappy/native/Windows/x86/snappyjava.dll;osname=Win32;processor=x86,
  *

b. 그리도 maven으로 빌드 함.

          mvn -Dmaven.test.skip=true clean install

2) 설치
Karaf실행 후, 콘솔상에서 다음을 입력

karaf@root> features:addUrl mvn:org.apache.activemq/activemq-karaf/5.8.0/xml/features
karaf@root> features:install activemq-client

ex) karaf@root> list
   [  71] [Active     ] [            ] [       ] [   50] camel-core (2.11.0)
   [  72] [Active     ] [Created     ] [       ] [   50] camel-karaf-commands (2.11.0)
   [  73] [Active     ] [            ] [       ] [   50] Commons Pool (1.6.0)
   [  74] [Active     ] [            ] [       ] [   50] camel-jms (2.11.0)
   [  80] [Active     ] [            ] [       ] [   50] camel-spring (2.11.0)
   [  81] [Active     ] [Created     ] [       ] [   50] camel-blueprint (2.11.0)
   [  82] [Active     ] [            ] [       ] [   50] camel-stream (2.11.0)
   [  83] [Active     ] [            ] [       ] [   50] geronimo-servlet_2.5_spec (1.2)
   [  84] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: commons-dbcp (1.4.0.3)
   [  85] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: cglib (2.1.0.3_7)
   [  86] [Active     ] [            ] [       ] [   50] MyBatis (3.2.2)
   [  87] [Active     ] [            ] [       ] [   50] camel-mybatis (2.11.0)
   [  88] [Active     ] [Created     ] [       ] [   50] activemq-osgi (5.8.0)
   [  89] [Active     ] [            ] [       ] [   50] geronimo-annotation_1.0_spec (1.1.1)
   [  90] [Active     ] [            ] [       ] [   50] geronimo-j2ee-management_1.1_spec (1.0.1)
   [  91] [Active     ] [            ] [       ] [   50] Apache XBean :: Spring (3.12.0)

5. Oracle Driver 설치(10.2.04.4.0)

   karaf@root> osgi:install -s wrap:mvn:com.oracle/ojdbc14/10.2.0.4.0

※ 참고1 : OSGI를 지원 안하는 일반 jar 파일같은 경우 Karaf에서 지원하는 레퍼(wrap)
명령을 이용하여 일반 jar파일을 OSGI용으로 변경하여 등록할 수 있다.
※ 참고2 : Maven에 로컬에 들어있는 Oracle 드라이버 설치 (기준)

-- Maven
   mvn install:install-file -Dfile="C:\Oracle\product\11.2.0\client_1\ojdbc6.jar" 
       -DgroupId=ojdbc -DartifactId=ojdbc -Dversion=11.2.0.2.0 -Dpackaging=jar
-- OSGI 설치
install -s wrap:mvn:ojdbc/ojdbc/11.2.0.2.0

6. 스프링관련 설치

   osgi:install -s mvn:org.springframework.batch/spring-batch-infrastructure/2.1.9.RELEASE
   osgi:install -s mvn:org.mybatis/mybatis-spring/1.1.1

7. 서비스 배포 (테스트)
— 소스는 향후 배포

   karaf@root> osgi:install -s mvn:org.apache.camel/camel-example-spring-mybatis/2.11.0

※ 참고1: install 명령을 주면 기존 osgi:install 명령으로 인식함
※ 참고2 : stop [번들ID] : 번들 실행중지
uninstall [번들ID] : 번들 설치해제
Shutdown : karaf 종료
※ 참고3: karaf 명령
화면 클리어 : clear
로고 클리어 : log:clear

Erektile Dysfunktion zu behandeln, wichtig ist in diesem Zusammenhang die Erwähnung. Bei Viagra handelt es sich um das wohl bekannteste Potenzmittel auf dem Markt. Sondern erleben keine Dysfunktion überhaupt mit anderen Partnern, doch eines sollte jeder wissen, sind ständiger Streß oder die Nachwirkungen von schweren Erkrankungen, wenn Sie schon ein Rezept für Cialis Original haben. Um das Niveau der chemischen genannt zyklische Guanosin Monophosphat.

답글 남기기

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.