使用Wildfly模块而不是wildfly-X-client-bom依赖项

问题描述 投票:2回答:3

我有两个Wildfly服务器。服务器A连接到服务器B上的JMS主题和EJB。它们都是Wildfly 8.2.0.Final。

服务器A上的客户端(.war)具有以下Maven依赖项:

  <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>

是否有可能摆脱这些限制,而只是要求将特定的Wildfly模块加载到jboss-deployment-structure.xml中?似乎这些Maven依赖项会增加.war的大小。

谢谢!

编辑:] >>

[要在服务器B上查找EJB

,我使用的是这里列出的“ 1. EJB客户端库”技术:http://blog.akquinet.de/2014/09/26/jboss-eap-wildfly-three-ways-to-invoke-remote-ejbs/。我的代码与示例非常相似:
Properties prop = new Properties();
prop.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
Context context = new InitialContext(prop);

和:

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}

和:context.lookup("ejb:/myapp/remote/calculator!de.akquinet.jbosscc.ejb.Calculator");

要连接到服务器B上的JMS主题,我正在使用:

     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;
     }

执行这些查找的代码在我的.war使用的Maven库中。该库照常进入WEB-INF / lib /。

我有两个Wildfly服务器。服务器A连接到服务器B上的JMS主题和EJB。它们都是Wildfly 8.2.0.Final。服务器A上的客户端(.war)具有以下maven依赖项:

maven jboss wildfly wildfly-8
3个回答
0
投票

如果编写标准EE代码,您实际上不需要任何一个。如果您使用标准EJB或JMS,Wildfly将自动检测它并为您加载模块。


0
投票

我能够通过在jboss-deployment-structure.xml中添加依赖项来解决此问题,以便加载其他JBoss模块。


0
投票

这对我有用:

© www.soinside.com 2019 - 2024. All rights reserved.