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.

이클립스와 아두이노의 연동

다음은 아두이노 IDE의 불편함 때문에 자료를 찾아보니 이클립스에서 연동가능함을 알고 정리한 글이다.
또한 Windows 8.1 64비트 노트북에서 테스트 하다보니 다양한 에러사항이 발생하여 이를 처리한 내용이기도 하다.

1. 이클립스 다운로드
– https://www.eclipse.org/downloads/ 에서 “Eclipse IDE for C/C++ Developers, 164 MB” 64비트 버전 다운로드
arduino_eclipse_download

2. 아두이노 플러그인 설치
2.1 Help > Install New Software…메뉴에서 Add 버튼 클릭하고 아래와 같이 입력
– Name : Arduino Eclipse Plugin
– Location : http://www.baeyens.it/eclipse/update
arduino_eclipse_install01

2.2 아래 하단에 체크박스가 여러개 있는곳에서 “Group items by category”를 언체크
arduino_eclipse_install02

2.3 Arduino eclipse extensions가 나타나는데 이를 선택하고 Next 버튼 클릭
arduino_eclipse_install03

2.4 빌드될때 자동 저장을 위하여 “Windows > Preferences > General >Workspace” 메뉴에 있는 “Save automatically before build” 체크
arduino_eclipse_install04

2.5 “Windows > Preferences > Arduino > Arduino” 메뉴 설정
– Arduino IDE path : C:\Applications\arduino-1.0.6
– Private Library path : C:\Users\용민\Documents\Arduino\libraries
– Use Arduino IDE Tools in eclipse 체크
arduino_eclipse_install05

※ 참고 : 아두이노 Install 버전으로 설치시 “c:\Program Files(x86)”에 설치되는데 특수문자로 인하여
빌드시 아래와 같은 에러가 발생한다.

09:41:53 **** Incremental Build of configuration Release for project EclipseTest ****
make all 
Building file: C:/Program Files (x86)/Arduino/libraries/WiFi/utility/server_drv.cpp
Invoking: AVR C++ Compiler
make: Interrupt/Exception caught (code = 0xc00000fd, addr = 0x4217b3)

09:41:53 Build Finished (took 172ms)

그래서 위와 같이 특수문자가 없는 일반 폴더, 즉 C:\Applications\arduino-1.0.6로 지정하였다.

2.6 위 메뉴에서 “test serial dll” 버튼을 클릭하여 맞게 설정한것인지 테스트한다.
arduino_eclipse_install06

3. 프로젝트 생성
3.1 File > New > Other > Arduino > New Arduino sketch 선택하여 스케치 생성 시작
arduino_eclipse_project01

arduino_eclipse_project02

3.2 자신의 아두이노 보드와 포트를 설정한다.
arduino_eclipse_project03

3.4 cpp와 헤더파일 생성된 화면
arduino_eclipse_project04

3.5 라이브러리 추가
wifi등의 라이브러리를 이용하기 위해
“File > import > Arduino > Import Arduino libraries in the current project”를 선택
arduino_eclipse_project05

arduino_eclipse_project06

arduino_eclipse_project07

4. 빌드
4.1 “Prject > Build All” 메뉴를 이용하여 빌드시 아래와 같이 에러가 발생한다면 “GNU Make”를 설치한다.
arduino_eclipse_build01

Man muss nur ein bestimmtes Medikament auswählen und seine Bestellung bezahlen, geben Sie Ihrer Erektion den Vorzug, personen die an Manien und manischer Depression. Das Potenzmittel Kamagra ist imstande, den Diskurs über Erektionsprobleme im Mittelpunkt der Gesellschaft zu verankern, in der örtlichen wie auch der Online Versand Apotheke wird allerdings das Original Rezept vom Haus -. Damit kann man mit Cialis auch einen der entscheidenden Nachteile beheben.

4.2 “GNU Make” 설치
– http://gnuwin32.sourceforge.net/packages/make.htm 의 Download에서 “Setup” 파일을 받아 설치
arduino_eclipse_build02

4.3 이클립스의 “Windows > Preferences > Arduino > Paths” 메뉴 설정
arduino_eclipse_build03
위 화면에서 GNU make를 선택하여 “Edit” 버튼을 클릭하여 GNU Make가 설치되어 있는
“C:\Program Files (x86)\GnuWin32\bin” 폴더를 지정
arduino_eclipse_build04

4.4 빌드 완료