JBoss.orgCommunity Documentation
This chapter contains important information for migrating to newer versions of Errai. If you experience any problems, don't hesitate to get in touch with us. See Chapter 18, Reporting problems .
The first issues that will arise after replacing the jars or after changing the version numbers in the
pom.xml
are unresolved package imports. This is due to refactorings that became necessary when the project grew. Most of these import problems can be resolved automatically by modern IDEs (Organize Imports). So, this should replace
org.jboss.errai.bus.client.protocols.*
with
org.jboss.errai.common.client.protocols.*
for example.
The following is a list of manual steps that have to be carried out when upgrading:
@ExposedEntity became @Portable (
org.jboss.errai.common.client.api.annotations.Portable
). See
Chapter 5, Marshalling
for details.
The @Conversational annotation must now target the event objects themselves, not the observer methods of the events. So an event type is either conversational or not; you no longer specify that listeners receive arbitrary events in a conversational context. See the Conversational Events section of the CDI chapter for details.
Errai CDI projects must now use the
SimpleDispatcher
instead of the
AsynDispatcher
. This has to be configured in
Section 12.4, “ErraiService.properties”
.
The bootstrap listener (configured in
WEB-INF/web.xml
) for Errai CDI has changed (
org.jboss.errai.container.DevModeCDIBootstrap
is now
org.jboss.errai.container.CDIServletStateListener
).
gwt 2.3.0 or newer must be used and replace older versions.
mvel2 2.1.Beta8 or newer must be used and replace older versions.
weld 1.1.5.Final or newer must be used and replace older versions.
slf4j 1.6.1 or newer must be used and replace older versions.
This step can be skipped if Maven is used to build the project. If the project is NOT built using Maven, the following jar files have to be added manually to project's build/class path: errai-common-2.x.jar, errai-marshalling-2.x.jar, errai-codegen-2.x.jar, netty-4.0.0.Alpha1.errai.r1.jar.
If the project was built using an early version of an Errai archetype the configuration of the maven-gwt-plugin has to be modified to contain the
<hostedWebapp>path-to-your-standard-webapp-folder</hostedWebapp>
. This is usually either
war
or
src/main/webapp
.
The following is a list of manual steps that have to be carried out when upgrading from a 2.0.Beta version to 2.0.CR1 or 2.0.Final:
Starting with 2.0.CR1 the default for automatic service discovery has been changed in favour of CDI based applications. That means it has to be explicitly turned on for plain bus applications (Errai applications that do not use Errai-CDI). Not doing so will result in
NoSubscribersToDeliverTo
exceptions. The snippet below shows how to activate automatic service discovery:
Example 15.1. web.xml
<servlet>
<servlet-name>ErraiServlet</servlet-name>
<servlet-class>org.jboss.errai.bus.server.servlet.DefaultBlockingServlet</servlet-class>
<init-param>
<param-name>auto-discover-services</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
The
jboss7-support
module was deleted and is no longer needed as a dependency.
There are some breaking API changes in the update from Errai 2.2.x to Errai 3.0.x.
Here are the steps you'll need to take to get your project compiling after you update to Errai 3:
Use your IDE to organize imports at the top level. In eclipse, you'd click in the Project Explorer, press Ctrl-A (select all) and then Ctrl-O (Organize Imports). Other IDEs have similar features.
The
ErrorCallback
interface has been made more general so the same type can be shared between Errai modules. This allows you reuse your own generic error handler class for, eg, Errai JAX-RS and ErraiBus callbacks. If you want to use a generic error handler throughout your app, change your
ErrorCallback
implementations to
ErrorCallback<?>
and change the first argument type of your error() method to Object. Otherwise, if you have use-case-specific error callbacks, implement the interfaces
RestErrorCallback
or
BusErrorCallback
as appropriate.
Note: Errai 3 is still changing rapidly, so this section is a work in progress. Please add any additional steps you had to take in upgrading your own codebase from Errai 2.2.