I am trying to setup an embedded activeMQ with Jboss 7.3.0 and activemq-rar-5.6.0.
The embedded broker should be accessible from inside Jboss and also from outside(via tcp from another application)
I am facing the following exception when i start jboss with 'standalone.bat -c standalone-full.xml'
**Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.ra.activemq-ra is already registered**
I really appreciate any guidance on why i am getting this exception. I have attached below an image from the log.
Below are my configurations.
I added a resource adapter inside resource-adapters subsystem in standalone-full.xml file
<subsystem xmlns="urn:jboss:domain:resource-adapters:5.0">
<resource-adapters>
<resource-adapter id="activemq-ra.rar">
<archive>
activemq-ra.rar
</archive>
<transaction-support>XATransaction</transaction-support>
<!-- <config-property name="ServerUrl">tcp://localhost:61616</config-property> -->
<config-property name="ServerUrl">vm://localhost</config-property>
<connection-definitions>
<connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/activemq/ConnectionFactory" enabled="true" use-java-context="true" pool-name="ActiveMQConnectionFactoryPool" use-ccm="true">
<xa-pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>20</max-pool-size>
</xa-pool>
</connection-definition>
</connection-definitions>
<admin-objects>
<admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/queue/HELLOWORLDMDBQueue" use-java-context="true" pool-name="HELLOWORLDMDBQueue">
<config-property name="PhysicalName">HELLOWORLDMDBQueue</config-property>
</admin-object>
<admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/HELLOWORLDMDBTopic" use-java-context="true" pool-name="HELLOWORLDMDBTopic">
<config-property name="PhysicalName">HELLOWORLDMDBTopic</config-property>
</admin-object>
</admin-objects>
</resource-adapter>
</resource-adapters>
</subsystem>
I updated the resource-adapter-ref inside the mdb tag in standalone-full.xml file.
<subsystem xmlns="urn:jboss:domain:ejb3:6.0">
<session-bean>
<stateless>
<bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
</stateless>
<stateful default-access-timeout="5000" cache-ref="simple" passivation-disabled-cache-ref="simple"/>
<singleton default-access-timeout="5000"/>
</session-bean>
<mdb>
<!--<resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-ra.rar}"/> -->
<resource-adapter-ref resource-adapter-name="activemq-ra.rar"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
The messaging subsystem inside standalone-full.xml is
<subsystem xmlns="urn:jboss:domain:messaging-activemq:8.0">
<server name="default">
<statistics enabled="${wildfly.messaging-activemq.statistics-enabled:${wildfly.statistics-enabled:false}}"/>
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
<http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-connector>
<http-acceptor name="http-acceptor" http-listener="default"/>
<http-acceptor name="http-acceptor-throughput" http-listener="default">
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-acceptor>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="myTestQ" entries="java:jboss/exported/jms/queue/myTestQ"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
</server>
</subsystem>
I Updated ra.xml file, changed the ServerUrl to tcp://localhost:61616
<resourceadapter-class>org.apache.activemq.ra.ActiveMQResourceAdapter</resourceadapter-class>
<config-property>
<description>
The URL to the ActiveMQ server that you want this connection to connect to. If using
an embedded broker, this value should be 'vm://localhost'.
</description>
<config-property-name>ServerUrl</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>tcp://localhost:61616</config-property-value>
<!--<config-property-value>vm://localhost</config-property-value> -->
</config-property>
And set the config-property-value of the config-property BrokerXmlConfig in META-INF/ra.xml to xbean:broker-config.xml
<config-property>
<description>
Sets the XML configuration file used to configure the embedded ActiveMQ broker via
Spring if using embedded mode.
BrokerXmlConfig is the filename which is assumed to be on the classpath unless
a URL is specified. So a value of foo/bar.xml would be assumed to be on the
classpath whereas file:dir/file.xml would use the file system.
Any valid URL string is supported.
</description>
<config-property-name>BrokerXmlConfig</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value></config-property-value>
<description>To use the broker-config.xml from the root for the RAR </description>
<config-property-value>xbean:broker-config.xml</config-property-value>
<!-- To use an external file or url location
<config-property-value>xbean:file:///amq/config/jee/broker-config.xml</config-property-value>
-->
</config-property>
I created a new activemq-ra.rar file and placed it in jboss-eap-7.3\standalone\deployments folder.
Try using a different name for your resource adapter archive. For example, use activemq5-ra.rar instead of activemq-ra.rar. I believe you're conflicting with the embedded JCA RA used for ActiveMQ Artemis integration.
Alternatively you could remove the messaging subsystem from your server's XML configuration.
Related
I'm currently trying to fix in issue in our JBOSS Deployment with different SOAP Endpoints, we trying to close the Webservice Interface over https(port 8443) to only allow it via CA Authentication (port 8444).
We are Using JBOSS 7.4.7 and JDK 11
Here are the JBOSS Standalone Configurations:
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="https" port="8443"/>
<socket-binding name="httpsca" port="8444"/>
</socket-binding-group>
[...]
<subsystem xmlns="urn:jboss:domain:undertow:12.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other" statistics-enabled="${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}}">
<buffer-cache name="default"/>
<server name="default-server">
<https-listener name="https" socket-binding="https" max-post-size="0" secure="true" ssl-context="ssl"/>
<https-listener name="httpsca" socket-binding="httpsca" max-post-size="0" secure="true" ssl-context="sslca"/>
</server>
[...]
<subsystem xmlns="urn:jboss:domain:webservices:2.0" statistics-enabled="${wildfly.webservices.statistics-enabled:${wildfly.statistics-enabled:false}}">
<modify-wsdl-address>true</modify-wsdl-address>
<wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
<wsdl-port>8444</wsdl-port>
<wsdl-secure-port>8444</wsdl-secure-port>
<endpoint-config name="Standard-Endpoint-Config"/>
<endpoint-config name="Recording-Endpoint-Config"/>
<client-config name="Standard-Client-Config"/>
</subsystem>
<tls>
<key-stores>
<key-store name="test">
<credential-reference clear-text="****"/>
<implementation type="JKS"/>
<file path="ssl_keystore.jks" relative-to="jboss.server.config.dir"/>
</key-store>
<key-store name="test-trusted">
<credential-reference clear-text="****"/>
<implementation type="JKS"/>
<file path="ssl_truststore.jks" relative-to="jboss.server.config.dir"/>
</key-store>
</key-stores>
<key-managers>
<key-manager name="serverssl" key-store="test">
<credential-reference clear-text="****"/>
</key-manager>
</key-managers>
<trust-managers>
<trust-manager name="serverssl-ca" key-store="test-trusted"/>
</trust-managers>
<server-ssl-contexts>
<server-ssl-context name="test-ssl" cipher-suite-filter="TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,TLS_DHE_DSS_WITH_AES_128_GCM_SHA256,TLS_DHE_DSS_WITH_AES_256_GCM_SHA384" cipher-suite-names="TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256" protocols="TLSv1.2 TLSv1.3" key-manager="serverssl"/>
<server-ssl-context name="test-sslca" cipher-suite-filter="TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,TLS_DHE_DSS_WITH_AES_128_GCM_SHA256,TLS_DHE_DSS_WITH_AES_256_GCM_SHA384" cipher-suite-names="TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256" protocols="TLSv1.2 TLSv1.3" need-client-auth="true" key-manager="serverssl" trust-manager="serverssl-ca"/>
</server-ssl-contexts>
</tls>
We are having trouble setting only one Port for the WSDL Endpoint.
1. If I don't set <wsdl-secure-port>, then the JBOSS throws an error because it trys to create a http endpoint which is not active at all.It also occurs if I only set the <wsdl-secure-port> and not the <wsdl-port>.
Are we doing something wrong or is that a bug from JBOSS ?
Thanks for any help and tips in advice.
We have a WildFly 10 instance configured with ActiveMQ Artemis.
After the server is running for weeks We have found this error on putting a message in a queue:
WARN [com.arjuna.ats.jta] (default task-39) ARJUNA016061: TransactionImple.enlistResource - XAResource.start returned: XAException.XAER_RMFAIL for < formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff0a4809a7:12ad14f2:613b6c2b:8c8976c, node_name=1, branch_uid=0:ffff0a4809a7:12ad14f2:613b6c2b:8c89779, subordinatenodename=null, eis_name=java:/JmsXA NodeId:560e8de4-ccea-11eb-a9ec-014175cacf74 >: javax.transaction.xa.XAException
at org.apache.activemq.artemis.ra.ActiveMQRAXAResource.start(ActiveMQRAXAResource.java:85)
at org.apache.activemq.artemis.service.extensions.xa.ActiveMQXAResourceWrapperImpl.start(ActiveMQXAResourceWrapperImpl.java:121)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:662)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:423)
...
Caused by: ActiveMQConnectionTimedOutException[errorType=CONNECTION_TIMEDOUT message=AMQ119014: Timed out after waiting 30,000 ms for response when sending packet 44]
at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:398)
at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:304)
at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext.simpleRollback(ActiveMQSessionContext.java:299)
at org.apache.activemq.artemis.core.client.impl.ClientSessionImpl.rollback(ClientSessionImpl.java:542)
at org.apache.activemq.artemis.core.client.impl.ClientSessionImpl.rollback(ClientSessionImpl.java:513)
at org.apache.activemq.artemis.core.client.impl.ClientSessionImpl.resetIfNeeded(ClientSessionImpl.java:594)
at org.apache.activemq.artemis.ra.ActiveMQRAXAResource.start(ActiveMQRAXAResource.java:80)
... 131 more
This error appears on each operation on the queues until the server is restarted.
The exception was logged by a local client (a war deployed in the application server itself). The local client sends messages, there are remote consumers consuming them. When the error occurred the as load was not higher than usual. I did not collect a thread dump I can try to collect them if the error occurs again.
The subsystem configuration is:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
<server name="default">
<management jmx-enabled="true" />
<security enabled="false" />
<bindings-directory
path="/data/activemq/bindings" />
<journal-directory path="/data/activemq/journal" />
<large-messages-directory
path="/data/activemq/largemessages" />
<paging-directory path="/data/activemq/pages" />
<security-setting name="#">
<role name="guest" delete-non-durable-queue="true"
create-non-durable-queue="true" consume="true" send="true" />
</security-setting>
<address-setting name="#"
message-counter-history-day-limit="10" page-size-bytes="2097152"
max-size-bytes="104857600" max-delivery-attempts="-1"
redelivery-delay="300000" expiry-address="jms.queue.ExpiryQueue"
dead-letter-address="jms.queue.DLQ" />
<address-setting
name="jms.queue.queue1" max-delivery-attempts="-1"
expiry-address="jms.queue.ExpiryQueue"
dead-letter-address="jms.queue.DLQ" redelivery-delay="120000" />
<http-connector name="http-connector"
endpoint="http-acceptor" socket-binding="messaging" />
<http-connector name="http-connector-throughput"
endpoint="http-acceptor-throughput" socket-binding="messaging">
<param name="batch-delay" value="50" />
</http-connector>
<in-vm-connector name="in-vm" server-id="0" />
<http-acceptor name="http-acceptor"
http-listener="default" />
<http-acceptor name="http-acceptor-throughput"
http-listener="default">
<param name="batch-delay" value="50" />
<param name="direct-deliver" value="false" />
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0" />
<jms-queue name="ExpiryQueue"
entries="java:/jms/queue/ExpiryQueue" />
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ" />
<jms-queue name="queue1"
entries="queue1 queue/queue1 jms/queue/queue1 java:jboss/exported/queue1" />
<!--
...
--->
<jms-queue name="queueN"
entries="queueN queue/queueN jms/queue/queueN java:jboss/exported/queueN" />
<connection-factory name="InVmConnectionFactory"
entries="java:/ConnectionFactory" connectors="in-vm" />
<connection-factory
name="RemoteConnectionFactory"
failover-on-initial-connection="true" reconnect-attempts="-1"
block-on-acknowledge="true" consumer-window-size="0"
client-failure-check-period="10000" ha="true"
entries="java:jboss/exported/jms/RemoteConnectionFactory"
connectors="http-connector" />
<pooled-connection-factory
name="activemq-ra" transaction="xa"
entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory"
connectors="in-vm" />
</server>
</subsystem>
Is there any configuration error? Can anyone suggest a solution for this error?
WildFly 10.1.0 was released in August 2016 and it uses ActiveMQ Artemis 1.1.0 which was release in October 2015, nearly 6 years ago now. WildFly is up to version 25 now and ActiveMQ Artemis is at 2.18.0 now. I strongly encourage you to upgrade to a later release of WildFly or even use the latest release of ActiveMQ Artemis standalone (i.e. not embedded in WildFly).
Even if a bug is identified in 1.1.0 there will be no bug-fix release for this version. In order to get any kind of fix you will be forced to upgrade to the latest version unless you back-port the fix and build it yourself. It's worth noting that many hundreds of bugs have been fixed in ActiveMQ Artemis since 1.1.0 was released. Your issue could very well be among them.
I was upgrading ATG application from 10.x to 11.x. I also upgraded jboss-eap from 5.1 to 7.2 I have faced various JBoss issues and many of them were fixed.
As of now we are getting the following error while starting the ATG fulfillment server and it seems to be JBoss JMS issue.
07:56:43,346 ERROR [nucleusNamespace.atg.dynamo.messaging.MessagingManager] (ServerService Thread Pool -- 81) PatchBay failed to startup properly : a Scheduler job will be registered to continue trying to bring PatchBay up : note this may result in further errors: atg.nucleus.ServiceException: An error occurred trying to resolve JNDI name "java:/XAConnectionFactory" for the "xa-topic-connection-factory-name" in provider "Hornet" in definition file "/atg/dynamo/messaging/dynamoMessagingSystem.xml": javax.naming.NameNotFoundException: XAConnectionFactory -- service jboss.naming.context.java.XAConnectionFactory
at atg.dms.patchbay.Provider.initializeTopicConnection(Provider.java:364)
at atg.dms.patchbay.PatchBayManager.createInputDestination(PatchBayManager.java:1811)
at atg.dms.patchbay.PatchBayManager.createInputPorts(PatchBayManager.java:1446)
at atg.dms.patchbay.PatchBayManager.createElementManager(PatchBayManager.java:1477)
at atg.dms.patchbay.PatchBayManager.createMessageFilters(PatchBayManager.java:1338)
In Jboss 5, there were following configuration files:
ls jboss-eap-5.1/seam/bootstrap/deploy/messaging/
connection-factories-service.xml hsqldb-persistence-service.xml legacy-service.xml remoting-service.xml
destinations-service.xml jms-ds.xml messaging-service.xml
In Jboss 7.2 we have the following message config in standalone.xml file:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:4.0">
<server name="default">
<journal pool-files="10"/>
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
<http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-connector>
<http-acceptor name="http-acceptor" http-listener="default"/>
<http-acceptor name="http-acceptor-throughput" http-listener="default">
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-acceptor>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
</server>
</subsystem>
Following are the contents of atg/dynamo/messaging/dynamoMessagingSystem.xml in the code
<?xml version="1.0" encoding="UTF-8"?>
<dynamo-message-system>
<patchbay>
<!-- JBoss Hornet provider -->
<provider>
<provider-name>Hornet</provider-name>
<xa-topic-connection-factory-name>
java:/XAConnectionFactory
</xa-topic-connection-factory-name>
<xa-queue-connection-factory-name>
java:/XAConnectionFactory
</xa-queue-connection-factory-name>
<supports-transactions>
true
</supports-transactions>
<supports-xa-transactions>
true
</supports-xa-transactions>
<username>***</username>
<password>***</password>
<initial-context-factory>
/abcd/common/services/HornetQ
</initial-context-factory>
</provider>
<!-- Reporting order message source -->
<message-source>
<nucleus-name>/abcd/commerce/fulfillment/processor/SendReportingSubmitOrderMessage</nucleus-name>
<output-port>
<port-name>ReportingOrderSubmit</port-name>
<output-destination>
<provider-name>local</provider-name>
<destination-name>localdms:/local/Fulfillment/LocalSubmitOrder</destination-name>
<destination-type>Topic</destination-type>
</output-destination>
</output-port>
</message-source>
<!-- Split order message source -->
<message-source>
<nucleus-name>/abcd/commerce/fulfillment/processor/SendSplitMessages/</nucleus-name>
<output-port>
<port-name>DEFAULT</port-name>
</output-port>
<output-port>
<port-name>FulfillmentOrderSubmitPort</port-name>
<output-destination>
<destination-name>patchbay:/Fulfillment/SubmitOrder</destination-name>
<destination-type>Topic</destination-type>
</output-destination>
</output-port>
</message-source>
<!-- Custom source/sink will take fulfillment failures and forward them, perhaps to multiple queues or none -->
<message-source>
<nucleus-name>
/abcd/commerce/fulfillment/FailureMessageSink
</nucleus-name>
<output-port>
<port-name>
FulfillmentFailureNotifications
</port-name>
<output-destination>
<destination-name>
patchbay:/Fulfillment/FulfillmentFailureNotifications
</destination-name>
<destination-type>
Topic
</destination-type>
</output-destination>
</output-port>
</message-source>
<!-- Custom source/sink will take fulfillment failures and forward them, perhaps to multiple queues or none -->
<message-sink>
<nucleus-name>
/abcd/commerce/fulfillment/FailureMessageSink
</nucleus-name>
<input-port>
<port-name>FulfillmentError</port-name>
<input-destination>
<destination-name>patchbay:/Fulfillment/ErrorNotification</destination-name>
<destination-type>Queue</destination-type>
</input-destination>
</input-port>
</message-sink>
I'm new to both jboss and ATG, Could anyone help me to resolve the issue ?
java:/XAConnectionFactory is not defined in WildFly. You need to configure WildFly to properly create and expose those connection factories like this:
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory java:/XAConnectionFactory" connectors="in-vm" transaction="xa"/>
Please note also that you are now on Apache ActiveMQ Artemis and no longer on HornetQ
I would like to expose my WildFly server to STOMP clients but I have not found any recent samples. As I understand it all communication in recent WildFly versions goes through a single socket (listening to 8080 by default). Do I need to change any configuration or is it supported out of the box? Any pointers are appreciated.
I am on a different version of WildFly (10.0.CR1) for that version the smallest possible change looks like:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
<server name="default">
...
<acceptor name="stomp-acceptor" factory-class="org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory">
<param name="protocols" value="STOMP"/>
<param name="port" value="61613"/>
</acceptor>
...
</server>
</subsystem>
It's true WildFly only listens on port 8080 by default (plus port 9990 for management), using HTTP protocol upgrade to switch to different protocols.
However, you can still define additional acceptors for other ports. I don't know whether or not it is possible to use STOMP with protocol upgrade over port 8080, but here's how to configure an additional Netty acceptor for port 5445:
<extension module="org.jboss.as.messaging"/>
<subsystem xmlns="urn:jboss:domain:messaging:2.0">
<hornetq-server>
<journal-file-size>102400</journal-file-size>
<connectors>
<http-connector name="http-connector" socket-binding="http">
<param key="http-upgrade-endpoint" value="http-acceptor"/>
</http-connector>
<http-connector name="http-connector-throughput" socket-binding="http">
<param key="http-upgrade-endpoint" value="http-acceptor-throughput"/>
<param key="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0"/>
</connectors>
<acceptors>
<http-acceptor name="http-acceptor" http-listener="default"/>
<http-acceptor name="http-acceptor-throughput" http-listener="default">
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</http-acceptor>
<netty-acceptor name="stomp-acceptor" socket-binding="messaging-stomp">
<param key="protocols" value="STOMP"/>
<param key="connection-ttl" value="30000"/>
</netty-acceptor>
<in-vm-acceptor name="in-vm" server-id="0"/>
</acceptors>
<security-settings>
<security-setting match="#">
<permission type="send" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
</security-setting>
</security-settings>
<address-settings>
<!--default for catch all-->
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<max-size-bytes>10485760</max-size-bytes>
<page-size-bytes>2097152</page-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
</address-setting>
</address-settings>
<jms-connection-factories>
<connection-factory name="InVmConnectionFactory">
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/ConnectionFactory"/>
</entries>
</connection-factory>
<connection-factory name="RemoteConnectionFactory">
<connectors>
<connector-ref connector-name="http-connector"/>
</connectors>
<entries>
<entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
</entries>
</connection-factory>
<pooled-connection-factory name="hornetq-ra">
<transaction mode="xa"/>
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/JmsXA"/>
<entry name="java:jboss/DefaultJMSConnectionFactory"/>
</entries>
</pooled-connection-factory>
</jms-connection-factories>
<jms-destinations>
<jms-queue name="ExpiryQueue">
<entry name="java:/jms/queue/ExpiryQueue"/>
</jms-queue>
<jms-queue name="DLQ">
<entry name="java:/jms/queue/DLQ"/>
</jms-queue>
</jms-destinations>
</hornetq-server>
</subsystem>
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="messaging-stomp" port="5445"/>
</socket-binding-group>
In addition, you'll have to create a user account with role guest via add-user.sh. This account will be used by the STOMP client.
Tested on WildFly 8.2.0.Final.
The following conf did the trick in my case (WF 10.0.0.Final)
<remote-acceptor name="stomp-acceptor" socket-binding="messaging-stomp">
<param name="protocols" value="STOMP"/>
<param name="connection-ttl" value="30000"/>
<param name="stomp-enable-message-id" value="true"/>
</remote-acceptor>
...
<socket-binding name="messaging-stomp" port="61613"/>
I am having problems while starting EJB application on AS JBOSS 7 or on EAP 6.1 with JBoss AS 7.2 while associating dependencies between EJB and persistenceUnit.
Line log error:
10:07:04,857 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"crm.war\".component.ClienteDAOBean.START missing [ jboss.naming.context.java.module.crm.crm.\"env/br.com.crm.model.dao.ClienteDAOBean/em\" ]","jboss.persistenceunit.\"crm.war#crmUnity\" missing [ jboss.naming.context.java.jboss.datasources/CRMDS ]","jboss.deployment.unit.\"crm.war\".jndiDependencyService missing [ jboss.naming.context.java.module.crm.crm.\"env/br.com.crm.model.dao.ClienteDAOBean/em\", jboss.naming.context.java.module.crm.crm.\"env/br.com.crm.model.dao.ContatoDAOBean/em\" ]","jboss.deployment.unit.\"crm.war\".component.br/com/crm/model/dao/ContatoDAORemote.START missing [ jboss.naming.context.java.module.crm.crm.\"env/br.com.crm.model.dao.ContatoDAOBean/em\" ]"]}}}
Below, follow xml files and EJB code:
application.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems,Inc.//DTD J2EE Application 1.2//EN" "http://java.sun.com/j2ee/dtds/application_1_2.dtd">
<application>
<display-name>crm</display-name>
<module>
<web>
<web-uri>crm.war</web-uri>
<context-root>crm</context-root>
</web>
</module>
<module>
<ejb>crmEJB.jar</ejb>
</module>
</application>
crm-ds.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- The Hypersonic embedded database JCA connection factory config
$Id: hsqldb-ds.xml,v 1.1.2.11 2003/09/28 12:31:36 starksm Exp $ -->
<datasources>
<local-tx-datasource enabled="true"
use-java-context="true" pool-name="CRMDS">
<jndi-name>java:jboss/datasources/CRMDS</jndi-name>
<connection-url>jdbc:hsqldb:file:database/crm</connection-url>
<driver>hsqldb.jar</driver>
<driver-class>org.hsqldb.jdbcDriver</driver-class>
<user-name>SA</user-name>
<password></password>
</local-tx-datasource>
</datasources>
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="crmUnity" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/CRMDS</jta-data-source>
<class>br.com.crm.model.entities.Cliente</class>
<class>br.com.crm.model.entities.Contato</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.show_sql" value="false" />
</properties>
</persistence-unit>
</persistence>
ContatoDAOBeanRemote.java
#Remote
public interface ContatoDAORemote {
// code
}
ContatoDAOBean.java
package br.com.crm.model.dao;
/**
* #author tarcisio
* Session Bean controlado pelo Container para realização de operações sobre
* a base de dados de contatos de clientes.
*/
#Stateless(name = "br/com/crm/model/dao/ContatoDAORemote")
public class ContatoDAOBean implements ContatoDAORemote{
#PersistenceUnit(unitName = "crmUnity")
private EntityManagerFactory emf;
// code
}
standalone.xml
<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2011, Red Hat, Inc., and individual contributors
~ as indicated by the #author tags. See the copyright.txt file in the
~ distribution for a full listing of individual contributors.
~
~ This is free software; you can redistribute it and/or modify it
~ under the terms of the GNU Lesser General Public License as
~ published by the Free Software Foundation; either version 2.1 of
~ the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this software; if not, write to the Free
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<server xmlns="urn:jboss:domain:1.0">
<extensions>
<extension module="org.jboss.as.clustering.infinispan"/>
<extension module="org.jboss.as.connector"/>
<extension module="org.jboss.as.deployment-scanner"/>
<extension module="org.jboss.as.ee"/>
<extension module="org.jboss.as.ejb3"/>
<extension module="org.jboss.as.jaxrs"/>
<extension module="org.jboss.as.jmx"/>
<extension module="org.jboss.as.jpa"/>
<extension module="org.jboss.as.logging"/>
<extension module="org.jboss.as.naming"/>
<extension module="org.jboss.as.osgi"/>
<extension module="org.jboss.as.remoting"/>
<extension module="org.jboss.as.sar"/>
<extension module="org.jboss.as.security"/>
<extension module="org.jboss.as.threads"/>
<extension module="org.jboss.as.transactions"/>
<extension module="org.jboss.as.web" />
<extension module="org.jboss.as.weld" />
</extensions>
<management>
<security-realms>
<security-realm name="PropertiesMgmtSecurityRealm">
<authentication>
<properties path="mgmt-users.properties" relative-to="jboss.server.config.dir" />
</authentication>
</security-realm>
</security-realms>
<management-interfaces>
<native-interface interface="management" port="9999" />
<http-interface interface="management" port="9990"/>
</management-interfaces>
</management>
<profile>
<subsystem xmlns="urn:jboss:domain:logging:1.0">
<console-handler name="CONSOLE">
<level name="INFO"/>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
</console-handler>
<periodic-rotating-file-handler name="FILE">
<level name="INFO"/>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
</periodic-rotating-file-handler>
<logger category="com.arjuna">
<level name="WARN"/>
</logger>
<logger category="org.apache.tomcat.util.modeler">
<level name="WARN"/>
</logger>
<logger category="sun.rmi">
<level name="WARN"/>
</logger>
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="FILE"/>
</handlers>
</root-logger>
</subsystem>
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true" pool-name="H2DS">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
<driver>h2</driver>
<pool></pool>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
<validation></validation>
<timeout></timeout>
<statement></statement>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0">
<deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir" path="deployments" />
</subsystem>
<subsystem xmlns="urn:jboss:domain:ee:1.0" />
<subsystem xmlns="urn:jboss:domain:ejb3:1.0" />
<subsystem xmlns="urn:jboss:domain:infinispan:1.0" default-cache-container="hibernate">
<cache-container name="hibernate" default-cache="local-query">
<local-cache name="entity">
<eviction strategy="LRU" max-entries="10000"/>
<expiration max-idle="100000"/>
</local-cache>
<local-cache name="local-query">
<eviction strategy="LRU" max-entries="10000"/>
<expiration max-idle="100000"/>
</local-cache>
<local-cache name="timestamps">
<eviction strategy="NONE"/>
</local-cache>
</cache-container>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
<subsystem xmlns="urn:jboss:domain:jca:1.0">
<archive-validation enabled="false" />
<bean-validation enabled="false" />
<default-workmanager>
<short-running-threads blocking="true">
<core-threads count="10" per-cpu="20"/>
<queue-length count="10" per-cpu="20"/>
<max-threads count="10" per-cpu="20"/>
<keepalive-time time="10" unit="seconds"/>
</short-running-threads>
<long-running-threads blocking="true">
<core-threads count="10" per-cpu="20"/>
<queue-length count="10" per-cpu="20"/>
<max-threads count="10" per-cpu="20"/>
<keepalive-time time="10" unit="seconds"/>
</long-running-threads>
</default-workmanager>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jmx:1.0">
<jmx-connector registry-binding="jmx-connector-registry" server-binding="jmx-connector-server" />
</subsystem>
<subsystem xmlns="urn:jboss:domain:jpa:1.0">
<jpa default-datasource=""/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:naming:1.0" />
<subsystem xmlns="urn:jboss:domain:osgi:1.0" activation="lazy">
<configuration pid="org.apache.felix.webconsole.internal.servlet.OsgiManager">
<property name="manager.root">jboss-osgi</property>
</configuration>
<properties>
<!--
A comma seperated list of module identifiers. Each system module
is added as a dependency to the OSGi framework module. The packages
from these system modules can be made visible as framework system packages.
http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#FRAMEWORK_SYSTEMPACKAGES_EXTRA
-->
<property name="org.jboss.osgi.system.modules">
org.apache.commons.logging,
org.apache.log4j,
org.jboss.as.osgi,
org.slf4j,
</property>
<!--
Framework environment property identifying extra packages which the system bundle
must export from the current execution environment
-->
<property name="org.osgi.framework.system.packages.extra">
org.apache.commons.logging;version=1.1.1,
org.apache.log4j;version=1.2,
org.jboss.as.osgi.service;version=7.0,
org.jboss.osgi.deployment.interceptor;version=1.0,
org.jboss.osgi.spi.capability;version=1.0,
org.jboss.osgi.spi.util;version=1.0,
org.jboss.osgi.testing;version=1.0,
org.jboss.osgi.vfs;version=1.0,
org.slf4j;version=1.5.10,
</property>
<!-- Specifies the beginning start level of the framework -->
<property name="org.osgi.framework.startlevel.beginning">1</property>
</properties>
<modules>
<!-- modules registered with the OSGi layer on startup -->
<module identifier="javaee.api"/>
<module identifier="org.jboss.logging"/>
<!-- bundles installed on startup -->
<module identifier="org.apache.aries.util"/>
<module identifier="org.jboss.osgi.webconsole"/>
<module identifier="org.osgi.compendium"/>
<!-- bundles started in startlevel 1 -->
<module identifier="org.apache.felix.log" startlevel="1"/>
<module identifier="org.jboss.osgi.logging" startlevel="1"/>
<module identifier="org.apache.felix.configadmin" startlevel="1"/>
<module identifier="org.jboss.as.osgi.configadmin" startlevel="1"/>
<!-- bundles started in startlevel 2 -->
<module identifier="org.apache.aries.jmx" startlevel="2"/>
<module identifier="org.apache.felix.eventadmin" startlevel="2"/>
<module identifier="org.apache.felix.metatype" startlevel="2"/>
<module identifier="org.apache.felix.scr" startlevel="2"/>
<module identifier="org.apache.felix.webconsole" startlevel="2"/>
<module identifier="org.jboss.osgi.jmx" startlevel="2"/>
<module identifier="org.jboss.osgi.http" startlevel="2"/>
<!-- bundles started in startlevel 3 -->
<module identifier="org.jboss.osgi.blueprint" startlevel="3"/>
<module identifier="org.jboss.osgi.webapp" startlevel="3"/>
<module identifier="org.jboss.osgi.xerces" startlevel="3"/>
</modules>
</subsystem>
<subsystem xmlns="urn:jboss:domain:remoting:1.0"/>
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.0" />
<subsystem xmlns="urn:jboss:domain:sar:1.0"/>
<subsystem xmlns="urn:jboss:domain:security:1.0">
<security-domains>
<security-domain name="other" cache-type="default">
<authentication>
<login-module code="UsersRoles" flag="required"/>
</authentication>
</security-domain>
</security-domains>
</subsystem>
<subsystem xmlns="urn:jboss:domain:threads:1.0"/>
<subsystem xmlns="urn:jboss:domain:transactions:1.0">
<recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
<core-environment>
<process-id>
<uuid />
</process-id>
</core-environment>
<coordinator-environment default-timeout="300"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">
<connector name="http" scheme="http" protocol="HTTP/1.1" socket-binding="http"/>
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost" />
<alias name="example.com" />
</virtual-server>
</subsystem>
<subsystem xmlns="urn:jboss:domain:weld:1.0" />
</profile>
<interfaces>
<interface name="management">
<inet-address value="127.0.0.1"/>
</interface>
<interface name="public">
<inet-address value="127.0.0.1"/>
</interface>
</interfaces>
<socket-binding-group name="standard-sockets" default-interface="public">
<socket-binding name="http" port="8080"/>
<socket-binding name="https" port="8443"/>
<socket-binding name="jmx-connector-registry" port="1090"/>
<socket-binding name="jmx-connector-server" port="1091"/>
<socket-binding name="jndi" port="1099"/>
<socket-binding name="osgi-http" port="8090"/>
<socket-binding name="remoting" port="4447"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
</socket-binding-group>
</server>
Project Technologies:
Embedded HSQDB database version 2.2.3
EJB 3
JPA 2.1
HIBERNATE 3 providing JPA Persistence
Can anybody help me to solve this dependencies problem?
Thank you in advance.
It would be perfect, if you would place alias for datasource in ear, and config them in standalone.xml: you got database independent distributive in ideal case. Try to insert this block in standalone.xml (I took parameters from your crm-ds.xml):
<subsystem xmlns="urn:jboss:domain:datasources:1.1">
<datasources>
<datasource jta="false" jndi-name="java:jboss/datasources/CRMDS" pool-name="CRMDS" enabled="true" use-ccm="false">
<connection-url>jdbc:hsqldb:file:database/crm</connection-url>
<driver-class>org.h2.Driver</driver-class>
<driver>h2</driver>
<security>
<user-name>SA</user-name>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
Version of subsystem may be server specific.