I'm using RMI replicated Ehcache 2.6.3 on WebSphere 8.
After application get started getting this error message from ehcache.
(PayloadUtil.java:203) Could not ungzip. Heartbeat will not be working. Not in GZIP format
What could be the reason?
Here is the configuration:
<cacheManagerEventListenerFactory class="" properties=""/>
<cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=automatic,
multicastGroupAddress=239.21.131.242,
multicastGroupPort=${multicastGroupPort}, timeToLive=32"
propertySeparator="," />
<cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" />
<cache name="REFERENCE_DATA"
maxElementsInMemory="1000"
eternal="false"
overflowToDisk="false"
memoryStoreEvictionPolicy="LFU"
statistics="true"
timeToLiveSeconds="10800"
>
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=false, replicatePuts=false,
replicatePutsViaCopy=false, replicateUpdates=true,
replicateUpdatesViaCopy=false, replicateRemovals=true"/>
</cache>
2013-02-15 09:30:45,903 DEBUG (RMICacheManagerPeerListener.java:548) 4 RMICachePeers bound in registry for RMI listener
2013-02-15 09:30:45,904 DEBUG (ConfigurationHelper.java:325) CacheDecoratorFactory not configured. Skipping for 'SERVICE_EXECUTION_CACHE'.
2013-02-15 09:30:45,905 DEBUG (ConfigurationHelper.java:354) CacheDecoratorFactory not configured for defaultCache. Skipping for 'SERVICE_EXECUTION_CACHE'.
2013-02-15 09:30:45,906 DEBUG (MemoryStore.java:149) Initialized net.sf.ehcache.store.NotifyingMemoryStore for ERROR_CODES_CACHE
2013-02-15 09:30:45,907 DEBUG (Cache.java:1164) Initialised cache: ERROR_CODES_CACHE
2013-02-15 09:30:45,908 DEBUG (RMICacheManagerPeerListener.java:516) Adding to RMI listener
2013-02-15 09:30:45,911 DEBUG (RMICacheManagerPeerListener.java:548) 5 RMICachePeers bound in registry for RMI listener
2013-02-15 09:30:45,912 DEBUG (ConfigurationHelper.java:325) CacheDecoratorFactory not configured. Skipping for 'ERROR_CODES_CACHE'.
2013-02-15 09:30:45,912 DEBUG (ConfigurationHelper.java:354) CacheDecoratorFactory not configured for defaultCache. Skipping for 'ERROR_CODES_CACHE'.
2013-02-15 09:30:47,588 INFO (CacheFactory.java:29) ERROR_CODES_CACHE : Cache is defined as "load on demand"
2013-02-15 09:30:47,588 INFO (CacheFactory.java:25) CONFIGURATION_ITEMS_CACHE loading
2013-02-15 09:30:47,592 INFO (CacheFactory.java:27) CONFIGURATION_ITEMS_CACHE loaded
2013-02-15 09:30:47,592 INFO (CacheFactory.java:25) REFERENCE_DATA loading
2013-02-15 09:30:47,593 DEBUG (Cache.java:1969) Cache: CONFIGURATION_ITEMS_CACHE store hit for environmentconfig
2013-02-15 09:30:47,939 INFO (CacheFactory.java:27) REFERENCE_DATA loaded
2013-02-15 09:30:50,780 DEBUG (PayloadUtil.java:153) Cache peers for this CacheManager to be advertised: //172.21.131.242:50551/SERVICE_EXECUTION_CACHE|//172.21.131.242:50551/ERROR_CODES_CACHE|//172.21.131.242:50551/ACCOUNTING_CACHE|//172.21.131.242:50551/CONFIGURATION_ITEMS_CACHE|//172.21.131.242:50551/REFERENCE_DATA
2013-02-15 09:30:50,781 ERROR (PayloadUtil.java:203) Could not ungzip. Heartbeat will not be working. Not in GZIP format
2013-02-15 09:30:50,782 DEBUG (MulticastKeepaliveHeartbeatReceiver.java:148) rmiUrls received
Related
I am using Apache Artemis V2.12.0, started two instance of broker in two VM's
broker.xml (myhost1) [ broker.xml of myhost2 is similar only the port I used was 61616]
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
<core xmlns="urn:activemq:core">
<bindings-directory>./data/bindings</bindings-directory>
<journal-directory>./data/journal</journal-directory>
<large-messages-directory>./data/largemessages</large-messages-directory>
<paging-directory>./data/paging</paging-directory>
<!-- Connectors -->
<connectors>
<connector name="netty-connector">tcp://10.64.60.100:61617</connector><!-- direct ip addres of host myhost1 -->
<connector name="broker2-connector">tcp://myhost2:61616</connector> <!-- ip 10.64.60.101 <- mocked up ip for security reasons -->
</connectors>
<!-- Acceptors -->
<acceptors>
<acceptor name="amqp">tcp://0.0.0.0:61617?amqpIdleTimeout=0;tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE,AMQP;useEpoll=true</acceptor>
</acceptors>
<cluster-connections>
<cluster-connection name="myhost1-cluster">
<connector-ref>netty-connector</connector-ref>
<retry-interval>500</retry-interval>
<use-duplicate-detection>true</use-duplicate-detection>
<message-load-balancing>ON_DEMAND</message-load-balancing>
<max-hops>1</max-hops>
<static-connectors>
<connector-ref>broker2-connector</connector-ref> <!-- defined in the connectors -->
</static-connectors>
</cluster-connection>
</cluster-connections>
<security-settings>
<security-setting match="#">
<permission type="createNonDurableQueue" roles="amq"/>
<permission type="deleteNonDurableQueue" roles="amq"/>
<permission type="createDurableQueue" roles="amq"/>
<permission type="deleteDurableQueue" roles="amq"/>
<permission type="createAddress" roles="amq"/>
<permission type="deleteAddress" roles="amq"/>
<permission type="consume" roles="amq"/>
<permission type="browse" roles="amq"/>
<permission type="send" roles="amq"/>
<permission type="manage" roles="amq"/>
</security-setting>
</security-settings>
<address-settings>
<!--default for catch all-->
<address-setting match="#">
<dead-letter-address>DLQ</dead-letter-address>
<expiry-address>ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<!-- with -1 only the global-max-size is in use for limiting -->
<max-size-bytes>-1</max-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<address-full-policy>PAGE</address-full-policy>
<auto-create-queues>true</auto-create-queues>
<auto-create-addresses>true</auto-create-addresses>
<auto-delete-queues>false</auto-delete-queues>
<auto-delete-created-queues>false</auto-delete-created-queues>
<auto-delete-addresses>false</auto-delete-addresses>
</address-setting>
</address-settings>
</core>
</configuration>
After starting the broker instance on two nodes they joined the cluster, which i can see in logs.
2020-06-03 23:59:17,874 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61617 for protocols [CORE,AMQP]
2020-06-03 23:59:17,910 INFO [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live
2020-06-03 23:59:17,910 INFO [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.12.0 [localhost, nodeID=e6c6eab6-a456-11ea-94cf-000d3a306e31]
2020-06-03 23:59:18,240 INFO [org.apache.activemq.artemis.core.server] AMQ221027: Bridge ClusterConnectionBridge#5e9820f4 [name=$.artemis.internal.sf.myhost1-cluster.bd39cc41-a201-11ea-abaa-000d3a315d06, queue=QueueImpl[name=$.artemis.internal.sf.devmq1-cluster.bd39cc41-a201-11ea-abaa-000d3a315d06, postOffice=PostOfficeImpl [server=ActiveMQServerImpl::serverUUID=e6c6eab6-a456-11ea-94cf-000d3a306e31], temp=false]#2b0263f3 targetConnector=ServerLocatorImpl (identity=(Cluster-connection-bridge::ClusterConnectionBridge#5e9820f4 [name=$.artemis.internal.sf.devmq1-cluster.bd39cc41-a201-11ea-abaa-000d3a315d06, queue=QueueImpl[name=$.artemis.internal.sf.devmq1-cluster.bd39cc41-a201-11ea-abaa-000d3a315d06, postOffice=PostOfficeImpl [server=ActiveMQServerImpl::serverUUID=e6c6eab6-a456-11ea-94cf-000d3a306e31], temp=false]#2b0263f3 targetConnector=ServerLocatorImpl [initialConnectors=[TransportConfiguration(name=netty-connector, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=61616&host=10-64-60-100], discoveryGroupConfiguration=null]]::ClusterConnectionImpl#24293395[nodeUUID=e6c6eab6-a456-11ea-94cf-000d3a306e31, connector=TransportConfiguration(name=netty-connector, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=61617&host=10-64-60-101, address=, server=ActiveMQServerImpl::serverUUID=e6c6eab6-a456-11ea-94cf-000d3a306e31])) [initialConnectors=[TransportConfiguration(name=netty-connector, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=61616&host=10-64-60-100], discoveryGroupConfiguration=null]] is connected
2020-06-03 23:59:18,364 INFO [org.apache.activemq.hawtio.branding.PluginContextListener] Initialized activemq-branding plugin
Below java code sends message to the clustered broker,
Step1: both the brokers where running
Step2: The java client was started to send messages to the broker
Step3: From the console of myhost1, i see messages pushed to the queue
Step4: I stop the broker instance in myhost1
Step5: java client log, retries to connect to the other server, after n attempts it throws exception. (My expectation is it should NOT throw any exception)
The java code has JNDI approach which i commented, even in this case the messages where pushed but similar exception occured.
I tired JmsPoolConnectionfactory, even then the same issue, where when one of the broker instance is stopped after few retries it throws exception. (the logs for this are at bottom of the code)
Question:
Using the java code on client side how to achieve auto discovery/failover/reconnect without any exception. I am using static-connector under the cluster-options.
package com.demo.artemis.clients;
import java.util.Properties;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
import org.messaginghub.pooled.jms.JmsPoolConnectionFactory;
public class ArtemisClientClustered
{
public static void main(final String[] args) throws Exception {
//only produces the message
new ArtemisClientClustered().runProducer(true, false);
}
public boolean runProducer(boolean produceMesage, boolean consumeMessage) throws Exception{
Connection connection = null;
InitialContext initalContext = null;
int i = 0;
try {
Properties jndiProp = new Properties();
jndiProp.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
//jndiProp.put("connectionFactory.ConnectionFactory", "tcp://localhost:61616?producerMaxRate=50");
jndiProp.put("connectionFactory.ConnectionFactory", "(tcp://myhost2:61616,tcp://myhost1:61617)?ha=true;reconnectAttempts=-1;");
jndiProp.put("queue.queue/ahm.load-datawarehouse.queue","ahm.load-datawarehouse.queue");
initalContext = new InitialContext(jndiProp);
// Step 2. Perfom a lookup on the queue
Queue queue = (Queue) initalContext.lookup("queue/myExampleQ.queue");
// Step 3. Perform a lookup on the Connection Factory
//ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616?producerMaxRate=50");
ConnectionFactory cf = (ConnectionFactory)initalContext.lookup("ConnectionFactory");
// ConnectionFactory cf= new ActiveMQJMSConnectionFactory("(tcp://myhost2:61616,tcp://myhost1:61617)?ha=true;reconnectAttempts=-1;");
//using the PoolconectionFactory
JmsPoolConnectionFactory jmsPoolConnectionFactory = new JmsPoolConnectionFactory();
jmsPoolConnectionFactory.setMaxConnections(8);
jmsPoolConnectionFactory.setConnectionFactory(cf);
// Step 4. Create a JMS Connection
connection = jmsPoolConnectionFactory.createConnection("admin","admin");
// Step 5. Create a JMS Session
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
if(produceMesage) {
// Step 6. Create a JMS Message Producer
MessageProducer producer = session.createProducer(queue);
System.out.println("Will now send as many messages as we can in few seconds...");
// Step 7. Send as many messages as we can in N milliseconds
final long duration = 1200000;
i=0;
long start = System.currentTimeMillis();
while (System.currentTimeMillis() - start <= duration) {
TextMessage message = session.createTextMessage("This is text message: " + i++);
producer.send(message);
}
long end = System.currentTimeMillis();
double rate = 1000 * (double) i / (end - start);
System.out.println("We sent " + i + " messages in " + (end - start) + " milliseconds");
System.out.println("Actual send rate was " + rate + " messages per second");
// Step 8. For good measure we consumer the messages we produced.
}
if(consumeMessage) {
MessageConsumer messageConsumer = session.createConsumer(queue);
connection.start();
System.out.println("Now consuming the messages...");
i = 0;
while (true) {
TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000);
if (messageReceived == null) {
break;
}
i++;
}
System.out.println("Received " + i + " messages");
}
return true;
} finally {
// Step 9. Be sure to close our resources!
if (connection != null) {
connection.close();
}
}
}
}
Log message of client code execution: When the client starts both myhost1 and myhost2 was running.
After sometime I manually stop the myhost1 broker, expecting the myhost2 will be automatically discovered by the client.
....
2020-06-03 23:58:48 DEBUG ClientSessionFactoryImpl:1102 - Trying to connect with connectorFactory = org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory#45d84a20, connectorConfig=TransportConfiguration(name=ConnectionFactory, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=61616&host=myhost2&reconnectAttempts=-1&ha=true
2020-06-03 23:58:48 DEBUG NettyConnector:486 - Connector NettyConnector [host=myhost2, port=61616, httpEnabled=false, httpUpgradeEnabled=false, useServlet=false, servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true] using native epoll
2020-06-03 23:58:48 DEBUG client:668 - AMQ211002: Started EPOLL Netty Connector version 4.1.48.Final to myhost2:61616
2020-06-03 23:58:48 DEBUG NettyConnector:815 - Remote destination: myhost2/10.64.60.101:61616
2020-06-03 23:58:48 DEBUG NettyConnector:659 - Added ActiveMQClientChannelHandler to Channel with id = cf33ff23
2020-06-03 23:58:48 DEBUG Recycler:97 - -Dio.netty.recycler.maxCapacityPerThread: 4096
2020-06-03 23:58:48 DEBUG Recycler:98 - -Dio.netty.recycler.maxSharedCapacityFactor: 2
2020-06-03 23:58:48 DEBUG Recycler:99 - -Dio.netty.recycler.linkCapacity: 16
2020-06-03 23:58:48 DEBUG Recycler:100 - -Dio.netty.recycler.ratio: 8
2020-06-03 23:58:48 DEBUG AbstractByteBuf:63 - -Dio.netty.buffer.checkAccessible: true
2020-06-03 23:58:48 DEBUG AbstractByteBuf:64 - -Dio.netty.buffer.checkBounds: true
2020-06-03 23:58:48 DEBUG ResourceLeakDetectorFactory:195 - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector#6933b6c6
2020-06-03 23:58:48 DEBUG ClientSessionFactoryImpl:809 - Reconnection successful
2020-06-03 23:58:48 DEBUG NettyConnector:1269 - NettyConnector [host=myhost2, port=61616, httpEnabled=false, httpUpgradeEnabled=false, useServlet=false, servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true] host 1: 10.44.6.85 ip address: 10.44.6.85 host 2: myhost2 ip address: 10.44.6.85
2020-06-03 23:58:48 DEBUG ClientSessionFactoryImpl:277 - ClientSessionFactoryImpl received backup update for live/backup pair = TransportConfiguration(name=ConnectionFactory, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=61616&host=myhost2&reconnectAttempts=-1&ha=true / null but it didn't belong to TransportConfiguration(name=ConnectionFactory, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=61616&host=myhost2&reconnectAttempts=-1&ha=true
Will now send as many messages as we can in few seconds...
...
...
2020-06-04 00:01:09 WARN client:210 - AMQ212037: Connection failure to myhost2/10.64.60.101:61616 has been detected: AMQ219015: The connection was disconnected because of server shutdown [code=DISCONNECTED]
2020-06-04 00:01:09 DEBUG ClientSessionFactoryImpl:800 - Trying reconnection attempt 0/-1
2020-06-04 00:01:09 DEBUG ClientSessionFactoryImpl:1102 - Trying to connect with connectorFactory = org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory#45d84a20, connectorConfig=TransportConfiguration(name=ConnectionFactory, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=61616&host=myhost2&reconnectAttempts=-1&ha=true
2020-06-04 00:01:09 DEBUG NettyConnector:486 - Connector NettyConnector [host=myhost2, port=61616, httpEnabled=false, httpUpgradeEnabled=false, useServlet=false, servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true] using native epoll
2020-06-04 00:01:09 DEBUG client:668 - AMQ211002: Started EPOLL Netty Connector version 4.1.48.Final to myhost2:61616
2020-06-04 00:01:09 DEBUG NettyConnector:815 - Remote destination: myhost2/10.64.60.101:61616
2020-06-04 00:01:09 DEBUG NettyConnector:659 - Added ActiveMQClientChannelHandler to Channel with id = d4ed884e
2020-06-04 00:01:09 DEBUG ClientSessionFactoryImpl:1063 - Connector towards NettyConnector [host=myhost2, port=61616, httpEnabled=false, httpUpgradeEnabled=false, useServlet=false, servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true] failed
2020-06-04 00:01:09 DEBUG ClientSessionFactoryImpl:1140 - Backup is not active, trying original connection configuration now.
2020-06-04 00:01:11 DEBUG ClientSessionFactoryImpl:800 - Trying reconnection attempt 1/-1
2020-06-04 00:01:11 DEBUG ClientSessionFactoryImpl:1102 - Trying to connect with connectorFactory = org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory#45d84a20, connectorConfig=TransportConfiguration(name=ConnectionFactory, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=61616&host=myhost2&reconnectAttempts=-1&ha=true
2020-06-04 00:01:11 DEBUG NettyConnector:486 - Connector NettyConnector [host=myhost2, port=61616, httpEnabled=false, httpUpgradeEnabled=false, useServlet=false, servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true] using native epoll
2020-06-04 00:01:11 DEBUG client:668 - AMQ211002: Started EPOLL Netty Connector version 4.1.48.Final to myhost2:61616
2020-06-04 00:01:11 DEBUG NettyConnector:815 - Remote destination: myhost2/10.64.60.101:61616
2020-06-04 00:01:11 DEBUG NettyConnector:659 - Added ActiveMQClientChannelHandler to Channel with id = 1530857a
2020-06-04 00:01:11 DEBUG ClientSessionFactoryImpl:1063 - Connector towards NettyConnector [host=myhost2, port=61616, httpEnabled=false, httpUpgradeEnabled=false, useServlet=false, servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true] failed
020-06-04 00:01:37 DEBUG NettyConnector:659 - Added ActiveMQClientChannelHandler to Channel with id = d886a84e
2020-06-04 00:01:37 DEBUG ClientSessionFactoryImpl:1063 - Connector towards NettyConnector [host=myhost2, port=61616, httpEnabled=false, httpUpgradeEnabled=false, useServlet=false, servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true] failed
2020-06-04 00:01:37 DEBUG ClientSessionFactoryImpl:1140 - Backup is not active, trying original connection configuration now.
Exception in thread "main" javax.jms.JMSException: AMQ219014: Timed out after waiting 30,000 ms for response when sending packet 71
at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:457)
at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:361)
at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext.sendFullMessage(ActiveMQSessionContext.java:552)
at org.apache.activemq.artemis.core.client.impl.ClientProducerImpl.sendRegularMessage(ClientProducerImpl.java:296)
at org.apache.activemq.artemis.core.client.impl.ClientProducerImpl.doSend(ClientProducerImpl.java:268)
at org.apache.activemq.artemis.core.client.impl.ClientProducerImpl.send(ClientProducerImpl.java:143)
at org.apache.activemq.artemis.core.client.impl.ClientProducerImpl.send(ClientProducerImpl.java:125)
at org.apache.activemq.artemis.jms.client.ActiveMQMessageProducer.doSendx(ActiveMQMessageProducer.java:483)
at org.apache.activemq.artemis.jms.client.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:220)
at org.messaginghub.pooled.jms.JmsPoolMessageProducer.sendMessage(JmsPoolMessageProducer.java:182)
at org.messaginghub.pooled.jms.JmsPoolMessageProducer.send(JmsPoolMessageProducer.java:90)
at org.messaginghub.pooled.jms.JmsPoolMessageProducer.send(JmsPoolMessageProducer.java:79)
at com.demo.artemis.clients.ArtemisClientClustered.runProducer(ArtemisClientClustered.java:77)
at com.demo.artemis.clients.ArtemisClientClustered.main(ArtemisClientClustered.java:26)
Caused by: ActiveMQConnectionTimedOutException[errorType=CONNECTION_TIMEDOUT message=AMQ219014: Timed out after waiting 30,000 ms for response when sending packet 71]
... 14 more
NOTE: When I used the Camel consumer to consumer the message from this queue and transform to another queue. During the process when I stop the broker the consumer count is automatically redirected to the other broker instance. From the console I am able to see the consumer counts redirected from one broker to another.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="jmsConnectionFactory" class="org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory">
<constructor-arg index="0" value="(tcp://myhost2:61616,tcp://myhost1:61617)?ha=true;reconnectAttempts=-1;"/>
</bean>
<bean id="jmsPooledConnectionFactory" class="org.messaginghub.pooled.jms.JmsPoolConnectionFactory" init-method="start" destroy-method="stop">
<property name="maxConnections" value="10" />
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="jmsPooledConnectionFactory" />
<property name="concurrentConsumers" value="10" />
</bean>
<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
<property name="configuration" ref="jmsConfig" />
</bean>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<endpoint id="queue1" uri="jms:queue:myExampleQ" />
<endpoint id="queue2" uri="jms:queue:myExampleQ2" />
<route>
<from uri="ref:queue1" />
<convertBodyTo type="java.lang.String" />
<transform>
<simple>MSG FRM queue1 TO queue2 : ${bodyAs(String)}</simple>
</transform>
<to uri="ref:queue2" />
</route>
</camelContext>
</beans>
You've configured an active/active cluster of 2 nodes. This supports both connection and message load-balancing, but it doesn't support transparent failover. In order to get transparent failover you need to configure an active/passive HA pair. Check the ActiveMQ Artemis documentation as well as HA examples shipped with the broker for more details on how to do that.
this is the first time I am trying to setup datasource in my Wildfly server. I tried to follow some tutorials which I found on Google but it still doesn't work.
I am working on a web service but I keep getting some errors when I deploy my .war file.
Here is the latest log when app is deployed:
22:16:33,049 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment IslamicPostsWS.war (runtime-name: IslamicPostsWS.war) in 7ms
22:16:33,184 INFO [org.jboss.as.server] (XNIO-1 task-2) JBAS018558: Undeployed "IslamicPostsWS.war" (runtime-name: "IslamicPostsWS.war")
22:16:33,186 INFO [org.jboss.as.controller] (XNIO-1 task-2) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."IslamicPostsWS.war".POST_MODULE
22:16:35,518 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015877: Stopped deployment IslamicPostsWS (runtime-name: IslamicPostsWS) in 7ms
22:16:35,660 INFO [org.jboss.as.server] (XNIO-1 task-6) JBAS018558: Undeployed "IslamicPostsWS" (runtime-name: "IslamicPostsWS")
22:16:38,358 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) JBAS015018: Deployment IslamicPostsWS was previously deployed by this scanner but has been removed from the server deployment list by another management tool. Marker file C:\Users\Ilhami\workspace-services\.metadata\.plugins\org.jboss.ide.eclipse.as.core\WildFly_8.0_Runtime_Server1396040937545\deploy\IslamicPostsWS.undeployed is being added to record this fact.
22:17:00,406 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "IslamicPostsWS.war" (runtime-name: "IslamicPostsWS.war")
22:17:00,540 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "IslamicPostsWS.war")]) - failure description: {
"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.IslamicPostsWS.IslamicPostsWS.DefaultDataSource is missing [jboss.naming.context.java.jboss.datasources.ExampleDS]"],
"JBAS014879: One or more services were unable to start due to one or more indirect dependencies not being available." => {
"Services that were unable to start:" => [
"jboss.deployment.unit.\"IslamicPostsWS.war\".component.\"com.sun.faces.config.ConfigureListener\".START",
"jboss.deployment.unit.\"IslamicPostsWS.war\".component.\"javax.faces.webapp.FacetTag\".START",
"jboss.deployment.unit.\"IslamicPostsWS.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START",
"jboss.deployment.unit.\"IslamicPostsWS.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START",
"jboss.deployment.unit.\"IslamicPostsWS.war\".component.\"org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher\".START",
"jboss.deployment.unit.\"IslamicPostsWS.war\".component.\"org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap\".START",
"jboss.deployment.unit.\"IslamicPostsWS.war\".deploymentCompleteService",
"jboss.deployment.unit.\"IslamicPostsWS.war\".jndiDependencyService",
"jboss.naming.context.java.module.IslamicPostsWS.IslamicPostsWS.env.jdbc.TestDB",
"jboss.undertow.deployment.default-server.default-host./IslamicPostsWS",
"jboss.undertow.deployment.default-server.default-host./IslamicPostsWS.UndertowDeploymentInfoService"
],
"Services that may be the cause:" => [
"jboss.jdbc-driver.com_mysql_jdbc_Driver",
"jboss.naming.context.java.jboss.datasources.ExampleDS"
]
}
}
22:17:00,683 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "IslamicPostsWS.war" (runtime-name : "IslamicPostsWS.war")
22:17:00,683 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.jboss.datasources.ExampleDS (missing) dependents: [service jboss.naming.context.java.module.IslamicPostsWS.IslamicPostsWS.DefaultDataSource]
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="JPADB">
<jta-data-source>java:jboss/datasources/DBTest</jta-data-source>
<properties>
<property name="showSql" value="true"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
</properties>
</persistence-unit>
</persistence>
Just tell me if you need more files.
Go into your wildfly console (something like localhost:9990) and edit the Configuration->Container->EE->Default Bindings section. Set the default datasource to the JNDI name of some valid datasource.
I removed the default one that was there and just pointed it to my main datasource since the server exists to run one app only.
You probably have the ds declaration "java:jboss/datasources/ExampleDS" missing in your standalone.xml xmlns "urn:jboss:domain:datasources:2.0" section, just and it will work (here's the example from the default configuration):
<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>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
Or you can also add through the UI as mentioned by other response.
can you post your datasource definition?
I think it would be the best to test the datasource deployment 'standalone'. I mean separated from an actual application deployment, just to test whether your datasource works or not.
You can test this f.i. using the web console (localhost:9990/console).
It also looks like there are problems with the pre-configured example DS of wildfly. Did you remove this DS? In standalone.xml there is also a reference on ExampleDS which might be broken.
Assuming you are using a MySQL DB, you can create a DS in the following way:
(1) Download the mysql driver from here:
http://dev.mysql.com/downloads/connector/j/
(2) Copy the mysql driver to:
WILDFLY_HOME/modules/system/layers/base/com/mysql/main
(3) From the JBoss (or Wildfly) console, run the command:
/subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql, driver-module-name=com.mysql, driver-class-name=com.mysql.jdbc.Driver)
(4) Then, again from the JBoss (or Wildfly) console, run command:
/subsystem=datasources/data-source=YourDS:add(driver-name=mysql, user-name=USERNAME, password=PASSWORD, connection-url=jdbc:mysql://localhost:3306/YOURDATABASE, min-pool-size=5, max-pool-size=15, jndi-name=java:jboss/datasources/YourDS, enabled=true, validate-on-match=true, valid-connection-checker-class-name=org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker, exception-sorter-class-name=org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter)
Voila. Now you have a Datasource with a JNDI path of:
java:jboss/datasources/YourDS
Check if default-bindings configuration references to correct datasource: https://docs.jboss.org/author/display/WFLY8/Default+EE+Bindings+Configuration
I had
service jboss.naming.context.java.jboss.datasourservice jboss.naming.context.java.jboss.datasources.ExampleDS (missing) dependents:...
on wildfly-8.1.0.Final.
IMHO
in standalone/configuration/standalone-full.xml it had
<default-bindings ... datasource="java:jboss/datasources/ExampleDS" ...
and
<datasource jndi-name="java:/datasources/ExampleDS"...
jndi-name mismatch!
I created ExampleDS2 with jndi-name="java:jboss/datasources/ExampleDS". This solved my problem.
I am running apachemq on windows xp.I have no web server services running or any database of any sort,but i keep on getting this error once i start active mq
ERROR | Failed to start Apache ActiveMQ ([localhost,
ID:computer_1-3725-13902958 73141-0:1], java.net.URISyntaxException:
Illegal character in hostname at index 13:
ws://computer_1:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857
600)
This is the complete log
C:\apache_activemq>.\bin\activemq
Java Runtime: Oracle Corporation 1.7.0_21 C:\Program Files\Java\jdk1.7.0_21\jre
Heap sizes: current=1013632k free=996854k max=1013632k
JVM args: -Dcom.sun.management.jmxremote -Xms1G -Xmx1G -Djava.util.logging.c
onfig.file=logging.properties -Dhawtio.realm=activemq -Dhawtio.role=admins -Dhaw
tio.rolePrincipalClasses=org.apache.activemq.jaas.GroupPrincipal -Djava.security
.auth.login.config=C:\apache_activemq\bin\..\conf\login.config -Dactivemq.classp
ath=C:\apache_activemq\bin\..\conf;C:\apache_activemq\bin\../conf;C:\apache_acti
vemq\bin\../conf; -Dactivemq.home=C:\apache_activemq\bin\.. -Dactivemq.base=C:\a
pache_activemq\bin\.. -Dactivemq.conf=C:\apache_activemq\bin\..\conf -Dactivemq.
data=C:\apache_activemq\bin\..\data -Djava.io.tmpdir=C:\apache_activemq\bin\..\d
ata\tmp
Extensions classpath:
[C:\apache_activemq\bin\..\lib,C:\apache_activemq\bin\..\lib\camel,C:\apache_a
ctivemq\bin\..\lib\optional,C:\apache_activemq\bin\..\lib\web,C:\apache_activemq
\bin\..\lib\extra]
ACTIVEMQ_HOME: C:\apache_activemq\bin\..
ACTIVEMQ_BASE: C:\apache_activemq\bin\..
ACTIVEMQ_CONF: C:\apache_activemq\bin\..\conf
ACTIVEMQ_DATA: C:\apache_activemq\bin\..\data
Loading message broker from: xbean:activemq.xml
INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1#726b5b: startu
p date [Tue Jan 21 12:17:33 EAT 2014]; root of context hierarchy
INFO | PListStore:[C:\apache_activemq\bin\..\data\localhost\tmp_storage] starte
d
INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[C:\apache_activemq\b
in\..\data\kahadb]
INFO | JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099
/jmxrmi
INFO | KahaDB is version 5
INFO | Recovering from the journal ...
INFO | Recovery replayed 14 operations from the journal in 0.16 seconds.
INFO | Apache ActiveMQ 5.9.0 (localhost, ID:computer_1-3725-1390295873141-0:1)
is starting
INFO | Listening for connections at: tcp://0.0.0.0:61616?maximumConnections=100
0&wireFormat.maxFrameSize=104857600
INFO | Connector openwire started
INFO | Listening for connections at: amqp://0.0.0.0:5672?maximumConnections=100
0&wireFormat.maxFrameSize=104857600
INFO | Connector amqp started
INFO | Listening for connections at: stomp://0.0.0.0:61613?maximumConnections=1
000&wireFormat.maxFrameSize=104857600
INFO | Connector stomp started
INFO | Listening for connections at: mqtt://0.0.0.0:1883?maximumConnections=100
0&wireFormat.maxFrameSize=104857600
INFO | Connector mqtt started
ERROR | Failed to start Apache ActiveMQ ([localhost, ID:computer_1-3725-13902958
73141-0:1], java.net.URISyntaxException: Illegal character in hostname at index
13: ws://computer_1:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857
600)
INFO | Apache ActiveMQ 5.9.0 (localhost, ID:computer_1-3725-1390295873141-0:1)
is shutting down
INFO | Connector openwire stopped
INFO | Connector amqp stopped
INFO | Connector stomp stopped
INFO | Connector mqtt stopped
INFO | Connector ws stopped
INFO | PListStore:[C:\apache_activemq\bin\..\data\localhost\tmp_storage] stoppe
d
INFO | Stopping async queue tasks
INFO | Stopping async topic tasks
INFO | Stopped KahaDB
INFO | Apache ActiveMQ 5.9.0 (localhost, ID:computer_1-3725-1390295873141-0:1)
uptime 13.059 seconds
INFO | Apache ActiveMQ 5.9.0 (localhost, ID:computer_1-3725-1390295873141-0:1)
is shutdown
INFO | Closing org.apache.activemq.xbean.XBeanBrokerFactory$1#726b5b: startup d
ate [Tue Jan 21 12:17:33 EAT 2014]; root of context hierarchy
WARN | Exception thrown from LifecycleProcessor on context close
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refr
esh' before invoking lifecycle methods via the context: org.apache.activemq.xbea
n.XBeanBrokerFactory$1#726b5b: startup date [Tue Jan 21 12:17:33 EAT 2014]; root
of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getLif
ecycleProcessor(AbstractApplicationContext.java:360)
at org.springframework.context.support.AbstractApplicationContext.doClos
e(AbstractApplicationContext.java:1057)
at org.springframework.context.support.AbstractApplicationContext.close(
AbstractApplicationContext.java:1010)
at org.apache.activemq.hooks.SpringContextHook.run(SpringContextHook.jav
a:30)
at org.apache.activemq.broker.BrokerService.stop(BrokerService.java:782)
at org.apache.activemq.xbean.XBeanBrokerService.stop(XBeanBrokerService.
java:122)
at org.apache.activemq.broker.BrokerService.start(BrokerService.java:574
)
at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBean
BrokerService.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1608)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1549)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:628)
at org.springframework.context.support.AbstractApplicationContext.finish
BeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:479)
at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(
ResourceXmlApplicationContext.java:64)
at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(
ResourceXmlApplicationContext.java:52)
at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFact
ory.java:104)
at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext
(XBeanBrokerFactory.java:104)
at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBroker
Factory.java:67)
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.j
ava:71)
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.j
ava:54)
at org.apache.activemq.console.command.StartCommand.runTask(StartCommand
.java:87)
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractC
ommand.java:57)
at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand
.java:150)
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractC
ommand.java:57)
at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.ja
va:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
at org.apache.activemq.console.Main.main(Main.java:115)
ERROR: java.lang.RuntimeException: Failed to execute start task. Reason: java.la
ng.IllegalStateException: BeanFactory not initialized or already closed - call '
refresh' before accessing beans via the ApplicationContext
java.lang.RuntimeException: Failed to execute start task. Reason: java.lang.Ille
galStateException: BeanFactory not initialized or already closed - call 'refresh
' before accessing beans via the ApplicationContext
at org.apache.activemq.console.command.StartCommand.runTask(StartCommand
.java:91)
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractC
ommand.java:57)
at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand
.java:150)
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractC
ommand.java:57)
at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.ja
va:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
at org.apache.activemq.console.Main.main(Main.java:115)
Caused by: java.lang.IllegalStateException: BeanFactory not initialized or alrea
dy closed - call 'refresh' before accessing beans via the ApplicationContext
at org.springframework.context.support.AbstractRefreshableApplicationCon
text.getBeanFactory(AbstractRefreshableApplicationContext.java:171)
at org.springframework.context.support.AbstractApplicationContext.destro
yBeans(AbstractApplicationContext.java:1090)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:487)
at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(
ResourceXmlApplicationContext.java:64)
at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(
ResourceXmlApplicationContext.java:52)
at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFact
ory.java:104)
at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext
(XBeanBrokerFactory.java:104)
at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBroker
Factory.java:67)
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.j
ava:71)
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.j
ava:54)
at org.apache.activemq.console.command.StartCommand.runTask(StartCommand
.java:87)
... 10 more
ERROR: java.lang.IllegalStateException: BeanFactory not initialized or already c
losed - call 'refresh' before accessing beans via the ApplicationContext
java.lang.IllegalStateException: BeanFactory not initialized or already closed -
call 'refresh' before accessing beans via the ApplicationContext
at org.springframework.context.support.AbstractRefreshableApplicationCon
text.getBeanFactory(AbstractRefreshableApplicationContext.java:171)
at org.springframework.context.support.AbstractApplicationContext.destro
yBeans(AbstractApplicationContext.java:1090)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:487)
at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(
ResourceXmlApplicationContext.java:64)
at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(
ResourceXmlApplicationContext.java:52)
at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFact
ory.java:104)
at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext
(XBeanBrokerFactory.java:104)
at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBroker
Factory.java:67)
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.j
ava:71)
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.j
ava:54)
at org.apache.activemq.console.command.StartCommand.runTask(StartCommand
.java:87)
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractC
ommand.java:57)
at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand
.java:150)
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractC
ommand.java:57)
at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.ja
va:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
at org.apache.activemq.console.Main.main(Main.java:115)
C:\apache_activemq>
My %SystemRoot%\system32\drivers\etc\hosts looks like this
127.0.0.1 localhost
127.0.0.1 mpa.one.microsoft.com
My activemq.xml looks like this
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- START SNIPPET: example -->
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:${activemq.conf}/credentials.properties</value>
</property>
</bean>
<!-- Allows log searching in hawtio console -->
<bean id="logQuery" class="org.fusesource.insight.log.log4j.Log4jLogQuery"
lazy-init="false" scope="singleton"
init-method="start" destroy-method="stop">
</bean>
<!--
The <broker> element is used to configure the ActiveMQ broker.
-->
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic=">" >
<!-- The constantPendingMessageLimitStrategy is used to prevent
slow topic consumers to block producers and affect other consumers
by limiting the number of messages that are retained
For more information, see:
http://activemq.apache.org/slow-consumer-handling.html
-->
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
<!--
The managementContext is used to configure how ActiveMQ is exposed in
JMX. By default, ActiveMQ uses the MBean server that is started by
the JVM. For more information, see:
http://activemq.apache.org/jmx.html
-->
<managementContext>
<managementContext createConnector="true"/>
</managementContext>
<!--
Configure message persistence for the broker. The default persistence
mechanism is the KahaDB store (identified by the kahaDB tag).
For more information, see:
http://activemq.apache.org/persistence.html
-->
<persistenceAdapter>
<kahaDB directory="${activemq.data}/kahadb"/>
</persistenceAdapter>
<!--
The systemUsage controls the maximum amount of space the broker will
use before disabling caching and/or slowing down producers. For more information, see:
http://activemq.apache.org/producer-flow-control.html
-->
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage percentOfJvmHeap="70" />
</memoryUsage>
<storeUsage>
<storeUsage limit="100 gb"/>
</storeUsage>
<tempUsage>
<tempUsage limit="50 gb"/>
</tempUsage>
</systemUsage>
</systemUsage>
<!--
The transport connectors expose ActiveMQ over a given protocol to
clients and other brokers. For more information, see:
http://activemq.apache.org/configuring-transports.html
-->
<transportConnectors>
<!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>
<!-- destroy the spring context on shutdown to stop jetty -->
<shutdownHooks>
<bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
</shutdownHooks>
</broker>
<!--
Enable web consoles, REST and Ajax APIs and demos
The web consoles requires by default login, you can disable this in the jetty.xml file
Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
-->
<import resource="jetty.xml"/>
</beans>
<!-- END SNIPPET: example -->
How should i fix this error?.
I had similar problem. The problem gone after reboot. Try to reboot PC and start activemq first.
Probably it related that some ports were already taken.
My hostname which is localhost did not contain any underscores.The only underscore was in my computer name.My old name was computer_1 but i changed it to computer1 and now i am able to use localhost:8161 activemq web console.
To know how to change the computer name when on windows,do google it or refer to windows documentation.This error has nothing to do with hostname proper but rather the computer name.
Check your "activemq.log" in your "data" folder, in my case I obtain this error because I was using a "redeliveryPlugin" and it requires a schedulerSupport="true" in broker definition.
I am running JBoss as standalone version. I would like to connect to my local mysql database
I copied the mysql connector in modules folder
me#air~/Downloads/jboss/standalone/configuration - 10:56:18 $ ls ../../modules/org/mysql/main/
mysql-connector-java-5.1.22-bin.jar
Next I changed the standalone.xml in jboss/standalone/configuration as
<drivers>
<driver name="com.mysql" module="org.mysql" />
<driver name="h2" module="com.h2database.h2"> <!-- default provided-->
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
Then I added the datasource as
<datasource jndi-name="java:/bb" pool-name="bb-pool" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:mysql://127.0.0.1:3306/mydb</connection-url>
<driver>mysql</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>bb</user-name>
<password>bb</password>
</security>
<statement>
<prepared-statement-cache-size>100</prepared-statement-cache-size>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</datasource>
I am using JBoss AS 7.1.
When I start the server on console, I see errors
10:54:47,458 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
10:54:47,671 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.mysql (missing) dependents: [service jboss.data-source.java:/bb]
10:54:47,676 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
10:54:47,676 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 2000ms - Started 134 of 212 services (2 services failed or missing dependencies, 74 services are passive or on-demand)
and when I hit Ctrl+C, I see
^C10:54:54,998 INFO [org.jboss.as.osgi] (MSC service thread 1-8) JBAS011942: Stopping OSGi Framework
10:54:55,004 INFO [org.jboss.as.logging] JBAS011503: Restored bootstrap log handlers
10:54:55,007 INFO [com.arjuna.ats.jbossatx] ARJUNA032018: Destroying TransactionManagerService
10:54:55,008 INFO [com.arjuna.ats.jbossatx] ARJUNA032014: Stopping transaction recovery manager
10:54:55,010 INFO [org.apache.catalina.core.StandardContext] Container org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/] has not been started
10:54:55,039 INFO [org.apache.coyote.http11.Http11Protocol] Pausing Coyote HTTP/1.1 on http--127.0.0.1-8080
10:54:55,039 INFO [org.apache.coyote.http11.Http11Protocol] Stopping Coyote HTTP/1.1 on http--127.0.0.1-8080
10:54:55,043 INFO [org.jboss.as.controller] JBAS014774: Service status report
JBAS014776: Newly corrected services:
service jboss.jdbc-driver.mysql (new available)
10:54:55,044 INFO [org.jboss.as] JBAS015950: JBoss AS 7.1.1.Final "Brontes" stopped in 47ms
I am new to JBoss and don't know how to fix this issue or to understand what is that I am doing wrong here
I think in your datasource you are referencing the driver mysql, but you named the driver com.mysql.
Try changing one the driver name to mysql.
Just a note: it is best to use the CLI to install the drivers and use the CLI or Web Console to build your datasources. The intention with AS7 is that these tools are used for all of your config and there are very few reasons why you should touch the XML yourself.
I had exactly the same mistake. Took me hours to find out how dumb it was.
In my case I was running jboss as a service under the jboss-as user, nice and easy. Except that when I created the mysql/main directory, along with the files within, I was under another user. No permissions there for jboss-as guy.
A simple chown on modules/ directory did the job.
First of all, your driver definition name doesn't match the driver name under the <datasource> definition. Replace <driver name="com.mysql" ... with <driver name="mysql" ... for it to work.
Second, have you added the module.xml file? It's not enough to copy the MySQL connector jar in the ./modules/com/mysql/main folder, you also have to add the module.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.26-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Also, I had a strage similar problem when using the MySQL connector version 5.0.8, where the driver was not found / recognized. It disappeared when I switched to the newer 5.1.26 version.
Make sure you are using latest version of mysql jdbc connector , i solve same issue of mine with replacing latest mysql connetor
I have some problems trying to start a datanode in Hadoop, from the log I can see that datanode is started twice (partial log follows):
2012-05-22 16:25:00,369 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting DataNode
STARTUP_MSG: host = master/192.168.0.1
STARTUP_MSG: args = []
STARTUP_MSG: version = 1.0.1
STARTUP_MSG: build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.0 -r 1243785; compiled by 'hortonfo' on Tue Feb 14 08:15:38 UTC 2012
************************************************************/
2012-05-22 16:25:00,375 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting DataNode
STARTUP_MSG: host = master/192.168.0.1
STARTUP_MSG: args = []
STARTUP_MSG: version = 1.0.1
STARTUP_MSG: build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.0 -r 1243785; compiled by 'hortonfo' on Tue Feb 14 08:15:38 UTC 2012
************************************************************/
2012-05-22 16:25:00,490 INFO org.apache.hadoop.metrics2.impl.MetricsConfig: loaded properties from hadoop-metrics2.properties
2012-05-22 16:25:00,500 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source MetricsSystem,sub=Stats registered.
2012-05-22 16:25:00,500 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Scheduled snapshot period at 10 second(s).
2012-05-22 16:25:00,500 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: DataNode metrics system started
2012-05-22 16:25:00,512 INFO org.apache.hadoop.metrics2.impl.MetricsConfig: loaded properties from hadoop-metrics2.properties
2012-05-22 16:25:00,523 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source MetricsSystem,sub=Stats registered.
2012-05-22 16:25:00,523 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Scheduled snapshot period at 10 second(s).
2012-05-22 16:25:00,524 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: DataNode metrics system started
2012-05-22 16:25:00,722 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source ugi registered.
2012-05-22 16:25:00,724 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source ugi registered.
2012-05-22 16:25:00,727 WARN org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Source name ugi already exists!
2012-05-22 16:25:00,729 WARN org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Source name ugi already exists!
2012-05-22 16:20:15,894 INFO org.apache.hadoop.hdfs.server.common.Storage: Cannot lock storage /app/hadoop/tmp/dfs/data. The directory is already locked.
2012-05-22 16:20:16,008 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Cannot lock storage /app/hadoop/tmp/dfs/data. The directory is already locked.
at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.lock(Storage.java:602)
at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.analyzeStorage(Storage.java:455)
at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:111)
at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNode.java:385)
at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:299)
at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:1582)
at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:1521)
at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:1539)
at org.apache.hadoop.hdfs.server.datanode.DataNode.secureMain(DataNode.java:1665)
at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:1682)
I've searched online and I found this question, but I didn't overwrite anything using conf/hdfs-site.xml, that is shown below, so Hadoop should use default values that (as described here) cannot cause any failed lock.
This is my conf/hdfs-site.xml:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.replication</name>
<value>2</value>
<description>Default block replication.
The actual number of replications can be specified when the file is created.
The default is used if replication is not specified in create time.
</description>
</property>
</configuration>
This is my conf/core-site.xml:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/app/hadoop/tmp</value>
<description>A base for other temporary directories.</description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://master:54310</value>
<description>The name of the default file system. A URI whose
scheme and authority determine the FileSystem implementation. The
uri's scheme determines the config property (fs.SCHEME.impl) naming
the FileSystem implementation class. The uri's authority is used to
determine the host, port, etc. for a filesystem.</description>
</property>
</configuration>
This is the content of hadoop/conf/slaves:
master
slave
stop datanode
remove the in_use.lock file from the dfs data dir
location and start datanode
it should work just fine
Also add the following 2 properties in your hdfs-site.xml file..
<property>
<name>dfs.name.dir</name>
<value>/some_path</value>
</property>
<property>
<name>dfs.data.dir</name>
<value>/some_path</value>
</property>
their default location is /tmp..because of this you lose data on each restart.
I was facing a similar issue, but I read a post that said the dfs.name.dir and dfs.data.dir should be different from each other. I had the two to be the same, and changing these values to be different from each other fixed my issue.
I had the same issue and setting umask to 0022 in the shell, where I was running the tests fixed the issue for me.
sudo rm -r /tmp/hadoop-[YourNameHere]/dfs/data/
And restart dfs.