Chapter 1. Get Started Developing Applications

1.1. Become Familiar with Java Enterprise Edition 8

1.1.1. Overview of Java EE 8 Profiles

Java Enterprise Edition (Java EE) 8, as defined in JSR 366, includes support for profiles, which are subsets of APIs that represent configurations that are suited to specific classes of applications.

Java EE 8 defines specifications for the Web and the Full Platform profiles. A product can choose to implement the Full Platform, the Web Profile, or one or more custom profiles, in any combination.

  • The Web Profile includes a selected subset of APIs that are designed to be useful for web application development.
  • The Full Platform profile includes the APIs defined by the Java EE 8 Web Profile, plus the complete set of Java EE 8 APIs that are useful for enterprise application development.

JBoss EAP Continuous Delivery 14 implements the Java EE 8 Full Platform and the Web Profile specifications. See Java EE 8 Profiles and Technologies Reference for the list of Java EE 8 technologies, JSRs, and whether they are inluded in the Web and Full Platform profiles.

See Java™ EE 8 Technologies for the complete list of Java EE 8 APIs.

Note

Java EE also includes support for JSR 375, which defines portable, plug-in interfaces for authentication and identity stores, and a new injectable-type SecurityContext interface that provides an access point for programmatic security. You can use the built-in implementations of these APIs, or define custom implementations.

1.2. Setting up the Development Environment

It is recommended to use JBoss Developer Studio 11.0 or later with JBoss EAP 7.2.

  1. Download and install JBoss Developer Studio.

    For instructions, see Installing JBoss Developer Studio Stand-alone Using the Installer in the JBoss Developer Studio Installation Guide.

  2. Set up the JBoss EAP server in JBoss Developer Studio.

    For instructions, see Using Runtime Detection to Set Up JBoss EAP from within the IDE in the Getting Started with JBoss Developer Studio Tools guide.

1.3. Configure Annotation Processing in JBoss Developer Studio

Annotation Processing (AP) is turned off by default in Eclipse. If your project generates implementation classes, this can result in java.lang.ExceptionInInitializerError exceptions, followed by CLASS_NAME (implementation not found) error messages when you deploy your project.

You can resolve these issues in one of the following ways. You can enable annotation processing for the individual project or you can enable annotation processing globally for all JBoss Developer Studio projects.

Enable Annotation Processing for an Individual Project

To enable annotation processing for a specific project, you must add the m2e.apt.activation property with a value of jdt_apt to the project’s pom.xml file.

<properties>
    <m2e.apt.activation>jdt_apt</m2e.apt.activation>
</properties>

You can find examples of this technique in the pom.xml files for the logging-tools and kitchensink-ml quickstarts that ship with JBoss EAP.

Enable Annotation Processing Globally in JBoss Developer Studio

  1. Select WindowPreferences.
  2. Expand Maven, and select Annotation Processing.
  3. Under Select Annotation Processing Mode, select Automatically configure JDT APT (builds faster , but outcome may differ from Maven builds), then click Apply and Close.

1.4. Configure the Default Welcome Web Application

JBoss EAP includes a default Welcome application, which displays at the root context on port 8080 by default.

This default Welcome application can be replaced with your own web application. This can be configured in one of two ways:

You can also disable the welcome content.

Change the welcome-content File Handler

  1. Modify the existing welcome-content file handler’s path to point to the new deployment.

    /subsystem=undertow/configuration=handler/file=welcome-content:write-attribute(name=path,value="/path/to/content")
    Note

    Alternatively, you could create a different file handler to be used by the server’s root.

    /subsystem=undertow/configuration=handler/file=NEW_FILE_HANDLER:add(path="/path/to/content")
    /subsystem=undertow/server=default-server/host=default-host/location=\/:write-attribute(name=handler,value=NEW_FILE_HANDLER)
  2. Reload the server for the changes to take effect.

    reload

Change the default-web-module

  1. Map a deployed web application to the server’s root.

    /subsystem=undertow/server=default-server/host=default-host:write-attribute(name=default-web-module,value=hello.war)
  2. Reload the server for the changes to take effect.

    reload

Disable the Default Welcome Web Application

  1. Disable the welcome application by removing the location entry / for the default-host.

    /subsystem=undertow/server=default-server/host=default-host/location=\/:remove
  2. Reload the server for the changes to take effect.

    reload