Monthly Archives: January 2014

JBoss EAP 6 High Availability by PacktPub Book Review


Language : English
Paperback : 166 pages [ 235mm x 191mm ] Release Date : December 2013
ISBN : 1783282436
ISBN 13 : 9781783282432
Author(s) : Weinan Li

This book shows how to leverage the power of JBoss EAP 6 to successfully build high-availability clusters quickly and efficiently.

Here is the Table of Contents:

Chapter 1: JBoss EAP 6 Overview
Chapter 2: Using JBoss EAP 6
Chapter 3: Setting Up a JBoss EAP6 Cluster
Chapter 4: Load Balancing with mod_jk
Chapter 5: Load Balancing with mod_cluster
Chapter 6: Clustering with SSL
Chapter 7: Clustering mod_cluster with SSL
Chapter 8: Developing Distributed Applications

This book is targeted towards JBoss EAP 6 administrators and Java EE developers. It not only provides a step-by-step tutorial but also include design discussions. The first couple of chapters provide an overview of JBoss EAP 6 and how to get started with it. Chapter 3 applies the knowledge gained so far and gets into the nitty gritty details of setting up a cluster.

Chapter 4 and 5 cover load balancing with mod_jk and mod_cluster modules respectively. The design difference between mod_jk and mod_cluster helps understand which of these modules should be applied in a particular scenario. Both of these modules can be used as a load balancer to proxy user requests. Failover of request from one node to another is also covered for both the modules.

Chapter 6 and 7 explain how to enable SSL when using JBoss EAP 6 independently and in a clustering environment. Once again, SSL configuration with mod_jk and mod_cluster modules are explained in very easy to understand steps. The final chapter shows how to achieve high availability using sticky sessions and session replication.

If you are interested in understanding how to setup a cluster using JBoss EAP in an easy-to-follow guide full of hands-on examples of real-world administration tasks, this is your ultimate guide!

You can purchase the book from here and send feedback to feedback@packtpub.com.

Role Based Access Control in WildFly 8 (Tech Tip #12)

Role Based Access Control (RBAC) is the ability to restrict access to system or certain portions of it to authorized users. For JBoss AS 7.x or JBoss EAP 6.0 and 6.1, the web-based administrative console had an all-or-nothing approach. So if a user can authenticate with management security realm, then he’ll have all the privileges. This might be OK for smaller deployments but the roles are typically divided for mission critical deployments and a finer-grained control is required. JBoss EAP 6.2 and WildFly 8 introduces RBAC using different roles.

There are 7 different roles in 2 different categories – first 4 roles where users are locked out of sensitive data and 3 higher level roles where users are able to deal with sensitive data.

Role Permissions
Monitor Has the fewest permissions
Only read configuration and current runtime state
No access to sensitive resources or data or audit logging resources
Operator All permissions of Monitor
Can modify the runtime state, e.g. reload or shutdown the server, pause/resume JMS destination, flush database connection pool.
Does not have permission to modify persistent state.
Maintainer All permissions of Operator
Can modify the persistent state, e.g. deploy an application, setting up new data sources, add a JMS destination
Deployer All permissions of Maintainer
Permission is restricted to applications only, cannot make changes to container configuration
Administrator All permissions of Maintainer
View and modify sensitive data such as access control system
No access to administrative audit logging system
Auditor All permissions of Monitor
View and modify resources to administrative audit logging system
Cannot modify sensitive resources or data outside auditing, can read any sensitive data
Super User Has all the permissions
Equivalent to administrator in previous versions

WildFly 8 ships with two access control providers:

  • “simple”
    • any authenticated administrator has all privileges
    • consistent with AS 7
    • the default behavior (ensures compatibility with older releases)
  • “rbac”
    • users are mapped to different roles
    • new in WildFly 8

Brian Stansberry has wonderfully explained all the nitty-gritty details in three-part video.

First part shows the basics of Role Based Access Control, and show how you can use standard roles within the WildFly Administration Console.

Second part shows how to configure roles and setup users which map to roles.

Third part shows how to configure constraints which allow you to tweak the behavior of roles.

Enjoy!

Getting Started with IntelliJ IDEA by PacktPub Book Review


Language : English
Paperback : 114 pages [ 235mm x 191mm ] Release Date : October 2013
ISBN : 1849699615
ISBN 13 : 9781849699617
Author(s) : Hudson Orsine Assumpção

The book shows IntelliJ IDEA 12 features and capabilities for web and desktop development. It also provide general tips to help improve development speed. Readers would need MySQL 5.5, Apache Tomcat 7, and JDK 7 for building applications.

Here is the Table of Contents:

Chapter 1: Getting Started with IntelliJ IDEA 12
Chapter 2: Improving Your Development Speed
Chapter 3: Working with Databases
Chapter 4: Web Development
Chapter 5: Desktop Development

It starts with basic navigation of source code and covers smart code completion, code analysis, advanced refactoring, navigation and search, live templates, and many other features that boosts your productivity. It also shows how to organize the activities necessary to do work such as task and context management and TODO marking.

A complete application development experience require a database and web and desktop application development. The book explains how IntelliJ work with databases, such as generating tables, managing the data, and even creating ORM entities for JPA or Hibernate. The web application created in the book uses JavaServer Faces with Primefaces toolkit, Spring, and SOAP web services and deploys on Tomcat 7. In agile methodology and TDD spirit this chapter also shows how to create and run tests using JUnit. Desktop application is covered using AWT and SWT.

Even though IntelliJ IDEA 13 is already out, this book gives a good introduction for beginners. It may provide some tips for expert users as well.

You can purchase the book from here and send feedback to feedback@packtpub.com.

Webinar Replay and Q&A Transcript: WildFly/JBoss EAP instead of GlassFish/WebLogic

jan8-2014-webinar-banner

Replay of the webinar “WildFly for Innovation and Red Hat JBoss EAP for commercial support” is now available.

If you already registered then click on “Already Registered” in the left navigation bar of registration page otherwise register and watch the replay instantly.

The webinar was very well attended with hundreds of viewers and there were lot of questions asked. I’ve captured some of those here:

  • Is it safe (or very bad idea) to develop on WildFly and run in production on EAP?

    The recommended model is to use JBoss EAP for development, testing, and production for an application. There are always differences between WildFly and EAP with former offering bleeding-edge technologies and latter providing a lot more stability with bugfixes and patches. WildFly would be appropriate only for development/evaluation/contribution of new innovative features such as Java EE 7 in the upstream project.

  • If you develop on Wildfly and deploy on EAP  is there a risk Wildfly will move ahead too quickly and EAP will fall behind in capabilities supported?

    WildFly is focused on innovation and moves at a rapid pace. This allows WildFly to easily implement new technologies and provide a platform for enterprise developers to try them out. New features can be added or older features may be removed to provide a better experience for that particular release. There is no requirement to provide a patch release and any support is only through community.

    JBoss EAP is derived from a particular WildFly release and is focused on long term stability and predictability. It is battle tested on a variety of operating systems, JDK, and databases. It goes through rigorous performance testing, regression testing, scalability testing, and other means to ensure that a military-grade product is delivered. API level compatibility is guaranteed across different versions of EAP, this is not a requirement for WildFly. Enterprises that want stability and predictability should look at JBoss EAP. Developers that want bleeding edge technology should look at WildFly.

  • Isn’t JBoss EAP an open source product as well ?

    Yes, JBoss EAP binaries and source code are made available under open source licenses.

  • When will JBoss EAP provide support for Java EE 7 full platform ?

    We’re currently in the planning stages for EAP 7. More details and the roadmap will be presented at Red Hat Summit in San Francisco, April 14-17.

  • EAP 6 would be supporting JEE7?

    EAP 6 will not be fully certified for Java EE 7. Although some selective features, such as WebSocket, may be backported. We’ll have more detail on that at Red Hat Summit in April.

  • Is EAP an alternative to WebSphere?  Why or why not?

    Absolutely. JBoss EAP is a compelling alternative to WebSphere. https://engage.redhat.com/forms/jboss-v-websphere provides all the details. And don’t just take Red Hat’s word for it – JBoss EAP has been a leader (along with WebLogic and WebSphere) in Gartner’s Enterprise Application Server Magic Quadrant for the last five years and many customers have made the migration to JBoss from more expensive proprietary alternatives like WebSphere and WebLogic. You could also reference Get Unstuck with JBoss if appropriate. It contains quite a few resources on this topic.

  • How do you compare Wildfly with alternative open source servers such as  VMWare VFabric  and wso2 app server ?

    Red Hat EWS (Red Hat | JBoss Web Server) is vanilla Tomcat and fully supported by Red Hat. This offering is very comparable to tcServer. VMWare vFabric is optimized for running Spring applications. Spring is one of the technologies supported by WildFly, in addition to many others. WSO 2 supports many Java EE technologies but not a Java EE compliant app sever. WildFly provides full Java EE 7 compliance and EAP 7 will provide commercial support for that in future.

  • So if I recompile the EAP sources I can do whatever I want with the compiled binary ?

    No – you can’t do “whatever”. The open source licenses governing JBoss EAP source code, principally the LGPL, grant you certain permissions subject to conditions that you must comply with. In addition, you may not brand your recompiled EAP sources as “JBoss” or any other Red Hat-owned trademark. This means, for example, that if you distribute or publicly deploy your recompiled binary you must first remove all JBoss and other Red Hat branding, such as logo files. Any recompilation of EAP sources is not JBoss EAP and must not be presented as being a Red Hat or JBoss product.

  • We are using JBoss 5 EAP. Is there any guide for migrating to WildFly or EAP version?

    EAP 5 is based on Java EE 5. WildFly is a Java EE 7 compliant container. Application would need to be manually ported by learning the new Java EE 7 programming capabilities. Migration Guide provides complete details on how to migrate your applications from EAP 5.x to 6.x. JBoss Migration Center offer additional tools that provide configuration migration across different versions of EAP. We strongly encourage you to locate a Red Hat partner and work with them on this.

  • Do Red Hat Engineers commit new features into WildFly before committing into EAP  e.g. WebSockets?

    WildFly is the upstream project which JBoss EAP is based on. All features are committed into WildFly first and allow developers to try the cutting-edge technologies in their development cycles. A version of WildFly is the basis for JBoss EAP, where all the features are battle tested for production deployments.

  • Are no extra ports (random) used for EJB communication and what about hornetQ ports?

    Only two ports are exposed: 8080 for application and 9990 for management in the default profile. All other technologies will handshake over these two ports.

  • Will it support Scala?

    WildFly and JBoss are polyglot application server. Scala (just as many other languages Ruby, Clojure, etc.) can easily be incorporated with Java applications, and even standalone Scala applications are possible on JBoss. There is a number of frameworks that could be useful for developers using JBoss and having a need for building applications using Scala. For example, Escalante is a Scala application server based on JBoss AS 7. Spray provides a REST/HTTP-based integration layer over Scala and Akka and supports any Servlet 3.0 compliant container.

  • Does undertow allow session management using Infinispan ?

    Yes, it does.

  • Where can we see approximate price-list for EAP production deployments in numbers?

    Contact Red Hat sales at http://www.redhat.com/contact/sales for a price list of JBoss EAP.

  • Why has JBoss performance metrics never been published to SpecJ?

    We do performance benchmark testing in our regular test suite and really care about it. We are planning to submit SPECjEnterprise 2010 benchmark numbers on a fully open source stack in future.

  • How CentOS relates to JBoss EAP?

    CentOS is not related to JBoss EAP. CentOS is a community project providing a distribution of Linux, while JBoss EAP is an enterprise-class application server product provided by Red Hat. Red Hat is involved in and contributes to a wide range of open source communities including CentOS and JBoss.org. Complete list of JBoss supported configurations can be found here.

  • When EAP will support websockets as WildFly does

    We are investigating back porting WebSocket support to EAP 6.x. EAP 7 is planned to be Java EE 7 compatible and will support WebSocket. Stay tuned for more details at Red Hat Summit.

  • Is it possible to have a customized JBoss EAP version  that addresses a specific need?

    You can customize the JBoss EAP by manipulating subsystems in configuration files. But we recommend talking to sales so that they can understand your needs better and offer a comprehensive solution.

  • Which version of JBoss EAP 6.x.x will be based on Wildfly 8 ?

    JBoss EAP 6.x will continue to be derived from JBoss AS 7.x.x. We are considering backporting some features of WildFly to EAP 6.x. JBoss EAP 7 will be derived from a future version of WildFly.

  • What will be approximate cost for 8 processor single instance deployment? for EAP 6.2?

    Contact sales for an exact quote.

  • We are moving some of application servers from WL to JBoss. But i find it hard to do it  is there is seamless process which can help in migration ?

    Red Hat has recognized the importance of supporting a first-class program around migration that kicked off in 2013. One of the key enablers in our migration story is Windup, which we are working with several customers and partners to enhance in order to have a more effective and streamlined migration process. More details about migration tools is available here.

  • Does EAP use standard JPA artifacts??

    Yes, JBoss EAP is Java EE 6 compliant and so provides support for JPA 2.

  • Will Tomcat still be supported in WildFly 8?  If not  does Undertow support the AJP Connector interface? Or will it have a different connector interface?

    Undertow is the new web server for WildFly 8 and Tomcat will not be supported in WildFly 8. AJP Connector is already supported.

  • Is it easy to migrate from JBoss AS 7.1.1 to JBoss eap 6.2?

    As a general rule, we provide seamless migration from upstream projects to corresponding products. Migrating from AS 7.1.x to JBoss EAP 6.2 should be very straight forward. Guides are provided across major versions, for example Migration Guide from EAP 5.x to EAP 6.2 is here. You should also look at JBoss Migration Center for additional tools in this area.

  • Are Wildfly and EAP different installations?  i.e. How to go from Dev evaluation to Production with support?

    Yes, you can’t automagically update a WildFly installation to become EAP – they are separate installations. You need to redeploy your applications and recreate your resources from community projects like WildFly to products like JBoss EAP.

  • Can we pay less for licensing  if we don’t want any support  only right to deploy and documentation?

    Red Hat only charges for subscriptions, there is no licensing cost.

  • OEM licensing? Can we deploy wildfly & EAP depending on customer paying or not paying for EAP?

    Contact sales for an exact quote.

  • Please elaborate: Red Hat JBoss BRMS

    Red Hat JBoss BRMS is a comprehensive platform for business rules management and complex event processing. More details here.

  • Is there a good quickstart for migrating glassfish to EAP from a JMS perspective??  like setting up JMS ConnectionFactory

    Stay tuned, a white paper is coming soon on this topic.

  • How about WildFly with eclipse?

    http://blog.arungupta.me/2013/12/getting-started-jboss-tools-wildfly-techtip-5 shows WildFly and Eclipse integration.

  • paper on JBOSS Clustering vs. Weblogic Clustering. Some module to use on Apache for three tier implementation  like we have mod_weblogic similar for jboss ?

    mod_cluster is a cluster-aware plugin for Apache HTTPD that can be used to provide software-based load balancing for clustered JBoss EAP deployments.

  • What is next for WildFly?

    WildFly 9 feature set and scope is still being discussed. If there are any particular features that you need then please file issues in JIRA. You can also follow the community at @WildFlyAS. We’ll provide more details at JUDCon and Red Hat Summit.

  • Can JBoss EAP be used for evaluation and development without buying a license
    ?

    JBoss EAP is licensed royalty-free. In particular, JBoss EAP can be downloaded from jboss.org and used for evaluation and development without payment of a license fee. If you download JBoss EAP from jboss.org and use it in production you are obligated to purchase a subscription — otherwise you are in breach of the agreement covering the download.

  • What major companies are using EAP currently?

    Mitsubishi, E*Trade, Sprint, GEICO and many others listed here.

  • Are all the features in JBoss 7.1.2 in wildfly 8?

    This is generally true. However the specifications pruned by Java EE (JAX-RPC (JSR 101), JAXR (JSR 93), EJB Entity Beans (part of JSR 153), and Java EE Application Deployment (JSR 88)) are removed from WildFly. Also, JBoss Web is now replaced by Undertow as the web server.

  • If you use WildFly for dev and EAP for production  how do you make sure that the JEE versions are compatible?

    First of all, there is no such thing as “JEE” :-)

    JBoss EAP 5.x is downstream from JBoss AS 5.x and both are Java EE 5 compliant. JBoss EAP 6.x is downstream of JBoss AS 7.x and both are java EE 6 compliant. JBoss EAP 7 will be based on a future version of WildFly and both will be Java EE 7 compliant. Java EE N+1 compliant application server will support Java EE N applications as well. So make sure to choose your development and deployment environments accordingly.

  • Does a subscription for JBoss EAP 6 include the ‘JBoss Enterprise SOA Platform’ or similar SOA Platform?

    A subscription for any individual JBoss Enterprise Middleware product includes development use for all of the products in the JBoss Enterprise Middleware portfolio. Please refer to the Red Hat JBoss Subscription Guide for details.

 

Deploy to WildFly using jboss-cli (Tech Tip #11)

WildFly provides multiple ways to deploy to your applications.

So far we’ve seen:

This tip will cover the most likely way to deploy deploy applications to WildFly, i.e. jboss-cli.

jboss-cli is Command Line Interface management tool for a standalone server or a managed domain. It is available in the “bin” directory of unzipped WildFly distribution and allows a user to connect to a standalone server or domain controller and execute management operations.

“jboss-cli” can be used to deploy applications using the interactive console or in a non-interactive manner.

Lets look at interactive first:

    • Use jboss-cli to connect with the existing standalone instance by giving the following command:
      The -c switch connects using the default host (‘localhost’) and management port (‘9990’). These values are specified in ‘bin/jboss-cli.xml’ and can be updated.

      This opens up the “jboss-cli” interactive console and shows the following prompt:

      The prompt indicates that ‘jboss-cli’ is connected to a standalone instance’s management port.

    • Deploy the application by giving the following command in console:

      The directory name of the war file in the command may be different depending upon how ‘jboss-cli’ was invoked. Verify the server log to ensure that the application was redeployed. Look for specific timestamp in the log entries.

      --force switch can be included in the command to replace the existing application.

    • Verify the deployment status by typing the following command deployment-info in the console:

      and see the output as:

      Verify the server log to ensure that the application was deployed. Look for specific timestamp in the log entries.

    • Undeploy the application by giving the following command:

    • Type “exit” or “quit” to exit the interactive console.

Now lets look at how these commands can be issued non-interactively very easily.

  • Deploy the application as:
  • Verify the deployment status as:
  • Undeploy the application as:

Deploy to WildFly using curl (Tech Tip #10)

WildFly 8 provide multiple ways to deploy your web applications.

So far we’ve seen:

This tip will show how to use curl to deploy your applications to WildFly.

Deploying applications using curl is a two-step process.

Step 1: Upload your archive to WildFly using the following command:

This command:

  • Makes a POST request using form-encoded (“-F”) data with one field (“file”) defining the location of the WAR file
  • “target/javaee7-1.0-SNAPSHOT.war” is the location of the WAR file
  • “u1” is the administrative user with password “p1”
  • “localhost:9090” is the default management host and port for WildFly instance
  • WildFly management port uses digest authentication and that is defined using “–digest”
  • Prints the output as something like:
    {“outcome” : “success”, “result” : { “BYTES_VALUE” : “+Dg9u1ALXacrndNdLrT3DQSaqjw=” }}

Step 2: Deploy the archive

This command:

  • Sends a POST request (“-d”) with JSON payload
  • The value assigned to “result” name in the JSON response of previous command is used in this command
  • Content type of the payload is explicitly specified to be “application/json”
  • “add” command triggers the deployment of the archive
  • Application archive is enabled as well, as opposed to not by default
  • As earlier, “u1” is the administrative user with password “p1”
  • As earlier, “localhost:9090” is the default management host and port for WildFly instance
  • As earlier, WildFly management port uses digest authentication and that is defined using “–digest”

Now your application is available at http://localhost:8080/javaee7/EmployeeList or whatever the context root is!

That’s it!

Additional ways to deploy your applications will be discussed in subsequent blogs.

WildFly Maven Plugin to Deploy Applications and Artifacts (Tech Tip #9)

Applications can be deployed to WildFly in many different ways. One of the typical ways it to use the wildfly-maven-plugin. This tech tip will provide details on that.

Actually, you just need to add wildfly-maven-plugin to your pom.xml as:

And that’s it!

Fire up a WildFly instance as explained in Tech Tip #1. Deploy your application to this WildFly instance using:

Simple, isn’t it ?

You can even start a WildFly instance defined by -Djboss-as.home property and deploy the application using the following command:

The property -Djboss-as.home may not be specified in which case WildFly is downloaded and started and the application is deployed to it.

The version of WildFly to be downloaded can be optionally specified as:

Now this application can be redeployed as:

Or undeployed as:

This plugin provide lots of other targets:

Goals Description
wildfly:deploy-only Only deploy, without packaging
wildfly:redeploy-only Redeploy, without packaging
wildfly:add-resource Adds a resource to the server (only in domain mode)
wildfly:add-artifact Adds an arbitrary artifact
wildfly:execute-command Execute commands to the running instance, batch mode supported as well

Refer to the plugin usage page and documentation for complete details.

Other deployment mechanisms such as jboss-cli, web-based admin console, REST API, and filesystem based will be covered in future blogs.

What is your typical way to deploy an application to WildFly ?

What is your deployment preference during development ? Does it differ from testing deployment phase ?

Multiple Instances of WildFly on Different Ports on Same Machine (Tech Tip #8)

WildFly can be started on the default port 8080 using:

./bin/standalone.sh

The default landing page is then accessible at localhost:8080 and looks like:

tt1-wildfly-welcome

The default admin console is accessible at localhost:9990/console and looks like:

tt8-admin-console

Do you want to start another WildFly standalone instance on the same machine on a different port ?

./bin/standalone.sh -Djboss.socket.binding.port-offset=1000

will start another standalone server on port 8080 + 1000. And so the landing page is now accessible at localhost:9080. Similarly, admin console is now accessible at localhost:10990/console.

Similarly, you can start multiple instances by specifying port offset.