Reputation: 13727
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.
Upvotes: 3
Views: 1002
Reputation: 21
this worked for me:
I replaced wildfly-jms-client-bom
:
<dependency>
<groupId>org.jboss.eap</groupId>
<artifactId>wildfly-jms-client-bom</artifactId>
<version>7.1.0.GA-redhat-11</version>
<type>pom</type>
</dependency>
with javaee-api
:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
and added an explicit dependency on module org.apache.activemq.artemis
(the following ultimately adds Dependencies: org.apache.activemq.artemis
in META-INF/MANIFEST.MF
inside the war
file):
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifestEntries>
<Dependencies>org.apache.activemq.artemis</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
Upvotes: 0
Reputation: 13727
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"/>
Upvotes: 0
Reputation: 2983
You really shouldn't need either of those if you write standard EE code. If you use standard EJB or JMS, Wildfly will automatically detect it and load the modules for you.
Most projects should only need this:
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-7.0</artifactId>
<version>1.0.2.Final</version>
<scope>provided</scope>
<type>pom</type>
</dependency>
Upvotes: 1