JBoss EAP 7 베타는 이제 출시레드햇, 그리고 특히 WildFly 팀! 이번 릴리스에는 다음 문서에 설명된 대로 많은 개선 사항이 있습니다. 릴리스 정보. 주요 테마 중 하나는 Java EE 7 규정 준수입니다.
JBoss EAP 7 및 Java EE 7
IBM과 오라클은 이미 상업적으로 지원되는 Java EE 7 호환 애플리케이션 서버를 제공하고 있습니다. 이제 Red Hat도 곧 이 대열에 합류할 예정입니다. WildFly는 2년 이상 Java EE 7을 지원해 왔지만, 오픈 소스가 전사적으로 채택되기 위해서는 상용 지원이 필수적입니다. 따라서 이것은 좋은 소식입니다! 다양한 디존 레프카드의 자바 EE 7 API 와 함께 저술한 알루빈저.

"헬로 월드"가 많이 있습니다. Java EE 7 샘플 모두 JBoss EAP와 함께 실행되어야 합니다. 누군가가 pom.xml 을 클릭하고 새 프로필을 추가합니다.
왜 NoSQL인가요?
기존 엔터프라이즈 애플리케이션을 구축하는 경우 RDBMS를 사용해도 괜찮을 수 있습니다. RDBMS를 사용하면 많은 이점이 있지만 대신 NoSQL 데이터베이스를 사용하면 몇 가지 장점이 있습니다:
- 미리 정의된 스키마가 필요하지 않으므로 스키마 없는 데이터베이스. 기존 개체에 새 속성을 쉽게 추가할 수 있으며 ALTER TABLE이 필요하지 않습니다. 기존 객체의 비정형 데이터 는 다운타임이나 서비스 수준 저하 없이 언제든지 데이터 형식을 유연하게 변경할 수 있습니다. 또한 구조가 없기 때문에 서버에서 조인이 발생하지 않으며, 따라서 조인 간의 관계도 없습니다.
- 확장성, 민첩성 및 성능 는 일반적으로 RDBMS에서 제공하는 전체 기능 세트보다 더 중요합니다. 이 데이터베이스 세트는 최종적인 일관성 및/또는 단일 항목으로 제한된 트랜잭션을 제공하지만 CRUD에 더 중점을 둡니다.
- NoSQL은 다음을 위해 설계되었습니다. 스케일 아웃 (수직) 확장 대신 (수평) 확장으로 전환합니다. 이는 데이터베이스뿐만 아니라 다른 모든 것이 클라우드로 이동하고 있다는 사실을 아는 것이 중요합니다. RBDMS는 샤딩을 사용하여 스케일아웃할 수 있지만 복잡한 관리가 필요하며, 마음이 약한 사람에게는 적합하지 않습니다. 샤드 간에 조인이 필요한 쿼리는 다음과 같습니다. 매우 비효율적.
- RDBMS에는 임피던스 불일치 데이터베이스 구조와 도메인 클래스 사이에 매핑이 필요합니다. 이러한 경우 Java 지속성 API 또는 Hibernate에서 제공하는 것과 같은 객체 관계형 매핑이 필요합니다.
- NoSQL 데이터베이스는 관리가 용이하도록 설계되었으며 데이터 모델이 더 단순하여 다음과 같은 이점을 제공합니다. 관리 비용 절감 도 마찬가지입니다.
이제 여러분 모두 NoSQL에 대해 관심을 갖고 자세히 알아보고 싶으실 것입니다:
간단히 말해, NoSQL 데이터베이스에는 네 가지 유형이 있습니다:
- 문서: 카우치베이스, 몽고 및 기타
- 키/값: Couchbase, Redis 및 기타
- 그래프: Neo4J, OrientDB 및 기타
- 칼럼: 카산드라 및 기타
Java EE 7은 NoSQL을 지원하지 않는 Java 지속성 API를 제공합니다. 그렇다면 JBoss EAP 7로 NoSQL을 어떻게 시작할 수 있을까요? 이 블로그에서는 JBoss EAP 7 베타에 배포된 간단한 Java EE 애플리케이션을 사용하여 Couchbase 데이터베이스를 쿼리하는 방법을 보여드립니다.
카우치베이스란 무엇인가요?
카우치베이스 는 오픈소스 NoSQL 문서 데이터베이스입니다. 고성능 데이터 액세스를 위한 통합 분산 캐싱을 활용하면서 JSON 문서에 액세스하고, 색인하고, 쿼리할 수 있습니다. 개발자는 다양한 언어(Java, Go, .NET, Node, PHP, Python, C)를 사용하여 Couchbase에 애플리케이션을 작성할 수 있습니다. 여러 SDK. 이 블로그에서는 다음을 사용하여 CRUD 애플리케이션을 쉽게 만드는 방법을 보여줍니다. 카우치베이스용 Java SDK.
JBoss EAP 7 실행
JBoss EAP 7을 시작하는 방법에는 두 가지가 있습니다.
다운로드 및 실행
- 다운로드 JBoss EAP 7 베타 을 클릭하고 압축을 풉니다.
- 로 애플리케이션 서버를 시작합니다:
1234567891011121314151617181920./jboss-eap-7.0/bin/standalone.sh=========================================================================JBoss Bootstrap EnvironmentJBOSS_HOME: /Users/arungupta/tools/jboss-eap-7.0JAVA: javaJAVA_OPTS: -server -verbose:gc -Xloggc:"/Users/arungupta/tools/jboss-eap-7.0/standalone/log/gc.log" -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceClassUnloading -Xms1303m -Xmx1303m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true=========================================================================21:22:58,773 INFO [org.jboss.modules] (main) JBoss Modules version 1.4.4.Final-redhat-1. . .21:23:21,441 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on https://127.0.0.1:9990/management21:23:21,442 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on https://127.0.0.1:999021:23:21,442 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: EAP 7.0.0.Beta1 (WildFly Core 2.0.3.Final-redhat-1) started in 22950ms - Started 261 of 509 services (332 services are lazy, passive or on-demand)
도커 실행
컨테이너화된 세상에서는 도커 실행 를 사용하여 JBoss EAP를 실행합니다. 그러나 JBoss EAP 이미지는 다음과 같이 존재하지 않습니다. 도커 허브 를 사용하므로 이미지를 명시적으로 빌드해야 합니다. 여전히 JBoss EAP를 명시적으로 다운로드한 다음 다음을 사용해야 합니다. 도커파일 를 클릭해 이미지를 작성합니다:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# Use latest jboss/base-jdk:8 image as the base FROM jboss/base-jdk:8 # Set the JBOSS_VERSION env variable ENV JBOSS_VERSION 7.0.0.Beta ENV JBOSS_HOME /opt/jboss/jboss-eap-7.0/ COPY jboss-eap-$JBOSS_VERSION.zip $HOME # Add the JBoss distribution to /opt, and make jboss the owner of the extracted zip content # Make sure the distribution is available from a well-known place RUN cd $HOME && unzip jboss-eap-$JBOSS_VERSION.zip && rm jboss-eap-$JBOSS_VERSION.zip # Ensure signals are forwarded to the JVM process correctly for graceful shutdown ENV LAUNCH_JBOSS_IN_BACKGROUND true # Expose the ports we're interested in EXPOSE 8080 9990 # Set the default command to run on boot # This will boot JBoss EAP in the standalone mode and bind to all interface CMD ["/opt/jboss/jboss-eap-7.0/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"] |
이미지가 다음과 같이 빌드됩니다:
|
1 |
docker build -t arungupta/jboss-eap:7-beta . |
그런 다음 JBoss EAP 7 컨테이너를 다음과 같이 실행할 수 있습니다:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
docker run -it -p 8080:8080 arungupta/jboss-eap:7-beta ========================================================================= JBoss Bootstrap Environment JBOSS_HOME: /opt/jboss/jboss-eap-7.0/ JAVA: /usr/lib/jvm/java/bin/java JAVA_OPTS: -server -verbose:gc -Xloggc:"/opt/jboss/jboss-eap-7.0//standalone/log/gc.log" -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceClassUnloading -Xms1303m -Xmx1303m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true ========================================================================= 20:51:12,551 INFO [org.jboss.modules] (main) JBoss Modules version 1.4.4.Final-redhat-1 20:51:12,824 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final-redhat-1 . . . 20:51:16,750 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on https://0.0.0.0:9990/management 20:51:16,758 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on https://0.0.0.0:9990 20:51:16,759 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: EAP 7.0.0.Beta1 (WildFly Core 2.0.3.Final-redhat-1) started in 4529ms - Started 261 of 509 services (332 services are lazy, passive or on-demand) |
애플리케이션 및 관리 포트가 모든 네트워크 인터페이스에 바인딩되는 방식에 주목하세요. 이렇게 하면 나중에 이 JBoss EAP 인스턴스에 애플리케이션을 배포하는 것이 간단해집니다. 나중에 더 쉽게 시작할 수 있는 방법을 보여드리기 위해 서버를 중지합니다.
애플리케이션 서버 및 데이터베이스 시작
Java EE 애플리케이션은 Couchbase에 저장된 JSON 문서를 통해 HTTP CRUD 인터페이스를 제공합니다. 애플리케이션 자체는 JBoss EAP 7 베타에 배포됩니다. 따라서 Couchbase와 JBoss EAP를 시작해야 합니다. 다음에서 Docker Compose 파일을 사용합니다. github.com/arun-gupta/docker-images/blob/master/jboss-eap7-nosql/docker-compose.yml 를 클릭하여 Couchbase 및 JBoss EAP 7 컨테이너를 시작합니다:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
mycouchbase: container_name: "db" image: couchbase/server ports: - 8091:8091 - 8092:8092 - 8093:8093 - 11210:11210 jboss: image: arungupta/jboss-eap:7-beta environment: - COUCHBASE_URI=db ports: - 8080:8080 - 9990:9990 |
애플리케이션은 다음과 같이 시작됩니다:
|
1 2 3 4 |
docker-compose --x-networking up -d Creating network "jbosseap7nosql" with driver "None" Starting jbosseap7nosql_jboss_1 Creating db |
시작된 컨테이너는 다음과 같이 볼 수 있습니다:
|
1 2 3 4 |
docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 154436dfbfb1 couchbase/server "/entrypoint.sh couch" 10 seconds ago Up 8 seconds 0.0.0.0:8091-8093->8091-8093/tcp, 11207/tcp, 11211/tcp, 18091-18092/tcp, 0.0.0.0:11210->11210/tcp db cb76d4e38df3 arungupta/jboss-eap:7-beta "/opt/jboss/jboss-eap" 10 seconds ago Up 9 seconds 0.0.0.0:8080->8080/tcp, 0.0.0.0:9990->9990/tcp jbosseap7nosql_jboss_1 |
카우치베이스 서버 구성
복제 카우치베이스-자비 애플리케이션입니다. 이 Java EE 애플리케이션은 다음을 사용합니다. Couchbase Java SDK API 를 클릭하여 Couchbase 서버에 연결합니다. 부트스트랩 코드는 다음과 같습니다:
|
1 |
CouchbaseCluster.create(System.getenv("COUCHBASE_URI")); |
에서 호출되며 데이터베이스 추상화. 카우치베이스 서버는 다음을 사용하여 구성할 수 있습니다. REST API. 이러한 REST API는 Maven 프로필에 정의되어 있습니다. pom.xml 로 설정합니다. 따라서 Couchbase 서버를 다음과 같이 구성합니다:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
mvn install -Pcouchbase -Ddocker.host=$(docker-machine ip couchbase) [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building couchbase-javaee 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ couchbase-javaee --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ couchbase-javaee --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ couchbase-javaee --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/arungupta/workspaces/couchbase-javaee/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ couchbase-javaee --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ couchbase-javaee --- [INFO] [INFO] --- maven-war-plugin:2.1.1:war (default-war) @ couchbase-javaee --- [INFO] Packaging webapp [INFO] Assembling webapp [couchbase-javaee] in [/Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee] [INFO] Processing war project [INFO] Copying webapp resources [/Users/arungupta/workspaces/couchbase-javaee/src/main/webapp] [INFO] Webapp assembled in [82 msecs] [INFO] Building war: /Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee.war [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ couchbase-javaee --- [INFO] Installing /Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee.war to /Users/arungupta/.m2/repository/org/couchbase/sample/couchbase-javaee/1.0-SNAPSHOT/couchbase-javaee-1.0-SNAPSHOT.war [INFO] Installing /Users/arungupta/workspaces/couchbase-javaee/pom.xml to /Users/arungupta/.m2/repository/org/couchbase/sample/couchbase-javaee/1.0-SNAPSHOT/couchbase-javaee-1.0-SNAPSHOT.pom [INFO] [INFO] --- exec-maven-plugin:1.4.0:exec (Configure memory) @ couchbase-javaee --- * Hostname was NOT found in DNS cache * Trying 192.168.99.102... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 192.168.99.102 (192.168.99.102) port 8091 (#0) > POST /pools/default HTTP/1.1 > User-Agent: curl/7.37.1 > Host: 192.168.99.102:8091 > Accept: */* > Content-Length: 36 > Content-Type: application/x-www-form-urlencoded > } [data not shown] * upload completely sent off: 36 out of 36 bytes < HTTP/1.1 200 OK * Server Couchbase Server is not blacklisted < Server: Couchbase Server < Pragma: no-cache < Date: Mon, 21 Dec 2015 21:35:10 GMT < Content-Length: 0 < Cache-Control: no-cache < 100 36 0 0 100 36 0 15510 --:--:-- --:--:-- --:--:-- 18000 * Connection #0 to host 192.168.99.102 left intact [INFO] [INFO] --- exec-maven-plugin:1.4.0:exec (Configure services) @ couchbase-javaee --- * Hostname was NOT found in DNS cache * Trying 192.168.99.102... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 192.168.99.102 (192.168.99.102) port 8091 (#0) > POST /node/controller/setupServices HTTP/1.1 > User-Agent: curl/7.37.1 > Host: 192.168.99.102:8091 > Accept: */* > Content-Length: 26 > Content-Type: application/x-www-form-urlencoded > } [data not shown] * upload completely sent off: 26 out of 26 bytes < HTTP/1.1 200 OK * Server Couchbase Server is not blacklisted < Server: Couchbase Server < Pragma: no-cache < Date: Mon, 21 Dec 2015 21:35:10 GMT < Content-Length: 0 < Cache-Control: no-cache < 100 26 0 0 100 26 0 9976 --:--:-- --:--:-- --:--:-- 13000 * Connection #0 to host 192.168.99.102 left intact [INFO] [INFO] --- exec-maven-plugin:1.4.0:exec (Setup credentials) @ couchbase-javaee --- * Hostname was NOT found in DNS cache * Trying 192.168.99.102... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 192.168.99.102 (192.168.99.102) port 8091 (#0) > POST /settings/web HTTP/1.1 > User-Agent: curl/7.37.1 > Host: 192.168.99.102:8091 > Accept: */* > Content-Length: 50 > Content-Type: application/x-www-form-urlencoded > } [data not shown] * upload completely sent off: 50 out of 50 bytes < HTTP/1.1 200 OK * Server Couchbase Server is not blacklisted < Server: Couchbase Server < Pragma: no-cache < Date: Mon, 21 Dec 2015 21:35:10 GMT < Content-Type: application/json < Content-Length: 44 < Cache-Control: no-cache < { [data not shown] 100 94 100 44 100 50 6880 7818 --:--:-- --:--:-- --:--:-- 8333 * Connection #0 to host 192.168.99.102 left intact {"newBaseUri":"https://192.168.99.102:8091/"}[INFO] [INFO] --- exec-maven-plugin:1.4.0:exec (Install travel-sample bucket) @ couchbase-javaee --- * Hostname was NOT found in DNS cache * Trying 192.168.99.102... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 192.168.99.102 (192.168.99.102) port 8091 (#0) * Server auth using Basic with user 'Administrator' > POST /sampleBuckets/install HTTP/1.1 > Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA== > User-Agent: curl/7.37.1 > Host: 192.168.99.102:8091 > Accept: */* > Content-Length: 17 > Content-Type: application/x-www-form-urlencoded > } [data not shown] * upload completely sent off: 17 out of 17 bytes < HTTP/1.1 202 Accepted * Server Couchbase Server is not blacklisted < Server: Couchbase Server < Pragma: no-cache < Date: Mon, 21 Dec 2015 21:35:11 GMT < Content-Type: application/json < Content-Length: 2 < Cache-Control: no-cache < { [data not shown] 100 19 100 2 100 17 41 355 --:--:-- --:--:-- --:--:-- 361 * Connection #0 to host 192.168.99.102 left intact [][INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.094 s [INFO] Finished at: 2015-12-21T13:35:11-08:00 [INFO] Final Memory: 13M/309M [INFO] ------------------------------------------------------------------------ |
Java EE 애플리케이션을 JBoss에 배포하기
Java EE 애플리케이션은 다음을 사용하여 JBoss EAP 7 베타에 쉽게 배포할 수 있습니다. 와일드플라이 메이븐 플러그인. 이것은 또한 다음에서 Maven 프로필로 정의됩니다. pom.xml 도 사용할 수 있습니다. 애플리케이션을 다음 이름으로 배포합니다:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
mvn install -Pwildfly -Dwildfly.hostname=$(docker-machine ip couchbase) -Dwildfly.username=admin -Dwildfly.password=Admin#007 [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building couchbase-javaee 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ couchbase-javaee --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ couchbase-javaee --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ couchbase-javaee --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/arungupta/workspaces/couchbase-javaee/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ couchbase-javaee --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ couchbase-javaee --- [INFO] [INFO] --- maven-war-plugin:2.1.1:war (default-war) @ couchbase-javaee --- [INFO] Packaging webapp [INFO] Assembling webapp [couchbase-javaee] in [/Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee] [INFO] Processing war project [INFO] Copying webapp resources [/Users/arungupta/workspaces/couchbase-javaee/src/main/webapp] [INFO] Webapp assembled in [62 msecs] [INFO] Building war: /Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee.war [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ couchbase-javaee --- [INFO] Installing /Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee.war to /Users/arungupta/.m2/repository/org/couchbase/sample/couchbase-javaee/1.0-SNAPSHOT/couchbase-javaee-1.0-SNAPSHOT.war [INFO] Installing /Users/arungupta/workspaces/couchbase-javaee/pom.xml to /Users/arungupta/.m2/repository/org/couchbase/sample/couchbase-javaee/1.0-SNAPSHOT/couchbase-javaee-1.0-SNAPSHOT.pom [INFO] [INFO] >>> wildfly-maven-plugin:1.1.0.Alpha4:deploy (default) > package @ couchbase-javaee >>> [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ couchbase-javaee --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ couchbase-javaee --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ couchbase-javaee --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/arungupta/workspaces/couchbase-javaee/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ couchbase-javaee --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ couchbase-javaee --- [INFO] Skipping execution of surefire because it has already been run for this configuration [INFO] [INFO] --- maven-war-plugin:2.1.1:war (default-war) @ couchbase-javaee --- [INFO] Packaging webapp [INFO] Assembling webapp [couchbase-javaee] in [/Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee] [INFO] Processing war project [INFO] Copying webapp resources [/Users/arungupta/workspaces/couchbase-javaee/src/main/webapp] [INFO] Webapp assembled in [20 msecs] [INFO] Building war: /Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee.war [INFO] [INFO] <<< wildfly-maven-plugin:1.1.0.Alpha4:deploy (default) < package @ couchbase-javaee <<< [INFO] [INFO] --- wildfly-maven-plugin:1.1.0.Alpha4:deploy (default) @ couchbase-javaee --- Dec 21, 2015 1:43:34 PM org.xnio.Xnio INFO: XNIO version 3.3.1.Final Dec 21, 2015 1:43:34 PM org.xnio.nio.NioXnio INFO: XNIO NIO Implementation Version 3.3.1.Final Dec 21, 2015 1:43:34 PM org.jboss.remoting3.EndpointImpl INFO: JBoss Remoting version 4.0.9.Final [INFO] Authenticating against security realm: ManagementRealm [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 17.010 s [INFO] Finished at: 2015-12-21T13:43:48-08:00 [INFO] Final Memory: 17M/217M [INFO] ------------------------------------------------------------------------ |
애플리케이션에 액세스
앞서 언급했듯이 이 애플리케이션은 Couchbase에 저장된 JSON 문서를 통해 HTTP CRUD API를 제공합니다. 애플리케이션에 다음과 같이 액세스합니다:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
curl -v https://$(docker-machine ip couchbase):8080/couchbase-javaee/resources/airline * Hostname was NOT found in DNS cache * Trying 192.168.99.102... * Connected to 192.168.99.102 (192.168.99.102) port 8080 (#0) > GET /couchbase-javaee/resources/airline HTTP/1.1 > User-Agent: curl/7.37.1 > Host: 192.168.99.102:8080 > Accept: */* > < HTTP/1.1 200 OK < Connection: keep-alive < X-Powered-By: Undertow/1 * Server JBoss-EAP/7 is not blacklisted < Server: JBoss-EAP/7 < Content-Type: application/octet-stream < Content-Length: 1402 < Date: Mon, 21 Dec 2015 21:45:40 GMT < * Connection #0 to host 192.168.99.102 left intact [{"travel-sample":{"country":"United States","iata":"Q5","callsign":"MILE-AIR","name":"40-Mile Air","icao":"MLA","id":10,"type":"airline"}}, {"travel-sample":{"country":"United States","iata":"TQ","callsign":"TXW","name":"Texas Wings","icao":"TXW","id":10123,"type":"airline"}}, {"travel-sample":{"country":"United States","iata":"A1","callsign":"atifly","name":"Atifly","icao":"A1F","id":10226,"type":"airline"}}, {"travel-sample":{"country":"United Kingdom","iata":null,"callsign":null,"name":"Jc royal.britannica","icao":"JRB","id":10642,"type":"airline"}}, {"travel-sample":{"country":"United States","iata":"ZQ","callsign":"LOCAIR","name":"Locair","icao":"LOC","id":10748,"type":"airline"}}, {"travel-sample":{"country":"United States","iata":"K5","callsign":"SASQUATCH","name":"SeaPort Airlines","icao":"SQH","id":10765,"type":"airline"}}, {"travel-sample":{"country":"United States","iata":"KO","callsign":"ACE AIR","name":"Alaska Central Express","icao":"AER","id":109,"type":"airline"}}, {"travel-sample":{"country":"United Kingdom","iata":"5W","callsign":"FLYSTAR","name":"Astraeus","icao":"AEU","id":112,"type":"airline"}}, {"travel-sample":{"country":"France","iata":"UU","callsign":"REUNION","name":"Air Austral","icao":"REU","id":1191,"type":"airline"}}, {"travel-sample":{"country":"France","iata":"A5","callsign":"AIRLINAIR","name":"Airlinair","icao":"RLA","id":1203,"type":"airline"}}] |
애플리케이션의 항공사 리소스에서 CRUD 작업(GET, POST, PUT, DELETE)을 수행할 수 있습니다. 전체 CRUD API는 다음 문서에 설명되어 있습니다. github.com/arun-gupta/couchbase-javaee. 이 블로그에서는 JBoss EAP 7에서 NoSQL 데이터베이스에 액세스하는 방법을 설명합니다. Couchbase 4에 대해 자세히 읽어보세요:
- 카우치베이스 서버 4.1의 새로운 기능
- 카우치베이스 서버 문서
- 다음 연락처로 문의하세요. 카우치베이스 포럼
- 팔로우 @couchbasedev 또는 @couchbase
최근 개발자 중심 웨비나에서 Couchbase에 대해 자세히 알아보세요: