Some subsystems require configuration to work properly on EC2. This comes from the fact that the server is usually bound to the instance private IP address (10.x.x.x) which is only visible from inside EC2, but that address is mapped to an instance public IP address, which is visible from outside the cloud.
WebServices:
When a client makes a web service request through
Service.create(wsdlURL, serviceName);
he connects to the server public IP address, but is subsequently redirected to an address that is defined inside the server configuration files in the webservices subsystem. This address is by default ${jboss.bind.address:127.0.0.1}, which means that on EC2, the caller will get redirected to the server's private IP address and will be unable to resolve the request. The server's public IP address has to be configured in the element
<wsdl-host>$\{jboss.bind.address:127.0.0.1\}</wsdl-host>
in standalone or domain configuration files.
This can also be done through CLI:
/subsystem=webservices:write-attribute(name=wsdl-host,value=PUBLIC_IP_ADDRESS)
Messaging:
The cause of problems is the same, but the configuration is a little different. In *-full*.xml configuration files, the messaging subsystem has element
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
The socket-binding needs to reference a new socket binding, let's call it "messaging-socket-binding". Then, the new socket binding has to be created in the socket-binding-group at the bottom of the configuration files:
<outbound-socket-binding name="messaging-socket-binding"> <remote-destination host="PUBLIC_IP_ADDRESS" port="${jboss.http.port:8080}" </outbound-socket-binding>
This can also be done through CLI:
/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=messaging-socket-binding:add(host=PUBLIC_IP_ADDRESS,port=${jboss.http.port:8080})
/subsystem=messaging-activemq/server=default/http-connector=http-connector:write-attribute(name=socket-binding,value=messaging-socket-binding)