How to configure Wildfly to connect to remote Artemis server? - wildfly

I cannot configure Wildfly 14.0.1.Final to connect to the remote Artemis server. Here is my standalone.xml:
<server name="default">
<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>
<remote-connector name="remote-artemis" socket-binding="remote-artemis"/>
<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" connectors="in-vm" transaction="xa"/>
<pooled-connection-factory name="remote-artemis" entries="java:/jms/remoteCF" connectors="remote-artemis" user="admin" password="admin"/>
</server>
And here is my MDB:
#ResourceAdapter("remote-artemis")
#MessageDriven(name = "ExampleMdb", activationConfig = {
#ActivationConfigProperty(propertyName = "destination", propertyValue = "DMSQueue"),
#ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
#ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"),
#ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") })
public class ExampleMdb implements MessageListener {}
I have DMSQueue in DMSQueue address on Artemis server.
This is what I get in Wildfly console: AMQ151001: Attempting to reconnect org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec(ra=org.wildfly.extension.messaging.activemq.ActiveMQResourceAdapter#9382da9c destination=queues/DMSQueue destinationType=javax.jms.Queue ack=Auto-acknowledge durable=false clientID=null user=admin password=**** maxSession=15)
and
AMQ151004: Instantiating javax.jms.Queue "DMSQueue" directly since UseJNDI=false.
What I can see in Artemis web console is that there are two connections and one session from Wildfly and one registered producer, but no consumers. I also tried configuring this with Thorntail but got the same results.

I'm looking at the documentation here: https://docs.wildfly.org/14/Admin_Guide.html#Messaging_Connect_a_pooled-connection-factory_to_a_Remote_Artemis_Server
Assuming you have the remote-artemis socket binding defined (you don't show that), it seems you have to configure the MDB to use the specific resource adapter by annotating it with #org.jboss.ejb3.annotation.ResourceAdapter("remote-artemis").
If the MDB isn't configured to use a specific resource adapter, either by this annotation or by some other means, the default resource adapter configured in the ejb3 subsystem will be used.
The rest of your configuration looks good (according to the docs, I'm no expert on messaging :-) ).

Related

JBoss EAP 7.4 and ActiveMQ Artemis 2.18.0 JMS bridge

I've been working with OpenMQ to ActiveMQ Artemis migration, and I'm having a bit of a problem getting my head around the JMS bridge concept. In OpenMQ JBoss's configuration we had JMS bridges but while migrating to ActiveMQ Artemis and re-making the standalone configuration I came to a problem where I can't get the JMS bridges working. Maybe there is a chance that someone could give me an example of how they are written properly or just do it for my configuration so I have a good example?
(Don't mind only 1 ip, I've changed everything since I can't share ip's etc.)
Broker is a remote Artemis cluster which has 2 queues - sync.Trigger.gg and dlq.sync.Trigger.gg. I want a JMS bridge on JBoss to consume the message from the remote ActiveMQ Artemis (which in configuration is 1.0.0.1:61616) and send that message in the local queue named SyncTriggerQueue, and if the consumption fails by my deployed App then another bridge should send it back to dlq.sync.Trigger.gg. I know that I need 2 bridges for this (i.e. 1 in bridge for reading and writing to inbuilt queue and 1 out bridge for sending it to the DLQ).
I have 2 bridges in the configuration, and I've put "??" in the values where I don't know what to put inside. Could someone maybe fill it with the values it has to have from the story I've told? I would really appreciate help from someone who works with/knows these configurations.
P.S.
I've achieved a working configuration without the JMS bridges, but our Architect wants to keep it the way it was - with the bridges, so that's why I'm fighting with this.
P.S.S.
I have no idea if the in-built ActiveMQ queues are written properly, so feel free to re-make them.
Since I can't find how to add files here (probably not possible) then I'll just add my whole configuration as a code block, with some deleted parts that seem unnecessary.
<subsystem xmlns="urn:jboss:domain:messaging-activemq:13.0">
<server name="default">
<cluster password="${jboss.messaging.cluster.password:CHANGE ME!!}"/>
<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" redistribution-delay="1000"/>
<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>
<jgroups-broadcast-group name="bg-group1" jgroups-cluster="activemq-cluster" connectors="http-connector"/>
<jgroups-discovery-group name="dg-group1" jgroups-cluster="activemq-cluster"/>
<cluster-connection name="my-cluster" address="jms" connector-name="http-connector" discovery-group="dg-group1"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="SyncTriggerQueue" entries="java:jboss/exported/SyncTriggerQueue" durable="false"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector" ha="true" block-on-acknowledge="true" reconnect-attempts="-1"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
<connection-factory name="SyncTriggerConnectionFactory" entries="java:jboss/exported/jms/TriggerRes" connectors="http-connector" client-id="TriggerMDB1" scheduled-thread-pool-max-size="8" thread-pool-max-size="32" factory-type="XA_GENERIC"/>
</server>
<jms-bridge name="SyncTriggerInBridge"
module="org.apache.activemq.artemis"
add-messageID-in-header="true"
max-batch-time="500"
max-batch-size="10"
max-retries="-1"
failure-retry-interval="30000"
quality-of-service="ONCE_AND_ONLY_ONCE">
<source destination="??"
connection-factory="??"
user="appusertest"
password="appusertest">
<source-context>
<property name="java.naming.factory.initial" value="org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"/>
<property name="java.naming.provider.url" value="??"/>
</source-context>
</source>
<target destination="??"
connection-factory="??">
</target>
</jms-bridge>
<jms-bridge name="SyncTriggerOutBridge"
module="org.apache.activemq.artemis"
add-messageID-in-header="true"
max-batch-time="500"
max-batch-size="10"
max-retries="-1"
failure-retry-interval="30000"
quality-of-service="ONCE_AND_ONLY_ONCE">
<source destination="??"
connection-factory="??">
</source>
<target destination="??"
connection-factory="??"
user="appusertest"
password="appusertest">
<target-context>
<property name="java.naming.factory.initial" value="org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"/>
<property name="java.naming.provider.url" value="??"/>
</target-context>
</target>
</jms-bridge>
</subsystem>
<subsystem xmlns="urn:jboss:domain:resource-adapters:6.0">
<resource-adapters>
<resource-adapter id="artemis-ra.rar">
<module slot="main" id="gg.go.artemis.rar" />
<transaction-support>XATransaction</transaction-support>
<config-property name="CallFailoverTimeout">30000</config-property>
<config-property name="CallTimeout">30000</config-property>
<config-property name="ClientFailureCheckPeriod">30000</config-property>
<config-property name="ConnectionLoadBalancingPolicyClassName">gg.go.artemis.loadbalancing.OrderedConnectionLoadBalancingPolicyLoggingImpl</config-property>
<config-property name="ConnectionParameters">host=1.0.0.1;port=61616</config-property>
<config-property name="ConnectorClassName">org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory</config-property>
<config-property name="ConsumerMaxRate">1</config-property>
<config-property name="HA">true</config-property>
<config-property name="InitialConnectAttempts">9</config-property>
<config-property name="MinLargeMessageSize">5120000</config-property>
<config-property name="Password">admin</config-property>
<config-property name="ReconnectAttempts">-1</config-property>
<config-property name="RetryInterval">-1</config-property>
<config-property name="ThreadPoolMaxSize">10</config-property>
<config-property name="UserName">admin</config-property>
<connection-definitions>
<connection-definition class-name="org.apache.activemq.artemis.ra.ActiveMQRAManagedConnectionFactory" jndi-name="java:jboss/DefaultArtemisConnectionFactory" enabled="true" connectable="true" pool-name="DefaultArtemisConnectionFactory" use-java-context="true" use-ccm="true" />
</connection-definitions>
</resource-adapter>
</resource-adapters>
</subsystem>
jms-bridge TRACE logs
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$SourceReceiver#6c989ca received message ActiveMQMessage[null]:PERSISTENT/ClientMessageImpl[messageID=2145, durable=true, address=rekku.SyncTrigger.virre,userID=null,properties=TypedProperties[_AMQ_ROUTING_TYPE=1]]
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$SourceReceiver#6c989ca rescheduled batchExpiryTime to 1660722704869
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#62859582 woke up
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#62859582 waited enough
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#62859582 waiting for 500
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#62859582 woke up
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#62859582 waited enough
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#62859582 waiting for 500
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#57e98840 woke up
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#57e98840 waited enough
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#57e98840 got some messages so sending batch
TRACE ... Sending batch of 1 messages
TRACE ... Adding old message id in Message header
TRACE ... Sending message ActiveMQMessage[null]:PERSISTENT/ClientMessageImpl[messageID=2145, durable=true, address=sync.Trigger.gg,userID=null,properties=TypedProperties[_AMQ_ROUTING_TYPE=1,AMQ_BRIDGE_MSG_ID_LIST=NULL-value,JMSXDeliveryCount=1]]
TRACE ... Sent message ActiveMQMessage[ID:70bf4ffb-1e01-11ed-a09e-00059a3c7a00]:PERSISTENT/ClientMessageImpl[messageID=2145, durable=true, address=jms.queue.SyncTriggerQueue,userID=70bf4ffb-1e01-11ed-a09e-00059a3c7a00,properties=TypedProperties[__AMQ_CID=54a01028-1e01-11ed-a09e-00059a3c7a00,_AMQ_ROUTING_TYPE=1,AMQ_BRIDGE_MSG_ID_LIST=NULL-value,JMSXDeliveryCount=1]]
TRACE ... Delisting resources from tx
TRACE ... Delisted resources from tx
TRACE ... Committing JTA transaction
TRACE ... Committed JTA transaction
TRACE ... Starting JTA transaction
TRACE ... Enlisted resources in tx
TRACE ... Enlisting resources in tx
TRACE ... Started JTA transaction
Couple of things:
The bridge shouldn't use the ActiveMQ Artemis JCA RA so all the <resource-adapter> configuration is irrelevant. Therefore, I will not include it in my example.
There must be another local queue which the bridge can use to send the message back to the remote dlq.sync.Trigger.gg. This is the queue your application should use as a DLQ. I'll call this queue DlqSyncTriggerQueue. If you want the broker to handle sending failed messages to DlqSyncTriggerQueue then you should create a new address setting, e.g.:
<address-setting name="jms.queue.SyncTriggerQueue" dead-letter-address="jms.queue.DlqSyncTriggerQueue"/>
This assumes your application will be consuming messages from SyncTriggerQueue.
Here's the rest of the relevant configuration:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:13.0">
<server name="default">
<cluster password="${jboss.messaging.cluster.password:CHANGE ME!!}"/>
<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" redistribution-delay="1000"/>
<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>
<jgroups-broadcast-group name="bg-group1" jgroups-cluster="activemq-cluster" connectors="http-connector"/>
<jgroups-discovery-group name="dg-group1" jgroups-cluster="activemq-cluster"/>
<cluster-connection name="my-cluster" address="jms" connector-name="http-connector" discovery-group="dg-group1"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="SyncTriggerQueue" entries="java:/SyncTriggerQueue" durable="false"/>
<jms-queue name="DlqSyncTriggerQueue" entries="java:/DlqSyncTriggerQueue" durable="false"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector" ha="true" block-on-acknowledge="true" reconnect-attempts="-1"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
</server>
<jms-bridge name="SyncTriggerInBridge"
module="org.apache.activemq.artemis"
add-messageID-in-header="true"
max-batch-time="500"
max-batch-size="10"
max-retries="-1"
failure-retry-interval="30000"
quality-of-service="ONCE_AND_ONLY_ONCE">
<source destination="sync.Trigger.gg"
connection-factory="ConnectionFactory"
user="appusertest"
password="appusertest">
<source-context>
<property name="java.naming.factory.initial" value="org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"/>
<property name="java.naming.provider.url" value="tcp://1.0.0.1:61616"/>
<property name="queue.sync.Trigger.gg" value="sync.Trigger.gg"/>
</source-context>
</source>
<target destination="SyncTriggerQueue"
connection-factory="java:/ConnectionFactory">
</target>
</jms-bridge>
<jms-bridge name="SyncTriggerOutBridge"
module="org.apache.activemq.artemis"
add-messageID-in-header="true"
max-batch-time="500"
max-batch-size="10"
max-retries="-1"
failure-retry-interval="30000"
quality-of-service="ONCE_AND_ONLY_ONCE">
<source destination="DlqSyncTriggerQueue"
connection-factory="java:/ConnectionFactory">
</source>
<target destination="dlq.sync.Trigger.gg"
connection-factory="ConnectionFactory"
user="appusertest"
password="appusertest">
<target-context>
<property name="java.naming.factory.initial" value="org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"/>
<property name="java.naming.provider.url" value="tcp://1.0.0.1:61616"/>
<property name="queue.dlq.sync.Trigger.gg" value="dlq.sync.Trigger.gg"/>
</target-context>
</target>
</jms-bridge>
</subsystem>
On the remote ActiveMQ Artemis cluster you may need to add anycastPrefix=jms.queue.;multicastPrefix=jms.topic. to the configuration of your acceptor which is listening on 61616.

Wildfly - Configure ActiveMQ to use Postgres journal

I'm trying do setup the ActiveMQ on Wildfly 17.0.1.Final to use Postgresql as journal.
I have the datasource configured, and I'm using it in the application. However, when I configure ActiveMQ Artemis to use the Postgres datasource as a journal I'm having the problem described. Is there something missing in the setup?
Versions:
Wildfly 17.0.1.Final
Openjdk version "1.8.0_212"
PostgreSQL 9.2.24 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28), 64-bit
If I use ExampleDS as a datasource journal my application starts, but for the Postgresql datasource I'm having the error.
The datasource subsystem:
<subsystem xmlns="urn:jboss:domain:datasources:5.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jta="true" jndi-name="java:jboss/datasources/PostgreDS" pool-name="PostgreDS" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:postgresql://localhost:5432/test</connection-url>
<driver>postgresql</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>10</max-pool-size>
<flush-strategy>IdleConnections</flush-strategy>
</pool>
<security>
<user-name>test</user-name>
<password>test</password>
</security>
<validation>
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
<background-validation>true</background-validation>
<background-validation-millis>60000</background-validation-millis>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
</validation>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
The activemq subsystem:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:7.0">
<server name="default">
<cluster password="${jboss.messaging.cluster.password:changeme}"/>
<journal datasource="PostgreDS" />
<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" redistribution-delay="1000"/>
<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>
<broadcast-group name="bg-group1" jgroups-cluster="activemq-cluster" connectors="http-connector"/>
<discovery-group name="dg-group1" jgroups-cluster="activemq-cluster"/>
<cluster-connection name="my-cluster" address="jms" connector-name="http-connector" discovery-group="dg-group1"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="queueTESTE" entries="java:/jms/queue/queueTESTE"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector" ha="true" block-on-acknowledge="true" reconnect-attempts="-1"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
</server>
</subsystem>
10:02:58,137 WARN [org.apache.activemq.artemis.jdbc.store.drivers.AbstractJDBCDriver] (ServerService Thread Pool -- 88)
SQL STATEMENTS:
CREATE TABLE large_messages (ID BIGSERIAL, FILENAME VARCHAR(255), EXTENSION VARCHAR(10), DATA OID, PRIMARY KEY(ID))
SQL EXCEPTIONS:
SQLState: 00000 ErrorCode: 0 Message: CREATE TABLE will create implicit sequence "large_messages_id_seq" for serial column "large_messages.id"
SQLState: 00000 ErrorCode: 0 Message: CREATE TABLE / PRIMARY KEY will create implicit index "large_messages_pkey" for table "large_messages"
10:02:58,257 WARN [org.apache.activemq.artemis.jdbc.store.drivers.AbstractJDBCDriver] (ServerService Thread Pool -- 88)
SQL STATEMENTS:
CREATE TABLE page_store (ID BIGSERIAL, FILENAME VARCHAR(255), EXTENSION VARCHAR(10), DATA OID, PRIMARY KEY(ID))
SQL EXCEPTIONS:
SQLState: 00000 ErrorCode: 0 Message: CREATE TABLE will create implicit sequence "page_store_id_seq" for serial column "page_store.id"
SQLState: 00000 ErrorCode: 0 Message: CREATE TABLE / PRIMARY KEY will create implicit index "page_store_pkey" for table "page_store"
10:02:58,321 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 88) AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
10:02:58,321 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 88) AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
10:02:58,321 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 88) AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
10:02:58,322 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 88) AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
10:02:59,890 ERROR [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 88) AMQ224097: Failed to start server: java.lang.NoClassDefFoundError: org/postgresql/PGConnection
at org.apache.activemq.artemis.jdbc.store.file.PostgresSequentialSequentialFileDriver.createFile(PostgresSequentialSequentialFileDriver.java:71)
at org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFileFactoryDriver.openFile(JDBCSequentialFileFactoryDriver.java:114)
at org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFile.load(JDBCSequentialFile.java:110)
at org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFile.open(JDBCSequentialFile.java:104)
at org.apache.activemq.artemis.core.paging.impl.PagingStoreFactoryDatabase.reloadStores(PagingStoreFactoryDatabase.java:223)
at org.apache.activemq.artemis.core.paging.impl.PagingManagerImpl.reloadStores(PagingManagerImpl.java:300)
at org.apache.activemq.artemis.core.paging.impl.PagingManagerImpl.start(PagingManagerImpl.java:404)
at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.initialisePart1(ActiveMQServerImpl.java:2757)
at org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation.run(LiveOnlyActivation.java:64)
at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.internalStart(ActiveMQServerImpl.java:595)
at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.start(ActiveMQServerImpl.java:522)
at org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:373)
at org.wildfly.extension.messaging.activemq.jms.JMSService.doStart(JMSService.java:206)
at org.wildfly.extension.messaging.activemq.jms.JMSService.access$000(JMSService.java:65)
at org.wildfly.extension.messaging.activemq.jms.JMSService$1.run(JMSService.java:100)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:485)
Caused by: java.lang.ClassNotFoundException: org.postgresql.PGConnection from [Module "org.apache.activemq.artemis" version 2.8.1 from local module loader #10e92f8f (finder: local module finder #7ce3cb8e (roots: /home/rafael/dev/server/wildfly-17.0.1.Final/modules,/home/rafael/dev/server/wildfly-17.0.1.Final/modules/system/layers/base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
... 24 more
I can check that 4 tables were created in the public schema when I started Wildfly, but after that the error occurs.
I also added the postgres module to the Artemis module, and now the error is:
Caused by: java.lang.ClassCastException: org.jboss.jca.adapters.jdbc.jdk8.WrappedConnectionJDK8 cannot be cast to org.postgresql.PGConnection
I then added the <module name="org.jboss.ironjacamar.jdbcadapters" /> too, but the same error occurs.
Did you already try to use the regular (non XA) driver:
<driver name="postgresql" module="org.postgresql">
<driver-class>org.postgresql.Driver</driver-class>
</driver>

JBoss EAP7.1 Integrated ActiveMQ Artemis message redistribution in cluster mode does not work

After following item 29 of the https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.1/html/configuring_messaging/clusters_overview, redistribution test does not work.
Test Case: 1 jboss master and 2 jboss slaves. I created the "respostaCsu" queue in the artemis and posted a message on it. The message arrived on slave-1. This had no associated listeners for their correlationId and for this reason did not remove the message from the queue. The message should be forwarded to the next cluster machine (slave-2) according to the RedHat (redistribution-delay = 0 and message-load-balancing-type = ON_DEMAND) documentation. However the message was not redirected and remained in slave-1.
Any suggestion?
JBoss EAP 7.1 master domain.xml file:
...
<socket-binding-group name="full-ha-sockets" default-interface="public">
<socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
<socket-binding name="http" port="${jboss.http.port:8080}"/>
<socket-binding name="https" port="${jboss.https.port:8443}"/>
<socket-binding name="iiop" interface="unsecure" port="3528"/>
<socket-binding name="iiop-ssl" interface="unsecure" port="3529"/>
<socket-binding name="jgroups-mping" interface="private" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>
<socket-binding name="jgroups-tcp" interface="private" port="7600"/>
<socket-binding name="jgroups-udp" interface="private" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>
<socket-binding name="modcluster" port="0" multicast-address="${jboss.modcluster.multicast.address:224.0.1.105}" multicast-port="23364"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
<socket-binding name="messaging-group" interface="private" port="5432" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="9876"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
</socket-binding-group>
...
<subsystem xmlns="urn:jboss:domain:messaging-activemq:2.0">
<server name="default">
<security enabled="false"/>
<cluster user="mbuser" password="mbsenha"/>
<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" redistribution-delay="0"/>
<address-setting name="jms.#" redistribution-delay="0"/>
<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>
<broadcast-group name="mb-broadcast-group" socket-binding="messaging-group" broadcast-period="2000" connectors="http-connector"/>
<discovery-group name="mb-discovery-group" socket-binding="messaging-group" refresh-timeout="10000"/>
<cluster-connection name="my-cluster" address="jms" connector-name="http-connector" use-duplicate-detection="false" message-load-balancing-type="ON_DEMAND" discovery-group="mb-discovery-group"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="solicitacaoCsu" entries="java:/jms/queue/QL.REQ.BKLQ001Z" durable="false"/>
<jms-queue name="respostaCsu" entries="java:/jms/queue/QL.RSP.BKLQ001Z" durable="false"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector" ha="true" block-on-acknowledge="true" reconnect-attempts="-1"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
</server>
</subsystem>
Redistribution doesn't support selectors. However, initial distribution does. Therefore you should create your consumer before you send the request so that the consumer is on the queue when the reply is sent.
Thank you all.
But I found the solution! The problem was "messaging-group" tag in socket-binding! I configured port=0, multicast-addres to 231.7.7.7 and redistribution-delay to 0. It's works! =)
Here is my Jboss CLI:
/profile=full-ha/subsystem=messaging-activemq/server=default/broadcast-group=bg-group1:remove
/profile=full-ha/subsystem=messaging-activemq/server=default/discovery-group=dg-group1:remove
/socket-binding-group=full-ha-sockets/socket-binding=messaging-group:add(port=0,multicast-address=${jboss.messaging.group.address:231.7.7.7},multicast-port=${jboss.messaging.group.port:9876})
/socket-binding-group=full-ha-sockets/socket-binding=messaging-throughput:add(port=5455)
/profile=full-ha/subsystem=messaging-activemq/server=default/broadcast-group=bg-group1:add(socket-binding=messaging-group,broadcast-period=5000,connectors=[http-connector])
/profile=full-ha/subsystem=messaging-activemq/server=default/discovery-group=dg-group1:add(socket-binding=messaging-group,refresh-timeout=10000)
/profile=full-ha/subsystem=messaging-activemq/server=default/address-setting=#:write-attribute(name=redistribution-delay,value=0)

Why is my EntityManager not properly injected?

I tried to build a project with manages Employees using JPA and Beans and JSF. I started trying to manipulated an existing user which I manually created in the database. (before I tried to read the data from the database, this worked well) I tried this in various ways, by getting different errors, so I assume that I do somethinbg completely wrong. My Server is Wildfly 8 and database is postgresql.
15:09:43,410 ERROR [io.undertow.request] (default task-14) UT005023: Exception handling request to /time/modifyuser.jsf: javax.servlet.ServletException: Bei der Ressourcen-Einspeisung auf dem verwalteten Bean employeeManagerTool ist ein Fehler aufgetreten.
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
//...
Caused by: javax.naming.NamingException: JBAS011878: Failed to lookup env/tbp.WAM.Tools.EmployeeManagerTool/entityManager [Root exception is java.lang.NullPointerException]
//...
Caused by: java.lang.NullPointerException
at org.jboss.as.jpa.container.ExtendedPersistenceDeepInheritance.findExtendedPersistenceContext(ExtendedPersistenceDeepInheritance.java:49) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.as.jpa.injectors.PersistenceContextInjectionSource$PersistenceContextJndiInjectable.getReference(PersistenceContextInjectionSource.java:168) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:131)
... 93 more
So here is my Bean:
#Stateless(name = "EmployeeManagerTool")
public class EmployeeManagerTool implements EmployeeManagerToolLocal {
#PersistenceContext(type=PersistenceContextType.EXTENDED)
private EntityManager entityManager;
public EmployeeManagerTool() {
}
public void modifyEmployee() {
Employee employee = entityManager.find(Employee.class, 1);
employee.setFirstName("NNF");
employee.setLastName("NNL");
entityManager.persist(employee);
}
//just trying to alter the first entry, there is one with id=1
// other CRUD methods
}
My Entity looks like this:
#Entity
#Table(name = "tbl_Employee")
public class Employee implements Serializable {
private String firstName;
private String lastName;
private String username;
private String password;
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private int id;
#Version
private int version;
public Employee() {}
//some getter and setter...
}
My JSF file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>ejb-in-ear</title>
</head>
<body>
<h:form>
<h:commandButton value="Save User" action="#{employeeManagerTool.modifyEmployee()}"/>
</h:form>
</body>
</html>
My 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="timebudget" transaction-type="JTA">
<!-- using hibernate as JPA provider -->
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<!-- Datenquelle ist PostGres -->
<jta-data-source>java:jboss/datasources/TBPDS</jta-data-source>
<properties>
<!-- Konfiguration für den PostGreSQL-Dialekt -->
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<!-- hibernate Einstellungen -->
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.use_sql_comments" value="false" />
<property name="hibernate.archive.autodetection" value="class" />
</properties>
</persistence-unit>
</persistence>
Pleaaase, help me. I'm stuck at this for the whole weekend. I don't get what I'm doing wrong...
Standalone.xml:
<?xml version="1.0" ?>
<server xmlns="urn:jboss:domain:2.2">
<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.jdr"/>
<extension module="org.jboss.as.jmx"/>
<extension module="org.jboss.as.jpa"/>
<extension module="org.jboss.as.jsf"/>
<extension module="org.jboss.as.logging"/>
<extension module="org.jboss.as.mail"/>
<extension module="org.jboss.as.naming"/>
<extension module="org.jboss.as.pojo"/>
<extension module="org.jboss.as.remoting"/>
<extension module="org.jboss.as.sar"/>
<extension module="org.jboss.as.security"/>
<extension module="org.jboss.as.transactions"/>
<extension module="org.jboss.as.webservices"/>
<extension module="org.jboss.as.weld"/>
<extension module="org.wildfly.extension.batch"/>
<extension module="org.wildfly.extension.io"/>
<extension module="org.wildfly.extension.undertow"/>
</extensions>
<management>
<security-realms>
<security-realm name="ManagementRealm">
<authentication>
<local default-user="$local" skip-group-loading="true"/>
<properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
<authorization map-groups-to-roles="false">
<properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/>
</authorization>
</security-realm>
<security-realm name="ApplicationRealm">
<authentication>
<local default-user="$local" allowed-users="*" skip-group-loading="true"/>
<properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
<authorization>
<properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
</authorization>
</security-realm>
</security-realms>
<audit-log>
<formatters>
<json-formatter name="json-formatter"/>
</formatters>
<handlers>
<file-handler name="file" formatter="json-formatter" path="audit-log.log" relative-to="jboss.server.data.dir"/>
</handlers>
<logger log-boot="true" log-read-only="false" enabled="false">
<handlers>
<handler name="file"/>
</handlers>
</logger>
</audit-log>
<management-interfaces>
<http-interface security-realm="ManagementRealm" http-upgrade-enabled="true">
<socket-binding http="management-http"/>
</http-interface>
</management-interfaces>
<access-control provider="simple">
<role-mapping>
<role name="SuperUser">
<include>
<user name="$local"/>
</include>
</role>
</role-mapping>
</access-control>
</management>
<profile>
<subsystem xmlns="urn:jboss:domain:logging:2.0">
<console-handler name="CONSOLE">
<level name="INFO"/>
<formatter>
<named-formatter name="COLOR-PATTERN"/>
</formatter>
</console-handler>
<periodic-rotating-file-handler name="FILE" autoflush="true">
<formatter>
<named-formatter name="PATTERN"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</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="org.jboss.as.config">
<level name="DEBUG"/>
</logger>
<logger category="sun.rmi">
<level name="WARN"/>
</logger>
<logger category="jacorb">
<level name="WARN"/>
</logger>
<logger category="jacorb.config">
<level name="ERROR"/>
</logger>
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="FILE"/>
</handlers>
</root-logger>
<formatter name="PATTERN">
<pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
<formatter name="COLOR-PATTERN">
<pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
</subsystem>
<subsystem xmlns="urn:jboss:domain:batch:1.0">
<job-repository>
<in-memory/>
</job-repository>
<thread-pool>
<max-threads count="10"/>
<keepalive-time time="30" unit="seconds"/>
</thread-pool>
</subsystem>
<subsystem xmlns="urn:jboss:domain:datasources:2.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jta="true" jndi-name="java:jboss/datasources/TBPDS" pool-name="TBPDS" enabled="true" use-ccm="true">
<connection-url>jdbc:postgresql://localhost:5432/bank</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<driver>postgresql-9.4-1201.jdbc4.jar</driver>
<security>
<user-name>bank</user-name>
<password>bank</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<timeout>
<set-tx-query-timeout>false</set-tx-query-timeout>
<blocking-timeout-millis>0</blocking-timeout-millis>
<idle-timeout-minutes>0</idle-timeout-minutes>
<query-timeout>0</query-timeout>
<use-try-lock>0</use-try-lock>
<allocation-retry>0</allocation-retry>
<allocation-retry-wait-millis>0</allocation-retry-wait-millis>
</timeout>
<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>
<subsystem xmlns="urn:jboss:domain:deployment-scanner:2.0">
<deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:ee:2.0">
<spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>
<concurrent>
<context-services>
<context-service name="default" jndi-name="java:jboss/ee/concurrency/context/default" use-transaction-setup-provider="true"/>
</context-services>
<managed-thread-factories>
<managed-thread-factory name="default" jndi-name="java:jboss/ee/concurrency/factory/default" context-service="default"/>
</managed-thread-factories>
<managed-executor-services>
<managed-executor-service name="default" jndi-name="java:jboss/ee/concurrency/executor/default" context-service="default" hung-task-threshold="60000" core-threads="5" max-threads="25" keepalive-time="5000"/>
</managed-executor-services>
<managed-scheduled-executor-services>
<managed-scheduled-executor-service name="default" jndi-name="java:jboss/ee/concurrency/scheduler/default" context-service="default" hung-task-threshold="60000" core-threads="2" keepalive-time="3000"/>
</managed-scheduled-executor-services>
</concurrent>
<default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/ExampleDS" jms-connection-factory="java:jboss/DefaultJMSConnectionFactory" managed-executor-service="java:jboss/ee/concurrency/executor/default" managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default" managed-thread-factory="java:jboss/ee/concurrency/factory/default"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:ejb3:2.0">
<session-bean>
<stateful default-access-timeout="5000" cache-ref="simple" passivation-disabled-cache-ref="simple"/>
<singleton default-access-timeout="5000"/>
</session-bean>
<pools>
<bean-instance-pools>
<strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
<strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
</bean-instance-pools>
</pools>
<caches>
<cache name="simple"/>
<cache name="distributable" passivation-store-ref="infinispan" aliases="passivating clustered"/>
</caches>
<passivation-stores>
<passivation-store name="infinispan" cache-container="ejb" max-size="10000"/>
</passivation-stores>
<async thread-pool-name="default"/>
<timer-service thread-pool-name="default" default-data-store="default-file-store">
<data-stores>
<file-data-store name="default-file-store" path="timer-service-data" relative-to="jboss.server.data.dir"/>
</data-stores>
</timer-service>
<remote connector-ref="http-remoting-connector" thread-pool-name="default"/>
<thread-pools>
<thread-pool name="default">
<max-threads count="10"/>
<keepalive-time time="100" unit="milliseconds"/>
</thread-pool>
</thread-pools>
<default-security-domain value="other"/>
<default-missing-method-permissions-deny-access value="true"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:io:1.1">
<worker name="default"/>
<buffer-pool name="default"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:infinispan:2.0">
<cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">
<local-cache name="passivation" batching="true">
<file-store passivation="true" purge="false"/>
</local-cache>
<local-cache name="persistent" batching="true">
<file-store passivation="false" purge="false"/>
</local-cache>
</cache-container>
<cache-container name="ejb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan" aliases="sfsb">
<local-cache name="passivation" batching="true">
<file-store passivation="true" purge="false"/>
</local-cache>
<local-cache name="persistent" batching="true">
<file-store passivation="false" purge="false"/>
</local-cache>
</cache-container>
<cache-container name="hibernate" default-cache="local-query" module="org.hibernate">
<local-cache name="entity">
<transaction mode="NON_XA"/>
<eviction strategy="LRU" max-entries="10000"/>
<expiration max-idle="100000"/>
</local-cache>
<local-cache name="local-query">
<transaction mode="NONE"/>
<eviction strategy="LRU" max-entries="10000"/>
<expiration max-idle="100000"/>
</local-cache>
<local-cache name="timestamps">
<transaction mode="NONE"/>
<eviction strategy="NONE"/>
</local-cache>
</cache-container>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
<subsystem xmlns="urn:jboss:domain:jca:2.0">
<archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/>
<bean-validation enabled="true"/>
<default-workmanager>
<short-running-threads>
<core-threads count="50"/>
<queue-length count="50"/>
<max-threads count="50"/>
<keepalive-time time="10" unit="seconds"/>
</short-running-threads>
<long-running-threads>
<core-threads count="50"/>
<queue-length count="50"/>
<max-threads count="50"/>
<keepalive-time time="10" unit="seconds"/>
</long-running-threads>
</default-workmanager>
<cached-connection-manager/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jdr:1.0"/>
<subsystem xmlns="urn:jboss:domain:jmx:1.3">
<expose-resolved-model/>
<expose-expression-model/>
<remoting-connector/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jpa:1.1">
<jpa default-datasource="" default-extended-persistence-inheritance="DEEP"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jsf:1.0"/>
<subsystem xmlns="urn:jboss:domain:mail:2.0">
<mail-session name="default" jndi-name="java:jboss/mail/Default">
<smtp-server outbound-socket-binding-ref="mail-smtp"/>
</mail-session>
</subsystem>
<subsystem xmlns="urn:jboss:domain:naming:2.0">
<remote-naming/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:pojo:1.0"/>
<subsystem xmlns="urn:jboss:domain:remoting:2.0">
<endpoint worker="default"/>
<http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:resource-adapters:2.0"/>
<subsystem xmlns="urn:jboss:domain:sar:1.0"/>
<subsystem xmlns="urn:jboss:domain:security:1.2">
<security-domains>
<security-domain name="other" cache-type="default">
<authentication>
<login-module code="Remoting" flag="optional">
<module-option name="password-stacking" value="useFirstPass"/>
</login-module>
<login-module code="RealmDirect" flag="required">
<module-option name="password-stacking" value="useFirstPass"/>
</login-module>
</authentication>
</security-domain>
<security-domain name="jboss-web-policy" cache-type="default">
<authorization>
<policy-module code="Delegating" flag="required"/>
</authorization>
</security-domain>
<security-domain name="jboss-ejb-policy" cache-type="default">
<authorization>
<policy-module code="Delegating" flag="required"/>
</authorization>
</security-domain>
</security-domains>
</subsystem>
<subsystem xmlns="urn:jboss:domain:transactions:2.0">
<core-environment>
<process-id>
<uuid/>
</process-id>
</core-environment>
<recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:undertow:1.2">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
</handlers>
<filters>
<response-header name="server-header" header-name="Server" header-value="WildFly/8"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
</filters>
</subsystem>
<subsystem xmlns="urn:jboss:domain:webservices:1.2">
<wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
<endpoint-config name="Standard-Endpoint-Config"/>
<endpoint-config name="Recording-Endpoint-Config">
<pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
<handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
</pre-handler-chain>
</endpoint-config>
<client-config name="Standard-Client-Config"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:weld:2.0"/>
</profile>
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
</interfaces>
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
<socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
<socket-binding name="http" port="${jboss.http.port:8080}"/>
<socket-binding name="https" port="${jboss.https.port:8443}"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
</socket-binding-group>
<deployments>
<deployment name="postgresql" runtime-name="postgresql-9.4-1201.jdbc4.jar">
<content sha1="b46544ef0eaf0405504089dcc71f36e3f190ef09"/>
</deployment>
<deployment name="wildfly-ejb-in-ear-ear.ear" runtime-name="wildfly-ejb-in-ear-ear.ear">
<content sha1="eee0b026b1fac8c09a35bc0ef318a237d8d47c6e"/>
</deployment>
</deployments>
</server>
I noticed you are using Extended entity manager (#PersistenceContext(type=PersistenceContextType.EXTENDED) with Stateless session bean #Stateless, but When you specify that an injected EntityManager is an extended persistence context, you should use #Stateful session bean, because extended EntityManagers still live beyond the scope of a JTA transaction, now you have 2 solutions:
change stateless to stateful session bean: in this case please note that extended entity managers create a persistence context when a stateful session bean instance is created that lasts until the bean is removed.
change extended entity manager to transaction-scoped entity manager by using type=PersistenceContextType.TRANSACTION: The persistence context of a transaction-scoped entity manager begins when the transaction begins and lasts until the end of a transaction, but the persistence context of an extended entity manager will last for the entire length of the conversation.
thanks all for help;
If anyone getting the same error than me, maybe this helps:
I used managed beans in JSF which are EJB, but I need to use CDI-Beans. As I deleted the Beans from the faces-config.xml everything works fine.
Sorry for asking this question.

JBoss 7.2 jms messaging queue

We're running a standalone JBoss 7.2 on my localhost and using the standalone-full.xml
but in a lightweight version so that anything that isnt used is removed - for instance
the messaging sections were removed.
But now im trying to do a MessageDrivenBean with a queue by using the jms.
I started by adding following to the standalone-full.xml :
<extensions>
<extension module="org.jboss.as.messaging"/>
<subsystem xmlns="urn:jboss:domain:messaging:1.1">
<hornetq-server>
<persistence-enabled>true</persistence-enabled>
<journal-file-size>102400</journal-file-size>
<journal-min-files>2</journal-min-files>
<connectors>
<netty-connector name="netty" socket-binding="messaging"/>
<netty-connector name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
</netty-connector>
<in-vm-connector name="in-vm" server-id="0"/>
</connectors>
<acceptors>
<netty-acceptor name="netty" socket-binding="messaging"/>
<netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</netty-acceptor>
<in-vm-acceptor name="in-vm" server-id="0"/>
</acceptors>
<security-domain>XXSecurityDomain</security-domain>
<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>
<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="netty"/>
</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"/>
</entries>
</pooled-connection-factory>
</jms-connection-factories>
</hornetq-server>
</subsystem>
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:100}">
<socket-binding name="messaging" port="5445"/>
<socket-binding name="messaging-throughput" port="5455"/>
Next i used an existing servlet which was already working before, and modified it :
public class XRequestServlet extends HttpServlet
Context mQueueContext = null;
ConnectionFactory mConnectionFactory = null;
Connection mConnection = null;
public void init() throws ServletException {
try {
log.info("init()");
mQueueContext = new InitialContext();
mConnectionFactory = (ConnectionFactory) mQueueContext.lookup("/ConnectionFactory");
} catch (NamingException e) {
e.printStackTrace();
}
}
public void doPost(WebSession pWebSession, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
log.info("doPost()");
String vDestinationName = "java:jboss/exported/jms/queue/testQueue";
PrintWriter vOut = response.getWriter();
try {
log.info("1");
mConnection = mConnectionFactory.createConnection();
log.info("1.5");
Queue vQueue = (Queue) mQueueContext.lookup(vDestinationName);
log.info("2");
To test it i use a RESTClient plugin in firefox and i can see the my request
enters doPost() and i see logging doPost(), 1 and 1.5 but at trying to create
a queue fails.
In the jboss log i get following error :
javax.naming.NameNotFoundException: jms/queue/testQueue -- service jboss.naming.context.java.jboss.exported.jms.queue.testQueue
Can someone give me advice what needs to be done ??
I haven't reviewed the rest of your config, but the immediate cause of the error you are getting, is that you don't seem to have configured any queues in JBoss, so when you try to look it up using the mQueueContext.lookup the exception is thrown.
Queues are configured under jms-destinations like this:
<subsystem xmlns="urn:jboss:domain:messaging:1.0">
[...]
<jms-destinations>
<jms-queue name="testQueue">
<entry name="jms/queue/test"/>
<entry name="java:jboss/exported/jms/queue/test"/>
</jms-queue>
[...]
</subsystem>
See https://docs.jboss.org/author/display/AS72/Messaging+configuration#Messagingconfiguration-JMSQueuesandTopics for more documentation on setting up JMS under JBoss 7