JBoss EAP 7.4 and ActiveMQ Artemis 2.18.0 JMS bridge - jboss

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.

Related

How to configure Wildfly to connect to remote Artemis server?

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 :-) ).

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.

wso2 ESB: Clone and Aggregate timed out

I tried using both a proxy and an API in WSO2 ESB to test the aggregation of similar SOAP web services into one response but I'm just having time-outs. For testing I'm using a Weather web service (http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl). I'm basically calling the same action GetCityWeatherByZIP twice by using the clone mediator providing a different ZIP code for each, and then aggregating the results. Eventualy the intention is to call web services which are hosted on different servers but for the moment I was trying to use the same service. I would appreciate any help I can get.
Below is the proxy config:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="aggre"
transports="http"
statistics="disable"
trace="enable"
startOnLoad="true">
<target>
<inSequence>
<clone>
<target>
<sequence>
<payloadFactory media-type="xml">
<format>
<m0:GetCityWeatherByZIP xmlns:m0="http://ws.cdyne.com/WeatherWS/">
<m0:ZIP>11001</m0:ZIP>
</m0:GetCityWeatherByZIP>
</format>
<args/>
</payloadFactory>
<header name="Action" scope="default" value="urn:GetCityWeatherByZIP "/>
<call>
<endpoint key="weather"/>
</call>
</sequence>
</target>
<target>
<sequence>
<payloadFactory media-type="xml">
<format>
<m0:GetCityWeatherByZIP xmlns:m0="http://ws.cdyne.com/WeatherWS/">
<m0:ZIP>11010</m0:ZIP>
</m0:GetCityWeatherByZIP>
</format>
<args/>
</payloadFactory>
<header name="Action" scope="default" value="urn:GetCityWeatherByZIP "/>
<call>
<endpoint key="weather"/>
</call>
</sequence>
</target>
</clone>
<aggregate>
<completeCondition>
<messageCount min="-1" max="-1"/>
</completeCondition>
<onComplete xmlns:m0="http://ws.cdyne.com/WeatherWS"
expression="/m0:GetCityWeatherByZIPResponse">
<drop/>
</onComplete>
</aggregate>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description/>
</proxy>
Below is the weather endpoint config:
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="weather">
<address uri="http://wsf.cdyne.com/WeatherWS/Weather.asmx" format="soap11">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</address>
</endpoint>
Carbon Log:
TID: [0] [ESB] [2014-07-08 11:10:44,377] INFO {org.apache.axis2.transport.http.HTTPSender} - Unable to sendViaPost to url[http://servername:8281/services/aggre.aggreHttpSoap11Endpoint] {org.apache.axis2.transport.http.HTTPSender}
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:150)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1413)
at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)
at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:622)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:451)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:278)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:430)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:554)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:530)
at org.apache.jsp.admin.jsp.WSRequestXSSproxy_005fajaxprocessor_jsp._jspService(org.apache.jsp.admin.jsp.WSRequestXSSproxy_005fajaxprocessor_jsp:276)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.ui.JspServlet.service(JspServlet.java:155)
at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(ContextPathServletAdaptor.java:37)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
TID: [0] [ESB] [2014-07-08 11:10:44,420] WARN {org.apache.synapse.transport.passthru.SourceHandler} - Connection time out after request is read: http-incoming-295 {org.apache.synapse.transport.passthru.SourceHandler}
SOAP Action is incorrect, must be http://ws.cdyne.com/WeatherWS/GetCityWeatherByZIP
Namespace for the aggregate's onComplete xpath expression is incorrect, a '/' is missing at the end : http://ws.cdyne.com/WeatherWS/
After aggregation, you don't want to drop the message, you want to send it as a response : replace <drop/> with <send/> in the "onComplete" mediation
The response will be a soap message and SOAP Body must have one root node as first child so you have to apply a transformation, for exemple :
<payloadFactory media-type="xml">
<format>
<response>
$1
</response>
</format>
<args>
<arg evaluator="xml" xmlns:m0="http://ws.cdyne.com/WeatherWS/" expression="//m0:GetCityWeatherByZIPResponse"/>
</args>
</payloadFactory>
By default, clone mediator stop parent mediation, you need to specify continueParent="true" if you want the aggregate to be executed
With call mediator, underline worker thread returns without waiting for the response : the request used to execute your proxy will reach your aggregate : before executing aggregate mediator, test if the message is a GetCityWeatherByZIPResponse
Complete proxy :
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TestSOF"
transports="http"
statistics="disable"
trace="enable"
startOnLoad="true">
<target>
<inSequence>
<clone continueParent="true">
<target>
<sequence>
<payloadFactory media-type="xml">
<format>
<m0:GetCityWeatherByZIP xmlns:m0="http://ws.cdyne.com/WeatherWS/">
<m0:ZIP>11001</m0:ZIP>
</m0:GetCityWeatherByZIP>
</format>
<args/>
</payloadFactory>
<header name="Action" scope="default" value="http://ws.cdyne.com/WeatherWS/GetCityWeatherByZIP"/>
<call>
<endpoint key="weather"/>
</call>
</sequence>
</target>
<target>
<sequence>
<payloadFactory media-type="xml">
<format>
<m0:GetCityWeatherByZIP xmlns:m0="http://ws.cdyne.com/WeatherWS/">
<m0:ZIP>11010</m0:ZIP>
</m0:GetCityWeatherByZIP>
</format>
<args/>
</payloadFactory>
<header name="Action" scope="default" value="http://ws.cdyne.com/WeatherWS/GetCityWeatherByZIP"/>
<call>
<endpoint key="weather"/>
</call>
</sequence>
</target>
</clone>
<filter source="local-name($body/*[1])" regex="GetCityWeatherByZIPResponse">
<then>
<aggregate>
<completeCondition>
<messageCount min="-1" max="-1"/>
</completeCondition>
<onComplete xmlns:m0="http://ws.cdyne.com/WeatherWS/"
expression="//m0:GetCityWeatherByZIPResponse">
<payloadFactory media-type="xml">
<format>
<response>
$1
</response>
</format>
<args>
<arg evaluator="xml" xmlns:m0="http://ws.cdyne.com/WeatherWS/" expression="//m0:GetCityWeatherByZIPResponse"/>
</args>
</payloadFactory>
<send/>
</onComplete>
</aggregate>
</then>
</filter>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description/>
</proxy>
Endpoint :
<?xml version="1.0" encoding="UTF-8"?>
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="weather">
<wsdl service="Weather"
port="WeatherSoap"
uri="http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL"/>
</endpoint>
The response I get :
<response xmlns="http://ws.apache.org/ns/synapse">
<GetCityWeatherByZIPResponse xmlns="http://ws.cdyne.com/WeatherWS/">
<GetCityWeatherByZIPResult>
<Success>true</Success>
<ResponseText>City Found</ResponseText>
<State>NY</State>
<City>Franklin Square</City>
<WeatherStationCity>Farmingdale</WeatherStationCity>
<WeatherID>14</WeatherID>
<Description>Cloudy</Description>
<Temperature>73</Temperature>
<RelativeHumidity>78</RelativeHumidity>
<Wind>S6</Wind>
<Pressure>29.75R</Pressure>
<Visibility/>
<WindChill/>
<Remarks/>
</GetCityWeatherByZIPResult>
</GetCityWeatherByZIPResponse>
<GetCityWeatherByZIPResponse xmlns="http://ws.cdyne.com/WeatherWS/">
<GetCityWeatherByZIPResult>
<Success>true</Success>
<ResponseText>City Found</ResponseText>
<State>NY</State>
<City>Floral Park</City>
<WeatherStationCity>Farmingdale</WeatherStationCity>
<WeatherID>14</WeatherID>
<Description>Cloudy</Description>
<Temperature>73</Temperature>
<RelativeHumidity>78</RelativeHumidity>
<Wind>S6</Wind>
<Pressure>29.75R</Pressure>
<Visibility/>
<WindChill/>
<Remarks/>
</GetCityWeatherByZIPResult>
</GetCityWeatherByZIPResponse>
</response>
call mediator rely on non-blocking transport : edit repository/conf/nhttp.properties and add
http.socket.timeout.sender=60000 if you agree to wait for 60 seconds

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

Replication Timeouts in Infinispan

I'm working with a 10-node Infinispan cluster used as a Hibernate Search backend. Our servers are running TC server 2.5 (tomcat 6.0.32) on Java 1.6_24. We are using jGroups 2.12.1.3 for handling cluster cache writes from each node, and for multicast UDP transport.
When we launch 3+ nodes in our cluster, eventually one of the nodes begins to log replication timeouts. We've observed the same result whether we configure Infinispan for replication or for distribution cache modes. Although the rest of the cluster remains stable, the failing node becomes essentially unsuable for search.
Our configuration:
Infinispan:
<?xml version="1.0" encoding="UTF-8"?>
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:5.0 http://www.infinispan.org/schemas/infinispan-config-5.0.xsd"
xmlns="urn:infinispan:config:5.0">
<global>
<globalJmxStatistics
enabled="true"
cacheManagerName="HibernateSearch"
allowDuplicateDomains="true" />
<transport
clusterName="HibernateSearch-Infinispan-cluster-MT"
distributedSyncTimeout="50000">
<properties>
<property name="configurationFile" value="infinispan-udp.cfg.xml" />
</properties>
</transport>
<shutdown
hookBehavior="DONT_REGISTER" />
</global>
<default>
<locking
lockAcquisitionTimeout="20000"
writeSkewCheck="false"
concurrencyLevel="5000"
useLockStriping="false" />
<storeAsBinary storeKeysAsBinary="false" storeValuesAsBinary="true"
enabled="false" />
<invocationBatching
enabled="true" />
<clustering
mode="replication">
<stateRetrieval
timeout="60000"
logFlushTimeout="65000"
fetchInMemoryState="true"
alwaysProvideInMemoryState="true" />
<sync
replTimeout="50000" />
<l1 enabled="false" />
</clustering>
<jmxStatistics
enabled="true" />
<eviction
maxEntries="-1"
strategy="NONE" />
<expiration
maxIdle="-1" />
</default>
<namedCache
name="LuceneIndexesMetadata">
<clustering
mode="replication">
<stateRetrieval
fetchInMemoryState="true"
logFlushTimeout="30000" />
<sync
replTimeout="50000" />
<l1 enabled="false" />
</clustering>
<locking
lockAcquisitionTimeout="20000"
writeSkewCheck="false"
concurrencyLevel="5000"
useLockStriping="false" />
<loaders shared="true" preload="true">
<loader class="org.infinispan.loaders.jdbm.JdbmCacheStore" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
<properties>
<property name="location" value="/usr/local/tc/.index/metadata" />
</properties>
</loader>
</loaders>
</namedCache>
<namedCache
name="LuceneIndexesData">
<clustering
mode="replication">
<stateRetrieval
fetchInMemoryState="true"
logFlushTimeout="30000" />
<sync
replTimeout="50000" />
<l1 enabled="false" />
</clustering>
<locking
lockAcquisitionTimeout="20000"
writeSkewCheck="false"
concurrencyLevel="5000"
useLockStriping="false" />
<loaders shared="true" preload="true">
<loader class="org.infinispan.loaders.jdbm.JdbmCacheStore" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
<properties>
<property name="location" value="/usr/local/tc/.index/data" />
</properties>
</loader>
</loaders>
</namedCache>
<namedCache
name="LuceneIndexesLocking">
<clustering
mode="replication">
<stateRetrieval
fetchInMemoryState="true"
logFlushTimeout="30000" />
<sync
replTimeout="50000" />
<l1 enabled="false" />
</clustering>
<locking
lockAcquisitionTimeout="20000"
writeSkewCheck="false"
concurrencyLevel="5000"
useLockStriping="false" />
</namedCache>
jGroups (UDP):
<config xmlns="urn:org:jgroups"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-2.12.xsd">
<UDP
mcast_addr="${jgroups.udp.mcast_addr:228.10.10.9}"
mcast_port="${jgroups.udp.mcast_port:45599}"
tos="8"
ucast_recv_buf_size="20000000"
ucast_send_buf_size="640000"
mcast_recv_buf_size="25000000"
mcast_send_buf_size="640000"
loopback="true"
discard_incompatible_packets="true"
max_bundle_size="64000"
max_bundle_timeout="30"
ip_ttl="${jgroups.udp.ip_ttl:2}"
enable_bundling="true"
enable_diagnostics="false"
thread_naming_pattern="pl"
thread_pool.enabled="true"
thread_pool.min_threads="2"
thread_pool.max_threads="30"
thread_pool.keep_alive_time="5000"
thread_pool.queue_enabled="false"
thread_pool.queue_max_size="100"
thread_pool.rejection_policy="Discard"
oob_thread_pool.enabled="true"
oob_thread_pool.min_threads="2"
oob_thread_pool.max_threads="30"
oob_thread_pool.keep_alive_time="5000"
oob_thread_pool.queue_enabled="false"
oob_thread_pool.queue_max_size="100"
oob_thread_pool.rejection_policy="Discard"
/>
And the errors we observe:
10-31-2011 13:53:02 ERROR Hibernate Search: Directory writer-3 interceptors.InvocationContextInterceptor: ISPN000136: Execution error
org.infinispan.util.concurrent.TimeoutException: Replication timeout for tc-cluster-0105-21082
at org.infinispan.remoting.transport.AbstractTransport.parseResponseAndAddToResponseList(AbstractTransport.java:71)
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.invokeRemotely(JGroupsTransport.java:452)
at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:132)
at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:156)
at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:265)
at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:252)
at org.infinispan.remoting.rpc.RpcManagerImpl.broadcastRpcCommand(RpcManagerImpl.java:235)
at org.infinispan.remoting.rpc.RpcManagerImpl.broadcastRpcCommand(RpcManagerImpl.java:228)
at org.infinispan.interceptors.ReplicationInterceptor.handleCrudMethod(ReplicationInterceptor.java:116)
at org.infinispan.interceptors.ReplicationInterceptor.visitPutKeyValueCommand(ReplicationInterceptor.java:79)
at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)
at org.infinispan.interceptors.LockingInterceptor.visitPutKeyValueCommand(LockingInterceptor.java:294)
at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)
at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:133)
at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:60)
at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)
at org.infinispan.interceptors.TxInterceptor.enlistWriteAndInvokeNext(TxInterceptor.java:214)
at org.infinispan.interceptors.TxInterceptor.visitPutKeyValueCommand(TxInterceptor.java:162)
at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)
at org.infinispan.interceptors.CacheMgmtInterceptor.visitPutKeyValueCommand(CacheMgmtInterceptor.java:114)
at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)
at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:104)
at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:64)
at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:60)
at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)
at org.infinispan.interceptors.BatchingInterceptor.handleDefault(BatchingInterceptor.java:77)
at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:60)
at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)
at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:274)
at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:524)
at org.infinispan.CacheSupport.putIfAbsent(CacheSupport.java:74)
at org.infinispan.lucene.locking.BaseLuceneLock.obtain(BaseLuceneLock.java:65)
at org.apache.lucene.store.Lock.obtain(Lock.java:72)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1097)
at org.hibernate.search.backend.Workspace.createNewIndexWriter(Workspace.java:202)
at org.hibernate.search.backend.Workspace.getIndexWriter(Workspace.java:180)
at org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor.run(PerDPQueueProcessor.java:103)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Because this error is so pervasive regardless of our topology or caching mode, we believe we must be misconfigured somewhere. Can anyone recommend a fix?
Turns out we had a version clash between Infinispan and Hibernate Search. If you use Hibernate Search 3.4.1, you must use Infinispan 4.2.1, later versions may not work.