JBoss EAP 7 Beta is now 출시, many congratulations to Red Hat and particularly to the WildFly team! There are plenty of improvements coming in this release as documented in 릴리스 정보. 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.

Java EE 7 Refcards

 

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 도 마찬가지입니다.

So you are all excited about NoSQL now and want to learn more:

In short, there are four different types of NoSQL databases:

  • 문서: Couchbase, Mongo, and others
  • Key/Value: Couchbase, Redis, and others
  • 그래프: Neo4J, OrientDB, and others
  • 칼럼: 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.

카우치베이스란 무엇인가요?

카우치베이스 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

  • 다운로드 JBoss EAP 7 Beta and unzip.
  • Start the application server as:

Docker Run

In a containerized world, you just 도커 실행 to run your JBoss EAP. However, JBoss EAP image does not exist on 도커 허브 and so the image needs to be explicitly built. You still need to explicitly download JBoss EAP and then use the following 도커파일 to build the image:

The image is built as:

And then you can run the JBoss EAP 7 container as:

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:

The application is started as:

The started containers can be seen as:

카우치베이스 서버 구성

Clone couchbase-javaee application. This Java EE application uses Couchbase Java SDK APIs to connect to the Couchbase server. The bootstrap code is:

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:

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:

Access the Application

As mentioned earlier, the application provides HTTP CRUD API over JSON documents stored in Couchbase. Access the application as:

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:

Learn more about Couchbase in this recent developer-focused webinar:

작성자

게시자 Arun Gupta, 개발자 지원 부문 부사장, Couchbase

아룬 굽타는 Couchbase의 개발자 지원 담당 부사장입니다. 그는 Sun, Oracle, Red Hat에서 10년 이상 개발자 커뮤니티를 구축하고 이끌었습니다. 그는 콘텐츠, 마케팅 캠페인 및 프로그램의 전략, 계획 및 실행을 개발 및 실행하는 교차 기능 팀을 이끄는 데 있어 깊은 전문성을 보유하고 있습니다. 그 전에는 Sun에서 엔지니어링 팀을 이끌었으며 Java EE 팀의 창립 멤버입니다. Gupta는 기술에 관한 블로그 게시물을 2,000개 이상 작성했습니다. 40여 개국에서 수많은 주제에 대해 광범위한 강연 경험을 가지고 있으며, 3년 연속 JavaOne Rock Star로 선정되었습니다. 또한 미국에서 Devoxx4Kids 지부를 설립하여 어린이를 대상으로 한 기술 교육을 지속적으로 장려하고 있습니다. 기술에 관한 여러 권의 책을 저술했으며, 열렬한 마라토너이자 지구를 횡단하는 사람, Java 챔피언, JUG 리더, NetBeans 드림팀 멤버, Docker 캡틴이기도 한 그는 @arungupta에서 쉽게 만나볼 수 있습니다.

댓글 남기기