segunda-feira, 10 de março de 2014

JNDI in WildFly

In a previous message of mine, I guided the reader through the process of creating Java Message Service applications. I provided a simple example with a sender and a receiver. This application worked for JBoss AS 7, but ceased to work in version 8/WildFly. One of the reasons for this lies on the JNDI server, which left port 4447 and moved to port 8080. The exact ports depend on the configuration, but the idea is that the JNDI service no longer occupies a port for itself and shares the port with the rest of the Application Server.

This immediately breaks the legacy code. Unfortunately, changing the port is not enough to put our old clients back on track. We have to change the communication protocol in the jndi.properties file, as follows (note the "http-remoting"):



java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory
java.naming.provider.url=http-remoting://localhost:8080
jboss.naming.client.ejb.context=true
#username
java.naming.security.principal=joao
#password
java.naming.security.credentials=pedro


The only difference lies in the url line. A few other small differences may exist in what concerns the creation of users and the roles that users can play, but this is the detail where I lost most of the time.