I have two Wildfly servers. Server A connects to JMS topics and EJB's on Server B. They are both Wildfly 8.2.0.Final.
The client (a .war) on Server A has these maven dependencies:
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-ejb-client-bom</artifactId>
<version>8.2.0.Final</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-jms-client-bom</artifactId>
<version>8.2.0.Final</version>
<type>pom</type>
</dependency>
Is it possible to get rid of those, and just ask for specific Wildfly modules to be loaded in jboss-deployment-structure.xml instead? It seems like these Maven dependencies would increase the size of my .war.
Thanks!
Edit:
To look up EJB's on Server B, I'm using the "1. EJB client library" technique listed here: http://blog.akquinet.de/2014/09/26/jboss-eap-wildfly-three-ways-to-invoke-remote-ejbs/. My code is very similar to the example:
Properties prop = new Properties();
prop.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
Context context = new InitialContext(prop);
And:
remote.connections=default
remote.connection.default.host=127.0.0.1
remote.connection.default.port=8080
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false
remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=${host.auth:JBOSS-LOCAL-USER}
remote.connection.default.username=${username}
remote.connection.default.password=${password}
And: context.lookup("ejb:/myapp/remote/calculator!de.akquinet.jbosscc.ejb.Calculator");
To connect to a JMS topic on Server B I'm using:
final InitialContext initialContext = new InitialContext( m_jndiProperties );
final ConnectionFactory connectionFactory = getConnectionFactory( initialContext );
final Connection connection = connectionFactory.createConnection( m_clientKey.getUsername(), m_clientKey.getPassword() );
try
{
final Topic updateTopic = getUpdateTopic( initialContext );
final TopicSubscriber subscriber;
if( m_isDurableSubscription )
{
connection.setClientID( m_clientKey.getJmsClientId() );
connection.setExceptionListener( m_exceptionListener );
final Session subscriberSession = connection.createSession( false, Session.AUTO_ACKNOWLEDGE );
subscriber = subscriberSession.createDurableSubscriber( updateTopic, m_clientKey.getJmsSubscriptionId() );
}
else
{
connection.setExceptionListener( m_exceptionListener );
final Session subscriberSession = connection.createSession( false, Session.AUTO_ACKNOWLEDGE );
subscriber = ( (TopicSession)subscriberSession ).createSubscriber( updateTopic );
}
connection.stop();
subscriber.setMessageListener( m_msgListener );
m_connection = connection;
maybeLogMessage( m_logger, GenericLogLevel.INFO, "Successfully subscribed to topic: '" + topicName + "'." );
}
catch( JMSException | NamingException e )
{
//noinspection ThrowableResultOfMethodCallIgnored
JMSCloser.close( connection );
throw e;
}
The code to do these lookups is in a maven library that my .war uses. The library goes into WEB-INF/lib/ as usual.
I was able to solve this by adding dependencies in jboss-deployment-structure.xml so that additional JBoss modules are loaded.
To be an EJB client: <module name="org.jboss.remote-naming"/>
(your mileage may vary depending on how you are looking up EJB's).
To be a JMS client: <module name="org.hornetq"/>