JBoss.orgCommunity Documentation

Chapter 15. Configuration

15.1. Errai Development Mode Configuration
15.1.1. Deployment in Development Mode (JBossLauncher)
15.1.2. Additional JBossLauncher Arguments
15.1.3. Deployment to an Application Server
15.2. ErraiApp.properties
15.2.1. As a Marker File
15.2.2. As a Configuration File
15.3. Messaging (Errai Bus) Configuration
15.3.1. Compile-time Dependencies
15.3.2. Disabling remote communication
15.3.3. Configuring an alternative remote remote bus endpoint
15.3.4. ErraiService.properties
15.3.5. Servlet Configuration
15.4. Errai JAX-RS Setup
15.4.1. Compile-time dependency
15.4.2. GWT Module
15.4.3. Configuration
15.5. Errai JPA
15.5.1. Compile-time Dependencies
15.5.2. GWT Module Descriptor
15.6. Errai JPA Data Sync
15.6.1. Compile-time Dependencies
15.6.2. GWT Module Descriptor
15.7. Errai Data Binding
15.7.1. Compile-time Dependencies
15.7.2. GWT module descriptor
15.7.3. Bootstrapping Data Binding without Errai IOC
15.8. Errai UI
15.8.1. Compile-time dependency
15.8.2. GWT Module Descriptor
15.9. Errai UI Navigation
15.9.1. Compile-time Dependencies
15.9.2. GWT Module Descriptor
15.10. Errai Cordova (Mobile Support)
15.10.1. Compile-time Dependencies
15.10.2. Cordova Maven Plugin
15.10.3. GWT Module Descriptor
15.10.4. Building with Errai Cordova
15.11. Errai Security
15.11.1. Compile-time dependency
15.11.2. GWT Module Descriptor
15.11.3. CDI and Interceptor Bindings
15.12. Errai Project Dependencies
15.12.1. Errai Messaging
15.12.2. Errai CDI
15.12.3. Errai IOC
15.12.4. Errai UI
15.12.5. Errai Navigation
15.12.6. Errai DataBinding
15.12.7. Errai JPA Client
15.12.8. Errai JPA Datasync
15.12.9. Errai JAXRS
15.12.10. Errai Cordova
15.12.11. Errai Security

This section contains information on manually setting up Errai and describes additional configurations and settings which may be adjusted.

In development mode we need to bootstrap the CDI environment on our own and make both Errai and CDI available through JNDI (common denominator across all runtimes). GWT by default uses Jetty, that only supports read only JNDI. The current solution for this is to use a custom launcher to control a JBoss AS 7 or Wildfly 8 instance instead of GWT’s built-in Jetty.

To do this, requires the following configurations in the gwt-maven-plugin configuration:


<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>gwt-maven-plugin</artifactId>
  <version>${gwt.version}</version>

  <configuration>
  ...
    <extraJvmArgs>-Derrai.jboss.home=$JBOSS_HOME -Derrai.jboss.javaagent.path=${settings.localRepository}/org/jboss/errai/errai-client-local-class-hider/$ERRAI_VERSION/errai-client-local-class-hider-$ERRAI_VERSION.jar</extraJvmArgs>
    <noServer>false</noServer>
    <server>org.jboss.errai.cdi.server.gwt.JBossLauncher</server>
  </configuration>
  <executions>
  ...
  </executions>
</plugin>

What does all this mean?

We provide integration with the JBoss Application Server, but the requirements are basically the same for other vendors. When running a GWT client app that leverages CDI beans on a Java EE 6 application server, CDI is already part of the container and accessible through JNDI (java:/BeanManager).

ErraiApp.properties acts both as a marker file for JARs that contain Errai-enabled GWT modules, and as a place to put configuration settings for those modules in the rare case that non-default configuration is necessary.

ErraiApp.properties is usually left empty, but it can contain configuration settings for both the core of Errai and any of its extensions. Configuration properties defined and used by Errai components have keys that start with " errai. ". Third party extensions should each choose their own prefix for keys in ErraiApp.properties.

The ErraiService.properties file contains basic configuration for the bus itself. Unlike ErraiApp.properties, there should be at most one ErraiService.properties file on the classpath of a deployed application. If you do not need to set any properties to their non-default values, this file can be omitted from the deployment entirely.

Dispatchers encapsulate the strategy for taking messages that need to be delivered somewhere and seeing that they are delivered to where they need to go. There are two primary implementations that are provided with Errai, depending on your needs.

SimpleDispatcher:

SimpleDispatcher is basic implementation that provides no asychronous delivery mechanism. Rather, when you configure the Errai to use this implementation, messages are delivered to their endpoints synchronously. The incoming HTTP thread will be held open until the messages are delivered.

While this sounds like it has almost no advantages, especially in terms of scalablity. Using the SimpleDispatcher can be far preferable when you’re developing your application, as any errors and stack traces will be far more easily traced and some cloud services may not permit the use of threads in any case.

AsyncDispatcher:

The AsyncDispatcher provides full asynchronous delivery of messages. When this dispatcher is used, HTTP threads will have control immediately returned upon dispatch of the message. This dispatcher provides far more efficient use of resources in high-load applications, and will significantly decrease memory and thread usage overall.

Errai has several different implementations for HTTP traffic to and from the bus. We provide a universally-compatible blocking implementation that provides fully synchronous communication to/from the server-side bus. Where this introduces scalability problems, we have implemented many webserver-specific implementations that take advantage of the various proprietary APIs to provide true asynchrony.

These included implementations are packaged at: org.jboss.errai.bus.server.servlet .

Errai Cordova allows you build an Errai app to natively run on a device. In order to make this as easy as possible we have a maven plugin that will create a native binary that you can install on a device. It will put the html and javascript of you application in a cordova application.


<build>
 ...
    <plugins>
      <plugin>
        <groupId>org.jboss.errai</groupId>
        <artifactId>cordova-maven-plugin</artifactId>
        <version>${errai.version}</version>
      </plugin>

For those not using maven, here is the dependency tree of Errai project jars.