JBoss EAP 7 Beta is now released, many congratulations to Red Hat and particularly to the WildFly team!
There are plenty of improvements coming in this release as documented in Release Notes. One of the major themes is Java EE 7 compliance.
JBoss EAP 7 and Java EE 7
IBM and Oracle already provide commercially supported Java EE 7-compliant Application Servers. And now Red Hat will be joining this party soon as well. Although WildFly has supported Java EE 7 for 2+ years but commercial support is a critical for open source to be adopted enterprise-wide. So this is good news!
You can learn all about different Java EE 7 APIs in the DZone Refcardz that I authored along with @alrubinger.
There are plenty of “hello world” Java EE 7 Samples that should all run with JBoss EAP. Hopefully somebody will update the pom.xml
and add a new profile.
Why NoSQL?
If you are building a traditional enterprise application then you might be fine using an RDBMS. There are plenty of advantages of using RDBMS but using a NoSQL database instead has a few advantages:
- No need to have a pre-defined schema and that makes them a schema-less database. Addition of new properties to existing objects is easy and does not require ALTER TABLE. The unstructured data gives flexibility to change the format of data any time without downtime or reduced service levels. Also there are no joins happening on the server because there is no structure and thus no relation between them.
- Scalability, agility and performance is more important than the entire set of functionality typically provided by an RDBMS. This set of databases provide eventual consistency and/or transactions restricted to single items but more focus on CRUD.
- NoSQL are designed to scale-out (horizontal) instead of scale-up (vertical). This is important knowing that databases, and everything else as well, is moving into the cloud. RBDMS can scale-out using sharding but requires complex management and not for the faint of heart. Queries requiring JOINs across shards is extremely inefficient.
- RDBMS have impedance mismatch between the database structure and the domain classes. An Object Relational Mapping, such as one provided by Java Persistence API or Hibernate is needed in such case.
- NoSQL databases are designed for less management and simpler data models lead to lower administration cost as well.
So you are all excited about NoSQL now and want to learn more:
- Why NoSQL?
- Why do successful enterprises rely on NoSQL?
- Top 10 Enterprise NoSQL Usecases
In short, there are four different types of NoSQL databases:
- Document: Couchbase, Mongo, and others
- Key/Value: Couchbase, Redis, and others
- Graph: Neo4J, OrientDB, and others
- Column: Cassandra and others
Java EE 7 provides Java Persistence API that does not provide any support for NoSQL. So how do you get started with NoSQL with JBoss EAP 7?
This blog will show how to query a Couchbase database using simple Java EE application deployed on JBoss EAP 7 Beta.
What is Couchbase?
Couchbase is an open-source, NoSQL, document database. It allows to access, index, and query JSON documents while taking advantage of integrated distributed caching for high performance data access.
Developers can write applications to Couchbase using different languages (Java, Go, .NET, Node, PHP, Python, C) multiple SDKs. This blog will show how you can easily create a CRUD application using Java SDK for Couchbase.
Run JBoss EAP 7
There are two ways to start JBoss EAP 7.
Download and Run
- Download JBoss EAP 7 Beta and unzip.
- Start the application server as:
12345678910111213141516171819202122./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 http://127.0.0.1:9990/management21:23:21,442 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://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)
Docker Run
In a containerized world, you just docker run
to run your JBoss EAP. However, JBoss EAP image does not exist on Docker Hub and so the image needs to be explicitly built. You still need to explicitly download JBoss EAP and then use the following Dockerfile to build the image:
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
|
# 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"]
|
The image is built as:
1
2
3
|
docker build -t arungupta/jboss-eap:7-beta .
|
And then you can run the JBoss EAP 7 container as:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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 http://0.0.0.0:9990/management
20:51:16,758 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://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)
|
Notice, how application and management ports are bound to all network interfaces. This will simplify to deploy the application to this JBoss EAP instance later.
Stop the server as we will show an easier way to start it later.
Start Application Server and Database
The Java EE application will provide a HTTP CRUD interface over JSON documents stored in Couchbase. The application itself will be deployed on JBoss EAP 7 Beta. So it would require to start Couchbase and JBoss EAP.
Use the Docker Compose file from github.com/arun-gupta/docker-images/blob/master/jboss-eap7-nosql/docker-compose.yml to start Couchbase and JBoss EAP 7 container:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
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
|
The application is started as:
1
2
3
4
5
6
|
docker-compose --x-networking up -d
Creating network "jbosseap7nosql" with driver "None"
Starting jbosseap7nosql_jboss_1
Creating db
|
The started containers can be seen as:
1
2
3
4
5
6
|
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
|
Configure Couchbase Server
Clone couchbase-javaee application. This Java EE application uses Couchbase Java SDK APIs to connect to the Couchbase server. The bootstrap code is:
1
2
3
|
CouchbaseCluster.create(System.getenv("COUCHBASE_URI"));
|
and is invoked from Database abstraction.
Couchbase Server can be configured using REST API. These REST APIs are defined in a Maven profile in pom.xml
of this application. And so configure Couchbase server as:
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
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":"http://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] ------------------------------------------------------------------------
|
Deploy Java EE Application to JBoss
Java EE Application can be easily deployed to JBoss EAP 7 Beta using the WildFly Maven Plugin. This is also defined as a Maven profile in pom.xml
as well.
Deploy the application as:
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
|
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 <clinit>
INFO: XNIO version 3.3.1.Final
Dec 21, 2015 1:43:34 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.1.Final
Dec 21, 2015 1:43:34 PM org.jboss.remoting3.EndpointImpl <clinit>
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] ------------------------------------------------------------------------
|
Access the Application
As mentioned earlier, the application provides HTTP CRUD API over JSON documents stored in Couchbase.
Access the application as:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
curl -v http://$(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 operations (GET, POST, PUT, DELETE) can be performed on Airline resource in the application. Complete CRUD API is documented at github.com/arun-gupta/couchbase-javaee.
This blog explained how to access a NoSQL database from JBoss EAP 7.
Read more about Couchbase 4:
- What’s New in Couchbase Server 4.1
- Couchbase Server documentation
- Talk to us on Couchbase Forums
- Follow @couchbasedev or @couchbase
Learn more about Couchbase in this recent developer-focused webinar: