This article demonstrates how inbound request from a webserver (Apache) can be proxied to an application server (WildFly 10) using the Apache JServ Protocol (AJP). For more information on what AJP actually is, take a look at https://en.wikipedia.org/wiki/Apache_JServ_Protocol .
WildFly 10 Configuration
First you have to add an ajp-listener to the undertow subsystem (line 4).
standalone.xml – undertow subsystem:
<ajp-listener name="ajp" socket-binding="ajp" max-post-size="1048576000"/>
<http-listener name="default" max-post-size="2048576000" socket-binding="http"/>
<host name="default-host" alias="localhost">
<response-header name="server-header" header-name="Server" header-value="WildFly/10"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
Then you also have to add a socket-binding (line 4).
In Java Enterprise, the EJB (Enterprise Java Bean) technology is often used to create a service layer of a J2EE application running in an application Server (like Glassfish or Wildfly). While accessing these EJB instance is relatively easy from inside the same application (using
@EJB annotations for automatic dependency injection), it is sometimes also required to call some methods on the EJBs from outside the application server.
The JavaEE standard provides the “EJB remoting” functionality to do so. In this article I want to show how to access an EJB running in a Wildfly application server from a standalone Java application.
All code examples are also available on our Github page: https://github.com/illucIT/remote-ejb-example
The basic setup of Solr 4.10 with Eclipse 4.4 and Wildfly 8.1 requires quite a bit of configuration. First of all, be sure that your system fulfills the following requirements.
- Java Development Kit (jdk1.8.0_25)
- Eclipse Java EE IDE for Web Developers (Luna Service Release 1 (4.4.1))
- Apache Maven (already included in Eclipse)
- WildFly Application Server (wildfly-8.1.0.Final)
- JBossAS Tools (3.0.0.CR1) for Eclipse)
The specified version numbers are the versions I’m using. The tutorial should however apply to other major versions, too.