diff --git a/.gitignore b/.gitignore index 7af8f9fc2d..015033e264 100644 --- a/.gitignore +++ b/.gitignore @@ -58,11 +58,6 @@ integration/activemq-*-integration/.project # /distribution/activemq/ /distribution/activemq/.project -# /distribution/jnp-client/ -/distribution/jnp-client/target -/distribution/jnp-client/bin -/distribution/jnp-client/.project - # /docs/ /docs/.project diff --git a/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Run.java b/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Run.java index 8bab07e57e..a83be7557c 100644 --- a/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Run.java +++ b/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Run.java @@ -34,7 +34,6 @@ import org.apache.activemq.integration.bootstrap.ActiveMQBootstrapLogger; import org.apache.activemq.jms.server.JMSServerManager; import org.apache.activemq.jms.server.config.JMSConfiguration; import org.apache.activemq.jms.server.impl.JMSServerManagerImpl; -import org.apache.activemq.jms.server.impl.StandaloneNamingServer; import org.apache.activemq.spi.core.security.ActiveMQSecurityManager; import javax.management.MBeanServer; @@ -51,7 +50,6 @@ public class Run implements Action @Arguments(description = "Broker Configuration URI, default 'xml:${ACTIVEMQ_HOME}/config/non-clustered/bootstrap.xml'") String configuration; - private StandaloneNamingServer namingServer; private JMSServerManager jmsServerManager; private ArrayList components = new ArrayList<>(); @@ -84,20 +82,6 @@ public class Run implements Action ActiveMQServerImpl server = new ActiveMQServerImpl(core, mBeanServer, security); - namingServer = new StandaloneNamingServer(server); - - namingServer.setBindAddress(broker.naming.bindAddress); - - namingServer.setPort(broker.naming.port); - - namingServer.setRmiBindAddress(broker.naming.rmiBindAddress); - - namingServer.setRmiPort(broker.naming.rmiPort); - - namingServer.start(); - - ActiveMQBootstrapLogger.LOGGER.startedNamingService(broker.naming.bindAddress, broker.naming.port, broker.naming.rmiBindAddress, broker.naming.rmiPort); - if (jms != null) { jmsServerManager = new JMSServerManagerImpl(server, jms); diff --git a/activemq-dto/src/main/java/org/apache/activemq/dto/BrokerDTO.java b/activemq-dto/src/main/java/org/apache/activemq/dto/BrokerDTO.java index 70e6767cbd..c6f8974a49 100644 --- a/activemq-dto/src/main/java/org/apache/activemq/dto/BrokerDTO.java +++ b/activemq-dto/src/main/java/org/apache/activemq/dto/BrokerDTO.java @@ -40,9 +40,6 @@ public class BrokerDTO @XmlElementRef public SecurityDTO security; - @XmlElementRef - public NamingDTO naming; - @XmlElementRef(required = false) public WebServerDTO web; diff --git a/activemq-dto/src/main/resources/org/apache/activemq/dto/jaxb.index b/activemq-dto/src/main/resources/org/apache/activemq/dto/jaxb.index index d4f5b1f263..9cffb01307 100644 --- a/activemq-dto/src/main/resources/org/apache/activemq/dto/jaxb.index +++ b/activemq-dto/src/main/resources/org/apache/activemq/dto/jaxb.index @@ -19,5 +19,4 @@ CoreDTO JmsDTO SecurityDTO BasicSecurityDTO -NamingDTO diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java new file mode 100644 index 0000000000..18b145dc58 --- /dev/null +++ b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java @@ -0,0 +1,496 @@ +/** + * 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. + */ +package org.apache.activemq.jndi; + +import javax.jms.Queue; +import javax.jms.Topic; +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.spi.InitialContextFactory; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.activemq.api.core.DiscoveryGroupConfiguration; +import org.apache.activemq.api.core.JGroupsBroadcastGroupConfiguration; +import org.apache.activemq.api.core.TransportConfiguration; +import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration; +import org.apache.activemq.api.core.client.ActiveMQClient; +import org.apache.activemq.api.jms.ActiveMQJMSClient; +import org.apache.activemq.api.jms.JMSFactoryType; +import org.apache.activemq.core.client.ActiveMQClientLogger; +import org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory; +import org.apache.activemq.core.remoting.impl.netty.TransportConstants; +import org.apache.activemq.jms.client.ActiveMQConnectionFactory; + +/** + * A factory of the ActiveMQ InitialContext which contains + * {@link javax.jms.ConnectionFactory} instances as well as a child context called + * destinations which contain all of the current active destinations, in + * child context depending on the QoS such as transient or durable and queue or + * topic. + */ +public class ActiveMQInitialContextFactory implements InitialContextFactory +{ + public static final String CONNECTION_FACTORY_NAMES = "connectionFactoryNames"; + public static final String REFRESH_TIMEOUT = "refresh-timeout"; + public static final String DISCOVERY_INITIAL_WAIT_TIMEOUT = "discovery-initial-wait-timeout"; + + private static final String[] DEFAULT_CONNECTION_FACTORY_NAMES = {"ConnectionFactory", "XAConnectionFactory", "QueueConnectionFactory", "TopicConnectionFactory"}; + public static final String TCP_SCHEME = "tcp"; + public static final String JGROUPS_SCHEME = "jgroups"; + public static final String UDP_SCHEME = "udp"; + public static final String VM_SCHEME = "vm"; + public static final String HA = "ha"; + public static final String CF_TYPE = "type"; + public static final String QUEUE_CF = "QUEUE_CF"; + public static final String TOPIC_CF = "TOPIC_CF"; + public static final String QUEUE_XA_CF = "QUEUE_XA_CF"; + public static final String TOPIC_XA_CF = "TOPIC_XA_CF"; + public static final String XA_CF = "XA_CF"; + public static final String DYNAMIC_QUEUE_CONTEXT = "dynamicQueues"; + public static final String DYNAMIC_TOPIC_CONTEXT = "dynamicTopics"; + + private String connectionPrefix = "connection."; + private String queuePrefix = "queue."; + private String topicPrefix = "topic."; + + public Context getInitialContext(Hashtable environment) throws NamingException + { + // lets create a factory + Map data = new ConcurrentHashMap(); + String[] names = getConnectionFactoryNames(environment); + for (int i = 0; i < names.length; i++) + { + ActiveMQConnectionFactory factory = null; + String name = names[i]; + + try + { + factory = createConnectionFactory(name, environment); + } + catch (Exception e) + { + e.printStackTrace(); + throw new NamingException("Invalid broker URL"); + } + + data.put(name, factory); + } + + createQueues(data, environment); + createTopics(data, environment); + + data.put(DYNAMIC_QUEUE_CONTEXT, new LazyCreateContext() + { + private static final long serialVersionUID = 6503881346214855588L; + + protected Object createEntry(String name) + { + return ActiveMQJMSClient.createQueue(name); + } + }); + data.put(DYNAMIC_TOPIC_CONTEXT, new LazyCreateContext() + { + private static final long serialVersionUID = 2019166796234979615L; + + protected Object createEntry(String name) + { + return ActiveMQJMSClient.createTopic(name); + } + }); + + return createContext(environment, data); + } + + // Properties + // ------------------------------------------------------------------------- + public String getTopicPrefix() + { + return topicPrefix; + } + + public void setTopicPrefix(String topicPrefix) + { + this.topicPrefix = topicPrefix; + } + + public String getQueuePrefix() + { + return queuePrefix; + } + + public void setQueuePrefix(String queuePrefix) + { + this.queuePrefix = queuePrefix; + } + + // Implementation methods + // ------------------------------------------------------------------------- + + protected ReadOnlyContext createContext(Hashtable environment, Map data) + { + return new ReadOnlyContext(environment, data); + } + + protected ActiveMQConnectionFactory createConnectionFactory(String name, Hashtable environment) throws URISyntaxException, MalformedURLException + { + Hashtable connectionFactoryProperties = new Hashtable(environment); + if (DEFAULT_CONNECTION_FACTORY_NAMES[1].equals(name)) + { + connectionFactoryProperties.put(CF_TYPE, XA_CF); + } + if (DEFAULT_CONNECTION_FACTORY_NAMES[2].equals(name)) + { + connectionFactoryProperties.put(CF_TYPE, QUEUE_CF); + } + if (DEFAULT_CONNECTION_FACTORY_NAMES[3].equals(name)) + { + connectionFactoryProperties.put(CF_TYPE, TOPIC_CF); + } + String prefix = connectionPrefix + name + "."; + for (Iterator iter = environment.entrySet().iterator(); iter.hasNext(); ) + { + Map.Entry entry = (Map.Entry) iter.next(); + String key = (String) entry.getKey(); + if (key.startsWith(prefix)) + { + // Rename the key... + connectionFactoryProperties.remove(key); + key = key.substring(prefix.length()); + connectionFactoryProperties.put(key, entry.getValue()); + } + } + return createConnectionFactory(connectionFactoryProperties); + } + + protected String[] getConnectionFactoryNames(Map environment) + { + String factoryNames = (String) environment.get(CONNECTION_FACTORY_NAMES); + if (factoryNames != null) + { + List list = new ArrayList(); + for (StringTokenizer enumeration = new StringTokenizer(factoryNames, ","); enumeration.hasMoreTokens(); ) + { + list.add(enumeration.nextToken().trim()); + } + int size = list.size(); + if (size > 0) + { + String[] answer = new String[size]; + list.toArray(answer); + return answer; + } + } + return DEFAULT_CONNECTION_FACTORY_NAMES; + } + + protected void createQueues(Map data, Hashtable environment) + { + for (Iterator iter = environment.entrySet().iterator(); iter.hasNext(); ) + { + Map.Entry entry = (Map.Entry) iter.next(); + String key = entry.getKey().toString(); + if (key.startsWith(queuePrefix)) + { + String jndiName = key.substring(queuePrefix.length()); + data.put(jndiName, createQueue(entry.getValue().toString())); + } + } + } + + protected void createTopics(Map data, Hashtable environment) + { + for (Iterator iter = environment.entrySet().iterator(); iter.hasNext(); ) + { + Map.Entry entry = (Map.Entry) iter.next(); + String key = entry.getKey().toString(); + if (key.startsWith(topicPrefix)) + { + String jndiName = key.substring(topicPrefix.length()); + data.put(jndiName, createTopic(entry.getValue().toString())); + } + } + } + + /** + * Factory method to create new Queue instances + */ + protected Queue createQueue(String name) + { + return ActiveMQJMSClient.createQueue(name); + } + + /** + * Factory method to create new Topic instances + */ + protected Topic createTopic(String name) + { + return ActiveMQJMSClient.createTopic(name); + } + + /** + * Factory method to create a new connection factory from the given environment + */ + protected ActiveMQConnectionFactory createConnectionFactory(Hashtable environment) throws URISyntaxException, MalformedURLException + { + ActiveMQConnectionFactory connectionFactory; + Map transportConfig = new HashMap(); + + if (environment.containsKey(Context.PROVIDER_URL)) + { + URI providerURI = new URI(((String)environment.get(Context.PROVIDER_URL))); + + if (providerURI.getQuery() != null) + { + try + { + transportConfig = parseQuery(providerURI.getQuery()); + } + catch (URISyntaxException e) + { + } + } + + if (providerURI.getScheme().equals(TCP_SCHEME)) + { + String[] connectors = providerURI.getAuthority().split(","); + TransportConfiguration[] transportConfigurations = new TransportConfiguration[connectors.length]; + for (int i = 0; i < connectors.length; i++) + { + Map individualTransportConfig = new HashMap(transportConfig); + String[] hostAndPort = connectors[i].split(":"); + individualTransportConfig.put(TransportConstants.HOST_PROP_NAME, hostAndPort[0]); + individualTransportConfig.put(TransportConstants.PORT_PROP_NAME, hostAndPort[1]); + transportConfigurations[i] = new TransportConfiguration(NettyConnectorFactory.class.getCanonicalName(), individualTransportConfig); + } + + if (Boolean.TRUE.equals(environment.get(HA))) + { + connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithHA(getJmsFactoryType(environment), transportConfigurations); + } + else + { + connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(getJmsFactoryType(environment), transportConfigurations); + } + } + else if (providerURI.getScheme().equals(UDP_SCHEME)) + { + DiscoveryGroupConfiguration dgc = new DiscoveryGroupConfiguration() + .setRefreshTimeout(transportConfig.containsKey(REFRESH_TIMEOUT) ? Long.parseLong((String) transportConfig.get(REFRESH_TIMEOUT)) : ActiveMQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT) + .setDiscoveryInitialWaitTimeout(transportConfig.containsKey(DISCOVERY_INITIAL_WAIT_TIMEOUT) ? Long.parseLong((String) transportConfig.get(DISCOVERY_INITIAL_WAIT_TIMEOUT)) : ActiveMQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT) + .setBroadcastEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration() + .setGroupAddress(providerURI.getHost()) + .setGroupPort(providerURI.getPort()) + .setLocalBindAddress(transportConfig.containsKey(TransportConstants.LOCAL_ADDRESS_PROP_NAME) ? (String) transportConfig.get(TransportConstants.LOCAL_ADDRESS_PROP_NAME) : null) + .setLocalBindPort(transportConfig.containsKey(TransportConstants.LOCAL_PORT_PROP_NAME) ? Integer.parseInt((String) transportConfig.get(TransportConstants.LOCAL_PORT_PROP_NAME)) : -1)); + if (Boolean.TRUE.equals(environment.get(HA))) + { + connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithHA(dgc, getJmsFactoryType(environment)); + } + else + { + connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(dgc, getJmsFactoryType(environment)); + } + } + else if (providerURI.getScheme().equals(JGROUPS_SCHEME)) + { + JGroupsBroadcastGroupConfiguration config = new JGroupsBroadcastGroupConfiguration(providerURI.getAuthority(), providerURI.getPath() != null ? providerURI.getPath() : UUID.randomUUID().toString()); + + DiscoveryGroupConfiguration dgc = new DiscoveryGroupConfiguration() + .setRefreshTimeout(transportConfig.containsKey(REFRESH_TIMEOUT) ? Long.parseLong((String) transportConfig.get(REFRESH_TIMEOUT)) : ActiveMQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT) + .setDiscoveryInitialWaitTimeout(transportConfig.containsKey(DISCOVERY_INITIAL_WAIT_TIMEOUT) ? Long.parseLong((String) transportConfig.get(DISCOVERY_INITIAL_WAIT_TIMEOUT)) : ActiveMQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT) + .setBroadcastEndpointFactoryConfiguration(config); + if (Boolean.TRUE.equals(environment.get(HA))) + { + connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithHA(dgc, getJmsFactoryType(environment)); + } + else + { + connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(dgc, getJmsFactoryType(environment)); + } + } + else if (providerURI.getScheme().equals(VM_SCHEME)) + { + Map inVmTransportConfig = new HashMap(); + inVmTransportConfig.put("server-id", providerURI.getHost()); + TransportConfiguration tc = new TransportConfiguration("org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory", inVmTransportConfig); + connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(getJmsFactoryType(environment), tc); + } + else + { + throw new IllegalArgumentException("Invalid scheme"); + } + } + else + { + TransportConfiguration tc = new TransportConfiguration("org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory"); + connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(getJmsFactoryType(environment), tc); + } + + Properties properties = new Properties(); + properties.putAll(environment); + + for (Object key : environment.keySet()) + { + invokeSetter(connectionFactory, (String) key, environment.get(key)); + } + + return connectionFactory; + } + + private JMSFactoryType getJmsFactoryType(Hashtable environment) + { + JMSFactoryType ultimateType = JMSFactoryType.CF; // default value + if (environment.containsKey(CF_TYPE)) + { + String tempType = (String) environment.get(CF_TYPE); + if (QUEUE_CF.equals(tempType)) + { + ultimateType = JMSFactoryType.QUEUE_CF; + } + else if (TOPIC_CF.equals(tempType)) + { + ultimateType = JMSFactoryType.TOPIC_CF; + } + else if (QUEUE_XA_CF.equals(tempType)) + { + ultimateType = JMSFactoryType.QUEUE_XA_CF; + } + else if (TOPIC_XA_CF.equals(tempType)) + { + ultimateType = JMSFactoryType.TOPIC_XA_CF; + } + else if (XA_CF.equals(tempType)) + { + ultimateType = JMSFactoryType.XA_CF; + } + } + return ultimateType; + } + + + public static Map parseQuery(String uri) throws URISyntaxException + { + try + { + uri = uri.substring(uri.lastIndexOf("?") + 1); // get only the relevant part of the query + Map rc = new HashMap(); + if (uri != null && !uri.isEmpty()) + { + String[] parameters = uri.split("&"); + for (int i = 0; i < parameters.length; i++) + { + int p = parameters[i].indexOf("="); + if (p >= 0) + { + String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8"); + String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8"); + rc.put(name, value); + } + else + { + rc.put(parameters[i], null); + } + } + } + return rc; + } + catch (UnsupportedEncodingException e) + { + throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); + } + } + + public String getConnectionPrefix() + { + return connectionPrefix; + } + + public void setConnectionPrefix(String connectionPrefix) + { + this.connectionPrefix = connectionPrefix; + } + + private void invokeSetter(Object target, final String propertyName, final Object propertyValue) + { + Method setter = null; + + Method[] methods = target.getClass().getMethods(); + + // turn something like "consumerWindowSize" to "setConsumerWindowSize" + String setterMethodName = "set" + Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1); + + for (Method m : methods) + { + if (m.getName().equals(setterMethodName)) + { + setter = m; + break; + } + } + + try + { + if (setter != null) + { + ActiveMQClientLogger.LOGGER.info("Invoking: " + setter + " that takes a " + setter.getParameterTypes()[0] + " with a " + propertyValue.getClass()); + if (propertyValue.getClass() == String.class && setter.getParameterTypes()[0] != String.class) + { + String stringPropertyValue = (String) propertyValue; + if (setter.getParameterTypes()[0] == Integer.TYPE) + { + setter.invoke(target, Integer.parseInt(stringPropertyValue)); + } + else if (setter.getParameterTypes()[0] == Long.TYPE) + { + setter.invoke(target, Long.parseLong(stringPropertyValue)); + } + else if (setter.getParameterTypes()[0] == Double.TYPE) + { + setter.invoke(target, Double.parseDouble(stringPropertyValue)); + } + else if (setter.getParameterTypes()[0] == Boolean.TYPE) + { + setter.invoke(target, Boolean.parseBoolean(stringPropertyValue)); + } + } + else + { + setter.invoke(target, propertyValue); + } + } + } + catch (Exception e) + { + ActiveMQClientLogger.LOGGER.warn("Caught exception during invocation of: " + setter, e); + } + } +} diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/jndi/LazyCreateContext.java b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/LazyCreateContext.java new file mode 100644 index 0000000000..0fe51bcc1e --- /dev/null +++ b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/LazyCreateContext.java @@ -0,0 +1,43 @@ +/** + * 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. + */ +package org.apache.activemq.jndi; + +import javax.naming.NameNotFoundException; +import javax.naming.NamingException; + +public abstract class LazyCreateContext extends ReadOnlyContext +{ + public Object lookup(String name) throws NamingException + { + try + { + return super.lookup(name); + } + catch (NameNotFoundException e) + { + Object answer = createEntry(name); + if (answer == null) + { + throw e; + } + internalBind(name, answer); + return answer; + } + } + + protected abstract Object createEntry(String name); +} diff --git a/activemq-dto/src/main/java/org/apache/activemq/dto/NamingDTO.java b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/NameParserImpl.java similarity index 59% rename from activemq-dto/src/main/java/org/apache/activemq/dto/NamingDTO.java rename to activemq-jms-client/src/main/java/org/apache/activemq/jndi/NameParserImpl.java index a2aa5b64ef..8ae21cfebf 100644 --- a/activemq-dto/src/main/java/org/apache/activemq/dto/NamingDTO.java +++ b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/NameParserImpl.java @@ -14,26 +14,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.dto; +package org.apache.activemq.jndi; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; +import javax.naming.CompositeName; +import javax.naming.Name; +import javax.naming.NameParser; +import javax.naming.NamingException; -@XmlRootElement(name = "naming") -@XmlAccessorType(XmlAccessType.FIELD) -public class NamingDTO +public class NameParserImpl implements NameParser { - @XmlAttribute - public String bindAddress = "localhost"; - - @XmlAttribute - public int port = 1099; - - @XmlAttribute - public String rmiBindAddress = "localhost"; - - @XmlAttribute - public int rmiPort = 1098; + public Name parse(String name) throws NamingException + { + return new CompositeName(name); + } } diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java new file mode 100644 index 0000000000..9602d1a2b0 --- /dev/null +++ b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java @@ -0,0 +1,534 @@ +/** + * 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. + */ +package org.apache.activemq.jndi; + +import java.io.Serializable; +import java.util.Collections; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; +import javax.naming.Binding; +import javax.naming.CompositeName; +import javax.naming.Context; +import javax.naming.LinkRef; +import javax.naming.Name; +import javax.naming.NameClassPair; +import javax.naming.NameNotFoundException; +import javax.naming.NameParser; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.NotContextException; +import javax.naming.OperationNotSupportedException; +import javax.naming.Reference; +import javax.naming.spi.NamingManager; + +import org.apache.activemq.core.client.ActiveMQClientLogger; + +/** + * A read-only Context

This version assumes it and all its subcontext are + * read-only and any attempt to modify (e.g. through bind) will result in an + * OperationNotSupportedException. Each Context in the tree builds a cache of + * the entries in all sub-contexts to optimise the performance of lookup. + *

+ *

+ * This implementation is intended to optimise the performance of lookup(String) + * to about the level of a HashMap get. It has been observed that the scheme + * resolution phase performed by the JVM takes considerably longer, so for + * optimum performance lookups should be coded like: + *

+ * + * Context componentContext = (Context)new InitialContext().lookup("java:comp"); + * String envEntry = (String) componentContext.lookup("env/myEntry"); + * String envEntry2 = (String) componentContext.lookup("env/myEntry2"); + * + */ +@SuppressWarnings("unchecked") +public class ReadOnlyContext implements Context, Serializable +{ + public static final String SEPARATOR = "/"; + protected static final NameParser NAME_PARSER = new NameParserImpl(); + private static final long serialVersionUID = -5754338187296859149L; + + protected final Hashtable environment; // environment for this context + protected final Map bindings; // bindings at my level + protected final Map treeBindings; // all bindings under me + + private boolean frozen; + private String nameInNamespace = ""; + + public ReadOnlyContext() + { + environment = new Hashtable(); + bindings = new HashMap(); + treeBindings = new HashMap(); + } + + public ReadOnlyContext(Hashtable env) + { + if (env == null) + { + this.environment = new Hashtable(); + } + else + { + this.environment = new Hashtable(env); + } + this.bindings = Collections.EMPTY_MAP; + this.treeBindings = Collections.EMPTY_MAP; + } + + public ReadOnlyContext(Hashtable environment, Map bindings) + { + if (environment == null) + { + this.environment = new Hashtable(); + } + else + { + this.environment = new Hashtable(environment); + } + this.bindings = new HashMap(); + treeBindings = new HashMap(); + if (bindings != null) + { + for (Map.Entry binding : bindings.entrySet()) + { + try + { + internalBind(binding.getKey(), binding.getValue()); + } + catch (Throwable e) + { + ActiveMQClientLogger.LOGGER.error("Failed to bind " + binding.getKey() + "=" + binding.getValue(), e); + } + } + } + frozen = true; + } + + public ReadOnlyContext(Hashtable environment, Map bindings, String nameInNamespace) + { + this(environment, bindings); + this.nameInNamespace = nameInNamespace; + } + + protected ReadOnlyContext(ReadOnlyContext clone, Hashtable env) + { + this.bindings = clone.bindings; + this.treeBindings = clone.treeBindings; + this.environment = new Hashtable(env); + } + + protected ReadOnlyContext(ReadOnlyContext clone, Hashtable env, String nameInNamespace) + { + this(clone, env); + this.nameInNamespace = nameInNamespace; + } + + public void freeze() + { + frozen = true; + } + + boolean isFrozen() + { + return frozen; + } + + /** + * internalBind is intended for use only during setup or possibly by + * suitably synchronized superclasses. It binds every possible lookup into a + * map in each context. To do this, each context strips off one name segment + * and if necessary creates a new context for it. Then it asks that context + * to bind the remaining name. It returns a map containing all the bindings + * from the next context, plus the context it just created (if it in fact + * created it). (the names are suitably extended by the segment originally + * lopped off). + * + * @param name + * @param value + * @return + * @throws javax.naming.NamingException + */ + protected Map internalBind(String name, Object value) throws NamingException + { + assert name != null && name.length() > 0; + assert !frozen; + + Map newBindings = new HashMap(); + int pos = name.indexOf('/'); + if (pos == -1) + { + if (treeBindings.put(name, value) != null) + { + throw new NamingException("Something already bound at " + name); + } + bindings.put(name, value); + newBindings.put(name, value); + } + else + { + String segment = name.substring(0, pos); + assert segment != null; + assert !segment.equals(""); + Object o = treeBindings.get(segment); + if (o == null) + { + o = newContext(); + treeBindings.put(segment, o); + bindings.put(segment, o); + newBindings.put(segment, o); + } + else if (!(o instanceof ReadOnlyContext)) + { + throw new NamingException("Something already bound where a subcontext should go"); + } + ReadOnlyContext readOnlyContext = (ReadOnlyContext) o; + String remainder = name.substring(pos + 1); + Map subBindings = readOnlyContext.internalBind(remainder, value); + for (Iterator iterator = subBindings.entrySet().iterator(); iterator.hasNext(); ) + { + Map.Entry entry = (Map.Entry) iterator.next(); + String subName = segment + "/" + (String) entry.getKey(); + Object bound = entry.getValue(); + treeBindings.put(subName, bound); + newBindings.put(subName, bound); + } + } + return newBindings; + } + + protected ReadOnlyContext newContext() + { + return new ReadOnlyContext(); + } + + public Object addToEnvironment(String propName, Object propVal) throws NamingException + { + return environment.put(propName, propVal); + } + + public Hashtable getEnvironment() throws NamingException + { + return (Hashtable) environment.clone(); + } + + public Object removeFromEnvironment(String propName) throws NamingException + { + return environment.remove(propName); + } + + public Object lookup(String name) throws NamingException + { + if (name.length() == 0) + { + return this; + } + Object result = treeBindings.get(name); + if (result == null) + { + result = bindings.get(name); + } + if (result == null) + { + int pos = name.indexOf(':'); + if (pos > 0) + { + String scheme = name.substring(0, pos); + Context ctx = NamingManager.getURLContext(scheme, environment); + if (ctx == null) + { + throw new NamingException("scheme " + scheme + " not recognized"); + } + return ctx.lookup(name); + } + else + { + // Split out the first name of the path + // and look for it in the bindings map. + CompositeName path = new CompositeName(name); + + if (path.size() == 0) + { + return this; + } + else + { + String first = path.get(0); + Object obj = bindings.get(first); + if (obj == null) + { + throw new NameNotFoundException(name); + } + else if (obj instanceof Context && path.size() > 1) + { + Context subContext = (Context) obj; + obj = subContext.lookup(path.getSuffix(1)); + } + return obj; + } + } + } + if (result instanceof LinkRef) + { + LinkRef ref = (LinkRef) result; + result = lookup(ref.getLinkName()); + } + if (result instanceof Reference) + { + try + { + result = NamingManager.getObjectInstance(result, null, null, this.environment); + } + catch (NamingException e) + { + throw e; + } + catch (Exception e) + { + throw (NamingException) new NamingException("could not look up : " + name).initCause(e); + } + } + if (result instanceof ReadOnlyContext) + { + String prefix = getNameInNamespace(); + if (prefix.length() > 0) + { + prefix = prefix + SEPARATOR; + } + result = new ReadOnlyContext((ReadOnlyContext) result, environment, prefix + name); + } + return result; + } + + public Object lookup(Name name) throws NamingException + { + return lookup(name.toString()); + } + + public Object lookupLink(String name) throws NamingException + { + return lookup(name); + } + + public Name composeName(Name name, Name prefix) throws NamingException + { + Name result = (Name) prefix.clone(); + result.addAll(name); + return result; + } + + public String composeName(String name, String prefix) throws NamingException + { + CompositeName result = new CompositeName(prefix); + result.addAll(new CompositeName(name)); + return result.toString(); + } + + public NamingEnumeration list(String name) throws NamingException + { + Object o = lookup(name); + if (o == this) + { + return new ListEnumeration(); + } + else if (o instanceof Context) + { + return ((Context) o).list(""); + } + else + { + throw new NotContextException(); + } + } + + public NamingEnumeration listBindings(String name) throws NamingException + { + Object o = lookup(name); + if (o == this) + { + return new ListBindingEnumeration(); + } + else if (o instanceof Context) + { + return ((Context) o).listBindings(""); + } + else + { + throw new NotContextException(); + } + } + + public Object lookupLink(Name name) throws NamingException + { + return lookupLink(name.toString()); + } + + public NamingEnumeration list(Name name) throws NamingException + { + return list(name.toString()); + } + + public NamingEnumeration listBindings(Name name) throws NamingException + { + return listBindings(name.toString()); + } + + public void bind(Name name, Object obj) throws NamingException + { + throw new OperationNotSupportedException(); + } + + public void bind(String name, Object obj) throws NamingException + { + throw new OperationNotSupportedException(); + } + + public void close() throws NamingException + { + // ignore + } + + public Context createSubcontext(Name name) throws NamingException + { + throw new OperationNotSupportedException(); + } + + public Context createSubcontext(String name) throws NamingException + { + throw new OperationNotSupportedException(); + } + + public void destroySubcontext(Name name) throws NamingException + { + throw new OperationNotSupportedException(); + } + + public void destroySubcontext(String name) throws NamingException + { + throw new OperationNotSupportedException(); + } + + public String getNameInNamespace() throws NamingException + { + return nameInNamespace; + } + + public NameParser getNameParser(Name name) throws NamingException + { + return NAME_PARSER; + } + + public NameParser getNameParser(String name) throws NamingException + { + return NAME_PARSER; + } + + public void rebind(Name name, Object obj) throws NamingException + { + throw new OperationNotSupportedException(); + } + + public void rebind(String name, Object obj) throws NamingException + { + throw new OperationNotSupportedException(); + } + + public void rename(Name oldName, Name newName) throws NamingException + { + throw new OperationNotSupportedException(); + } + + public void rename(String oldName, String newName) throws NamingException + { + throw new OperationNotSupportedException(); + } + + public void unbind(Name name) throws NamingException + { + throw new OperationNotSupportedException(); + } + + public void unbind(String name) throws NamingException + { + throw new OperationNotSupportedException(); + } + + private abstract class LocalNamingEnumeration implements NamingEnumeration + { + private final Iterator i = bindings.entrySet() + .iterator(); + + public boolean hasMore() throws NamingException + { + return i.hasNext(); + } + + public boolean hasMoreElements() + { + return i.hasNext(); + } + + protected Map.Entry getNext() + { + return (Map.Entry) i.next(); + } + + public void close() throws NamingException + { + } + } + + private class ListEnumeration extends LocalNamingEnumeration + { + ListEnumeration() + { + } + + public Object next() throws NamingException + { + return nextElement(); + } + + public Object nextElement() + { + Map.Entry entry = getNext(); + return new NameClassPair((String) entry.getKey(), entry.getValue() + .getClass() + .getName()); + } + } + + private class ListBindingEnumeration extends LocalNamingEnumeration + { + ListBindingEnumeration() + { + } + + public Object next() throws NamingException + { + return nextElement(); + } + + public Object nextElement() + { + Map.Entry entry = getNext(); + return new Binding((String) entry.getKey(), entry.getValue()); + } + } +} diff --git a/activemq-jms-server/pom.xml b/activemq-jms-server/pom.xml index 476914bb0b..c39a31e6b6 100644 --- a/activemq-jms-server/pom.xml +++ b/activemq-jms-server/pom.xml @@ -53,10 +53,6 @@ org.jboss jboss-transaction-spi - - org.jboss.naming - jnpserver - diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/JMSServerConfigParser.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/JMSServerConfigParser.java index 3b6bca8457..67d7ef6931 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/JMSServerConfigParser.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/JMSServerConfigParser.java @@ -18,7 +18,6 @@ package org.apache.activemq.jms.server; import java.io.InputStream; -import org.apache.activemq.jms.server.config.ConnectionFactoryConfiguration; import org.apache.activemq.jms.server.config.JMSConfiguration; import org.apache.activemq.jms.server.config.JMSQueueConfiguration; import org.apache.activemq.jms.server.config.TopicConfiguration; @@ -58,12 +57,4 @@ public interface JMSServerConfigParser * @throws Exception */ JMSQueueConfiguration parseQueueConfiguration(final Node node) throws Exception; - - /** - * Parse the Connection Configuration node as a ConnectionFactoryConfiguration object - * @param node - * @return - * @throws Exception - */ - ConnectionFactoryConfiguration parseConnectionFactoryConfiguration(final Node node) throws Exception; } diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/embedded/EmbeddedJMS.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/embedded/EmbeddedJMS.java index 376e4ced18..e2d55500f3 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/embedded/EmbeddedJMS.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/embedded/EmbeddedJMS.java @@ -21,6 +21,7 @@ import javax.naming.Context; import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.registry.MapBindingRegistry; import org.apache.activemq.core.server.embedded.EmbeddedActiveMQ; +import org.apache.activemq.jms.server.JMSServerManager; import org.apache.activemq.jms.server.config.JMSConfiguration; import org.apache.activemq.jms.server.impl.JMSServerManagerImpl; import org.apache.activemq.spi.core.naming.BindingRegistry; @@ -58,6 +59,11 @@ public class EmbeddedJMS extends EmbeddedActiveMQ return registry; } + public JMSServerManager getJMSServerManager() + { + return serverManager; + } + /** * Only set this property if you are using a custom BindingRegistry * diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerConfigParserImpl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerConfigParserImpl.java index 139ffdb32d..cd948c13dd 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerConfigParserImpl.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerConfigParserImpl.java @@ -20,21 +20,15 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.util.ArrayList; -import java.util.List; import org.apache.activemq.api.config.ActiveMQDefaultConfiguration; -import org.apache.activemq.api.core.ActiveMQException; -import org.apache.activemq.api.core.client.ActiveMQClient; -import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.core.config.impl.Validators; -import org.apache.activemq.jms.server.ActiveMQJMSServerBundle; import org.apache.activemq.jms.server.ActiveMQJMSServerLogger; import org.apache.activemq.jms.server.JMSServerConfigParser; import org.apache.activemq.jms.server.config.ConnectionFactoryConfiguration; import org.apache.activemq.jms.server.config.JMSConfiguration; import org.apache.activemq.jms.server.config.JMSQueueConfiguration; import org.apache.activemq.jms.server.config.TopicConfiguration; -import org.apache.activemq.jms.server.config.impl.ConnectionFactoryConfigurationImpl; import org.apache.activemq.jms.server.config.impl.JMSConfigurationImpl; import org.apache.activemq.jms.server.config.impl.JMSQueueConfigurationImpl; import org.apache.activemq.jms.server.config.impl.TopicConfigurationImpl; @@ -85,8 +79,7 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser org.apache.activemq.utils.XMLUtil.validate(rootnode, "schema/activemq-jms.xsd"); String[] elements = new String[]{JMSServerDeployer.QUEUE_NODE_NAME, - JMSServerDeployer.TOPIC_NODE_NAME, - JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME}; + JMSServerDeployer.TOPIC_NODE_NAME}; for (String element : elements) { NodeList children = e.getElementsByTagName(element); @@ -100,11 +93,7 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser continue; } - if (node.getNodeName().equals(JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME)) - { - cfs.add(parseConnectionFactoryConfiguration(node)); - } - else if (node.getNodeName().equals(JMSServerDeployer.TOPIC_NODE_NAME)) + if (node.getNodeName().equals(JMSServerDeployer.TOPIC_NODE_NAME)) { topics.add(parseTopicConfiguration(node)); } @@ -118,7 +107,7 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser domain = XMLConfigurationUtil.getString(e, JMSServerDeployer.JMX_DOMAIN_NAME, ActiveMQDefaultConfiguration.getDefaultJmxDomain(), Validators.NO_CHECK); - JMSConfiguration value = newConfig(queues, topics, cfs, domain); + JMSConfiguration value = newConfig(queues, topics, domain); return value; } @@ -133,23 +122,8 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser public TopicConfiguration parseTopicConfiguration(final Node node) throws Exception { String topicName = node.getAttributes().getNamedItem(JMSServerConfigParserImpl.NAME_ATTR).getNodeValue(); - NodeList children = node.getChildNodes(); - ArrayList jndiNames = new ArrayList(); - for (int i = 0; i < children.getLength(); i++) - { - Node child = children.item(i); - - if (JMSServerDeployer.ENTRY_NODE_NAME.equals(children.item(i).getNodeName())) - { - String jndiElement = child.getAttributes().getNamedItem("name").getNodeValue(); - jndiNames.add(jndiElement); - } - } - - String[] strBindings = jndiNames.toArray(new String[jndiNames.size()]); - - return newTopic(topicName, strBindings); + return newTopic(topicName); } /** @@ -167,17 +141,11 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser String selectorString = null; boolean durable = XMLConfigurationUtil.getBoolean(e, "durable", JMSServerDeployer.DEFAULT_QUEUE_DURABILITY); NodeList children = node.getChildNodes(); - ArrayList jndiNames = new ArrayList(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); - if (JMSServerDeployer.ENTRY_NODE_NAME.equals(children.item(i).getNodeName())) - { - String jndiName = child.getAttributes().getNamedItem("name").getNodeValue(); - jndiNames.add(jndiName); - } - else if (JMSServerDeployer.QUEUE_SELECTOR_NODE_NAME.equals(children.item(i).getNodeName())) + if (JMSServerDeployer.QUEUE_SELECTOR_NODE_NAME.equals(children.item(i).getNodeName())) { Node selectorNode = children.item(i); Node attNode = selectorNode.getAttributes().getNamedItem("string"); @@ -185,298 +153,19 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser } } - String[] jndiArray = jndiNames.toArray(new String[jndiNames.size()]); - return newQueue(queueName, selectorString, durable, jndiArray); - } - - /** - * Parse the Connection Configuration node as a ConnectionFactoryConfiguration object - * - * @param node - * @return ConnectionFactoryConfiguration - * @throws Exception - */ - public ConnectionFactoryConfiguration parseConnectionFactoryConfiguration(final Node node) throws Exception - { - if (!node.getNodeName().equals(JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME)) - { - // sanity check, this shouldn't ever happen - throw ActiveMQJMSServerBundle.BUNDLE.invalidNodeParsingCF(node.getNodeName()); - } - Element e = (Element) node; - - String name = node.getAttributes().getNamedItem(JMSServerConfigParserImpl.NAME_ATTR).getNodeValue(); - - String fact = e.getAttribute("signature"); - boolean isXA = XMLConfigurationUtil.getBoolean(e, - "xa", - ActiveMQClient.DEFAULT_XA); - - JMSFactoryType factType = resolveFactoryType(fact, isXA); - - long clientFailureCheckPeriod = XMLConfigurationUtil.getLong(e, - "client-failure-check-period", - ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD, - Validators.MINUS_ONE_OR_GT_ZERO); - long connectionTTL = XMLConfigurationUtil.getLong(e, - "connection-ttl", - ActiveMQClient.DEFAULT_CONNECTION_TTL, - Validators.MINUS_ONE_OR_GE_ZERO); - long callTimeout = XMLConfigurationUtil.getLong(e, - "call-timeout", - ActiveMQClient.DEFAULT_CALL_TIMEOUT, - Validators.GE_ZERO); - long callFailoverTimeout = XMLConfigurationUtil.getLong(e, - "call-failover-timeout", - ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT, - Validators.MINUS_ONE_OR_GT_ZERO); - String clientID = XMLConfigurationUtil.getString(e, "client-id", null, Validators.NO_CHECK); - int dupsOKBatchSize = XMLConfigurationUtil.getInteger(e, - "dups-ok-batch-size", - ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, - Validators.GT_ZERO); - int transactionBatchSize = XMLConfigurationUtil.getInteger(e, - "transaction-batch-size", - ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, - Validators.GT_ZERO); - int consumerWindowSize = XMLConfigurationUtil.getInteger(e, - "consumer-window-size", - ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE, - Validators.MINUS_ONE_OR_GE_ZERO); - int producerWindowSize = XMLConfigurationUtil.getInteger(e, - "producer-window-size", - ActiveMQClient.DEFAULT_PRODUCER_WINDOW_SIZE, - Validators.MINUS_ONE_OR_GT_ZERO); - int consumerMaxRate = XMLConfigurationUtil.getInteger(e, - "consumer-max-rate", - ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE, - Validators.MINUS_ONE_OR_GT_ZERO); - int confirmationWindowSize = XMLConfigurationUtil.getInteger(e, - "confirmation-window-size", - ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE, - Validators.MINUS_ONE_OR_GT_ZERO); - int producerMaxRate = XMLConfigurationUtil.getInteger(e, - "producer-max-rate", - ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE, - Validators.MINUS_ONE_OR_GT_ZERO); - boolean cacheLargeMessagesClient = XMLConfigurationUtil.getBoolean(e, - "cache-large-message-client", - ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT); - int minLargeMessageSize = XMLConfigurationUtil.getInteger(e, - "min-large-message-size", - ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, - Validators.GT_ZERO); - - boolean compressLargeMessages = XMLConfigurationUtil.getBoolean(e, - "compress-large-messages", - ActiveMQClient.DEFAULT_COMPRESS_LARGE_MESSAGES); - - boolean blockOnAcknowledge = XMLConfigurationUtil.getBoolean(e, - "block-on-acknowledge", - ActiveMQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE); - boolean blockOnNonDurableSend = XMLConfigurationUtil.getBoolean(e, - "block-on-non-durable-send", - ActiveMQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND); - boolean blockOnDurableSend = XMLConfigurationUtil.getBoolean(e, - "block-on-durable-send", - ActiveMQClient.DEFAULT_BLOCK_ON_DURABLE_SEND); - boolean autoGroup = XMLConfigurationUtil.getBoolean(e, "auto-group", ActiveMQClient.DEFAULT_AUTO_GROUP); - boolean preAcknowledge = XMLConfigurationUtil.getBoolean(e, - "pre-acknowledge", - ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE); - long retryInterval = XMLConfigurationUtil.getLong(e, - "retry-interval", - ActiveMQClient.DEFAULT_RETRY_INTERVAL, - Validators.GT_ZERO); - double retryIntervalMultiplier = XMLConfigurationUtil.getDouble(e, - "retry-interval-multiplier", - ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER, - Validators.GT_ZERO); - long maxRetryInterval = XMLConfigurationUtil.getLong(e, - "max-retry-interval", - ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL, - Validators.GT_ZERO); - int reconnectAttempts = XMLConfigurationUtil.getInteger(e, - "reconnect-attempts", - ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS, - Validators.MINUS_ONE_OR_GE_ZERO); - boolean failoverOnInitialConnection = XMLConfigurationUtil.getBoolean(e, - "failover-on-initial-connection", - ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION); - - boolean useGlobalPools = XMLConfigurationUtil.getBoolean(e, - "use-global-pools", - ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS); - int scheduledThreadPoolMaxSize = XMLConfigurationUtil.getInteger(e, - "scheduled-thread-pool-max-size", - ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE, - Validators.MINUS_ONE_OR_GT_ZERO); - int threadPoolMaxSize = XMLConfigurationUtil.getInteger(e, - "thread-pool-max-size", - ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE, - Validators.MINUS_ONE_OR_GT_ZERO); - String connectionLoadBalancingPolicyClassName = XMLConfigurationUtil.getString(e, - "connection-load-balancing-policy-class-name", - ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME, - Validators.NOT_NULL_OR_EMPTY); - boolean ha = XMLConfigurationUtil.getBoolean(e, "ha", ActiveMQClient.DEFAULT_HA); - - String groupid = XMLConfigurationUtil.getString(e, "group-id", null, Validators.NO_CHECK); - List jndiBindings = new ArrayList(); - List connectorNames = new ArrayList(); - String discoveryGroupName = null; - - NodeList children = node.getChildNodes(); - - for (int j = 0; j < children.getLength(); j++) - { - Node child = children.item(j); - - if (JMSServerDeployer.ENTRIES_NODE_NAME.equals(child.getNodeName())) - { - NodeList entries = child.getChildNodes(); - for (int i = 0; i < entries.getLength(); i++) - { - Node entry = entries.item(i); - if (JMSServerDeployer.ENTRY_NODE_NAME.equals(entry.getNodeName())) - { - String jndiName = entry.getAttributes().getNamedItem("name").getNodeValue(); - - jndiBindings.add(jndiName); - } - } - } - else if (JMSServerDeployer.CONNECTORS_NODE_NAME.equals(child.getNodeName())) - { - NodeList entries = child.getChildNodes(); - for (int i = 0; i < entries.getLength(); i++) - { - Node entry = entries.item(i); - if (JMSServerDeployer.CONNECTOR_REF_ELEMENT.equals(entry.getNodeName())) - { - String connectorName = entry.getAttributes().getNamedItem("connector-name").getNodeValue(); - - connectorNames.add(connectorName); - } - } - } - else if (JMSServerDeployer.DISCOVERY_GROUP_ELEMENT.equals(child.getNodeName())) - { - discoveryGroupName = child.getAttributes().getNamedItem("discovery-group-name").getNodeValue(); - - } - } - - ConnectionFactoryConfiguration cfConfig; - - String[] strbindings = jndiBindings.toArray(new String[jndiBindings.size()]); - - if (discoveryGroupName != null) - { - cfConfig = new ConnectionFactoryConfigurationImpl() - .setDiscoveryGroupName(discoveryGroupName); - } - else - { - ArrayList connectors = new ArrayList(connectorNames.size()); - for (String connectorName : connectorNames) - { - connectors.add(connectorName); - } - cfConfig = new ConnectionFactoryConfigurationImpl() - .setConnectorNames(connectors); - } - - cfConfig - .setName(name) - .setHA(ha) - .setBindings(strbindings) - .setFactoryType(factType) - .setClientID(clientID) - .setClientFailureCheckPeriod(clientFailureCheckPeriod) - .setConnectionTTL(connectionTTL) - .setCallTimeout(callTimeout) - .setCallFailoverTimeout(callFailoverTimeout) - .setCacheLargeMessagesClient(cacheLargeMessagesClient) - .setMinLargeMessageSize(minLargeMessageSize) - .setCompressLargeMessages(compressLargeMessages) - .setConsumerWindowSize(consumerWindowSize) - .setConsumerMaxRate(consumerMaxRate) - .setConfirmationWindowSize(confirmationWindowSize) - .setProducerWindowSize(producerWindowSize) - .setProducerMaxRate(producerMaxRate) - .setBlockOnAcknowledge(blockOnAcknowledge) - .setBlockOnDurableSend(blockOnDurableSend) - .setBlockOnNonDurableSend(blockOnNonDurableSend) - .setAutoGroup(autoGroup) - .setPreAcknowledge(preAcknowledge) - .setLoadBalancingPolicyClassName(connectionLoadBalancingPolicyClassName) - .setTransactionBatchSize(transactionBatchSize) - .setDupsOKBatchSize(dupsOKBatchSize) - .setUseGlobalPools(useGlobalPools) - .setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize) - .setThreadPoolMaxSize(threadPoolMaxSize) - .setRetryInterval(retryInterval) - .setRetryIntervalMultiplier(retryIntervalMultiplier) - .setMaxRetryInterval(maxRetryInterval) - .setReconnectAttempts(reconnectAttempts) - .setFailoverOnInitialConnection(failoverOnInitialConnection) - .setGroupID(groupid); - - return cfConfig; - } - - private JMSFactoryType resolveFactoryType(String fact, boolean isXA) throws ActiveMQException - { - if ("".equals(fact)) - { - fact = "generic"; - } - if (isXA) - { - if ("generic".equals(fact)) - { - return JMSFactoryType.XA_CF; - } - if ("queue".equals(fact)) - { - return JMSFactoryType.QUEUE_XA_CF; - } - if ("topic".equals(fact)) - { - return JMSFactoryType.TOPIC_XA_CF; - } - } - else - { - if ("generic".equals(fact)) - { - return JMSFactoryType.CF; - } - if ("queue".equals(fact)) - { - return JMSFactoryType.QUEUE_CF; - } - if ("topic".equals(fact)) - { - return JMSFactoryType.TOPIC_CF; - } - } - throw ActiveMQJMSServerBundle.BUNDLE.invalidSignatureParsingCF(fact); + return newQueue(queueName, selectorString, durable); } /** * hook for integration layers * * @param topicName - * @param strBindings * @return */ - protected TopicConfiguration newTopic(final String topicName, final String[] strBindings) + protected TopicConfiguration newTopic(final String topicName) { return new TopicConfigurationImpl() - .setName(topicName) - .setBindings(strBindings); + .setName(topicName); } /** @@ -485,19 +174,16 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser * @param queueName * @param selectorString * @param durable - * @param jndiArray * @return */ protected JMSQueueConfiguration newQueue(final String queueName, final String selectorString, - final boolean durable, - final String[] jndiArray) + final boolean durable) { return new JMSQueueConfigurationImpl(). setName(queueName). setSelector(selectorString). - setDurable(durable). - setBindings(jndiArray); + setDurable(durable); } /** @@ -505,16 +191,13 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser * * @param queues * @param topics - * @param cfs * @param domain * @return */ protected JMSConfiguration newConfig(final ArrayList queues, - final ArrayList topics, - final ArrayList cfs, String domain) + final ArrayList topics, String domain) { return new JMSConfigurationImpl() - .setConnectionFactoryConfigurations(cfs) .setQueueConfigurations(queues) .setTopicConfigurations(topics) .setDomain(domain); diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerDeployer.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerDeployer.java index eaa2bec5b1..eab54a6869 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerDeployer.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerDeployer.java @@ -20,7 +20,6 @@ import org.apache.activemq.core.deployers.DeploymentManager; import org.apache.activemq.core.deployers.impl.XmlDeployer; import org.apache.activemq.jms.server.JMSServerConfigParser; import org.apache.activemq.jms.server.JMSServerManager; -import org.apache.activemq.jms.server.config.ConnectionFactoryConfiguration; import org.apache.activemq.jms.server.config.JMSQueueConfiguration; import org.apache.activemq.jms.server.config.TopicConfiguration; import org.w3c.dom.Node; @@ -36,18 +35,6 @@ public class JMSServerDeployer extends XmlDeployer private final JMSServerManager jmsServerManager; - protected static final String CONNECTOR_REF_ELEMENT = "connector-ref"; - - protected static final String DISCOVERY_GROUP_ELEMENT = "discovery-group-ref"; - - protected static final String ENTRIES_NODE_NAME = "entries"; - - protected static final String ENTRY_NODE_NAME = "entry"; - - protected static final String CONNECTORS_NODE_NAME = "connectors"; - - protected static final String CONNECTION_FACTORY_NODE_NAME = "connection-factory"; - protected static final String QUEUE_NODE_NAME = "queue"; protected static final String QUEUE_SELECTOR_NODE_NAME = "selector"; @@ -77,8 +64,7 @@ public class JMSServerDeployer extends XmlDeployer public String[] getElementTagName() { return new String[]{JMSServerDeployer.QUEUE_NODE_NAME, - JMSServerDeployer.TOPIC_NODE_NAME, - JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME}; + JMSServerDeployer.TOPIC_NODE_NAME}; } @Override @@ -100,19 +86,14 @@ public class JMSServerDeployer extends XmlDeployer } /** - * Creates the object to bind, this will either be a JBossConnectionFActory, ActiveMQQueue or - * ActiveMQTopic. + * Creates the object to bind, this will either be a ActiveMQQueue or ActiveMQTopic. * * @param node the config * @throws Exception */ private void createAndBindObject(final Node node) throws Exception { - if (node.getNodeName().equals(JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME)) - { - deployConnectionFactory(node); - } - else if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME)) + if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME)) { deployQueue(node); } @@ -131,12 +112,7 @@ public class JMSServerDeployer extends XmlDeployer @Override public void undeploy(final Node node) throws Exception { - if (node.getNodeName().equals(JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME)) - { - String cfName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue(); - jmsServerManager.destroyConnectionFactory(cfName); - } - else if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME)) + if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME)) { String queueName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue(); jmsServerManager.removeQueueFromJNDI(queueName); @@ -162,7 +138,7 @@ public class JMSServerDeployer extends XmlDeployer private void deployTopic(final Node node) throws Exception { TopicConfiguration topicConfig = parser.parseTopicConfiguration(node); - jmsServerManager.createTopic(false, topicConfig.getName(), topicConfig.getBindings()); + jmsServerManager.createTopic(false, topicConfig.getName()); } /** @@ -172,18 +148,6 @@ public class JMSServerDeployer extends XmlDeployer private void deployQueue(final Node node) throws Exception { JMSQueueConfiguration queueconfig = parser.parseQueueConfiguration(node); - jmsServerManager.createQueue(false, queueconfig.getName(), queueconfig.getSelector(), queueconfig.isDurable(), queueconfig.getBindings()); + jmsServerManager.createQueue(false, queueconfig.getName(), queueconfig.getSelector(), queueconfig.isDurable()); } - - /** - * @param node - * @throws Exception - */ - private void deployConnectionFactory(final Node node) throws Exception - { - ConnectionFactoryConfiguration cfConfig = parser.parseConnectionFactoryConfiguration(node); - jmsServerManager.createConnectionFactory(false, cfConfig, cfConfig.getBindings()); - } - - } diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java index 392a19b59d..3261033370 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java @@ -481,7 +481,10 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback { if (!contextSet) { - registry = new JndiBindingRegistry(new InitialContext()); + if (System.getProperty(Context.INITIAL_CONTEXT_FACTORY) != null) + { + registry = new JndiBindingRegistry(new InitialContext()); + } } } @@ -1731,10 +1734,9 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback private void checkJNDI(final String... jndiNames) throws NamingException { - for (String jndiName : jndiNames) { - if (registry.lookup(jndiName) != null) + if (registry != null && registry.lookup(jndiName) != null) { throw new NamingException(jndiName + " already has an object bound"); } @@ -1772,15 +1774,13 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback List queueConfigs = config.getQueueConfigurations(); for (JMSQueueConfiguration qConfig : queueConfigs) { - String[] bindings = qConfig.getBindings(); - createQueue(false, qConfig.getName(), qConfig.getSelector(), qConfig.isDurable(), bindings); + createQueue(false, qConfig.getName(), qConfig.getSelector(), qConfig.isDurable(), qConfig.getBindings()); } List topicConfigs = config.getTopicConfigurations(); for (TopicConfiguration tConfig : topicConfigs) { - String[] bindings = tConfig.getBindings(); - createTopic(false, tConfig.getName(), bindings); + createTopic(false, tConfig.getName(), tConfig.getBindings()); } } diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/StandaloneNamingServer.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/StandaloneNamingServer.java deleted file mode 100644 index 9d029a22f5..0000000000 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/StandaloneNamingServer.java +++ /dev/null @@ -1,170 +0,0 @@ -/** - * 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. - */ -package org.apache.activemq.jms.server.impl; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import org.apache.activemq.core.server.ActivateCallback; -import org.apache.activemq.core.server.ActiveMQComponent; -import org.apache.activemq.core.server.ActiveMQServer; -import org.apache.activemq.core.server.ActiveMQServerLogger; -import org.jnp.server.Main; -import org.jnp.server.NamingBeanImpl; - -/** - * This server class is only used in the standalone mode, its used to control the life cycle of the Naming Server to allow - * it to be activated and deactivated - * - * @author Andy Taylor - * 11/8/12 - */ -public class StandaloneNamingServer implements ActiveMQComponent -{ - private Main jndiServer; - - private ActiveMQServer server; - - private NamingBeanImpl namingBean; - - private int port = 1099; - - private String bindAddress = "localhost"; - - private int rmiPort = 1098; - - private String rmiBindAddress = "localhost"; - - private ExecutorService executor; - - public StandaloneNamingServer(ActiveMQServer server) - { - this.server = server; - } - - @Override - public void start() throws Exception - { - server.registerActivateCallback(new ServerActivateCallback()); - } - - @Override - public void stop() throws Exception - { - } - - @Override - public boolean isStarted() - { - return false; - } - - public void setPort(int port) - { - this.port = port; - } - - public void setBindAddress(String bindAddress) - { - this.bindAddress = bindAddress; - } - - public void setRmiPort(int rmiPort) - { - this.rmiPort = rmiPort; - } - - public void setRmiBindAddress(String rmiBindAddress) - { - this.rmiBindAddress = rmiBindAddress; - } - - private class ServerActivateCallback implements ActivateCallback - { - private boolean activated = false; - - @Override - public synchronized void preActivate() - { - if (activated) - { - return; - } - try - { - jndiServer = new Main(); - namingBean = new NamingBeanImpl(); - jndiServer.setNamingInfo(namingBean); - executor = Executors.newCachedThreadPool(); - jndiServer.setLookupExector(executor); - jndiServer.setPort(port); - jndiServer.setBindAddress(bindAddress); - jndiServer.setRmiPort(rmiPort); - jndiServer.setRmiBindAddress(rmiBindAddress); - namingBean.start(); - jndiServer.start(); - } - catch (Exception e) - { - ActiveMQServerLogger.LOGGER.unableToStartNamingServer(e); - } - - activated = true; - } - - @Override - public void activated() - { - - } - - @Override - public synchronized void deActivate() - { - if (!activated) - { - return; - } - if (jndiServer != null) - { - try - { - jndiServer.stop(); - } - catch (Exception e) - { - ActiveMQServerLogger.LOGGER.unableToStopNamingServer(e); - } - } - if (namingBean != null) - { - namingBean.stop(); - } - if (executor != null) - { - executor.shutdown(); - } - activated = false; - } - - @Override - public void activationComplete() - { - - } - } -} diff --git a/activemq-jms-server/src/main/resources/schema/activemq-jms.xsd b/activemq-jms-server/src/main/resources/schema/activemq-jms.xsd index 7367b15b8c..b3d2cdfe9b 100644 --- a/activemq-jms-server/src/main/resources/schema/activemq-jms.xsd +++ b/activemq-jms-server/src/main/resources/schema/activemq-jms.xsd @@ -9,259 +9,37 @@ version="1.0"> - - + + - - - - + + + - - + + - - - a list of connection factories to create and add to - JNDI - - - - - - Whether this is an XA connection factory - - - - + - - - A sequence of connectors used by the connection factory - - - - - - - A connector reference - - - - - - Name of the connector to connect to the live server - - - - - - - - - - - - - - - - - - - - - - the period (in ms) after which the client will consider the connection failed - after not receiving packets from the server. -1 disables this setting. - - - - - - - the time to live (in ms) for connections - - - - - - - - the timeout (in ms) for remote calls - - - - - - - - - - - - - - - - - - - - - - - - - - the pre-configured client ID for the connection factory - - - - - - - - - - - - whether or not messages are acknowledged synchronously - - - - - - - whether or not non-durable messages are sent synchronously - - - - - - - whether or not durable messages are sent synchronously - - - - - - whether or not message grouping is automatically used - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Type of connection factory - - - - - - - - - - - - - - Name of discovery group used by this connection factory - - - - - - - - + - - - - - - - - - - - + + + + + + + + + + - - - - - - + + + + + diff --git a/activemq-ra/pom.xml b/activemq-ra/pom.xml index c027026640..c1fca0503c 100644 --- a/activemq-ra/pom.xml +++ b/activemq-ra/pom.xml @@ -46,6 +46,13 @@ activemq-jms-server ${project.version} provided + + + + org.jboss.spec.javax.resource + jboss-connector-api_1.5_spec + + org.apache.geronimo.specs diff --git a/activemq-rest/src/main/java/org/apache/activemq/rest/integration/EmbeddedRestActiveMQJMS.java b/activemq-rest/src/main/java/org/apache/activemq/rest/integration/EmbeddedRestActiveMQJMS.java index 40140300ea..ee48d51ac6 100644 --- a/activemq-rest/src/main/java/org/apache/activemq/rest/integration/EmbeddedRestActiveMQJMS.java +++ b/activemq-rest/src/main/java/org/apache/activemq/rest/integration/EmbeddedRestActiveMQJMS.java @@ -37,4 +37,8 @@ public class EmbeddedRestActiveMQJMS extends EmbeddedRestActiveMQ return ((EmbeddedJMS) embeddedActiveMQ).getRegistry(); } + public EmbeddedJMS getEmbeddedJMS() + { + return (EmbeddedJMS) embeddedActiveMQ; + } } diff --git a/activemq-rest/src/main/java/org/apache/activemq/rest/queue/QueueDestinationsResource.java b/activemq-rest/src/main/java/org/apache/activemq/rest/queue/QueueDestinationsResource.java index 259826e71e..0358db173b 100644 --- a/activemq-rest/src/main/java/org/apache/activemq/rest/queue/QueueDestinationsResource.java +++ b/activemq-rest/src/main/java/org/apache/activemq/rest/queue/QueueDestinationsResource.java @@ -101,13 +101,6 @@ public class QueueDestinationsResource { } } - if (queue.getBindings() != null && queue.getBindings().length > 0 && manager.getRegistry() != null) - { - for (String binding : queue.getBindings()) - { - manager.getRegistry().bind(binding, activeMQQueue); - } - } URI uri = uriInfo.getRequestUriBuilder().path(queueName).build(); return Response.created(uri).build(); } diff --git a/activemq-rest/src/main/java/org/apache/activemq/rest/topic/TopicDestinationsResource.java b/activemq-rest/src/main/java/org/apache/activemq/rest/topic/TopicDestinationsResource.java index fa3415bdcb..8ab2a0e1a6 100644 --- a/activemq-rest/src/main/java/org/apache/activemq/rest/topic/TopicDestinationsResource.java +++ b/activemq-rest/src/main/java/org/apache/activemq/rest/topic/TopicDestinationsResource.java @@ -95,13 +95,6 @@ public class TopicDestinationsResource { } } - if (topic.getBindings() != null && topic.getBindings().length > 0 && manager.getRegistry() != null) - { - for (String binding : topic.getBindings()) - { - manager.getRegistry().bind(binding, activeMQTopic); - } - } URI uri = uriInfo.getRequestUriBuilder().path(topicName).build(); return Response.created(uri).build(); } diff --git a/activemq-rest/src/test/java/org/apache/activemq/rest/test/EmbeddedTest.java b/activemq-rest/src/test/java/org/apache/activemq/rest/test/EmbeddedTest.java index da0d9eaa6c..1ab39d4ed2 100644 --- a/activemq-rest/src/test/java/org/apache/activemq/rest/test/EmbeddedTest.java +++ b/activemq-rest/src/test/java/org/apache/activemq/rest/test/EmbeddedTest.java @@ -23,7 +23,10 @@ import javax.jms.MessageProducer; import javax.jms.ObjectMessage; import javax.jms.Session; import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.rest.HttpHeaderProperty; import org.apache.activemq.rest.integration.EmbeddedRestActiveMQJMS; import org.apache.activemq.spi.core.naming.BindingRegistry; @@ -49,6 +52,9 @@ public class EmbeddedTest server = new EmbeddedRestActiveMQJMS(); server.getManager().setConfigResourcePath("activemq-rest.xml"); server.start(); + List connectors = new ArrayList<>(); + connectors.add("in-vm"); + server.getEmbeddedJMS().getJMSServerManager().createConnectionFactory("ConnectionFactory", false, JMSFactoryType.CF, connectors, "ConnectionFactory"); } @AfterClass @@ -61,10 +67,10 @@ public class EmbeddedTest public static void publish(String destination, Serializable object, String contentType) throws Exception { BindingRegistry reg = server.getRegistry(); - Destination dest = (Destination) reg.lookup(destination); ConnectionFactory factory = (ConnectionFactory) reg.lookup("ConnectionFactory"); Connection conn = factory.createConnection(); Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); + Destination dest = session.createQueue(destination); try { @@ -109,7 +115,7 @@ public class EmbeddedTest TransformTest.Order order = new TransformTest.Order(); order.setName("1"); order.setAmount("$5.00"); - publish("/queue/exampleQueue", order, null); + publish("exampleQueue", order, null); ClientResponse res = consumeNext.request().header("Accept-Wait", "2").accept("application/xml").post(String.class); Assert.assertEquals(200, res.getStatus()); @@ -126,7 +132,7 @@ public class EmbeddedTest TransformTest.Order order = new TransformTest.Order(); order.setName("1"); order.setAmount("$5.00"); - publish("/queue/exampleQueue", order, null); + publish("exampleQueue", order, null); ClientResponse res = consumeNext.request().header("Accept-Wait", "2").accept("application/json").post(String.class); Assert.assertEquals(200, res.getStatus()); @@ -143,7 +149,7 @@ public class EmbeddedTest TransformTest.Order order = new TransformTest.Order(); order.setName("2"); order.setAmount("$15.00"); - publish("/queue/exampleQueue", order, "application/xml"); + publish("exampleQueue", order, "application/xml"); ClientResponse res = consumeNext.request().header("Accept-Wait", "2").post(String.class); Assert.assertEquals(200, res.getStatus()); diff --git a/activemq-rest/src/test/resources/activemq-jms.xml b/activemq-rest/src/test/resources/activemq-jms.xml index bce97ab150..37589895ef 100644 --- a/activemq-rest/src/test/resources/activemq-jms.xml +++ b/activemq-rest/src/test/resources/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/distribution/activemq/pom.xml b/distribution/activemq/pom.xml index c0e58459f3..7911837404 100644 --- a/distribution/activemq/pom.xml +++ b/distribution/activemq/pom.xml @@ -101,11 +101,6 @@ org.apache.activemq activemq-aerogear-integration ${project.version} - - - org.apache.activemq - jnp-client - ${project.version} org.apache.activemq diff --git a/distribution/activemq/src/main/assembly/dep.xml b/distribution/activemq/src/main/assembly/dep.xml index a4c17ac0a5..088ae95728 100644 --- a/distribution/activemq/src/main/assembly/dep.xml +++ b/distribution/activemq/src/main/assembly/dep.xml @@ -33,7 +33,6 @@ org.apache.activemq.rest:activemq-rest org.jboss.spec.javax.jms:jboss-jms-api_2.0_spec - org.jboss.naming:jnpserver org.jboss.logmanager:jboss-logmanager org.jboss:jboss-common-core io.netty:netty-all diff --git a/distribution/activemq/src/main/resources/bin/activemq b/distribution/activemq/src/main/resources/bin/activemq index 1e632d5a62..d8e01f1451 100755 --- a/distribution/activemq/src/main/resources/bin/activemq +++ b/distribution/activemq/src/main/resources/bin/activemq @@ -81,7 +81,7 @@ for i in `ls $ACTIVEMQ_HOME/lib/*.jar`; do done -JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces -Dactivemq.home=$ACTIVEMQ_HOME -Ddata.dir=$ACTIVEMQ_HOME/data -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dlogging.configuration=file:$ACTIVEMQ_HOME/config/logging.properties -Djava.library.path=$ACTIVEMQ_HOME/bin/lib/linux-i686:$ACTIVEMQ_HOME/bin/lib/linux-x86_64" -#JAVA_ARGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces" +JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dactivemq.home=$ACTIVEMQ_HOME -Ddata.dir=$ACTIVEMQ_HOME/data -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dlogging.configuration=file:$ACTIVEMQ_HOME/config/logging.properties -Djava.library.path=$ACTIVEMQ_HOME/bin/lib/linux-i686:$ACTIVEMQ_HOME/bin/lib/linux-x86_64" +#JAVA_ARGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" exec "$JAVACMD" $JAVA_ARGS -classpath $CLASSPATH org.apache.activemq.cli.ActiveMQ $@ \ No newline at end of file diff --git a/distribution/activemq/src/main/resources/bin/activemq.cmd b/distribution/activemq/src/main/resources/bin/activemq.cmd index 32dbb36c75..3a0a4f96d0 100755 --- a/distribution/activemq/src/main/resources/bin/activemq.cmd +++ b/distribution/activemq/src/main/resources/bin/activemq.cmd @@ -31,7 +31,7 @@ echo. :RUN_JAVA -if "%JVM_FLAGS%" == "" set JVM_FLAGS=-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces -Dactivemq.home=$ACTIVEMQ_HOME -Ddata.dir=$ACTIVEMQ_HOME/data -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dlogging.configuration="file:%ACTIVEMQ_HOME%\config\logging.properties" -Djava.library.path="%ACTIVEMQ_HOME%/bin/lib/linux-i686:%ACTIVEMQ_HOME%/bin/lib/linux-x86_64" +if "%JVM_FLAGS%" == "" set JVM_FLAGS=-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dactivemq.home=$ACTIVEMQ_HOME -Ddata.dir=$ACTIVEMQ_HOME/data -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dlogging.configuration="file:%ACTIVEMQ_HOME%\config\logging.properties" -Djava.library.path="%ACTIVEMQ_HOME%/bin/lib/linux-i686:%ACTIVEMQ_HOME%/bin/lib/linux-x86_64" if "x%ACTIVEMQ_OPTS%" == "x" goto noACTIVEMQ_OPTS set JVM_FLAGS=%JVM_FLAGS% %ACTIVEMQ_OPTS% diff --git a/distribution/activemq/src/main/resources/config/clustered/activemq-jms.xml b/distribution/activemq/src/main/resources/config/clustered/activemq-jms.xml index d1b456b679..ccdc8bd207 100644 --- a/distribution/activemq/src/main/resources/config/clustered/activemq-jms.xml +++ b/distribution/activemq/src/main/resources/config/clustered/activemq-jms.xml @@ -2,52 +2,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd"> - - true - - - - - - - + - - false - - - - - - - - - - true - - - - - - - - - - false - - - - - - - - - - - - - - - + diff --git a/distribution/activemq/src/main/resources/config/clustered/jndi.properties b/distribution/activemq/src/main/resources/config/clustered/jndi.properties deleted file mode 100644 index e2a9832f8e..0000000000 --- a/distribution/activemq/src/main/resources/config/clustered/jndi.properties +++ /dev/null @@ -1,2 +0,0 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces \ No newline at end of file diff --git a/distribution/activemq/src/main/resources/config/non-clustered/activemq-jms.xml b/distribution/activemq/src/main/resources/config/non-clustered/activemq-jms.xml index d1b456b679..ccdc8bd207 100644 --- a/distribution/activemq/src/main/resources/config/non-clustered/activemq-jms.xml +++ b/distribution/activemq/src/main/resources/config/non-clustered/activemq-jms.xml @@ -2,52 +2,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd"> - - true - - - - - - - + - - false - - - - - - - - - - true - - - - - - - - - - false - - - - - - - - - - - - - - - + diff --git a/distribution/activemq/src/main/resources/config/non-clustered/jndi.properties b/distribution/activemq/src/main/resources/config/non-clustered/jndi.properties deleted file mode 100644 index e2a9832f8e..0000000000 --- a/distribution/activemq/src/main/resources/config/non-clustered/jndi.properties +++ /dev/null @@ -1,2 +0,0 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces \ No newline at end of file diff --git a/distribution/activemq/src/main/resources/config/replicated/activemq-configuration.xml b/distribution/activemq/src/main/resources/config/replicated/activemq-configuration.xml index 5f41085a35..a7a756e5b6 100644 --- a/distribution/activemq/src/main/resources/config/replicated/activemq-configuration.xml +++ b/distribution/activemq/src/main/resources/config/replicated/activemq-configuration.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd"> ${data.dir:../data}/paging diff --git a/distribution/activemq/src/main/resources/config/replicated/activemq-jms.xml b/distribution/activemq/src/main/resources/config/replicated/activemq-jms.xml index d1b456b679..ccdc8bd207 100644 --- a/distribution/activemq/src/main/resources/config/replicated/activemq-jms.xml +++ b/distribution/activemq/src/main/resources/config/replicated/activemq-jms.xml @@ -2,52 +2,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd"> - - true - - - - - - - + - - false - - - - - - - - - - true - - - - - - - - - - false - - - - - - - - - - - - - - - + diff --git a/distribution/activemq/src/main/resources/config/replicated/jndi.properties b/distribution/activemq/src/main/resources/config/replicated/jndi.properties deleted file mode 100644 index e2a9832f8e..0000000000 --- a/distribution/activemq/src/main/resources/config/replicated/jndi.properties +++ /dev/null @@ -1,2 +0,0 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces \ No newline at end of file diff --git a/distribution/activemq/src/main/resources/config/shared-store/activemq-configuration.xml b/distribution/activemq/src/main/resources/config/shared-store/activemq-configuration.xml index e738d2f3bd..e5820e1687 100644 --- a/distribution/activemq/src/main/resources/config/shared-store/activemq-configuration.xml +++ b/distribution/activemq/src/main/resources/config/shared-store/activemq-configuration.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd"> ${data.dir:../data}/paging diff --git a/distribution/activemq/src/main/resources/config/shared-store/activemq-jms.xml b/distribution/activemq/src/main/resources/config/shared-store/activemq-jms.xml index d1b456b679..ccdc8bd207 100644 --- a/distribution/activemq/src/main/resources/config/shared-store/activemq-jms.xml +++ b/distribution/activemq/src/main/resources/config/shared-store/activemq-jms.xml @@ -2,52 +2,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd"> - - true - - - - - - - + - - false - - - - - - - - - - true - - - - - - - - - - false - - - - - - - - - - - - - - - + diff --git a/distribution/activemq/src/main/resources/config/shared-store/jndi.properties b/distribution/activemq/src/main/resources/config/shared-store/jndi.properties deleted file mode 100644 index e2a9832f8e..0000000000 --- a/distribution/activemq/src/main/resources/config/shared-store/jndi.properties +++ /dev/null @@ -1,2 +0,0 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces \ No newline at end of file diff --git a/distribution/jnp-client/pom.xml b/distribution/jnp-client/pom.xml deleted file mode 100644 index 122880cae4..0000000000 --- a/distribution/jnp-client/pom.xml +++ /dev/null @@ -1,75 +0,0 @@ - - 4.0.0 - - - - org.apache.activemq - activemq-distribution - 6.0.0-SNAPSHOT - - - jnp-client - jar - JBoss jnp client jar - - - - org.jboss.naming - jnpserver - - - org.jboss.logging - jboss-logging - - - - - - - src/main/resources - true - - - - - org.apache.maven.plugins - maven-shade-plugin - - - package - - shade - - - - - org.jboss.naming:jnpserver - org.jboss.logging:jboss-logging - - - - - org.jboss.naming:jnpserver - - org/jnp/interfaces/**/*.class - org/jboss/naming/**/*.class - org/jnp/server/NamingServer_Stub.class - - - - org.jboss.logging:jboss-logging - - org/jboss/logging/**/*.class - - - - - - - - - - - - diff --git a/distribution/pom.xml b/distribution/pom.xml index 143b72fb82..6e0c42b3e9 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -22,10 +22,6 @@ org.jboss.spec.javax.jms jboss-jms-api_2.0_spec - - org.jboss.naming - jnpserver - io.netty netty-all @@ -33,7 +29,6 @@ - jnp-client activemq diff --git a/docs/user-manual/en/appserver-integration.xml b/docs/user-manual/en/appserver-integration.xml index a22d95e950..897de10d6e 100644 --- a/docs/user-manual/en/appserver-integration.xml +++ b/docs/user-manual/en/appserver-integration.xml @@ -494,38 +494,35 @@ public class MyMDB implements MessageListener - - DiscoveryInitialWaitTimeout - + DiscoveryInitialWaitTimeout Long The initial time to wait for discovery. - - ConnectionLoadBalancingPolicyClassName + ConnectionLoadBalancingPolicyClassName String The load balancing policy class to use. - ConnectionTTL + ConnectionTTL Long The time to live (in milliseconds) for the connection. - CallTimeout + CallTimeout Long the call timeout (in milliseconds) for each packet sent. - DupsOKBatchSize + DupsOKBatchSize Integer the batch size (in bytes) between acknowledgements when using @@ -533,7 +530,7 @@ public class MyMDB implements MessageListener - TransactionBatchSize + TransactionBatchSize Integer the batch size (in bytes) between acknowledgements when using a @@ -541,70 +538,70 @@ public class MyMDB implements MessageListener - ConsumerWindowSize + ConsumerWindowSize Integer the window size (in bytes) for consumer flow control - ConsumerMaxRate + ConsumerMaxRate Integer the fastest rate a consumer may consume messages per second - ConfirmationWindowSize + ConfirmationWindowSize Integer the window size (in bytes) for reattachment confirmations - ProducerMaxRate + ProducerMaxRate Integer the maximum rate of messages per second that can be sent - MinLargeMessageSize + MinLargeMessageSize Integer the size (in bytes) before a message is treated as large - BlockOnAcknowledge + BlockOnAcknowledge Boolean whether or not messages are acknowledged synchronously - BlockOnNonDurableSend + BlockOnNonDurableSend Boolean whether or not non-durable messages are sent synchronously - BlockOnDurableSend + BlockOnDurableSend Boolean whether or not durable messages are sent synchronously - AutoGroup + AutoGroup Boolean whether or not message grouping is automatically used - PreAcknowledge + PreAcknowledge Boolean whether messages are pre acknowledged by the server before @@ -612,28 +609,28 @@ public class MyMDB implements MessageListener - ReconnectAttempts + ReconnectAttempts Integer maximum number of retry attempts, default for the resource adapter is -1 (infinite attempts) - RetryInterval + RetryInterval Long the time (in milliseconds) to retry a connection after failing - RetryIntervalMultiplier + RetryIntervalMultiplier Double multiplier to apply to successive retry intervals - FailoverOnServerShutdown + FailoverOnServerShutdown Boolean If true client will reconnect to another server if @@ -641,14 +638,14 @@ public class MyMDB implements MessageListener - ClientID + ClientID String the pre-configured client ID for the connection factory - ClientFailureCheckPeriod + ClientFailureCheckPeriod Long the period (in ms) after which the client will consider the @@ -657,21 +654,21 @@ public class MyMDB implements MessageListener - UseGlobalPools + UseGlobalPools Boolean whether or not to use a global thread pool for threads - ScheduledThreadPoolMaxSize + ScheduledThreadPoolMaxSize Integer the size of the scheduled thread pool - ThreadPoolMaxSize + ThreadPoolMaxSize Integer the size of the thread pool diff --git a/docs/user-manual/en/client-classpath.xml b/docs/user-manual/en/client-classpath.xml index 0115770635..2baafbd523 100644 --- a/docs/user-manual/en/client-classpath.xml +++ b/docs/user-manual/en/client-classpath.xml @@ -47,12 +47,5 @@ needed for the javax.jms.* classes. If you already have a jar with these interface classes on your classpath, you will not need it. - - -
- JMS Client with JNDI - If you are looking up JMS resources from the JNDI server co-located with the ActiveMQ - standalone server, you will also need the jar jnp-client.jar jar on - your client classpath as well as any other jars mentioned previously.
diff --git a/docs/user-manual/en/client-reconnection.xml b/docs/user-manual/en/client-reconnection.xml index 29a4266b96..96a45345ab 100644 --- a/docs/user-manual/en/client-reconnection.xml +++ b/docs/user-manual/en/client-reconnection.xml @@ -115,23 +115,16 @@ default value is 0. - If you're using JMS, and you're using the JMS Service on the server to load your JMS - connection factory instances directly into JNDI, then you can specify these parameters - in the xml configuration in activemq-jms.xml, for example: + If you're using JMS and you're using JNDI on the client to look up your JMS + connection factory instances then you can specify these parameters + in the JNDI context environment in, e.g. jndi.properties: -<connection-factory name="ConnectionFactory"> - <connectors> - <connector-ref connector-name="netty"/> - </connectors> - <entries> - <entry name="ConnectionFactory"/> - <entry name="XAConnectionFactory"/> - </entries> - <retry-interval>1000</retry-interval> - <retry-interval-multiplier>1.5</retry-interval-multiplier> - <max-retry-interval>60000</max-retry-interval> - <reconnect-attempts>1000</reconnect-attempts> -</connection-factory> +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url = tcp://localhost:5445 +connection.ConnectionFactory.retryInterval=1000 +connection.ConnectionFactory.retryIntervalMultiplier=1.5 +connection.ConnectionFactory.maxRetryInterval=60000 +connection.ConnectionFactory.reconnectAttempts=1000 If you're using JMS, but instantiating your JMS connection factory directly, you can specify the parameters using the appropriate setter methods on the ActiveMQConnectionFactory immediately after creating it. diff --git a/docs/user-manual/en/clusters.xml b/docs/user-manual/en/clusters.xml index 6d4227e495..2b4aad1c3d 100644 --- a/docs/user-manual/en/clusters.xml +++ b/docs/user-manual/en/clusters.xml @@ -378,18 +378,15 @@ whether you're using JMS or the core API.
Configuring client discovery using JMS - If you're using JMS and you're also using the JMS Service on the server to - load your JMS connection factory instances into JNDI, then you can specify which - discovery group to use for your JMS connection factory in the server side xml - configuration activemq-jms.xml. Let's take a look at an + If you're using JMS and you're using JNDI on the client to look up your JMS + connection factory instances then you can specify these parameters in the JNDI + context environment. e.g. in jndi.properties. Simply ensure the + host:port combination matches the group-address and group-port from the corresponding + broadcast-group on the server. Let's take a look at an example: -<connection-factory name="ConnectionFactory"> - <discovery-group-ref discovery-group-name="my-discovery-group"/> - <entries> - <entry name="ConnectionFactory"/> - </entries> -</connection-factory> +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url = udp://231.7.7.7:9876 The element discovery-group-ref specifies the name of a discovery group defined in activemq-configuration.xml. When this connection factory is downloaded from JNDI by a client application @@ -471,27 +468,17 @@ ClientSession session2 = factory.createSession(); A static list of possible servers can also be used by a normal client.
Configuring client discovery using JMS - If you're using JMS and you're also using the JMS Service on the server to - load your JMS connection factory instances into JNDI, then you can specify which - connectors to use for your JMS connection factory in the server side xml - configuration activemq-jms.xml. Let's take a look at an - example: + If you're using JMS and you're using JNDI on the client to look up your JMS + connection factory instances then you can specify these parameters + in the JNDI context environment in, e.g. jndi.properties: -<connection-factory name="ConnectionFactory"> - <connectors> - <connector-ref connector-name="netty-connector"/> - <connector-ref connector-name="netty-connector2"/> - <connector-ref connector-name="netty-connector3"/> - </connectors> - <entries> - <entry name="ConnectionFactory"/> - </entries> -</connection-factory> +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://myhost:5445,myhost2:5445 - The element connectors contains a list of pre defined connectors in the - activemq-configuration.xml file. When this connection factory is downloaded - from JNDI by a client application and JMS connections are created from it, those connections will - be load-balanced across the list of servers defined by these connectors. + The java.naming.provider.url contains a list of servers to use for the + connection factory. When this connection factory used client application and JMS connections + are created from it, those connections will be load-balanced across the list of servers defined + by the java.naming.provider.url. If you're using JMS, but you're not using JNDI to lookup a connection factory - you're instantiating @@ -830,20 +817,14 @@ ClientSession session = factory.createSession(); Specifying which load balancing policy to use differs whether you are using JMS or the core API. If you don't specify a policy then the default will be used which is org.apache.activemq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy. - If you're using JMS, and you're using JNDI on the server to put your JMS connection - factories into JNDI, then you can specify the load balancing policy directly in the - activemq-jms.xml configuration file on the server as follows: + If you're using JMS and you're using JNDI on the client to look up your JMS connection factory instances + then you can specify these parameters in the JNDI context environment in, e.g. + jndi.properties, to specify the load balancing policy directly: -<connection-factory name="ConnectionFactory"> - <discovery-group-ref discovery-group-name="my-discovery-group"/> - <entries> - <entry name="ConnectionFactory"/> - </entries> - <connection-load-balancing-policy-class-name> - org.apache.activemq.api.core.client.loadbalance.RandomConnectionLoadBalancingPolicy - </connection-load-balancing-policy-class-name> -</connection-factory> - The above example would deploy a JMS connection factory that uses the random connection load +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 +connection.ConnectionFactory.loadBalancingPolicyClassName=org.apache.activemq.api.core.client.loadbalance.RandomConnectionLoadBalancingPolicy + The above example would instantiate a JMS connection factory that uses the random connection load balancing policy. If you're using JMS but you're instantiating your connection factory directly on the client side then you can set the load balancing policy using the setter on the diff --git a/docs/user-manual/en/configuration-index.xml b/docs/user-manual/en/configuration-index.xml index db63a1bc8e..8307d99eeb 100644 --- a/docs/user-manual/en/configuration-index.xml +++ b/docs/user-manual/en/configuration-index.xml @@ -73,364 +73,56 @@ - - connection-factory - - ConnectionFactory - a list of connection factories to create and add to JNDI - - - - - - - - Continued.. - - - - - - - - - - connection-factory.signature (attribute) - - String - Type of connection factory - generic - - - - connection-factory.xa - - Boolean - If it is a XA connection factory - false - - - - connection-factory.auto-group - - Boolean - whether or not message grouping is automatically used - false - - - connection-factory.connectors - - String - A list of connectors used by the connection factory - - - - connection-factory.connectors.connector-ref.connector-name (attribute) - - String - Name of the connector to connect to the live server - - - - connection-factory.discovery-group-ref.discovery-group-name (attribute) - - String - Name of discovery group used by this connection factory - - - - - - connection-factory.discovery-initial-wait-timeout - - Long - the initial time to wait (in ms) for discovery groups to wait for - broadcasts - 10000 - - - - connection-factory.block-on-acknowledge - - Boolean - whether or not messages are acknowledged synchronously - false - - - - connection-factory.block-on-non-durable-send - - Boolean - whether or not non-durable messages are sent synchronously - false - - - - connection-factory.block-on-durable-send - - Boolean - whether or not durable messages are sent synchronously - true - - - connection-factory.call-timeout - Long - the timeout (in ms) for remote calls - 30000 - - - - connection-factory.client-failure-check-period - - Long - the period (in ms) after which the client will consider the - connection failed after not receiving packets from the - server - 30000 - - - - connection-factory.client-id - - String - the pre-configured client ID for the connection factory - null - - - - - connection-factory.connection-load-balancing-policy-class-name - - String - the name of the load balancing class - org.apache.activemq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy - - - - connection-factory.connection-ttl - - Long - the time to live (in ms) for connections - 1 * 60000 - - - - connection-factory.consumer-max-rate - Integer - the fastest rate a consumer may consume messages per - second - -1 - - - - connection-factory.consumer-window-size - Integer - the window size (in bytes) for consumer flow control - 1024 * 1024 - - - - connection-factory.dups-ok-batch-size - Integer - the batch size (in bytes) between acknowledgements when using - DUPS_OK_ACKNOWLEDGE mode - 1024 * 1024 - - - connection-factory.failover-on-initial-connection - Boolean - whether or not to failover to backup on event that initial connection to live server fails - false - - - - connection-factory.failover-on-server-shutdown - Boolean - whether or not to failover on server shutdown - false - - - - connection-factory.min-large-message-size - Integer - the size (in bytes) before a message is treated as large - 100 * 1024 - - - - connection-factory.avoid-large-messages - Boolean - If compress large messages and send them as regular messages if possible - false - - - connection-factory.cache-large-message-client - Boolean - If true clients using this connection factory will hold the large - message body on temporary files. - false - - - - connection-factory.pre-acknowledge - Boolean - whether messages are pre acknowledged by the server before - sending - false - - - - connection-factory.producer-max-rate - Integer - the maximum rate of messages per second that can be sent - -1 - - - connection-factory.producer-window-size - Integer - the window size in bytes for producers sending messages - 1024 * 1024 - - - - connection-factory.confirmation-window-size - - Integer - the window size (in bytes) for reattachment confirmations - 1024 * 1024 - - - - connection-factory.reconnect-attempts - - Integer - maximum number of retry attempts, -1 signifies infinite - 0 - - - - connection-factory.retry-interval - - Long - the time (in ms) to retry a connection after failing - 2000 - - - - connection-factory.retry-interval-multiplier - - Double - multiplier to apply to successive retry intervals - 1.0 - - - connection-factory.max-retry-interval - Integer - The maximum retry interval in the case a retry-interval-multiplier has been specified - 2000 - - - - connection-factory.scheduled-thread-pool-max-size - - Integer - the size of the scheduled thread pool - 5 - - - - connection-factory.thread-pool-max-size - - Integer - the size of the thread pool - -1 - - - - - connection-factory.transaction-batch-size - - Integer - the batch size (in bytes) between acknowledgements when using a - transactional session - 1024 * 1024 - - - - connection-factory.use-global-pools - - Boolean - whether or not to use a global thread pool for threads - true - - - queue + queue Queue a queue to create and add to JNDI - queue.name - (attribute) + queue.name (attribute) String unique name of the queue - queue.entry + queue.entry String - context where the queue will be bound in JNDI (there can be - many) + context where the queue will be bound in JNDI (there can be many) - queue.durable + queue.durable Boolean is the queue durable? true - queue.filter + queue.filter String optional filter expression for the queue - topic + topic Topic a topic to create and add to JNDI - topic.name - (attribute) + topic.name (attribute) String unique name of the topic - topic.entry + topic.entry String - context where the topic will be bound in JNDI (there can be - many) + context where the topic will be bound in JNDI (there can be many) - +
diff --git a/docs/user-manual/en/configuring-transports.xml b/docs/user-manual/en/configuring-transports.xml index 7ee6c00601..7e61d5069c 100644 --- a/docs/user-manual/en/configuring-transports.xml +++ b/docs/user-manual/en/configuring-transports.xml @@ -96,25 +96,16 @@ to other servers. That's defined by connectors. - If you're using JMS and the server side JMS service to instantiate JMS - ConnectionFactory instances and bind them in JNDI, then when creating the - ActiveMQConnectionFactory it needs to know what server - that connection factory will create connections to. - That's defined by the connector-ref element in the activemq-jms.xml file on the server side. Let's take a look at a - snipped from a activemq-jms.xml file that shows a JMS - connection factory that references our netty connector defined in our activemq-configuration.xml file: + If you're using JMS and you're using JNDI on the client to look up your JMS connection factory + instances then when creating the ActiveMQConnectionFactory it needs to know what + server that connection factory will create connections to. + That's defined by the java.naming.provider.url element in the JNDI context + environment, e.g. jndi.properties. Behind the scenes, the + org.apache.activemq.jndi.ActiveMQInitialContextFactory uses the + java.naming.provider.url to construct the transport. Here's a simple example: -<connection-factory name="ConnectionFactory"> - <connectors> - <connector-ref connector-name="netty"/> - </connectors> - <entries> - <entry name="ConnectionFactory"/> - <entry name="XAConnectionFactory"/> - </entries> -</connection-factory> +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://myhost:5445
@@ -168,7 +159,7 @@ Connection jmsConnection = connectionFactory.createConnection(); etc
-
+
Configuring the Netty transport Out of the box, ActiveMQ currently uses Netty, a high performance low level network library. diff --git a/docs/user-manual/en/flow-control.xml b/docs/user-manual/en/flow-control.xml index 5853f9ce4c..70ab4e2421 100644 --- a/docs/user-manual/en/flow-control.xml +++ b/docs/user-manual/en/flow-control.xml @@ -111,20 +111,14 @@
Using JMS - if JNDI is used to look up the connection factory, the consumer window size is - configured in activemq-jms.xml: + If JNDI is used on the client to instantiate and look up the connection factory the consumer window + size is configured in the JNDI context environment, e.g. jndi.properties. Here's a + simple example using the "ConnectionFactory" connection factory which is available in the context by + default: -<connection-factory name="ConnectionFactory"> - <connectors> - <connector-ref connector-name="netty-connector"/> - </connectors> - <entries> - <entry name="ConnectionFactory"/> - </entries> - - <!-- Set the consumer window size to 0 to have *no* buffer on the client side --> - <consumer-window-size>0</consumer-window-size> -</connection-factory> +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 +connection.ConnectionFactory.consumerWindowSize=0 If the connection factory is directly instantiated, the consumer window size is specified by ActiveMQConnectionFactory.setConsumerWindowSize() method. @@ -153,20 +147,13 @@
Using JMS - If JNDI is used to look up the connection factory, the max rate can be configured - in activemq-jms.xml: + If JNDI is used to instantiate and look up the connection factory, the max rate can be configured in + the JNDI context environment, e.g. jndi.properties. Here's a simple example using the + "ConnectionFactory" connection factory which is available in the context by default: -<connection-factory name="ConnectionFactory"> - <connectors> - <connector-ref connector-name="netty-connector"/> - </connectors> - <entries> - <entry name="ConnectionFactory"/> - </entries> - <!-- We limit consumers created on this connection factory to consume messages at a maximum rate - of 10 messages per sec --> - <consumer-max-rate>10</consumer-max-rate> -</connection-factory> +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 +connection.ConnectionFactory.consumerMaxRate=10 If the connection factory is directly instantiated, the max rate size can be set via the ActiveMQConnectionFactory.setConsumerMaxRate(int consumerMaxRate) method. @@ -208,18 +195,13 @@
Using JMS - If JNDI is used to look up the connection factory, the producer window size can be - configured in activemq-jms.xml: + If JNDI is used to instantiate and look up the connection factory, the producer window size can be + configured in the JNDI context environment, e.g. jndi.properties. Here's a simple + example using the "ConnectionFactory" connection factory which is available in the context by default: -<connection-factory name="ConnectionFactory"> - <connectors> - <connector-ref connector-name="netty-connector"/> - </connectors> - <entries> - <entry name="ConnectionFactory"/> - </entries> - <producer-window-size>10</producer-window-size> -</connection-factory> +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 +connection.ConnectionFactory.producerWindowSize=10 If the connection factory is directly instantiated, the producer window size can be set via the ActiveMQConnectionFactory.setProducerWindowSize(int producerWindowSize) method. @@ -286,29 +268,22 @@
Using Core API If the ActiveMQ core API is being used the rate can be set via the ServerLocator.setProducerMaxRate(int consumerMaxRate) method or + >ServerLocator.setProducerMaxRate(int producerMaxRate) method or alternatively via some of the ClientSession.createProducer() methods.
Using JMS - If JNDI is used to look up the connection factory, the max rate can be configured - in activemq-jms.xml: + If JNDI is used to instantiate and look up the connection factory, the max rate size can be + configured in the JNDI context environment, e.g. jndi.properties. Here's a simple + example using the "ConnectionFactory" connection factory which is available in the context by default: -<connection-factory name="ConnectionFactory"> - <connectors> - <connector-ref connector-name="netty-connector"/> - </connectors> - <entries> - <entry name="ConnectionFactory"/> - </entries> - <!-- We limit producers created on this connection factory to produce messages at a maximum rate - of 10 messages per sec --> - <producer-max-rate>10</producer-max-rate> -</connection-factory> +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 +connection.ConnectionFactory.producerMaxRate=10 If the connection factory is directly instantiated, the max rate size can be set via the ActiveMQConnectionFactory.setProducerMaxRate(int - consumerMaxRate) method. + producerMaxRate) method.
diff --git a/docs/user-manual/en/interoperability.xml b/docs/user-manual/en/interoperability.xml index 3c9ceec37a..f3f3bdd9bf 100644 --- a/docs/user-manual/en/interoperability.xml +++ b/docs/user-manual/en/interoperability.xml @@ -229,9 +229,8 @@ hq-message-id : STOMP12345 Stomp requires the file jndi.properties to be available on the classpath. This should look something like: -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.provider.url=jnp://localhost:1099 -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory + Configure any required JNDI resources in this file according to the documentation. Make sure this file is in the classpath along with the StompConnect jar and the ActiveMQ jars and simply run java org.codehaus.stomp.jms.Main. diff --git a/docs/user-manual/en/large-messages.xml b/docs/user-manual/en/large-messages.xml index 42b18d2670..43bc2a8e35 100644 --- a/docs/user-manual/en/large-messages.xml +++ b/docs/user-manual/en/large-messages.xml @@ -83,21 +83,14 @@ ClientSessionFactory factory = ActiveMQClient.createClientSessionFactory();
Using JMS - If JNDI is used to look up the connection factory, the minimum large message size - is specified in activemq-jms.xml - ... -<connection-factory name="ConnectionFactory"> - <connectors> - <connector-ref connector-name="netty"/> - </connectors> - <entries> - <entry name="ConnectionFactory"/> - <entry name="XAConnectionFactory"/> - </entries> - - <min-large-message-size>250000</min-large-message-size> -</connection-factory> -... + If JNDI is used to instantiate and look up the connection factory, the minimum large message size + is configured in the JNDI context environment, e.g. jndi.properties. Here's a simple + example using the "ConnectionFactory" connection factory which is available in the context by default: + +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 +connection.ConnectionFactory.minLargeMessageSize=250000 + If the connection factory is being instantiated directly, the minimum large message size is specified by ActiveMQConnectionFactory.setMinLargeMessageSize. @@ -121,17 +114,13 @@ ClientSessionFactory factory = ActiveMQClient.createClientSessionFactory();
- If you use JMS, you can achieve large messages compression by configuring your - connection factories. For example, - ... -<connection-factory name="ConnectionFactory"> - <connectors> - <connector-ref connector-name="netty"/> - </connectors> -... - <compress-large-messages>true</compress-large-messages> -</connection-factory> -... + If JNDI is used to instantiate and look up the connection factory, large message compression can be + configured in the JNDI context environment, e.g. jndi.properties. Here's a simple + example using the "ConnectionFactory" connection factory which is available in the context by default: + +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 +connection.ConnectionFactory.compressLargeMessages=true
diff --git a/docs/user-manual/en/logging.xml b/docs/user-manual/en/logging.xml index 27b4bfa515..8277b5562d 100644 --- a/docs/user-manual/en/logging.xml +++ b/docs/user-manual/en/logging.xml @@ -69,21 +69,9 @@
Logging in a client or with an Embedded server - Firstly, if you want to enable logging on the client side you need to include the jboss logging jars in your library. - If you are using the distribution make sure the jnp-client.jar is included or if you are using maven add the following - dependencies. + Firstly, if you want to enable logging on the client side you need to include the JBoss logging jars in your library. + If you are using maven add the following dependencies. -<dependency> -<groupId>org.jboss.naming</groupId> -<artifactId>jnp-client</artifactId> -<version>5.0.5.Final</version> - <exclusions> - <exclusion> - <groupId>org.jboss.logging</groupId> - <artifactId>jboss-logging-spi</artifactId> - </exclusion> - </exclusions> -</dependency> <dependency> <groupId>org.jboss.logmanager</groupId> <artifactId>jboss-logmanager</artifactId> @@ -94,8 +82,6 @@ <artifactId>activemq-core-client</artifactId> <version>2.3.0.Final</version> </dependency> - The first dependency jnp-client is not actually needed for logging, however this is needed for - using JNDI and imports a previous version JBoss logging which needs to be excluded There are 2 properties you need to set when starting your java program, the first is to set the Log Manager to use diff --git a/docs/user-manual/en/message-grouping.xml b/docs/user-manual/en/message-grouping.xml index b371897391..6ed962b272 100644 --- a/docs/user-manual/en/message-grouping.xml +++ b/docs/user-manual/en/message-grouping.xml @@ -77,34 +77,23 @@ message = ... message.setStringProperty("JMSXGroupID", "Group-0"); producer.send(message); - Alternatively, you can set autogroup to true on the ActiveMQConnectonFactory which will pick a random unique id. This can also be - set in the activemq-jms.xml file like this: + Alternatively, you can set autogroup to true on the + ActiveMQConnectonFactory which will pick a random unique id. This can also be set in the + JNDI context environment, e.g. jndi.properties. Here's a simple example using the + "ConnectionFactory" connection factory which is available in the context by default -<connection-factory name="ConnectionFactory"> - <connectors> - <connector-ref connector-name="netty-connector"/> - </connectors> - <entries> - <entry name="ConnectionFactory"/> - </entries> - <autogroup>true</autogroup> -</connection-factory> +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 +connection.ConnectionFactory.autoGroup=true Alternatively you can set the group id via the connection factory. All messages sent with producers created via this connection factory will set the JMSXGroupID to the specified value on all messages sent. To configure the - group id set it on the connection factory in the activemq-jms.xml config - file as follows + >JMSXGroupID to the specified value on all messages sent. This can also be set in the + JNDI context environment, e.g. jndi.properties. Here's a simple example using the + "ConnectionFactory" connection factory which is available in the context by default: -<connection-factory name="ConnectionFactory"> - <connectors> - <connector-ref connector-name="netty-connector"/> - </connectors> - <entries> - <entry name="ConnectionFactory"/> - </entries> - <group-id>Group-0</group-id> -</connection-factory> +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 +connection.ConnectionFactory.groupID=Group-0
Example diff --git a/docs/user-manual/en/pre-acknowledge.xml b/docs/user-manual/en/pre-acknowledge.xml index 77e21288c9..d8eec48442 100644 --- a/docs/user-manual/en/pre-acknowledge.xml +++ b/docs/user-manual/en/pre-acknowledge.xml @@ -57,18 +57,12 @@
Using PRE_ACKNOWLEDGE - This can be configured in the activemq-jms.xml file on the connection factory like this: + This can be configured in a client's JNDI context environment, e.g. jndi.properties, + like this: -<connection-factory name="ConnectionFactory"> - <connectors> - <connector-ref connector-name="netty-connector"/> - </connectors> - <entries> - <entry name="ConnectionFactory"/> - </entries> - <pre-acknowledge>true</pre-acknowledge> -</connection-factory> +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 +connection.ConnectionFactory.preAcknowledge=true Alternatively, to use pre-acknowledgement mode using the JMS API, create a JMS Session with the ActiveMQSession.PRE_ACKNOWLEDGE constant. diff --git a/docs/user-manual/en/spring-integration.xml b/docs/user-manual/en/spring-integration.xml index a929a67bc2..b5168715d8 100644 --- a/docs/user-manual/en/spring-integration.xml +++ b/docs/user-manual/en/spring-integration.xml @@ -40,20 +40,9 @@ <configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd"> - <!--the connection factory used by the example--> - <connection-factory name="ConnectionFactory"> - <connectors> - <connector-ref connector-name="in-vm"/> - </connectors> - <entries> - <entry name="ConnectionFactory"/> - </entries> - </connection-factory> <!--the queue used by the example--> - <queue name="exampleQueue"> - <entry name="/queue/exampleQueue"/> - </queue> + <queue name="exampleQueue"/> </configuration> Here we've specified a javax.jms.ConnectionFactory we want bound to a diff --git a/docs/user-manual/en/thread-pooling.xml b/docs/user-manual/en/thread-pooling.xml index 074fa22ecc..85a3189605 100644 --- a/docs/user-manual/en/thread-pooling.xml +++ b/docs/user-manual/en/thread-pooling.xml @@ -137,20 +137,14 @@ myFactory.setThreadPoolMaxSize(-1); ConnectionFactory myConnectionFactory = ActiveMQJMSClient.createConnectionFactory(myFactory); If you're using JNDI to instantiate ActiveMQConnectionFactory - instances, you can also set these parameters in the activemq-jms.xml - file where you describe your connection factory, for example: + instances, you can also set these parameters in the JNDI context environment, e.g. + jndi.properties. Here's a simple example using the "ConnectionFactory" connection + factory which is available in the context by default: -<connection-factory name="ConnectionFactory"> - <connectors> - <connector-ref connector-name="netty"/> - </connectors> - <entries> - <entry name="ConnectionFactory"/> - <entry name="XAConnectionFactory"/> - </entries> - <use-global-pools>false</use-global-pools> - <scheduled-thread-pool-max-size>10</scheduled-thread-pool-max-size> - <thread-pool-max-size>-1</thread-pool-max-size> -</connection-factory> +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 +connection.ConnectionFactory.useGlobalPools=false +connection.ConnectionFactory.scheduledThreadPoolMaxSize=10 +connection.ConnectionFactory.threadPoolMaxSize=-1
diff --git a/docs/user-manual/en/using-jms.xml b/docs/user-manual/en/using-jms.xml index 40be7b7afa..fdf0729dec 100644 --- a/docs/user-manual/en/using-jms.xml +++ b/docs/user-manual/en/using-jms.xml @@ -49,210 +49,262 @@ server JMS configuration so it is created automatically without us having to explicitly create it from the client.
-
- JMS Server Configuration - The file activemq-jms.xml on the server classpath contains any JMS - Queue, Topic and ConnectionFactory instances that we wish to create and make available - to lookup via the JNDI. - A JMS ConnectionFactory object is used by the client to make connections to the - server. It knows the location of the server it is connecting to, as well as many other - configuration parameters. In most cases the defaults will be acceptable. - We'll deploy a single JMS Queue and a single JMS Connection Factory instance on the - server for this example but there are no limits to the number of Queues, Topics and - Connection Factory instances you can deploy from the file. Here's our - configuration: - -<configuration xmlns="urn:activemq" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="urn:activemq ../schemas/activemq-jms.xsd "> - - <connection-factory name="ConnectionFactory"> - <connectors> - <connector-ref connector-name="netty"/> - </connectors> - <entries> - <entry name="ConnectionFactory"/> - </entries> - </connection-factory> - - <queue name="OrderQueue"> - <entry name="queues/OrderQueue"/> - </queue> -</configuration> - We deploy one ConnectionFactory called ConnectionFactory and bind - it in just one place in JNDI as given by the entry element. - ConnectionFactory instances can be bound in many places in JNDI if you require. +
+ JNDI Configuration + The JMS specification establishes the convention that administered + objects (i.e. JMS queue, topic and connection factory instances) are made + available via the JNDI API. Brokers are free to implement JNDI as they see fit assuming + the implementation fits the API. ActiveMQ does not have a JNDI server. Rather, it uses a + client-side JNDI implementation that relies on special properties set in the environment + to construct the appropriate JMS objects. In other words, no objects are stored in JNDI + on the ActiveMQ server. There are simply instantiated on the client based on the provided + configuration. Let's look at the different kinds of administered objects and how to configure + them. - The JMS connection factory references a connector called - netty. This is a reference to a connector object deployed in - the main core configuration file activemq-configuration.xml which - defines the transport and parameters used to actually connect to the server. + The following configuration properties are strictly required when ActiveMQ + is running in stand-alone mode. When ActiveMQ is integrated to an application + server (e.g. Wildfly) the application server itself will almost certainly provide a JNDI + client with its own properties. -
-
- Connection Factory Types - The JMS API doc provides several connection factories for applications. ActiveMQ JMS users - can choose to configure the types for their connection factories. Each connection factory - has a signature attribute and a xa parameter, the - combination of which determines the type of the factory. Attribute signature - has three possible string values, i.e. generic, - queue and topic; xa is a boolean - type parameter. The following table gives their configuration values for different - connection factory interfaces. - +
+ ConnectionFactory JNDI + A JMS connection factory is used by the client to make connections to the server. + It knows the location of the server it is connecting to, as well as many other + configuration parameters. + By default, a javax.naming.Context instance created using the + org.apache.activemq.jndi.ActiveMQInitialContextFactory will automatically + have the following connection factories available for lookup: + + + ConnectionFactory + + + XAConnectionFactory + + + QueueConnectionFactory + + + TopicConnectionFactory + + + Here's a simple example of the JNDI context environment for a client looking up a connection factory + to access an embedded instance of ActiveMQ: + +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory + It's really as simple as that. As noted previously, any JNDI context created with the + ActiveMQInitialContextFactory will have a set of default connection factories + available. Therefore, only the java.naming.factory.initial property is required + to access an embedded broker. + In certain situations there could be multiple server instances running within a particular JVM. In + that situation each server would typically have an InVM acceptor with a unique server-ID. A client + using JMS and JNDI can account for this by specifying a + javax.naming.Context.PROVIDER_URL (String value of + "java.naming.provider.url") in the JNDI environment like vm://2 where + 2 is the server-ID for acceptor. + Here is a list of all the supported URL schemes: + + vm + tcp + udp + jgroups + + Most clients won't be connecting to an embedded broker. Clients will most commonly connect + across a network a remote broker. In that case the client can use the + javax.naming.Context.PROVIDER_URL (String value of + "java.naming.provider.url") in the JNDI environment to specify where to connect. Here's a simple + example of a client configuring a connection factory to connect to a remote broker running on + myhost:5445: + +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://myhost:5445 + In the example above the client is using the tcp scheme for the provider URL. + A client may also specify multiple comma-delimited host:port combinations in the URL (e.g. + tcp://remote-host1:5445,remote-host2:5445). Whether there is one or many + host:port combinations in the URL they are treated as the initial connector(s) + for the underlying connection. + The udp scheme is also supported which should use an host:port combination that + matches the group-address and group-port from the corresponding + broadcast-group configured on the ActiveMQ server(s). + Each scheme has a specific set of properties which can be set using the traditional URL query string + format (e.g. scheme://host:port?key1=value1&key2=value2) to customize the underlying + transport mechanism. For example, if a client wanted to connect to a remote server using TCP and SSL + it would use a Context.PROVIDER_URL of + tcp://remote-host:5445?ssl-enabled=true. + All the properties available for the tcp scheme are described in + the documentation regarding the Netty transport. + The udp scheme supports 4 properties: + + + local-address - If you are running with multiple network interfaces on the same + machine, you may want to specify that the discovery group listens only only a specific interface. To + do this you can specify the interface address with this parameter. + + + local-port - If you want to specify a local port to which the datagram socket is + bound you can specify it here. Normally you would just use the default value of -1 which signifies + that an anonymous port should be used. This parameter is always specified in conjunction with + local-address. + + + refresh-timeout - This is the period the discovery group waits after receiving + the last broadcast from a particular server before removing that servers connector pair entry from its + list. You would normally set this to a value significantly higher than the broadcast-period on the + broadcast group otherwise servers might intermittently disappear from the list even though they are + still broadcasting due to slight differences in timing. This parameter is optional, the default value + is 10000 milliseconds (10 seconds). + + + discovery-initial-wait-timeout - If the connection factory is used immediately + after creation then it may not have had enough time to received broadcasts from all the nodes in the + cluster. On first usage, the connection factory will make sure it waits this long since creation + before creating the first connection. The default value for this parameter is 10000 milliseconds. + + + Lastly, the jgroups scheme is supported which provides an alternative to the + udp scheme for server discovery. The URL pattern is as follows + jgroups://<jgroups-xml-conf-filename> where + <jgroups-xml-conf-filename> refers to an XML file on the classpath that contains + the JGroups configuration. + The refresh-timeout and discovery-initial-wait-timeout properties + are supported just like with udp. + Although a javax.naming.Context instance created using the + org.apache.activemq.jndi.ActiveMQInitialContextFactory will automatically + have some connection factories present, it is possible for a client to specify its own connection + factories. This is done using the + org.apache.activemq.jndi.ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES + property (String value of "connectionFactoryNames"). The value for this property is a comma delimited + String of all the connection factories the client wishes to create. For example: + +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 +connectionFactoryNames=myConnectionFactory + In this example, the client is creating a connection factory named "myConnectionFactory." This + replaces all the default connection factories so that only the "myConnectionFactory" connection factory + is available to the client. + Aside from the underlying transport, the underlying connection factory implementation can also be + configured using special properties. To configure a particular connection factory the client would + follow this pattern for the property name to set in the environment: + connection.<connection-factory-name>.<property-name>. For example, if the + client wanted to customize the default connection factory "ConnectionFactory" to support + high-availability then it would do this: + +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://myhost:5445 +connection.ConnectionFactory.ha=true + Any property available on the underlying + org.apache.activemq.jms.client.ActiveMQConnectionFactory can be set this way in + addition to the ha (boolean) and type (String) properties. Here + are the different options for the type: +
Configuration for Connection Factory Types - - - + + - signature - xa - Connection Factory Type + type + interface - generic (default) - false (default) + CF (default) javax.jms.ConnectionFactory - generic - true + XA_CF javax.jms.XAConnectionFactory - queue - false + QUEUE_CF javax.jms.QueueConnectionFactory - queue - true + QUEUE_XA_CF javax.jms.XAQueueConnectionFactory - topic - false + TOPIC_CF javax.jms.TopicConnectionFactory - topic - true + TOPIC_XA_CF javax.jms.XATopicConnectionFactory
- As an example, the following configures an XAQueueConnectionFactory: - -<configuration xmlns="urn:activemq" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="urn:activemq ../schemas/activemq-jms.xsd "> - - <connection-factory name="ConnectionFactory" signature="queue"> - <xa>true</xa> - <connectors> - <connector-ref connector-name="netty"/> - </connectors> - <entries> - <entry name="ConnectionFactory"/> - </entries> - </connection-factory> -</configuration> - -
-
- JNDI configuration - When using JNDI from the client side you need to specify a set of JNDI properties - which tell the JNDI client where to locate the JNDI server, amongst other things. These - are often specified in a file called jndi.properties on the client - classpath, or you can specify them directly when creating the JNDI initial context. A - full JNDI tutorial is outside the scope of this document, please see the Sun JNDI tutorial - for more information on how to use JNDI. - For talking to the JBoss JNDI Server, the jndi properties will look something like - this: - -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.provider.url=jnp://myhost:1099 -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces - Where myhost is the hostname or IP address of the JNDI server. 1099 - is the port used by the JNDI server and may vary depending on how you have configured - your JNDI server. - In the default standalone configuration, JNDI server ports are configured in the file - activemq-beans.xml by setting properties on the JNDIServer bean: - -<bean name="StandaloneServer" class="org.apache.activemq.jms.server.impl.StandaloneNamingServer"> - <constructor> - <parameter> - <inject bean="ActiveMQServer"/> - </parameter> - </constructor> - <property name="port">${jnp.port:1099}</property> - <property name="bindAddress">${jnp.host:localhost}</property> - <property name="rmiPort">${jnp.rmiPort:1098}</property> - <property name="rmiBindAddress">${jnp.host:localhost}</property> -</bean> - - If you want your JNDI server to be available to non local clients make sure you - change its bind address to something other than localhost! - - - The JNDIServer bean must be defined only when ActiveMQ is running in - stand-alone mode. When ActiveMQ is integrated to JBoss Application - Server, JBoss AS will provide a ready-to-use JNDI server without any additional - configuration. - -
-
- The code - Here's the code for the example: - First we'll create a JNDI initial context from which to lookup our JMS objects: - InitialContext ic = new InitialContext(); - Now we'll look up the connection factory: - ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory"); - And look up the Queue: - Queue orderQueue = (Queue)ic.lookup("/queues/OrderQueue"); - Next we create a JMS connection using the connection factory: - Connection connection = cf.createConnection(); - And we create a non transacted JMS Session, with AUTO_ACKNOWLEDGE acknowledge - mode: - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - We create a MessageProducer that will send orders to the queue: - MessageProducer producer = session.createProducer(orderQueue); - And we create a MessageConsumer which will consume orders from the queue: - MessageConsumer consumer = session.createConsumer(orderQueue); - We make sure we start the connection, or delivery won't occur on it: - connection.start(); - We create a simple TextMessage and send it: - TextMessage message = session.createTextMessage("This is an order"); +
+
+ Destination JNDI + JMS destinations are also typically looked up via JNDI. As with connection factories, destinations can + be configured using special properties in the JNDI context environment. The property + name should follow the pattern: queue.<jndi-binding> or + topic.<jndi-binding>. The property value should be the name + of the queue hosted by the ActiveMQ server. For example, if the server had a JMS queue configured like + so: + +<queue name="OrderQueue"/> + And if the client wanted to bind this queue to "queues/OrderQueue" then the JNDI properties would be + configured like so: + +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://myhost:5445 +queue.queues/OrderQueue=OrderQueue + It is also possible to look-up JMS destinations which haven't been configured explicitly in the JNDI + context environment. This is possible using dynamicQueues/ or + dynamicTopics/ in the look-up string. For example, if the client wanted to look-up the + aforementioned "OrderQueue" it could do so simply by using the string "dynamicQueues/OrderQueue". Note, + the text that follows dynamicQueues/ or dynamicTopics/ must + correspond exactly to the name of the destination on the server. +
+
+ The code + Here's the code for the example: + First we'll create a JNDI initial context from which to lookup our JMS objects. If the above + properties are set in jndi.properties and it is on the classpath then any new, empty + InitialContext will be initialized using those properties: + InitialContext ic = new InitialContext(); + Now we'll look up the connection factory from which we can create connections to myhost:5445: + ConnectionFactory cf = (ConnectionFactory)ic.lookup("ConnectionFactory"); + And look up the Queue: + Queue orderQueue = (Queue)ic.lookup("queues/OrderQueue"); + Next we create a JMS connection using the connection factory: + Connection connection = cf.createConnection(); + And we create a non transacted JMS Session, with AUTO_ACKNOWLEDGE acknowledge + mode: + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + We create a MessageProducer that will send orders to the queue: + MessageProducer producer = session.createProducer(orderQueue); + And we create a MessageConsumer which will consume orders from the queue: + MessageConsumer consumer = session.createConsumer(orderQueue); + We make sure we start the connection, or delivery won't occur on it: + connection.start(); + We create a simple TextMessage and send it: + TextMessage message = session.createTextMessage("This is an order"); producer.send(message); - And we consume the message: - TextMessage receivedMessage = (TextMessage)consumer.receive(); + And we consume the message: + TextMessage receivedMessage = (TextMessage)consumer.receive(); System.out.println("Got order: " + receivedMessage.getText()); - It is as simple as that. For a wide range of working JMS examples please see the - examples directory in the distribution. - - Please note that JMS connections, sessions, producers and consumers are - designed to be re-used. - It is an anti-pattern to create new connections, sessions, producers and consumers - for each message you produce or consume. If you do this, your application will - perform very poorly. This is discussed further in the section on performance tuning - . - + It is as simple as that. For a wide range of working JMS examples please see the + examples directory in the distribution. + + Please note that JMS connections, sessions, producers and consumers are + designed to be re-used. + It is an anti-pattern to create new connections, sessions, producers and consumers + for each message you produce or consume. If you do this, your application will + perform very poorly. This is discussed further in the section on performance tuning + . + +
Directly instantiating JMS Resources without using JNDI Although it is a very common JMS usage pattern to lookup JMS Administered - Objects (that's JMS Queue, Topic and ConnectionFactory instances) from - JNDI, in some cases a JNDI server is not available and you still want to use JMS, or you - just think "Why do I need JNDI? Why can't I just instantiate these objects - directly?" + Objects (that's JMS Queue, Topic and ConnectionFactory instances) from JNDI, + in some cases you just think "Why do I need JNDI? Why can't I just instantiate these + objects directly?" With ActiveMQ you can do exactly that. ActiveMQ supports the direct instantiation of JMS Queue, Topic and ConnectionFactory instances, so you don't have to use JNDI at all. diff --git a/examples/core/embedded-remote/pom.xml b/examples/core/embedded-remote/pom.xml index d84c035b4c..9c63c973e0 100644 --- a/examples/core/embedded-remote/pom.xml +++ b/examples/core/embedded-remote/pom.xml @@ -37,11 +37,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnp-client - 5.0.5.Final - org.jboss.spec.javax.jms jboss-jms-api_2.0_spec diff --git a/examples/core/embedded/pom.xml b/examples/core/embedded/pom.xml index c49ff57d80..ac0195601d 100644 --- a/examples/core/embedded/pom.xml +++ b/examples/core/embedded/pom.xml @@ -37,11 +37,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnp-client - 5.0.5.Final - org.jboss.spec.javax.jms jboss-jms-api_2.0_spec diff --git a/examples/core/perf/pom.xml b/examples/core/perf/pom.xml index 5f56bbc03e..6db15e94c2 100644 --- a/examples/core/perf/pom.xml +++ b/examples/core/perf/pom.xml @@ -33,11 +33,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnp-client - 5.0.5.Final - org.apache.activemq.examples.jms activemq-jms-examples-common @@ -118,11 +113,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - diff --git a/examples/core/vertx-connector/pom.xml b/examples/core/vertx-connector/pom.xml index 79e83f9cbe..c12f66aa8c 100644 --- a/examples/core/vertx-connector/pom.xml +++ b/examples/core/vertx-connector/pom.xml @@ -41,11 +41,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnp-client - 5.0.5.Final - org.jboss.spec.javax.jms jboss-jms-api_2.0_spec @@ -148,11 +143,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - io.vertx vertx-core diff --git a/examples/core/vertx-connector/src/main/resources/server0/activemq-jms.xml b/examples/core/vertx-connector/src/main/resources/server0/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/core/vertx-connector/src/main/resources/server0/activemq-jms.xml +++ b/examples/core/vertx-connector/src/main/resources/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/activemq-jms-examples-common/config/server.properties b/examples/jms/activemq-jms-examples-common/config/server.properties index 0388e87151..138f0559a4 100644 --- a/examples/jms/activemq-jms-examples-common/config/server.properties +++ b/examples/jms/activemq-jms-examples-common/config/server.properties @@ -1 +1 @@ -server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces \ No newline at end of file +server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory \ No newline at end of file diff --git a/examples/jms/activemq-jms-examples-common/src/main/java/org/apache/activemq/common/example/ActiveMQExample.java b/examples/jms/activemq-jms-examples-common/src/main/java/org/apache/activemq/common/example/ActiveMQExample.java index 7c19bc3238..86059b6330 100644 --- a/examples/jms/activemq-jms-examples-common/src/main/java/org/apache/activemq/common/example/ActiveMQExample.java +++ b/examples/jms/activemq-jms-examples-common/src/main/java/org/apache/activemq/common/example/ActiveMQExample.java @@ -180,9 +180,10 @@ public abstract class ActiveMQExample { ActiveMQExample.log.info("using " + args[serverId] + " for jndi"); Properties props = new Properties(); - props.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory"); + props.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); props.put("java.naming.provider.url", args[serverId]); - props.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces"); + props.put("queue.queue/exampleQueue", "exampleQueue"); + props.put("topic.topic/exampleTopic", "exampleTopic"); return new InitialContext(props); } diff --git a/examples/jms/aerogear/pom.xml b/examples/jms/aerogear/pom.xml index 4ae12ea117..516d13f5de 100644 --- a/examples/jms/aerogear/pom.xml +++ b/examples/jms/aerogear/pom.xml @@ -70,7 +70,7 @@ org.apache.activemq.jms.example.AerogearExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -122,11 +122,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/aerogear/src/main/java/org/apache/activemq/jms/example/AerogearExample.java b/examples/jms/aerogear/src/main/java/org/apache/activemq/jms/example/AerogearExample.java index b9f10b1840..1c4ec67143 100644 --- a/examples/jms/aerogear/src/main/java/org/apache/activemq/jms/example/AerogearExample.java +++ b/examples/jms/aerogear/src/main/java/org/apache/activemq/jms/example/AerogearExample.java @@ -51,10 +51,10 @@ public class AerogearExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/aerogearQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-jms.xml index edc985ffed..24832553a0 100644 --- a/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/applet/pom.xml b/examples/jms/applet/pom.xml index c99b2c7e4a..4a2a26115a 100644 --- a/examples/jms/applet/pom.xml +++ b/examples/jms/applet/pom.xml @@ -51,7 +51,7 @@ org.apache.activemq.jms.example.AppletExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -107,11 +107,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/applet/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/applet/src/main/resources/hornetq/server0/activemq-jms.xml index 1dd09a682e..ab4841d633 100644 --- a/examples/jms/applet/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/applet/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/application-layer-failover/pom.xml b/examples/jms/application-layer-failover/pom.xml index 0cfa2f7cf3..c9cfb1af89 100644 --- a/examples/jms/application-layer-failover/pom.xml +++ b/examples/jms/application-layer-failover/pom.xml @@ -60,8 +60,8 @@ org.apache.activemq.jms.example.ApplicationLayerFailoverExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -126,11 +126,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/application-layer-failover/src/main/java/org/apache/activemq/jms/example/ApplicationLayerFailoverExample.java b/examples/jms/application-layer-failover/src/main/java/org/apache/activemq/jms/example/ApplicationLayerFailoverExample.java index 0b7c3a819d..2887e4caab 100644 --- a/examples/jms/application-layer-failover/src/main/java/org/apache/activemq/jms/example/ApplicationLayerFailoverExample.java +++ b/examples/jms/application-layer-failover/src/main/java/org/apache/activemq/jms/example/ApplicationLayerFailoverExample.java @@ -152,10 +152,10 @@ public class ApplicationLayerFailoverExample extends ActiveMQExample initialContext = getContext(server); // Step 2. Look-up the JMS Queue object from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Look-up a JMS Connection Factory object from JNDI on server 1 - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. We create a JMS Connection connection connection = connectionFactory.createConnection(); diff --git a/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-jms.xml index 3058fc865c..0d5c9537fb 100644 --- a/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-jms.xml index 3058fc865c..0d5c9537fb 100644 --- a/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/bridge/pom.xml b/examples/jms/bridge/pom.xml index f57adeff19..0c7b49c0da 100644 --- a/examples/jms/bridge/pom.xml +++ b/examples/jms/bridge/pom.xml @@ -64,8 +64,8 @@ org.apache.activemq.jms.example.BridgeExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -130,11 +130,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/bridge/src/main/java/org/apache/activemq/jms/example/BridgeExample.java b/examples/jms/bridge/src/main/java/org/apache/activemq/jms/example/BridgeExample.java index 4cbe94cfd4..fcf8719da6 100644 --- a/examples/jms/bridge/src/main/java/org/apache/activemq/jms/example/BridgeExample.java +++ b/examples/jms/bridge/src/main/java/org/apache/activemq/jms/example/BridgeExample.java @@ -59,11 +59,11 @@ public class BridgeExample extends ActiveMQExample // Step 2 - we look up the sausage-factory queue from node 0 - Queue sausageFactory = (Queue)ic0.lookup("/queue/sausage-factory"); + Queue sausageFactory = (Queue)ic0.lookup("queue/exampleQueue"); // Step 3 - we look up a JMS ConnectionFactory object from node 0 - ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory"); + ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("ConnectionFactory"); // Step 4 - we create an initial context for looking up JNDI on node 1 @@ -71,11 +71,11 @@ public class BridgeExample extends ActiveMQExample // Step 5 - we look up the mincing-machine queue on node 1 - Queue mincingMachine = (Queue)ic1.lookup("/queue/mincing-machine"); + Queue mincingMachine = (Queue)ic1.lookup("queue/exampleQueue1"); // Step 6 - we look up a JMS ConnectionFactory object from node 1 - ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory"); + ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("ConnectionFactory"); // Step 7. We create a JMS Connection connection0 which is a connection to server 0 diff --git a/examples/jms/bridge/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/bridge/src/main/resources/hornetq/server0/activemq-jms.xml index 2ec4406be5..3f96251c46 100644 --- a/examples/jms/bridge/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/bridge/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/bridge/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/bridge/src/main/resources/hornetq/server1/activemq-jms.xml index 0165bf18af..e4fe85ada6 100644 --- a/examples/jms/bridge/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/bridge/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/browser/pom.xml b/examples/jms/browser/pom.xml index 19d4284831..ffcd9471c0 100644 --- a/examples/jms/browser/pom.xml +++ b/examples/jms/browser/pom.xml @@ -44,7 +44,7 @@ org.apache.activemq.jms.example.QueueBrowserExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -91,11 +91,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/browser/src/main/java/org/apache/activemq/jms/example/QueueBrowserExample.java b/examples/jms/browser/src/main/java/org/apache/activemq/jms/example/QueueBrowserExample.java index bf2093bf3f..52e7fe19d9 100644 --- a/examples/jms/browser/src/main/java/org/apache/activemq/jms/example/QueueBrowserExample.java +++ b/examples/jms/browser/src/main/java/org/apache/activemq/jms/example/QueueBrowserExample.java @@ -55,10 +55,10 @@ public class QueueBrowserExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/browser/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/browser/src/main/resources/hornetq/server0/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/browser/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/browser/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/client-kickoff/pom.xml b/examples/jms/client-kickoff/pom.xml index c254db955b..3e0a2ed974 100644 --- a/examples/jms/client-kickoff/pom.xml +++ b/examples/jms/client-kickoff/pom.xml @@ -75,7 +75,7 @@ org.apache.activemq.jms.example.ClientKickoffExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -122,11 +122,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/client-kickoff/src/main/java/org/apache/activemq/jms/example/ClientKickoffExample.java b/examples/jms/client-kickoff/src/main/java/org/apache/activemq/jms/example/ClientKickoffExample.java index afd6083753..80957f754a 100644 --- a/examples/jms/client-kickoff/src/main/java/org/apache/activemq/jms/example/ClientKickoffExample.java +++ b/examples/jms/client-kickoff/src/main/java/org/apache/activemq/jms/example/ClientKickoffExample.java @@ -60,7 +60,7 @@ public class ClientKickoffExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perform a lookup on the Connection Factory - QueueConnectionFactory cf = (QueueConnectionFactory)initialContext.lookup("/ConnectionFactory"); + QueueConnectionFactory cf = (QueueConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 3.Create a JMS Connection connection = cf.createQueueConnection(); diff --git a/examples/jms/client-kickoff/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/client-kickoff/src/main/resources/hornetq/server0/activemq-jms.xml index 3de4046e2a..10a6dba87a 100644 --- a/examples/jms/client-kickoff/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/client-kickoff/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,14 +1,5 @@ - - - - - - - - - diff --git a/examples/jms/client-side-failoverlistener/pom.xml b/examples/jms/client-side-failoverlistener/pom.xml index 37ffe90f9d..402cced9bc 100644 --- a/examples/jms/client-side-failoverlistener/pom.xml +++ b/examples/jms/client-side-failoverlistener/pom.xml @@ -80,8 +80,8 @@ org.apache.activemq.jms.example.ClientSideFailoverListerExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -146,11 +146,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/client-side-failoverlistener/src/main/java/org/apache/activemq/jms/example/ClientSideFailoverListerExample.java b/examples/jms/client-side-failoverlistener/src/main/java/org/apache/activemq/jms/example/ClientSideFailoverListerExample.java index 0114786485..46b7b631c4 100644 --- a/examples/jms/client-side-failoverlistener/src/main/java/org/apache/activemq/jms/example/ClientSideFailoverListerExample.java +++ b/examples/jms/client-side-failoverlistener/src/main/java/org/apache/activemq/jms/example/ClientSideFailoverListerExample.java @@ -58,10 +58,10 @@ public class ClientSideFailoverListerExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look-up the JMS Queue object from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Look-up a JMS Connection Factory object from JNDI on server 0 - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. We create 1 JMS connections from the same connection factory. // Wait a little while to make sure broadcasts from all nodes have reached the client diff --git a/examples/jms/client-side-failoverlistener/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/client-side-failoverlistener/src/main/resources/hornetq/server0/activemq-jms.xml index 889b59d885..0d5c9537fb 100644 --- a/examples/jms/client-side-failoverlistener/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/client-side-failoverlistener/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,33 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - - + diff --git a/examples/jms/client-side-failoverlistener/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/client-side-failoverlistener/src/main/resources/hornetq/server1/activemq-jms.xml index c3b039357d..0d5c9537fb 100644 --- a/examples/jms/client-side-failoverlistener/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/client-side-failoverlistener/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,32 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/client-side-load-balancing/pom.xml b/examples/jms/client-side-load-balancing/pom.xml index 2e4f24a637..9ce2b28046 100644 --- a/examples/jms/client-side-load-balancing/pom.xml +++ b/examples/jms/client-side-load-balancing/pom.xml @@ -101,8 +101,8 @@ org.apache.activemq.jms.example.ClientSideLoadBalancingExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -176,11 +176,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/client-side-load-balancing/src/main/java/org/apache/activemq/jms/example/ClientSideLoadBalancingExample.java b/examples/jms/client-side-load-balancing/src/main/java/org/apache/activemq/jms/example/ClientSideLoadBalancingExample.java index da7390038d..be1895a94f 100644 --- a/examples/jms/client-side-load-balancing/src/main/java/org/apache/activemq/jms/example/ClientSideLoadBalancingExample.java +++ b/examples/jms/client-side-load-balancing/src/main/java/org/apache/activemq/jms/example/ClientSideLoadBalancingExample.java @@ -59,10 +59,10 @@ public class ClientSideLoadBalancingExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look-up the JMS Queue object from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Look-up a JMS Connection Factory object from JNDI on server 0 - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. We create 3 JMS connections from the same connection factory. Since we are using round-robin // load-balancing this should result in each sessions being connected to a different node of the cluster diff --git a/examples/jms/client-side-load-balancing/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/client-side-load-balancing/src/main/resources/hornetq/server0/activemq-jms.xml index 1ecf1f72ac..847659f7ad 100644 --- a/examples/jms/client-side-load-balancing/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/client-side-load-balancing/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,17 +1,8 @@ - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/client-side-load-balancing/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/client-side-load-balancing/src/main/resources/hornetq/server1/activemq-jms.xml index 1ecf1f72ac..847659f7ad 100644 --- a/examples/jms/client-side-load-balancing/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/client-side-load-balancing/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,17 +1,8 @@ - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/client-side-load-balancing/src/main/resources/hornetq/server2/activemq-jms.xml b/examples/jms/client-side-load-balancing/src/main/resources/hornetq/server2/activemq-jms.xml index 1ecf1f72ac..847659f7ad 100644 --- a/examples/jms/client-side-load-balancing/src/main/resources/hornetq/server2/activemq-jms.xml +++ b/examples/jms/client-side-load-balancing/src/main/resources/hornetq/server2/activemq-jms.xml @@ -1,17 +1,8 @@ - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-durable-subscription/pom.xml b/examples/jms/clustered-durable-subscription/pom.xml index 5ff2e28d4c..73d6727a50 100644 --- a/examples/jms/clustered-durable-subscription/pom.xml +++ b/examples/jms/clustered-durable-subscription/pom.xml @@ -79,8 +79,8 @@ org.apache.activemq.jms.example.ClusteredDurableSubscriptionExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -145,11 +145,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/clustered-durable-subscription/src/main/java/org/apache/activemq/jms/example/ClusteredDurableSubscriptionExample.java b/examples/jms/clustered-durable-subscription/src/main/java/org/apache/activemq/jms/example/ClusteredDurableSubscriptionExample.java index 5ca0f0d539..01d1c47747 100644 --- a/examples/jms/clustered-durable-subscription/src/main/java/org/apache/activemq/jms/example/ClusteredDurableSubscriptionExample.java +++ b/examples/jms/clustered-durable-subscription/src/main/java/org/apache/activemq/jms/example/ClusteredDurableSubscriptionExample.java @@ -59,16 +59,16 @@ public class ClusteredDurableSubscriptionExample extends ActiveMQExample ic0 = getContext(0); // Step 2. Look-up the JMS Topic object from JNDI - Topic topic = (Topic)ic0.lookup("/topic/exampleTopic"); + Topic topic = (Topic)ic0.lookup("topic/exampleTopic"); // Step 3. Look-up a JMS Connection Factory object from JNDI on server 0 - ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory"); + ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("ConnectionFactory"); // Step 4. Get an initial context for looking up JNDI from server 1 ic1 = getContext(1); // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1 - ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory"); + ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("ConnectionFactory"); // Step 6. We create a JMS Connection connection0 which is a connection to server 0 // and set the client-id diff --git a/examples/jms/clustered-durable-subscription/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/clustered-durable-subscription/src/main/resources/hornetq/server0/activemq-jms.xml index 1dd09a682e..ab4841d633 100644 --- a/examples/jms/clustered-durable-subscription/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/clustered-durable-subscription/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-durable-subscription/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/clustered-durable-subscription/src/main/resources/hornetq/server1/activemq-jms.xml index 1dd09a682e..ab4841d633 100644 --- a/examples/jms/clustered-durable-subscription/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/clustered-durable-subscription/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-grouping/pom.xml b/examples/jms/clustered-grouping/pom.xml index 0e55226665..f3a3fa60d9 100644 --- a/examples/jms/clustered-grouping/pom.xml +++ b/examples/jms/clustered-grouping/pom.xml @@ -101,9 +101,9 @@ org.apache.activemq.jms.example.ClusteredGroupingExample - jnp://localhost:1099 - jnp://localhost:1199 - jnp://localhost:1299 + tcp://localhost:5445 + tcp://localhost:5446 + tcp://localhost:5447 @@ -177,11 +177,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/clustered-grouping/src/main/java/org/apache/activemq/jms/example/ClusteredGroupingExample.java b/examples/jms/clustered-grouping/src/main/java/org/apache/activemq/jms/example/ClusteredGroupingExample.java index 0561d88b44..91421cf4d6 100644 --- a/examples/jms/clustered-grouping/src/main/java/org/apache/activemq/jms/example/ClusteredGroupingExample.java +++ b/examples/jms/clustered-grouping/src/main/java/org/apache/activemq/jms/example/ClusteredGroupingExample.java @@ -61,22 +61,22 @@ public class ClusteredGroupingExample extends ActiveMQExample ic0 = getContext(0); // Step 2. Look-up the JMS Queue object from JNDI - Queue queue = (Queue)ic0.lookup("/queue/exampleQueue"); + Queue queue = (Queue)ic0.lookup("queue/exampleQueue"); // Step 3. Look-up a JMS Connection Factory object from JNDI on server 0 - ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory"); + ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("ConnectionFactory"); // Step 4. Get an initial context for looking up JNDI from server 1 ic1 = getContext(1); // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1 - ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory"); + ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("ConnectionFactory"); // Step 4. Get an initial context for looking up JNDI from server 1 ic2 = getContext(2); // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1 - ConnectionFactory cf2 = (ConnectionFactory)ic2.lookup("/ConnectionFactory"); + ConnectionFactory cf2 = (ConnectionFactory)ic2.lookup("ConnectionFactory"); // Step 6. We create a JMS Connection connection0 which is a connection to server 0 connection0 = cf0.createConnection(); diff --git a/examples/jms/clustered-grouping/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/clustered-grouping/src/main/resources/hornetq/server0/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/clustered-grouping/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/clustered-grouping/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-grouping/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/clustered-grouping/src/main/resources/hornetq/server1/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/clustered-grouping/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/clustered-grouping/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-grouping/src/main/resources/hornetq/server2/activemq-jms.xml b/examples/jms/clustered-grouping/src/main/resources/hornetq/server2/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/clustered-grouping/src/main/resources/hornetq/server2/activemq-jms.xml +++ b/examples/jms/clustered-grouping/src/main/resources/hornetq/server2/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-jgroups/pom.xml b/examples/jms/clustered-jgroups/pom.xml index 1cdaf59a13..aca8a25a3f 100644 --- a/examples/jms/clustered-jgroups/pom.xml +++ b/examples/jms/clustered-jgroups/pom.xml @@ -75,8 +75,8 @@ org.apache.activemq.jms.example.ClusteredJgroupsExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -135,11 +135,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/clustered-jgroups/src/main/java/org/apache/activemq/jms/example/ClusteredJgroupsExample.java b/examples/jms/clustered-jgroups/src/main/java/org/apache/activemq/jms/example/ClusteredJgroupsExample.java index d838a5e84f..24ae554e4f 100644 --- a/examples/jms/clustered-jgroups/src/main/java/org/apache/activemq/jms/example/ClusteredJgroupsExample.java +++ b/examples/jms/clustered-jgroups/src/main/java/org/apache/activemq/jms/example/ClusteredJgroupsExample.java @@ -57,16 +57,16 @@ public class ClusteredJgroupsExample extends ActiveMQExample ic0 = getContext(0); // Step 2. Look-up the JMS Queue object from JNDI - Queue queue = (Queue)ic0.lookup("/queue/exampleQueue"); + Queue queue = (Queue)ic0.lookup("queue/exampleQueue"); // Step 3. Look-up a JMS Connection Factory object from JNDI on server 0 - ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory"); + ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("ConnectionFactory"); // Step 4. Get an initial context for looking up JNDI from server 1 ic1 = getContext(1); // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1 - ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory"); + ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("ConnectionFactory"); // Step 6. We create a JMS Connection connection0 which is a connection to server 0 connection0 = cf0.createConnection(); diff --git a/examples/jms/clustered-jgroups/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/clustered-jgroups/src/main/resources/hornetq/server0/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/clustered-jgroups/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/clustered-jgroups/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-jgroups/src/main/resources/hornetq/server0/client-jndi.properties b/examples/jms/clustered-jgroups/src/main/resources/hornetq/server0/client-jndi.properties index 080524fbb8..6940f75d77 100644 --- a/examples/jms/clustered-jgroups/src/main/resources/hornetq/server0/client-jndi.properties +++ b/examples/jms/clustered-jgroups/src/main/resources/hornetq/server0/client-jndi.properties @@ -1,3 +1,2 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.provider.url=jnp://localhost:1099 -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 \ No newline at end of file diff --git a/examples/jms/clustered-jgroups/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/clustered-jgroups/src/main/resources/hornetq/server1/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/clustered-jgroups/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/clustered-jgroups/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-jgroups/src/main/resources/hornetq/server1/client-jndi.properties b/examples/jms/clustered-jgroups/src/main/resources/hornetq/server1/client-jndi.properties index 7bcaf955be..79051092b8 100644 --- a/examples/jms/clustered-jgroups/src/main/resources/hornetq/server1/client-jndi.properties +++ b/examples/jms/clustered-jgroups/src/main/resources/hornetq/server1/client-jndi.properties @@ -1,3 +1,2 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.provider.url=jnp://localhost:2099 -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5446 \ No newline at end of file diff --git a/examples/jms/clustered-queue/pom.xml b/examples/jms/clustered-queue/pom.xml index 55147fa705..dfb3c5aa1c 100644 --- a/examples/jms/clustered-queue/pom.xml +++ b/examples/jms/clustered-queue/pom.xml @@ -71,8 +71,8 @@ org.apache.activemq.jms.example.ClusteredQueueExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -131,11 +131,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/clustered-queue/src/main/java/org/apache/activemq/jms/example/ClusteredQueueExample.java b/examples/jms/clustered-queue/src/main/java/org/apache/activemq/jms/example/ClusteredQueueExample.java index b264886199..5c1874d426 100644 --- a/examples/jms/clustered-queue/src/main/java/org/apache/activemq/jms/example/ClusteredQueueExample.java +++ b/examples/jms/clustered-queue/src/main/java/org/apache/activemq/jms/example/ClusteredQueueExample.java @@ -57,16 +57,16 @@ public class ClusteredQueueExample extends ActiveMQExample ic0 = getContext(0); // Step 2. Look-up the JMS Queue object from JNDI - Queue queue = (Queue)ic0.lookup("/queue/exampleQueue"); + Queue queue = (Queue)ic0.lookup("queue/exampleQueue"); // Step 3. Look-up a JMS Connection Factory object from JNDI on server 0 - ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory"); + ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("ConnectionFactory"); // Step 4. Get an initial context for looking up JNDI from server 1 ic1 = getContext(1); // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1 - ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory"); + ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("ConnectionFactory"); // Step 6. We create a JMS Connection connection0 which is a connection to server 0 connection0 = cf0.createConnection(); diff --git a/examples/jms/clustered-queue/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/clustered-queue/src/main/resources/hornetq/server0/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/clustered-queue/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/clustered-queue/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-queue/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/clustered-queue/src/main/resources/hornetq/server1/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/clustered-queue/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/clustered-queue/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-standalone/pom.xml b/examples/jms/clustered-standalone/pom.xml index cb5e4b2e09..427ec71a20 100644 --- a/examples/jms/clustered-standalone/pom.xml +++ b/examples/jms/clustered-standalone/pom.xml @@ -89,9 +89,9 @@ org.apache.activemq.jms.example.ClusteredStandaloneExample - jnp://localhost:1099 - jnp://localhost:1199 - jnp://localhost:1299 + tcp://localhost:5445 + tcp://localhost:5446 + tcp://localhost:5447 @@ -165,11 +165,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - diff --git a/examples/jms/clustered-standalone/src/main/java/org/apache/activemq/jms/example/ClusteredStandaloneExample.java b/examples/jms/clustered-standalone/src/main/java/org/apache/activemq/jms/example/ClusteredStandaloneExample.java index 7196c719cc..28704cea10 100644 --- a/examples/jms/clustered-standalone/src/main/java/org/apache/activemq/jms/example/ClusteredStandaloneExample.java +++ b/examples/jms/clustered-standalone/src/main/java/org/apache/activemq/jms/example/ClusteredStandaloneExample.java @@ -79,19 +79,19 @@ public class ClusteredStandaloneExample extends ActiveMQExample // We create a connection on each node, create a consumer on each connection and send some // messages at a node and verify they are all received by all consumers - ConnectionFactory cf0 = (ConnectionFactory)initialContext0.lookup("/ConnectionFactory"); + ConnectionFactory cf0 = (ConnectionFactory)initialContext0.lookup("ConnectionFactory"); System.out.println("Got cf " + cf0); - ConnectionFactory cf1 = (ConnectionFactory)initialContext1.lookup("/ConnectionFactory"); + ConnectionFactory cf1 = (ConnectionFactory)initialContext1.lookup("ConnectionFactory"); System.out.println("Got cf " + cf1); - ConnectionFactory cf2 = (ConnectionFactory)initialContext2.lookup("/ConnectionFactory"); + ConnectionFactory cf2 = (ConnectionFactory)initialContext2.lookup("ConnectionFactory"); System.out.println("Got cf " + cf2); - Topic topic = (Topic)initialContext0.lookup("/topic/ExampleTopic"); + Topic topic = (Topic)initialContext0.lookup("topic/exampleTopic"); connection0 = cf0.createConnection(); diff --git a/examples/jms/clustered-standalone/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/clustered-standalone/src/main/resources/hornetq/server0/activemq-jms.xml index 70a5fd5adf..845dfe193c 100644 --- a/examples/jms/clustered-standalone/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/clustered-standalone/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/clustered-standalone/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/clustered-standalone/src/main/resources/hornetq/server1/activemq-jms.xml index 70a5fd5adf..212fbd1707 100644 --- a/examples/jms/clustered-standalone/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/clustered-standalone/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,19 +1,9 @@ - - - - - - - - - - - + diff --git a/examples/jms/clustered-standalone/src/main/resources/hornetq/server2/activemq-jms.xml b/examples/jms/clustered-standalone/src/main/resources/hornetq/server2/activemq-jms.xml index 70a5fd5adf..845dfe193c 100644 --- a/examples/jms/clustered-standalone/src/main/resources/hornetq/server2/activemq-jms.xml +++ b/examples/jms/clustered-standalone/src/main/resources/hornetq/server2/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/clustered-static-discovery/pom.xml b/examples/jms/clustered-static-discovery/pom.xml index 8ce3ac9ee9..5245a17724 100644 --- a/examples/jms/clustered-static-discovery/pom.xml +++ b/examples/jms/clustered-static-discovery/pom.xml @@ -83,10 +83,10 @@ org.apache.activemq.jms.example.StaticClusteredQueueExample - jnp://localhost:1099 - jnp://localhost:1199 - jnp://localhost:1299 - jnp://localhost:1399 + tcp://localhost:5445 + tcp://localhost:5446 + tcp://localhost:5447 + tcp://localhost:5448 @@ -169,11 +169,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/clustered-static-discovery/src/main/java/org/apache/activemq/jms/example/StaticClusteredQueueExample.java b/examples/jms/clustered-static-discovery/src/main/java/org/apache/activemq/jms/example/StaticClusteredQueueExample.java index cca25b5c5e..868d611a28 100644 --- a/examples/jms/clustered-static-discovery/src/main/java/org/apache/activemq/jms/example/StaticClusteredQueueExample.java +++ b/examples/jms/clustered-static-discovery/src/main/java/org/apache/activemq/jms/example/StaticClusteredQueueExample.java @@ -61,10 +61,10 @@ public class StaticClusteredQueueExample extends ActiveMQExample ic0 = getContext(3); // Step 2. Look-up the JMS Queue object from JNDI - Queue queue = (Queue)ic0.lookup("/queue/exampleQueue"); + Queue queue = (Queue)ic0.lookup("queue/exampleQueue"); // Step 3. Look-up a JMS Connection Factory object from JNDI on server 0 - ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory"); + ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("ConnectionFactory"); //grab an initial connection and wait, in reality you wouldn't do it this way but since we want to ensure an // equal load balance we do this and then create 4 connections round robined diff --git a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server0/activemq-jms.xml index 68d3cce7df..847659f7ad 100644 --- a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,31 +1,8 @@ - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server0/jndi.properties b/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server0/jndi.properties deleted file mode 100644 index e2a9832f8e..0000000000 --- a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server0/jndi.properties +++ /dev/null @@ -1,2 +0,0 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces \ No newline at end of file diff --git a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server1/activemq-jms.xml index 68d3cce7df..847659f7ad 100644 --- a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,31 +1,8 @@ - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server1/jndi.properties b/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server1/jndi.properties deleted file mode 100644 index e2a9832f8e..0000000000 --- a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server1/jndi.properties +++ /dev/null @@ -1,2 +0,0 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces \ No newline at end of file diff --git a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server2/activemq-jms.xml b/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server2/activemq-jms.xml index 60569d262c..e254e36840 100644 --- a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server2/activemq-jms.xml +++ b/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server2/activemq-jms.xml @@ -18,32 +18,8 @@ - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server2/jndi.properties b/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server2/jndi.properties deleted file mode 100644 index dd514181e8..0000000000 --- a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server2/jndi.properties +++ /dev/null @@ -1,17 +0,0 @@ -# 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. - -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces diff --git a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server3/activemq-jms.xml b/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server3/activemq-jms.xml index 60569d262c..e254e36840 100644 --- a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server3/activemq-jms.xml +++ b/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server3/activemq-jms.xml @@ -18,32 +18,8 @@ - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server3/jndi.properties b/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server3/jndi.properties deleted file mode 100644 index e2a9832f8e..0000000000 --- a/examples/jms/clustered-static-discovery/src/main/resources/hornetq/server3/jndi.properties +++ /dev/null @@ -1,2 +0,0 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces \ No newline at end of file diff --git a/examples/jms/clustered-static-oneway/pom.xml b/examples/jms/clustered-static-oneway/pom.xml index 652a01fef5..0722ddf1c6 100644 --- a/examples/jms/clustered-static-oneway/pom.xml +++ b/examples/jms/clustered-static-oneway/pom.xml @@ -71,9 +71,9 @@ org.apache.activemq.jms.example.ClusterStaticOnewayExample - jnp://localhost:1099 - jnp://localhost:1199 - jnp://localhost:1299 + tcp://localhost:5445 + tcp://localhost:5446 + tcp://localhost:5447 @@ -147,11 +147,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/clustered-static-oneway/src/main/java/org/apache/activemq/jms/example/ClusterStaticOnewayExample.java b/examples/jms/clustered-static-oneway/src/main/java/org/apache/activemq/jms/example/ClusterStaticOnewayExample.java index fee4497f32..2eab7aee88 100644 --- a/examples/jms/clustered-static-oneway/src/main/java/org/apache/activemq/jms/example/ClusterStaticOnewayExample.java +++ b/examples/jms/clustered-static-oneway/src/main/java/org/apache/activemq/jms/example/ClusterStaticOnewayExample.java @@ -59,10 +59,10 @@ public class ClusterStaticOnewayExample extends ActiveMQExample ic0 = getContext(0); // Step 2. Look-up the JMS Queue object from JNDI - Queue queue = (Queue)ic0.lookup("/queue/exampleQueue"); + Queue queue = (Queue)ic0.lookup("queue/exampleQueue"); // Step 3. Look-up a JMS Connection Factory object from JNDI on server 0 - ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory"); + ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("ConnectionFactory"); //step 4. grab an initial connection and wait, in reality you wouldn't do it this way but since we want to ensure an // equal load balance we do this and then create 4 connections round robined diff --git a/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server0/activemq-jms.xml index 68d3cce7df..847659f7ad 100644 --- a/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,31 +1,8 @@ - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server0/jndi.properties b/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server0/jndi.properties deleted file mode 100644 index e2a9832f8e..0000000000 --- a/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server0/jndi.properties +++ /dev/null @@ -1,2 +0,0 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces \ No newline at end of file diff --git a/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server1/activemq-jms.xml index 68d3cce7df..847659f7ad 100644 --- a/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,31 +1,8 @@ - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server1/jndi.properties b/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server1/jndi.properties deleted file mode 100644 index e2a9832f8e..0000000000 --- a/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server1/jndi.properties +++ /dev/null @@ -1,2 +0,0 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces \ No newline at end of file diff --git a/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server2/activemq-jms.xml b/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server2/activemq-jms.xml index 60569d262c..e254e36840 100644 --- a/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server2/activemq-jms.xml +++ b/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server2/activemq-jms.xml @@ -18,32 +18,8 @@ - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server2/jndi.properties b/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server2/jndi.properties deleted file mode 100644 index 045c093899..0000000000 --- a/examples/jms/clustered-static-oneway/src/main/resources/hornetq/server2/jndi.properties +++ /dev/null @@ -1,18 +0,0 @@ -# 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. -# - -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces diff --git a/examples/jms/clustered-topic/pom.xml b/examples/jms/clustered-topic/pom.xml index 9c68f4b448..18d9fb54f0 100644 --- a/examples/jms/clustered-topic/pom.xml +++ b/examples/jms/clustered-topic/pom.xml @@ -79,8 +79,8 @@ org.apache.activemq.jms.example.ClusteredTopicExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -145,11 +145,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/clustered-topic/src/main/java/org/apache/activemq/jms/example/ClusteredTopicExample.java b/examples/jms/clustered-topic/src/main/java/org/apache/activemq/jms/example/ClusteredTopicExample.java index e5a602866d..eb5160358f 100644 --- a/examples/jms/clustered-topic/src/main/java/org/apache/activemq/jms/example/ClusteredTopicExample.java +++ b/examples/jms/clustered-topic/src/main/java/org/apache/activemq/jms/example/ClusteredTopicExample.java @@ -57,16 +57,16 @@ public class ClusteredTopicExample extends ActiveMQExample ic0 = getContext(0); // Step 2. Look-up the JMS Topic object from JNDI - Topic topic = (Topic)ic0.lookup("/topic/exampleTopic"); + Topic topic = (Topic)ic0.lookup("topic/exampleTopic"); // Step 3. Look-up a JMS Connection Factory object from JNDI on server 0 - ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory"); + ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("ConnectionFactory"); // Step 4. Get an initial context for looking up JNDI from server 1 ic1 = getContext(1); // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1 - ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory"); + ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("ConnectionFactory"); // Step 6. We create a JMS Connection connection0 which is a connection to server 0 connection0 = cf0.createConnection(); diff --git a/examples/jms/clustered-topic/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/clustered-topic/src/main/resources/hornetq/server0/activemq-jms.xml index 1dd09a682e..ab4841d633 100644 --- a/examples/jms/clustered-topic/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/clustered-topic/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/clustered-topic/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/clustered-topic/src/main/resources/hornetq/server1/activemq-jms.xml index 1dd09a682e..ab4841d633 100644 --- a/examples/jms/clustered-topic/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/clustered-topic/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/colocated-failover-scale-down/pom.xml b/examples/jms/colocated-failover-scale-down/pom.xml index fccdaed077..f128ea7bea 100644 --- a/examples/jms/colocated-failover-scale-down/pom.xml +++ b/examples/jms/colocated-failover-scale-down/pom.xml @@ -71,8 +71,8 @@ org.apache.activemq.jms.example.ColocatedFailoverScaleDownExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -137,11 +137,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/colocated-failover-scale-down/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverScaleDownExample.java b/examples/jms/colocated-failover-scale-down/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverScaleDownExample.java index 73609afdc9..b65279b6ea 100644 --- a/examples/jms/colocated-failover-scale-down/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverScaleDownExample.java +++ b/examples/jms/colocated-failover-scale-down/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverScaleDownExample.java @@ -58,9 +58,9 @@ public class ColocatedFailoverScaleDownExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look up the JMS resources from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); - ConnectionFactory connectionFactory1 = (ConnectionFactory)initialContext1.lookup("/ConnectionFactory"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); + ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); + ConnectionFactory connectionFactory1 = (ConnectionFactory)initialContext1.lookup("ConnectionFactory"); // Step 3. Create a JMS Connections connection = connectionFactory.createConnection(); diff --git a/examples/jms/colocated-failover-scale-down/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/colocated-failover-scale-down/src/main/resources/hornetq/server0/activemq-jms.xml index 2bf8233891..847659f7ad 100644 --- a/examples/jms/colocated-failover-scale-down/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/colocated-failover-scale-down/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,30 +1,8 @@ - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + \ No newline at end of file diff --git a/examples/jms/colocated-failover-scale-down/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/colocated-failover-scale-down/src/main/resources/hornetq/server1/activemq-jms.xml index 2bf8233891..847659f7ad 100644 --- a/examples/jms/colocated-failover-scale-down/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/colocated-failover-scale-down/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,30 +1,8 @@ - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + \ No newline at end of file diff --git a/examples/jms/colocated-failover/pom.xml b/examples/jms/colocated-failover/pom.xml index 4d63b888b6..290ed90669 100644 --- a/examples/jms/colocated-failover/pom.xml +++ b/examples/jms/colocated-failover/pom.xml @@ -71,8 +71,8 @@ org.apache.activemq.jms.example.ColocatedFailoverExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:1099 + tcp://localhost:1199 @@ -137,11 +137,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/colocated-failover/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverExample.java b/examples/jms/colocated-failover/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverExample.java index 533d2481c4..29d57a6371 100644 --- a/examples/jms/colocated-failover/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverExample.java +++ b/examples/jms/colocated-failover/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverExample.java @@ -56,9 +56,9 @@ public class ColocatedFailoverExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look up the JMS resources from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); - ConnectionFactory connectionFactory1 = (ConnectionFactory)initialContext1.lookup("/ConnectionFactory"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); + ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); + ConnectionFactory connectionFactory1 = (ConnectionFactory)initialContext1.lookup("ConnectionFactory"); // Step 3. Create a JMS Connections connection = connectionFactory.createConnection(); diff --git a/examples/jms/colocated-failover/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/colocated-failover/src/main/resources/hornetq/server0/activemq-jms.xml index 2bf8233891..847659f7ad 100644 --- a/examples/jms/colocated-failover/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/colocated-failover/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,30 +1,8 @@ - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + \ No newline at end of file diff --git a/examples/jms/colocated-failover/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/colocated-failover/src/main/resources/hornetq/server1/activemq-jms.xml index 2bf8233891..0a77a3f0a5 100644 --- a/examples/jms/colocated-failover/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/colocated-failover/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,30 +1,7 @@ - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - - + \ No newline at end of file diff --git a/examples/jms/consumer-rate-limit/pom.xml b/examples/jms/consumer-rate-limit/pom.xml index aa15902863..2b955710ee 100644 --- a/examples/jms/consumer-rate-limit/pom.xml +++ b/examples/jms/consumer-rate-limit/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.ConsumerRateLimitExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/consumer-rate-limit/src/main/java/org/apache/activemq/jms/example/ConsumerRateLimitExample.java b/examples/jms/consumer-rate-limit/src/main/java/org/apache/activemq/jms/example/ConsumerRateLimitExample.java index 61fdd77ef1..5bb9da8dbb 100644 --- a/examples/jms/consumer-rate-limit/src/main/java/org/apache/activemq/jms/example/ConsumerRateLimitExample.java +++ b/examples/jms/consumer-rate-limit/src/main/java/org/apache/activemq/jms/example/ConsumerRateLimitExample.java @@ -51,10 +51,10 @@ public class ConsumerRateLimitExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/consumer-rate-limit/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/consumer-rate-limit/src/main/resources/hornetq/server0/activemq-jms.xml index ad3d3e0230..0d5c9537fb 100644 --- a/examples/jms/consumer-rate-limit/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/consumer-rate-limit/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,24 +1,8 @@ - - - - - - - - - - - 10 - - - - - + diff --git a/examples/jms/consumer-rate-limit/src/main/resources/hornetq/server0/client-jndi.properties b/examples/jms/consumer-rate-limit/src/main/resources/hornetq/server0/client-jndi.properties index 080524fbb8..6940f75d77 100644 --- a/examples/jms/consumer-rate-limit/src/main/resources/hornetq/server0/client-jndi.properties +++ b/examples/jms/consumer-rate-limit/src/main/resources/hornetq/server0/client-jndi.properties @@ -1,3 +1,2 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.provider.url=jnp://localhost:1099 -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 \ No newline at end of file diff --git a/examples/jms/dead-letter/pom.xml b/examples/jms/dead-letter/pom.xml index ad0315bcae..6f7ebc896e 100644 --- a/examples/jms/dead-letter/pom.xml +++ b/examples/jms/dead-letter/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.DeadLetterExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/dead-letter/src/main/java/org/apache/activemq/jms/example/DeadLetterExample.java b/examples/jms/dead-letter/src/main/java/org/apache/activemq/jms/example/DeadLetterExample.java index 04c24829ae..17689558d9 100644 --- a/examples/jms/dead-letter/src/main/java/org/apache/activemq/jms/example/DeadLetterExample.java +++ b/examples/jms/dead-letter/src/main/java/org/apache/activemq/jms/example/DeadLetterExample.java @@ -52,10 +52,10 @@ public class DeadLetterExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Connection connection = cf.createConnection(); @@ -108,7 +108,7 @@ public class DeadLetterExample extends ActiveMQExample // We will now consume the message from the dead letter queue // Step 17. Perform a lookup on the dead letter queue - Queue deadLetterQueue = (Queue)initialContext.lookup("/queue/deadLetterQueue"); + Queue deadLetterQueue = (Queue)initialContext.lookup("queue/deadLetterQueue"); // Step 18. Create a JMS Message Consumer for the dead letter queue MessageConsumer deadLetterConsumer = session.createConsumer(deadLetterQueue); diff --git a/examples/jms/dead-letter/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/dead-letter/src/main/resources/hornetq/server0/activemq-jms.xml index e3ad631925..8fa2fbb2de 100644 --- a/examples/jms/dead-letter/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/dead-letter/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,24 +1,11 @@ - - - - - - - - - - - - + - - - + \ No newline at end of file diff --git a/examples/jms/dead-letter/src/main/resources/hornetq/server0/client-jndi.properties b/examples/jms/dead-letter/src/main/resources/hornetq/server0/client-jndi.properties index 080524fbb8..6940f75d77 100644 --- a/examples/jms/dead-letter/src/main/resources/hornetq/server0/client-jndi.properties +++ b/examples/jms/dead-letter/src/main/resources/hornetq/server0/client-jndi.properties @@ -1,3 +1,2 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.provider.url=jnp://localhost:1099 -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 \ No newline at end of file diff --git a/examples/jms/delayed-redelivery/pom.xml b/examples/jms/delayed-redelivery/pom.xml index 17d18c0aed..db25002aa9 100644 --- a/examples/jms/delayed-redelivery/pom.xml +++ b/examples/jms/delayed-redelivery/pom.xml @@ -44,7 +44,7 @@ org.apache.activemq.jms.example.DelayedRedeliveryExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -91,11 +91,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/delayed-redelivery/src/main/java/org/apache/activemq/jms/example/DelayedRedeliveryExample.java b/examples/jms/delayed-redelivery/src/main/java/org/apache/activemq/jms/example/DelayedRedeliveryExample.java index a80c31fc20..4bfc1ca2ec 100644 --- a/examples/jms/delayed-redelivery/src/main/java/org/apache/activemq/jms/example/DelayedRedeliveryExample.java +++ b/examples/jms/delayed-redelivery/src/main/java/org/apache/activemq/jms/example/DelayedRedeliveryExample.java @@ -55,10 +55,10 @@ public class DelayedRedeliveryExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perform a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/delayed-redelivery/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/delayed-redelivery/src/main/resources/hornetq/server0/activemq-jms.xml index e3ad631925..8fa2fbb2de 100644 --- a/examples/jms/delayed-redelivery/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/delayed-redelivery/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,24 +1,11 @@ - - - - - - - - - - - - + - - - + \ No newline at end of file diff --git a/examples/jms/delayed-redelivery/src/main/resources/hornetq/server0/client-jndi.properties b/examples/jms/delayed-redelivery/src/main/resources/hornetq/server0/client-jndi.properties index 080524fbb8..6940f75d77 100644 --- a/examples/jms/delayed-redelivery/src/main/resources/hornetq/server0/client-jndi.properties +++ b/examples/jms/delayed-redelivery/src/main/resources/hornetq/server0/client-jndi.properties @@ -1,3 +1,2 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.provider.url=jnp://localhost:1099 -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 \ No newline at end of file diff --git a/examples/jms/divert/pom.xml b/examples/jms/divert/pom.xml index 011e7c926a..d987365be1 100644 --- a/examples/jms/divert/pom.xml +++ b/examples/jms/divert/pom.xml @@ -64,8 +64,8 @@ org.apache.activemq.jms.example.DivertExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -130,11 +130,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/divert/src/main/java/org/apache/activemq/jms/example/DivertExample.java b/examples/jms/divert/src/main/java/org/apache/activemq/jms/example/DivertExample.java index daa85073c3..94d69ef281 100644 --- a/examples/jms/divert/src/main/java/org/apache/activemq/jms/example/DivertExample.java +++ b/examples/jms/divert/src/main/java/org/apache/activemq/jms/example/DivertExample.java @@ -60,14 +60,14 @@ public class DivertExample extends ActiveMQExample initialContextLondon = getContext(0); // Step 2. Look-up the queue orderQueue on the London server - this is the queue any orders are sent to - Queue orderQueue = (Queue)initialContextLondon.lookup("/queue/orders"); + Queue orderQueue = (Queue)initialContextLondon.lookup("queue/orders"); // Step 3. Look-up the topic priceUpdates on the London server- this is the topic that any price updates are // sent to - Topic priceUpdates = (Topic)initialContextLondon.lookup("/topic/priceUpdates"); + Topic priceUpdates = (Topic)initialContextLondon.lookup("topic/priceUpdates"); // Step 4. Look-up the spy topic on the London server- this is what we will use to snoop on any orders - Topic spyTopic = (Topic)initialContextLondon.lookup("/topic/spyTopic"); + Topic spyTopic = (Topic)initialContextLondon.lookup("topic/spyTopic"); // Step 6. Create an initial context to perform the JNDI lookup on the New York server initialContextNewYork = getContext(1); @@ -79,13 +79,13 @@ public class DivertExample extends ActiveMQExample // them to the address newYorkPriceUpdates on the New York server where they will be distributed to the topic // subscribers on // the New York server - Topic newYorkPriceUpdates = (Topic)initialContextNewYork.lookup("/topic/newYorkPriceUpdates"); + Topic newYorkPriceUpdates = (Topic)initialContextNewYork.lookup("topic/newYorkPriceUpdates"); // Step 8. Perform a lookup on the Connection Factory on the London server - ConnectionFactory cfLondon = (ConnectionFactory)initialContextLondon.lookup("/ConnectionFactory"); + ConnectionFactory cfLondon = (ConnectionFactory)initialContextLondon.lookup("ConnectionFactory"); // Step 9. Perform a lookup on the Connection Factory on the New York server - ConnectionFactory cfNewYork = (ConnectionFactory)initialContextNewYork.lookup("/ConnectionFactory"); + ConnectionFactory cfNewYork = (ConnectionFactory)initialContextNewYork.lookup("ConnectionFactory"); // Step 10. Create a JMS Connection on the London server connectionLondon = cfLondon.createConnection(); diff --git a/examples/jms/divert/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/divert/src/main/resources/hornetq/server0/activemq-jms.xml index 8d78604d5c..d82f40cd9a 100644 --- a/examples/jms/divert/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/divert/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,38 +1,18 @@ - - - - - - - - - - - - - - - + - - - + - - - + - - - + \ No newline at end of file diff --git a/examples/jms/divert/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/divert/src/main/resources/hornetq/server1/activemq-jms.xml index 97c9aab70f..8cb753a451 100644 --- a/examples/jms/divert/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/divert/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,24 +1,11 @@ - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/durable-subscription/pom.xml b/examples/jms/durable-subscription/pom.xml index 61c6f595b6..2149c87cdb 100644 --- a/examples/jms/durable-subscription/pom.xml +++ b/examples/jms/durable-subscription/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.DurableSubscriptionExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/durable-subscription/src/main/java/org/apache/activemq/jms/example/DurableSubscriptionExample.java b/examples/jms/durable-subscription/src/main/java/org/apache/activemq/jms/example/DurableSubscriptionExample.java index c33027ed15..792e82e88b 100644 --- a/examples/jms/durable-subscription/src/main/java/org/apache/activemq/jms/example/DurableSubscriptionExample.java +++ b/examples/jms/durable-subscription/src/main/java/org/apache/activemq/jms/example/DurableSubscriptionExample.java @@ -50,10 +50,10 @@ public class DurableSubscriptionExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look-up the JMS topic - Topic topic = (Topic)initialContext.lookup("/topic/exampleTopic"); + Topic topic = (Topic)initialContext.lookup("topic/exampleTopic"); // Step 3. Look-up the JMS connection factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS connection connection = cf.createConnection(); diff --git a/examples/jms/durable-subscription/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/durable-subscription/src/main/resources/hornetq/server0/activemq-jms.xml index 1dd09a682e..ab4841d633 100644 --- a/examples/jms/durable-subscription/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/durable-subscription/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/durable-subscription/src/main/resources/hornetq/server0/client-jndi.properties b/examples/jms/durable-subscription/src/main/resources/hornetq/server0/client-jndi.properties index 080524fbb8..f68e7f708b 100644 --- a/examples/jms/durable-subscription/src/main/resources/hornetq/server0/client-jndi.properties +++ b/examples/jms/durable-subscription/src/main/resources/hornetq/server0/client-jndi.properties @@ -1,3 +1,2 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.provider.url=jnp://localhost:1099 -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 diff --git a/examples/jms/embedded-simple/pom.xml b/examples/jms/embedded-simple/pom.xml index 251e5a9ccb..1b0130726a 100644 --- a/examples/jms/embedded-simple/pom.xml +++ b/examples/jms/embedded-simple/pom.xml @@ -48,8 +48,8 @@ org.apache.activemq.jms.example.EmbeddedExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5445 @@ -96,11 +96,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/embedded-simple/src/main/java/org/apache/activemq/jms/example/EmbeddedExample.java b/examples/jms/embedded-simple/src/main/java/org/apache/activemq/jms/example/EmbeddedExample.java index 11103ec6c7..e41a025a90 100644 --- a/examples/jms/embedded-simple/src/main/java/org/apache/activemq/jms/example/EmbeddedExample.java +++ b/examples/jms/embedded-simple/src/main/java/org/apache/activemq/jms/example/EmbeddedExample.java @@ -53,7 +53,7 @@ public class EmbeddedExample extends ActiveMQExample System.out.println("Started Embedded JMS Server"); ConnectionFactory cf = (ConnectionFactory)jmsServer.lookup("ConnectionFactory"); - Queue queue = (Queue)jmsServer.lookup("/queue/exampleQueue"); + Queue queue = (Queue)jmsServer.lookup("queue/exampleQueue"); // Step 10. Send and receive a message using JMS API Connection connection = null; diff --git a/examples/jms/embedded-simple/src/main/resources/activemq-jms.xml b/examples/jms/embedded-simple/src/main/resources/activemq-jms.xml index bce97ab150..37589895ef 100644 --- a/examples/jms/embedded-simple/src/main/resources/activemq-jms.xml +++ b/examples/jms/embedded-simple/src/main/resources/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/embedded/pom.xml b/examples/jms/embedded/pom.xml index 98d854c504..c6441f0b9f 100644 --- a/examples/jms/embedded/pom.xml +++ b/examples/jms/embedded/pom.xml @@ -48,8 +48,8 @@ org.apache.activemq.jms.example.EmbeddedExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -100,11 +100,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - diff --git a/examples/jms/embedded/readme.html b/examples/jms/embedded/readme.html index 8964d14b83..195175e130 100644 --- a/examples/jms/embedded/readme.html +++ b/examples/jms/embedded/readme.html @@ -30,36 +30,12 @@
             ActiveMQServer activemqServer = ActiveMQ.newActiveMQServer(configuration);
          
- -
  • Create and start the JNDI server (using JBoss JNDI implementation)
  • -
    -            System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
    -            NamingBeanImpl naming = new NamingBeanImpl();
    -            naming.start();
    -            Main jndiServer = new Main();
    -            jndiServer.setNamingInfo(naming);
    -            jndiServer.setPort(1099);
    -            jndiServer.setBindAddress("localhost");
    -            jndiServer.setRmiPort(1098);
    -            jndiServer.setRmiBindAddress("localhost");         
    -            jndiServer.start();
    -         
  • Create the JMS configuration
  •              JMSConfiguration jmsConfig = new JMSConfigurationImpl();
              
    -
  • Configure context used to bind the JMS resources to JNDI
  • -
    -            Hashtable<String, String> env = new Hashtable<String, String>();
    -            env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
    -            env.put("java.naming.provider.url", "jnp://localhost:1099");
    -            env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
    -            Context context = new InitialContext(env);
    -            jmsConfig.setContext(context);
    -         
    -
  • Configure the JMS ConnectionFactory
  •              TransportConfiguration connectorConfig = new TransportConfiguration(NettyConnectorFactory.class.getName());
    @@ -101,8 +77,7 @@
             
              
  • Stop the JNDI server
  • -            naming.stop();
    -            jndiServer.stop();
    +            naming.stop();
              
    diff --git a/examples/jms/embedded/src/main/java/org/apache/activemq/jms/example/EmbeddedExample.java b/examples/jms/embedded/src/main/java/org/apache/activemq/jms/example/EmbeddedExample.java index 5c22d41095..06fdb14b45 100644 --- a/examples/jms/embedded/src/main/java/org/apache/activemq/jms/example/EmbeddedExample.java +++ b/examples/jms/embedded/src/main/java/org/apache/activemq/jms/example/EmbeddedExample.java @@ -85,7 +85,7 @@ public final class EmbeddedExample extends ActiveMQExample jmsConfig.getConnectionFactoryConfigurations().add(cfConfig); // Step 4. Configure the JMS Queue - JMSQueueConfiguration queueConfig = new JMSQueueConfigurationImpl("queue1", null, false, "/queue/queue1"); + JMSQueueConfiguration queueConfig = new JMSQueueConfigurationImpl("queue1", null, false, "queue/queue1"); jmsConfig.getQueueConfigurations().add(queueConfig); // Step 5. Start the JMS Server using the ActiveMQ core server and the JMS configuration @@ -97,7 +97,7 @@ public final class EmbeddedExample extends ActiveMQExample // Step 6. Lookup JMS resources defined in the configuration ConnectionFactory cf = (ConnectionFactory)jmsServer.lookup("/cf"); - Queue queue = (Queue)jmsServer.lookup("/queue/queue1"); + Queue queue = (Queue)jmsServer.lookup("queue/queue1"); // Step 7. Send and receive a message using JMS API Connection connection = null; diff --git a/examples/jms/expiry/pom.xml b/examples/jms/expiry/pom.xml index ac0563ce40..70fc1add13 100644 --- a/examples/jms/expiry/pom.xml +++ b/examples/jms/expiry/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.ExpiryExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/expiry/src/main/java/org/apache/activemq/jms/example/ExpiryExample.java b/examples/jms/expiry/src/main/java/org/apache/activemq/jms/example/ExpiryExample.java index c086593c7c..a74467c76e 100644 --- a/examples/jms/expiry/src/main/java/org/apache/activemq/jms/example/ExpiryExample.java +++ b/examples/jms/expiry/src/main/java/org/apache/activemq/jms/example/ExpiryExample.java @@ -51,10 +51,10 @@ public class ExpiryExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Connection connection = cf.createConnection(); @@ -91,7 +91,7 @@ public class ExpiryExample extends ActiveMQExample System.out.println("Received message from " + queue.getQueueName() + ": " + messageReceived); // Step 14. Perfom a lookup on the expiry queue - Queue expiryQueue = (Queue)initialContext.lookup("/queue/expiryQueue"); + Queue expiryQueue = (Queue)initialContext.lookup("queue/expiryQueue"); // Step 15. Create a JMS Message Consumer for the expiry queue MessageConsumer expiryConsumer = session.createConsumer(expiryQueue); diff --git a/examples/jms/expiry/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/expiry/src/main/resources/hornetq/server0/activemq-jms.xml index 96ae117d88..d41da707db 100644 --- a/examples/jms/expiry/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/expiry/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,24 +1,11 @@ - - - - - - - - - - - - + - - - + \ No newline at end of file diff --git a/examples/jms/ha-policy-autobackup/pom.xml b/examples/jms/ha-policy-autobackup/pom.xml index 2b7fe802fe..86f5d4724a 100644 --- a/examples/jms/ha-policy-autobackup/pom.xml +++ b/examples/jms/ha-policy-autobackup/pom.xml @@ -71,8 +71,8 @@ org.apache.activemq.jms.example.HAPolicyAutoBackupExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -137,11 +137,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/jms/example/HAPolicyAutoBackupExample.java b/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/jms/example/HAPolicyAutoBackupExample.java index d3860d487f..3eebb40ba7 100644 --- a/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/jms/example/HAPolicyAutoBackupExample.java +++ b/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/jms/example/HAPolicyAutoBackupExample.java @@ -67,11 +67,11 @@ public class HAPolicyAutoBackupExample extends ActiveMQExample ic1 = getContext(1); // Step 2. Look-up the JMS Queue object from JNDI - Queue queue = (Queue) ic0.lookup("/queue/exampleQueue"); + Queue queue = (Queue) ic0.lookup("queue/exampleQueue"); // Step 3. Look-up a JMS Connection Factory object from JNDI on server 0 and 1 - ConnectionFactory cf0 = (ConnectionFactory) ic0.lookup("/ConnectionFactory"); - ConnectionFactory cf1 = (ConnectionFactory) ic1.lookup("/ConnectionFactory"); + ConnectionFactory cf0 = (ConnectionFactory) ic0.lookup("ConnectionFactory"); + ConnectionFactory cf1 = (ConnectionFactory) ic1.lookup("ConnectionFactory"); // Step 6. We create JMS Connections to server 0 and 1 connection0 = cf0.createConnection(); diff --git a/examples/jms/ha-policy-autobackup/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/ha-policy-autobackup/src/main/resources/hornetq/server0/activemq-jms.xml index 28e738b9bf..847659f7ad 100644 --- a/examples/jms/ha-policy-autobackup/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/ha-policy-autobackup/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,30 +1,8 @@ - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + \ No newline at end of file diff --git a/examples/jms/http-transport/pom.xml b/examples/jms/http-transport/pom.xml index f136dbb3fd..24a5f541a6 100644 --- a/examples/jms/http-transport/pom.xml +++ b/examples/jms/http-transport/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.HttpTransportExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/http-transport/src/main/java/org/apache/activemq/jms/example/HttpTransportExample.java b/examples/jms/http-transport/src/main/java/org/apache/activemq/jms/example/HttpTransportExample.java index 46c5c94530..efba974ca6 100644 --- a/examples/jms/http-transport/src/main/java/org/apache/activemq/jms/example/HttpTransportExample.java +++ b/examples/jms/http-transport/src/main/java/org/apache/activemq/jms/example/HttpTransportExample.java @@ -50,10 +50,10 @@ public class HttpTransportExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/http-transport/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/http-transport/src/main/resources/hornetq/server0/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/http-transport/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/http-transport/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/instantiate-connection-factory/pom.xml b/examples/jms/instantiate-connection-factory/pom.xml index a5fce8d7de..4b60d79f1a 100644 --- a/examples/jms/instantiate-connection-factory/pom.xml +++ b/examples/jms/instantiate-connection-factory/pom.xml @@ -62,7 +62,7 @@ org.apache.activemq.jms.example.InstantiateConnectionFactoryExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -109,11 +109,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/interceptor/pom.xml b/examples/jms/interceptor/pom.xml index 9e7b4395bc..34dff8ce6f 100644 --- a/examples/jms/interceptor/pom.xml +++ b/examples/jms/interceptor/pom.xml @@ -57,7 +57,7 @@ org.apache.activemq.jms.example.InterceptorExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -104,11 +104,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/interceptor/src/main/java/org/apache/activemq/jms/example/InterceptorExample.java b/examples/jms/interceptor/src/main/java/org/apache/activemq/jms/example/InterceptorExample.java index 325b5365a4..e2b2b40b0e 100644 --- a/examples/jms/interceptor/src/main/java/org/apache/activemq/jms/example/InterceptorExample.java +++ b/examples/jms/interceptor/src/main/java/org/apache/activemq/jms/example/InterceptorExample.java @@ -50,10 +50,10 @@ public class InterceptorExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perform a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/interceptor/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/interceptor/src/main/resources/hornetq/server0/activemq-jms.xml index 3058fc865c..0d5c9537fb 100644 --- a/examples/jms/interceptor/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/interceptor/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/jaas/pom.xml b/examples/jms/jaas/pom.xml index f3bcb557d9..1ce345b7eb 100644 --- a/examples/jms/jaas/pom.xml +++ b/examples/jms/jaas/pom.xml @@ -75,7 +75,7 @@ org.apache.activemq.jms.example.JAASExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -122,11 +122,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/jaas/src/main/java/org/apache/activemq/jms/example/JAASExample.java b/examples/jms/jaas/src/main/java/org/apache/activemq/jms/example/JAASExample.java index 80307ac672..7813924086 100644 --- a/examples/jms/jaas/src/main/java/org/apache/activemq/jms/example/JAASExample.java +++ b/examples/jms/jaas/src/main/java/org/apache/activemq/jms/example/JAASExample.java @@ -51,10 +51,10 @@ public class JAASExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Connection with user "jboss" and password "redhat" connection = cf.createConnection("jboss", "redhat"); diff --git a/examples/jms/jaas/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/jaas/src/main/resources/hornetq/server0/activemq-jms.xml index 3058fc865c..0d5c9537fb 100644 --- a/examples/jms/jaas/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/jaas/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/jms-auto-closeable/pom.xml b/examples/jms/jms-auto-closeable/pom.xml index 8468aa4fca..d0c49da6f7 100644 --- a/examples/jms/jms-auto-closeable/pom.xml +++ b/examples/jms/jms-auto-closeable/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.JMSAutoCloseableExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/jms-auto-closeable/src/main/java/org/apache/activemq/jms/example/JMSAutoCloseableExample.java b/examples/jms/jms-auto-closeable/src/main/java/org/apache/activemq/jms/example/JMSAutoCloseableExample.java index fa58f45db9..d83277103d 100644 --- a/examples/jms/jms-auto-closeable/src/main/java/org/apache/activemq/jms/example/JMSAutoCloseableExample.java +++ b/examples/jms/jms-auto-closeable/src/main/java/org/apache/activemq/jms/example/JMSAutoCloseableExample.java @@ -43,10 +43,10 @@ public class JMSAutoCloseableExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Context using the try-with-resources statement try diff --git a/examples/jms/jms-auto-closeable/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/jms-auto-closeable/src/main/resources/hornetq/server0/activemq-jms.xml index 3058fc865c..0d5c9537fb 100644 --- a/examples/jms/jms-auto-closeable/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/jms-auto-closeable/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/jms-bridge/pom.xml b/examples/jms/jms-bridge/pom.xml index fec058c249..20231fc2dc 100644 --- a/examples/jms/jms-bridge/pom.xml +++ b/examples/jms/jms-bridge/pom.xml @@ -77,8 +77,8 @@ org.apache.activemq.jms.example.JMSBridgeExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5455 @@ -143,11 +143,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/jms-bridge/readme.html b/examples/jms/jms-bridge/readme.html index 6a5959b8fe..827d173282 100644 --- a/examples/jms/jms-bridge/readme.html +++ b/examples/jms/jms-bridge/readme.html @@ -11,8 +11,8 @@

    The example will use two ActiveMQ servers:

      -
    • Server #0 – the Source server. It will be configured with a JMS Topic bound to JNDI under /source/topic -
    • Server #1 – the Target server. It will be configured with a JMS Queue bound to JNDI under /target/queue
      +
    • Server #0 – the Source server. It will be configured with a JMS Topic bound to JNDI under source/topic +
    • Server #1 – the Target server. It will be configured with a JMS Queue bound to JNDI under target/queue

    Both ActiveMQ server will run their own JNDI server used by the JMS Bridge and the JMS Client to lookup JMS resources (ConnectionFactory and Destination).

    @@ -102,10 +102,10 @@
  • We then create a JMS Bridge and start it, Note, the Bridge needs a transaction manager, in this instance we will use the JBoss TM
  •              JMSBridge jmsBridge = new JMSBridgeImpl(
    -               new JNDIConnectionFactoryFactory(sourceJndiParams, "/source/ConnectionFactory"),
    -               new JNDIConnectionFactoryFactory(targetJndiParams, "/target/ConnectionFactory"),
    -               new JNDIDestinationFactory(sourceJndiParams, "/source/topic"),
    -               new JNDIDestinationFactory(targetJndiParams, "/target/queue"),
    +               new JNDIConnectionFactoryFactory(sourceJndiParams, "source/ConnectionFactory"),
    +               new JNDIConnectionFactoryFactory(targetJndiParams, "target/ConnectionFactory"),
    +               new JNDIDestinationFactory(sourceJndiParams, "source/topic"),
    +               new JNDIDestinationFactory(targetJndiParams, "target/queue"),
                    null,
                    null,
                    null,
    @@ -125,8 +125,8 @@
             
  • We look up the JMS resources from the Source server
  • -           ConnectionFactory sourceConnectionFactory = (ConnectionFactory)sourceContext.lookup("/source/ConnectionFactory");
    -           Topic sourceTopic = (Topic)sourceContext.lookup("/source/topic");
    +           ConnectionFactory sourceConnectionFactory = (ConnectionFactory)sourceContext.lookup("source/ConnectionFactory");
    +           Topic sourceTopic = (Topic)sourceContext.lookup("source/topic");
             
  • We create JMS objects to send a message to the source destination
  • @@ -153,8 +153,8 @@
  • We look up the JMS resources from the target server
  • -           ConnectionFactory targetConnectionFactory = (ConnectionFactory)targetContext.lookup("/target/ConnectionFactory");
    -           Queue targetQueue = (Queue)targetContext.lookup("/target/queue");
    +           ConnectionFactory targetConnectionFactory = (ConnectionFactory)targetContext.lookup("target/ConnectionFactory");
    +           Queue targetQueue = (Queue)targetContext.lookup("target/queue");
             
  • We create JMS objects to receive a message from the target destination
  • diff --git a/examples/jms/jms-bridge/src/main/java/org/apache/activemq/jms/example/JMSBridgeExample.java b/examples/jms/jms-bridge/src/main/java/org/apache/activemq/jms/example/JMSBridgeExample.java index 690deaf897..01262517ca 100644 --- a/examples/jms/jms-bridge/src/main/java/org/apache/activemq/jms/example/JMSBridgeExample.java +++ b/examples/jms/jms-bridge/src/main/java/org/apache/activemq/jms/example/JMSBridgeExample.java @@ -66,10 +66,10 @@ public class JMSBridgeExample // Step 2. Create and start a JMS Bridge // Note, the Bridge needs a transaction manager, in this instance we will use the JBoss TM JMSBridge jmsBridge = new JMSBridgeImpl( - new JNDIConnectionFactoryFactory(sourceJndiParams, "/source/ConnectionFactory"), - new JNDIConnectionFactoryFactory(targetJndiParams, "/target/ConnectionFactory"), - new JNDIDestinationFactory(sourceJndiParams, "/source/topic"), - new JNDIDestinationFactory(targetJndiParams, "/target/queue"), + new JNDIConnectionFactoryFactory(sourceJndiParams, "source/ConnectionFactory"), + new JNDIConnectionFactoryFactory(targetJndiParams, "target/ConnectionFactory"), + new JNDIDestinationFactory(sourceJndiParams, "source/topic"), + new JNDIDestinationFactory(targetJndiParams, "target/queue"), null, null, null, @@ -111,8 +111,8 @@ public class JMSBridgeExample sourceConnection.close(); // Step 7. Lookup the *target* JMS resources - ConnectionFactory targetConnectionFactory = (ConnectionFactory)targetContext.lookup("/client/ConnectionFactory"); - Queue targetQueue = (Queue)targetContext.lookup("/target/queue"); + ConnectionFactory targetConnectionFactory = (ConnectionFactory)targetContext.lookup("client/ConnectionFactory"); + Queue targetQueue = (Queue)targetContext.lookup("target/queue"); // Step 8. Create a connection, a session and a message consumer for the *target* queue targetConnection = targetConnectionFactory.createConnection(); @@ -168,8 +168,7 @@ public class JMSBridgeExample { Hashtable jndiProps = new Hashtable(); jndiProps.put("java.naming.provider.url", server); - jndiProps.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); - jndiProps.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); + jndiProps.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); return jndiProps; } } diff --git a/examples/jms/jms-bridge/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/jms-bridge/src/main/resources/hornetq/server0/activemq-jms.xml index c9beb0e816..e2bb478e18 100644 --- a/examples/jms/jms-bridge/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/jms-bridge/src/main/resources/hornetq/server0/activemq-jms.xml @@ -2,26 +2,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd"> - - true - - - - - - - + - - - - - - - - - - - -
    \ No newline at end of file diff --git a/examples/jms/jms-bridge/src/main/resources/hornetq/server0/jndi.properties b/examples/jms/jms-bridge/src/main/resources/hornetq/server0/jndi.properties deleted file mode 100644 index 66bc507470..0000000000 --- a/examples/jms/jms-bridge/src/main/resources/hornetq/server0/jndi.properties +++ /dev/null @@ -1,2 +0,0 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces diff --git a/examples/jms/jms-bridge/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/jms-bridge/src/main/resources/hornetq/server1/activemq-jms.xml index d496c12dee..0f8993917d 100644 --- a/examples/jms/jms-bridge/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/jms-bridge/src/main/resources/hornetq/server1/activemq-jms.xml @@ -2,26 +2,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd"> - - true - - - - - - - + - - - - - - - - - - - -
    \ No newline at end of file diff --git a/examples/jms/jms-bridge/src/main/resources/hornetq/server1/jndi.properties b/examples/jms/jms-bridge/src/main/resources/hornetq/server1/jndi.properties deleted file mode 100644 index 66bc507470..0000000000 --- a/examples/jms/jms-bridge/src/main/resources/hornetq/server1/jndi.properties +++ /dev/null @@ -1,2 +0,0 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces diff --git a/examples/jms/jms-completion-listener/pom.xml b/examples/jms/jms-completion-listener/pom.xml index 302d535708..c7909ab498 100644 --- a/examples/jms/jms-completion-listener/pom.xml +++ b/examples/jms/jms-completion-listener/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.JMSCompletionListenerExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/jms-completion-listener/src/main/java/org/apache/activemq/jms/example/JMSCompletionListenerExample.java b/examples/jms/jms-completion-listener/src/main/java/org/apache/activemq/jms/example/JMSCompletionListenerExample.java index 7be10accb3..fdb66fe198 100644 --- a/examples/jms/jms-completion-listener/src/main/java/org/apache/activemq/jms/example/JMSCompletionListenerExample.java +++ b/examples/jms/jms-completion-listener/src/main/java/org/apache/activemq/jms/example/JMSCompletionListenerExample.java @@ -52,10 +52,10 @@ public class JMSCompletionListenerExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Context jmsContext = cf.createContext(); diff --git a/examples/jms/jms-completion-listener/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/jms-completion-listener/src/main/resources/hornetq/server0/activemq-jms.xml index 3058fc865c..0d5c9537fb 100644 --- a/examples/jms/jms-completion-listener/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/jms-completion-listener/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/jms-context/pom.xml b/examples/jms/jms-context/pom.xml index e2737e5ac5..8371058240 100644 --- a/examples/jms/jms-context/pom.xml +++ b/examples/jms/jms-context/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.JMSContextExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/jms-context/src/main/java/org/apache/activemq/jms/example/JMSContextExample.java b/examples/jms/jms-context/src/main/java/org/apache/activemq/jms/example/JMSContextExample.java index 16f7d42c3f..9a78e7c400 100644 --- a/examples/jms/jms-context/src/main/java/org/apache/activemq/jms/example/JMSContextExample.java +++ b/examples/jms/jms-context/src/main/java/org/apache/activemq/jms/example/JMSContextExample.java @@ -47,10 +47,10 @@ public class JMSContextExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Context jmsContext = cf.createContext(); diff --git a/examples/jms/jms-shared-consumer/pom.xml b/examples/jms/jms-shared-consumer/pom.xml index 7c2bd384f7..c59597abed 100644 --- a/examples/jms/jms-shared-consumer/pom.xml +++ b/examples/jms/jms-shared-consumer/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.JMSSharedConsumerExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/jms-shared-consumer/src/main/java/org/apache/activemq/jms/example/JMSSharedConsumerExample.java b/examples/jms/jms-shared-consumer/src/main/java/org/apache/activemq/jms/example/JMSSharedConsumerExample.java index 524d8af7fa..70c8ec5b38 100644 --- a/examples/jms/jms-shared-consumer/src/main/java/org/apache/activemq/jms/example/JMSSharedConsumerExample.java +++ b/examples/jms/jms-shared-consumer/src/main/java/org/apache/activemq/jms/example/JMSSharedConsumerExample.java @@ -55,10 +55,10 @@ public class JMSSharedConsumerExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Topic topic = (Topic) initialContext.lookup("/topic/exampleTopic"); + Topic topic = (Topic) initialContext.lookup("topic/exampleTopic"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Context jmsContext = cf.createContext(); diff --git a/examples/jms/jms-shared-consumer/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/jms-shared-consumer/src/main/resources/hornetq/server0/activemq-jms.xml index 8c54278c37..a053116b78 100644 --- a/examples/jms/jms-shared-consumer/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/jms-shared-consumer/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/jmx/pom.xml b/examples/jms/jmx/pom.xml index ede344e71d..88d0ae683e 100644 --- a/examples/jms/jmx/pom.xml +++ b/examples/jms/jmx/pom.xml @@ -80,7 +80,7 @@ org.apache.activemq.jms.example.JMXExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -127,11 +127,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/jmx/src/main/java/org/apache/activemq/jms/example/JMXExample.java b/examples/jms/jmx/src/main/java/org/apache/activemq/jms/example/JMXExample.java index 17a24b4cce..af7e21f88e 100644 --- a/examples/jms/jmx/src/main/java/org/apache/activemq/jms/example/JMXExample.java +++ b/examples/jms/jmx/src/main/java/org/apache/activemq/jms/example/JMXExample.java @@ -63,10 +63,10 @@ public class JMXExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - QueueConnectionFactory cf = (QueueConnectionFactory)initialContext.lookup("/ConnectionFactory"); + QueueConnectionFactory cf = (QueueConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Connection connection = cf.createQueueConnection(); diff --git a/examples/jms/jmx/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/jmx/src/main/resources/hornetq/server0/activemq-jms.xml index 2fa9178b8e..b53cafef62 100644 --- a/examples/jms/jmx/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/jmx/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,9 @@ - - - - - - - - - - - + diff --git a/examples/jms/large-message/pom.xml b/examples/jms/large-message/pom.xml index b1db82f291..312ca1ae33 100644 --- a/examples/jms/large-message/pom.xml +++ b/examples/jms/large-message/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.LargeMessageExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -105,11 +105,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/large-message/src/main/java/org/apache/activemq/jms/example/LargeMessageExample.java b/examples/jms/large-message/src/main/java/org/apache/activemq/jms/example/LargeMessageExample.java index 9d3cddc5df..7ffc7b913d 100644 --- a/examples/jms/large-message/src/main/java/org/apache/activemq/jms/example/LargeMessageExample.java +++ b/examples/jms/large-message/src/main/java/org/apache/activemq/jms/example/LargeMessageExample.java @@ -70,12 +70,12 @@ public class LargeMessageExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory. This ConnectionFactory has a special attribute set on // it. // Messages with more than 10K are considered large - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create the JMS objects connection = cf.createConnection(); @@ -139,9 +139,9 @@ public class LargeMessageExample extends ActiveMQExample initialContext = getContext(0); - queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + queue = (Queue)initialContext.lookup("queue/exampleQueue"); - cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); connection = cf.createConnection(); diff --git a/examples/jms/large-message/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/large-message/src/main/resources/hornetq/server0/activemq-jms.xml index cfd7043f9c..0d5c9537fb 100644 --- a/examples/jms/large-message/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/large-message/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,20 +1,8 @@ - - - - - - 10240 - - - - - - - + diff --git a/examples/jms/last-value-queue/pom.xml b/examples/jms/last-value-queue/pom.xml index b138e82afa..bfefd5f431 100644 --- a/examples/jms/last-value-queue/pom.xml +++ b/examples/jms/last-value-queue/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.LastValueQueueExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/last-value-queue/src/main/java/org/apache/activemq/jms/example/LastValueQueueExample.java b/examples/jms/last-value-queue/src/main/java/org/apache/activemq/jms/example/LastValueQueueExample.java index 73e2ff2fe3..d62ea0b671 100644 --- a/examples/jms/last-value-queue/src/main/java/org/apache/activemq/jms/example/LastValueQueueExample.java +++ b/examples/jms/last-value-queue/src/main/java/org/apache/activemq/jms/example/LastValueQueueExample.java @@ -55,10 +55,10 @@ public class LastValueQueueExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/lastValueQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Connection, session and producer on the queue connection = cf.createConnection(); diff --git a/examples/jms/last-value-queue/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/last-value-queue/src/main/resources/hornetq/server0/activemq-jms.xml index ad731a8b38..847659f7ad 100644 --- a/examples/jms/last-value-queue/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/last-value-queue/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,18 +1,8 @@ - - - - - - - - - - - - + + \ No newline at end of file diff --git a/examples/jms/management-notifications/pom.xml b/examples/jms/management-notifications/pom.xml index 605b4ebde8..4afe1d4fff 100644 --- a/examples/jms/management-notifications/pom.xml +++ b/examples/jms/management-notifications/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.ManagementNotificationExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/management-notifications/src/main/java/org/apache/activemq/jms/example/ManagementNotificationExample.java b/examples/jms/management-notifications/src/main/java/org/apache/activemq/jms/example/ManagementNotificationExample.java index f33decd27b..b98f8255d0 100644 --- a/examples/jms/management-notifications/src/main/java/org/apache/activemq/jms/example/ManagementNotificationExample.java +++ b/examples/jms/management-notifications/src/main/java/org/apache/activemq/jms/example/ManagementNotificationExample.java @@ -55,10 +55,10 @@ public class ManagementNotificationExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perform a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS connection, a session and a producer for the queue connection = cf.createConnection(); @@ -66,7 +66,7 @@ public class ManagementNotificationExample extends ActiveMQExample MessageProducer producer = session.createProducer(queue); // Step 5. Perform a lookup on the notifications topic - Topic notificationsTopic = (Topic)initialContext.lookup("/topic/notificationsTopic"); + Topic notificationsTopic = (Topic)initialContext.lookup("topic/notificationsTopic"); // Step 6. Create a JMS message consumer for the notification queue and set its message listener // It will display all the properties of the JMS Message diff --git a/examples/jms/management-notifications/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/management-notifications/src/main/resources/hornetq/server0/activemq-jms.xml index 7b997ee108..65e5a5c3eb 100644 --- a/examples/jms/management-notifications/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/management-notifications/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,23 +1,11 @@ - - - - - - - - - - - - + - - - + + \ No newline at end of file diff --git a/examples/jms/management/pom.xml b/examples/jms/management/pom.xml index 41192c6dca..8fecd6f9f6 100644 --- a/examples/jms/management/pom.xml +++ b/examples/jms/management/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.ManagementExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/management/src/main/java/org/apache/activemq/jms/example/ManagementExample.java b/examples/jms/management/src/main/java/org/apache/activemq/jms/example/ManagementExample.java index e7af331471..1ab1ac49ad 100644 --- a/examples/jms/management/src/main/java/org/apache/activemq/jms/example/ManagementExample.java +++ b/examples/jms/management/src/main/java/org/apache/activemq/jms/example/ManagementExample.java @@ -55,10 +55,10 @@ public class ManagementExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - QueueConnectionFactory cf = (QueueConnectionFactory)initialContext.lookup("/ConnectionFactory"); + QueueConnectionFactory cf = (QueueConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Connection connection = cf.createQueueConnection(); diff --git a/examples/jms/management/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/management/src/main/resources/hornetq/server0/activemq-jms.xml index 0a8701dc92..0d5c9537fb 100644 --- a/examples/jms/management/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/management/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,18 +1,8 @@ - - - - - - - - - - - - + + diff --git a/examples/jms/message-counters/pom.xml b/examples/jms/message-counters/pom.xml index 84de40b27f..2bca2d4cfc 100644 --- a/examples/jms/message-counters/pom.xml +++ b/examples/jms/message-counters/pom.xml @@ -75,7 +75,7 @@ org.apache.activemq.jms.example.MessageCounterExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -122,11 +122,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/message-counters/src/main/java/org/apache/activemq/jms/example/MessageCounterExample.java b/examples/jms/message-counters/src/main/java/org/apache/activemq/jms/example/MessageCounterExample.java index b3747e876f..a1b697a7e6 100644 --- a/examples/jms/message-counters/src/main/java/org/apache/activemq/jms/example/MessageCounterExample.java +++ b/examples/jms/message-counters/src/main/java/org/apache/activemq/jms/example/MessageCounterExample.java @@ -65,10 +65,10 @@ public class MessageCounterExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - QueueConnectionFactory cf = (QueueConnectionFactory)initialContext.lookup("/ConnectionFactory"); + QueueConnectionFactory cf = (QueueConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Connection, session and a producer for the queue connection = cf.createQueueConnection(); diff --git a/examples/jms/message-counters/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/message-counters/src/main/resources/hornetq/server0/activemq-jms.xml index 5814b76a48..44be37f044 100644 --- a/examples/jms/message-counters/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/message-counters/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,24 +1,11 @@ - - - - - - - - - - - - + - - - + diff --git a/examples/jms/message-group/pom.xml b/examples/jms/message-group/pom.xml index 2cfaa1516a..69571d9b5c 100644 --- a/examples/jms/message-group/pom.xml +++ b/examples/jms/message-group/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.MessageGroupExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/message-group/src/main/java/org/apache/activemq/jms/example/MessageGroupExample.java b/examples/jms/message-group/src/main/java/org/apache/activemq/jms/example/MessageGroupExample.java index 27e8b045d1..1a2cf49f06 100644 --- a/examples/jms/message-group/src/main/java/org/apache/activemq/jms/example/MessageGroupExample.java +++ b/examples/jms/message-group/src/main/java/org/apache/activemq/jms/example/MessageGroupExample.java @@ -60,10 +60,10 @@ public class MessageGroupExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perform a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/message-group/src/main/resources/hornetq/server0/hornetq-jms.xml b/examples/jms/message-group/src/main/resources/hornetq/server0/hornetq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/message-group/src/main/resources/hornetq/server0/hornetq-jms.xml +++ b/examples/jms/message-group/src/main/resources/hornetq/server0/hornetq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/message-group2/pom.xml b/examples/jms/message-group2/pom.xml index 2e0f9838b1..866e9844c7 100644 --- a/examples/jms/message-group2/pom.xml +++ b/examples/jms/message-group2/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.MessageGroup2Example - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/message-group2/src/main/java/org/apache/activemq/jms/example/MessageGroup2Example.java b/examples/jms/message-group2/src/main/java/org/apache/activemq/jms/example/MessageGroup2Example.java index 9f98f8acb3..ce462383e1 100644 --- a/examples/jms/message-group2/src/main/java/org/apache/activemq/jms/example/MessageGroup2Example.java +++ b/examples/jms/message-group2/src/main/java/org/apache/activemq/jms/example/MessageGroup2Example.java @@ -59,10 +59,10 @@ public class MessageGroup2Example extends ActiveMQExample initialContext = getContext(0); //Step 2. Perform a lookup on the queue - Queue queue = (Queue) initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue) initialContext.lookup("queue/exampleQueue"); //Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory"); //Step 4. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/message-group2/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/message-group2/src/main/resources/hornetq/server0/activemq-jms.xml index ec6c3d950d..847659f7ad 100644 --- a/examples/jms/message-group2/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/message-group2/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,20 +1,8 @@ - - - - - - - - - Group-0 - - - - + \ No newline at end of file diff --git a/examples/jms/message-priority/pom.xml b/examples/jms/message-priority/pom.xml index db6c2913b8..631f6bd81e 100644 --- a/examples/jms/message-priority/pom.xml +++ b/examples/jms/message-priority/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.MessagePriorityExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/message-priority/src/main/java/org/apache/activemq/jms/example/MessagePriorityExample.java b/examples/jms/message-priority/src/main/java/org/apache/activemq/jms/example/MessagePriorityExample.java index 6a2931eed6..e094b726c5 100644 --- a/examples/jms/message-priority/src/main/java/org/apache/activemq/jms/example/MessagePriorityExample.java +++ b/examples/jms/message-priority/src/main/java/org/apache/activemq/jms/example/MessagePriorityExample.java @@ -60,10 +60,10 @@ public class MessagePriorityExample extends ActiveMQExample initialContext = getContext(0); // Step 2. look-up the JMS queue object from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. look-up the JMS connection factory object from JNDI - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/message-priority/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/message-priority/src/main/resources/hornetq/server0/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/message-priority/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/message-priority/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/multiple-failover-failback/pom.xml b/examples/jms/multiple-failover-failback/pom.xml index b9827f6035..8264323419 100644 --- a/examples/jms/multiple-failover-failback/pom.xml +++ b/examples/jms/multiple-failover-failback/pom.xml @@ -101,9 +101,9 @@ org.apache.activemq.jms.example.MultipleFailoverFailbackExample - jnp://localhost:1099 - jnp://localhost:1199 - jnp://localhost:1299 + tcp://localhost:5445 + tcp://localhost:5446 + tcp://localhost:5447 @@ -177,11 +177,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/multiple-failover-failback/src/main/java/org/apache/activemq/jms/example/MultipleFailoverFailbackExample.java b/examples/jms/multiple-failover-failback/src/main/java/org/apache/activemq/jms/example/MultipleFailoverFailbackExample.java index 9cf1f9f0be..b6af378fc6 100644 --- a/examples/jms/multiple-failover-failback/src/main/java/org/apache/activemq/jms/example/MultipleFailoverFailbackExample.java +++ b/examples/jms/multiple-failover-failback/src/main/java/org/apache/activemq/jms/example/MultipleFailoverFailbackExample.java @@ -55,8 +55,8 @@ public class MultipleFailoverFailbackExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look up the JMS resources from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); + ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 3. Create a JMS Connection connection = connectionFactory.createConnection(); diff --git a/examples/jms/multiple-failover-failback/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/multiple-failover-failback/src/main/resources/hornetq/server0/activemq-jms.xml index 889b59d885..0d5c9537fb 100644 --- a/examples/jms/multiple-failover-failback/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/multiple-failover-failback/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,33 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - - + diff --git a/examples/jms/multiple-failover-failback/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/multiple-failover-failback/src/main/resources/hornetq/server1/activemq-jms.xml index c3b039357d..0d5c9537fb 100644 --- a/examples/jms/multiple-failover-failback/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/multiple-failover-failback/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,32 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/multiple-failover-failback/src/main/resources/hornetq/server2/activemq-jms.xml b/examples/jms/multiple-failover-failback/src/main/resources/hornetq/server2/activemq-jms.xml index 41d711bd71..0d5c9537fb 100644 --- a/examples/jms/multiple-failover-failback/src/main/resources/hornetq/server2/activemq-jms.xml +++ b/examples/jms/multiple-failover-failback/src/main/resources/hornetq/server2/activemq-jms.xml @@ -1,32 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/multiple-failover/pom.xml b/examples/jms/multiple-failover/pom.xml index e8c0744e98..844f22c3c6 100644 --- a/examples/jms/multiple-failover/pom.xml +++ b/examples/jms/multiple-failover/pom.xml @@ -101,9 +101,9 @@ org.apache.activemq.jms.example.MultipleFailoverExample - jnp://localhost:1099 - jnp://localhost:1199 - jnp://localhost:1299 + tcp://localhost:5445 + tcp://localhost:5446 + tcp://localhost:5447 @@ -177,11 +177,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/multiple-failover/src/main/java/org/apache/activemq/jms/example/MultipleFailoverExample.java b/examples/jms/multiple-failover/src/main/java/org/apache/activemq/jms/example/MultipleFailoverExample.java index 41849c932a..8f430a34cb 100644 --- a/examples/jms/multiple-failover/src/main/java/org/apache/activemq/jms/example/MultipleFailoverExample.java +++ b/examples/jms/multiple-failover/src/main/java/org/apache/activemq/jms/example/MultipleFailoverExample.java @@ -55,8 +55,8 @@ public class MultipleFailoverExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look up the JMS resources from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); + ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 3. Create a JMS Connection connection = connectionFactory.createConnection(); diff --git a/examples/jms/multiple-failover/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/multiple-failover/src/main/resources/hornetq/server0/activemq-jms.xml index 889b59d885..0d5c9537fb 100644 --- a/examples/jms/multiple-failover/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/multiple-failover/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,33 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - - + diff --git a/examples/jms/multiple-failover/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/multiple-failover/src/main/resources/hornetq/server1/activemq-jms.xml index c3b039357d..0d5c9537fb 100644 --- a/examples/jms/multiple-failover/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/multiple-failover/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,32 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/multiple-failover/src/main/resources/hornetq/server2/activemq-jms.xml b/examples/jms/multiple-failover/src/main/resources/hornetq/server2/activemq-jms.xml index 41d711bd71..0d5c9537fb 100644 --- a/examples/jms/multiple-failover/src/main/resources/hornetq/server2/activemq-jms.xml +++ b/examples/jms/multiple-failover/src/main/resources/hornetq/server2/activemq-jms.xml @@ -1,32 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/no-consumer-buffering/pom.xml b/examples/jms/no-consumer-buffering/pom.xml index 0415b4bd4b..b205475821 100644 --- a/examples/jms/no-consumer-buffering/pom.xml +++ b/examples/jms/no-consumer-buffering/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.NoConsumerBufferingExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/no-consumer-buffering/src/main/java/org/apache/activemq/jms/example/NoConsumerBufferingExample.java b/examples/jms/no-consumer-buffering/src/main/java/org/apache/activemq/jms/example/NoConsumerBufferingExample.java index 61e5ff6b6d..98af21d883 100644 --- a/examples/jms/no-consumer-buffering/src/main/java/org/apache/activemq/jms/example/NoConsumerBufferingExample.java +++ b/examples/jms/no-consumer-buffering/src/main/java/org/apache/activemq/jms/example/NoConsumerBufferingExample.java @@ -51,10 +51,10 @@ public class NoConsumerBufferingExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/no-consumer-buffering/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/no-consumer-buffering/src/main/resources/hornetq/server0/activemq-jms.xml index a679cccb09..0d5c9537fb 100644 --- a/examples/jms/no-consumer-buffering/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/no-consumer-buffering/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,24 +1,8 @@ - - - - - - - - - - - 0 - - - - - + diff --git a/examples/jms/non-transaction-failover/pom.xml b/examples/jms/non-transaction-failover/pom.xml index 54afb76bf7..0bd9fa5b01 100644 --- a/examples/jms/non-transaction-failover/pom.xml +++ b/examples/jms/non-transaction-failover/pom.xml @@ -85,8 +85,8 @@ org.apache.activemq.jms.example.NonTransactionFailoverExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -151,11 +151,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/non-transaction-failover/src/main/java/org/apache/activemq/jms/example/NonTransactionFailoverExample.java b/examples/jms/non-transaction-failover/src/main/java/org/apache/activemq/jms/example/NonTransactionFailoverExample.java index 68f79e9600..fc370970d2 100644 --- a/examples/jms/non-transaction-failover/src/main/java/org/apache/activemq/jms/example/NonTransactionFailoverExample.java +++ b/examples/jms/non-transaction-failover/src/main/java/org/apache/activemq/jms/example/NonTransactionFailoverExample.java @@ -56,8 +56,8 @@ public class NonTransactionFailoverExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look up the JMS resources from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); + ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 3. Create a JMS Connection connection = connectionFactory.createConnection(); diff --git a/examples/jms/non-transaction-failover/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/non-transaction-failover/src/main/resources/hornetq/server0/activemq-jms.xml index c3b039357d..0d5c9537fb 100644 --- a/examples/jms/non-transaction-failover/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/non-transaction-failover/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,32 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/non-transaction-failover/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/non-transaction-failover/src/main/resources/hornetq/server1/activemq-jms.xml index a5ea085775..0d5c9537fb 100644 --- a/examples/jms/non-transaction-failover/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/non-transaction-failover/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,32 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/openwire/pom.xml b/examples/jms/openwire/pom.xml index b2ba57520f..b129d99b75 100644 --- a/examples/jms/openwire/pom.xml +++ b/examples/jms/openwire/pom.xml @@ -56,7 +56,7 @@ org.apache.activemq.jms.example.OpenWireExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -108,11 +108,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/openwire/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/openwire/src/main/resources/hornetq/server0/activemq-jms.xml index 3058fc865c..0d5c9537fb 100644 --- a/examples/jms/openwire/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/openwire/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/paging/pom.xml b/examples/jms/paging/pom.xml index d635df56dd..6081b2b635 100644 --- a/examples/jms/paging/pom.xml +++ b/examples/jms/paging/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.PagingExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/paging/src/main/java/org/apache/activemq/jms/example/PagingExample.java b/examples/jms/paging/src/main/java/org/apache/activemq/jms/example/PagingExample.java index 1ba955ebb1..fe50d823e2 100644 --- a/examples/jms/paging/src/main/java/org/apache/activemq/jms/example/PagingExample.java +++ b/examples/jms/paging/src/main/java/org/apache/activemq/jms/example/PagingExample.java @@ -52,11 +52,11 @@ public class PagingExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 3. We look-up the JMS queue object from JNDI. pagingQueue is configured to hold a very limited number // of bytes in memory - Queue pageQueue = (Queue)initialContext.lookup("/queue/pagingQueue"); + Queue pageQueue = (Queue)initialContext.lookup("queue/pagingQueue"); // Step 4. Lookup for a JMS Queue Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); diff --git a/examples/jms/paging/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/paging/src/main/resources/hornetq/server0/activemq-jms.xml index 16a1074d45..980f889f33 100644 --- a/examples/jms/paging/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/paging/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,23 +1,10 @@ - - - - - - - - - - - - + - - - + \ No newline at end of file diff --git a/examples/jms/perf/pom.xml b/examples/jms/perf/pom.xml index 3416cf6216..6b049232f6 100644 --- a/examples/jms/perf/pom.xml +++ b/examples/jms/perf/pom.xml @@ -33,11 +33,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnp-client - 5.0.5.Final - org.apache.activemq.examples.jms activemq-jms-examples-common @@ -118,11 +113,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - diff --git a/examples/jms/perf/src/main/resources/client.jndi.properties b/examples/jms/perf/src/main/resources/client.jndi.properties index 080524fbb8..6940f75d77 100644 --- a/examples/jms/perf/src/main/resources/client.jndi.properties +++ b/examples/jms/perf/src/main/resources/client.jndi.properties @@ -1,3 +1,2 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.provider.url=jnp://localhost:1099 -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 \ No newline at end of file diff --git a/examples/jms/perf/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/perf/src/main/resources/hornetq/server0/activemq-jms.xml index 0fe8db194f..613bf942f4 100644 --- a/examples/jms/perf/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/perf/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,18 +1,7 @@ - - - - - - - - - - - - - + + diff --git a/examples/jms/pre-acknowledge/pom.xml b/examples/jms/pre-acknowledge/pom.xml index 35112bd144..14623b8133 100644 --- a/examples/jms/pre-acknowledge/pom.xml +++ b/examples/jms/pre-acknowledge/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.PreacknowledgeExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/pre-acknowledge/src/main/java/org/apache/activemq/jms/example/PreacknowledgeExample.java b/examples/jms/pre-acknowledge/src/main/java/org/apache/activemq/jms/example/PreacknowledgeExample.java index 18aaa2590e..e3f2c7aa27 100644 --- a/examples/jms/pre-acknowledge/src/main/java/org/apache/activemq/jms/example/PreacknowledgeExample.java +++ b/examples/jms/pre-acknowledge/src/main/java/org/apache/activemq/jms/example/PreacknowledgeExample.java @@ -63,9 +63,9 @@ public class PreacknowledgeExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perform the look-ups - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 3. Create a the JMS objects connection = cf.createConnection(); diff --git a/examples/jms/pre-acknowledge/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/pre-acknowledge/src/main/resources/hornetq/server0/activemq-jms.xml index 3058fc865c..0d5c9537fb 100644 --- a/examples/jms/pre-acknowledge/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/pre-acknowledge/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/producer-rate-limit/pom.xml b/examples/jms/producer-rate-limit/pom.xml index 35dcd665ca..6d4bf66aa9 100644 --- a/examples/jms/producer-rate-limit/pom.xml +++ b/examples/jms/producer-rate-limit/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.ProducerRateLimitExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/producer-rate-limit/src/main/java/org/apache/activemq/jms/example/ProducerRateLimitExample.java b/examples/jms/producer-rate-limit/src/main/java/org/apache/activemq/jms/example/ProducerRateLimitExample.java index 61fd763658..1b78bd96a3 100644 --- a/examples/jms/producer-rate-limit/src/main/java/org/apache/activemq/jms/example/ProducerRateLimitExample.java +++ b/examples/jms/producer-rate-limit/src/main/java/org/apache/activemq/jms/example/ProducerRateLimitExample.java @@ -51,10 +51,10 @@ public class ProducerRateLimitExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/producer-rate-limit/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/producer-rate-limit/src/main/resources/hornetq/server0/activemq-jms.xml index c68b505657..0d5c9537fb 100644 --- a/examples/jms/producer-rate-limit/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/producer-rate-limit/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,24 +1,8 @@ - - - - - - - - - - - 50 - - - - - + diff --git a/examples/jms/proton-cpp/pom.xml b/examples/jms/proton-cpp/pom.xml index 801d97de67..32d30c3695 100644 --- a/examples/jms/proton-cpp/pom.xml +++ b/examples/jms/proton-cpp/pom.xml @@ -33,11 +33,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnp-client - 5.0.5.Final - org.jboss.spec.javax.jms jboss-jms-api_2.0_spec @@ -119,11 +114,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - diff --git a/examples/jms/proton-j/pom.xml b/examples/jms/proton-j/pom.xml index 7f2fad59ec..f530c43c27 100644 --- a/examples/jms/proton-j/pom.xml +++ b/examples/jms/proton-j/pom.xml @@ -53,7 +53,7 @@ org.apache.activemq.jms.example.ProtonJExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -105,11 +105,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/proton-ruby/pom.xml b/examples/jms/proton-ruby/pom.xml index d3a2e7a88f..7c6ce2106d 100644 --- a/examples/jms/proton-ruby/pom.xml +++ b/examples/jms/proton-ruby/pom.xml @@ -83,11 +83,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/queue-message-redistribution/pom.xml b/examples/jms/queue-message-redistribution/pom.xml index a8868e8fc8..d2b79afaab 100644 --- a/examples/jms/queue-message-redistribution/pom.xml +++ b/examples/jms/queue-message-redistribution/pom.xml @@ -79,8 +79,8 @@ org.apache.activemq.jms.example.QueueMessageRedistributionExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -145,11 +145,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/queue-message-redistribution/src/main/java/org/apache/activemq/jms/example/QueueMessageRedistributionExample.java b/examples/jms/queue-message-redistribution/src/main/java/org/apache/activemq/jms/example/QueueMessageRedistributionExample.java index d8183d614d..732f36d3e1 100644 --- a/examples/jms/queue-message-redistribution/src/main/java/org/apache/activemq/jms/example/QueueMessageRedistributionExample.java +++ b/examples/jms/queue-message-redistribution/src/main/java/org/apache/activemq/jms/example/QueueMessageRedistributionExample.java @@ -59,16 +59,16 @@ public class QueueMessageRedistributionExample extends ActiveMQExample ic0 = getContext(0); // Step 2. Look-up the JMS Queue object from JNDI - Queue queue = (Queue)ic0.lookup("/queue/exampleQueue"); + Queue queue = (Queue)ic0.lookup("queue/exampleQueue"); // Step 3. Look-up a JMS Connection Factory object from JNDI on server 0 - ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory"); + ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("ConnectionFactory"); // Step 4. Get an initial context for looking up JNDI from server 1 ic1 = getContext(1); // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1 - ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory"); + ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("ConnectionFactory"); // Step 6. We create a JMS Connection connection0 which is a connection to server 0 connection0 = cf0.createConnection(); diff --git a/examples/jms/queue-message-redistribution/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/queue-message-redistribution/src/main/resources/hornetq/server0/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/queue-message-redistribution/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/queue-message-redistribution/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/queue-message-redistribution/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/queue-message-redistribution/src/main/resources/hornetq/server1/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/queue-message-redistribution/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/queue-message-redistribution/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/queue-requestor/pom.xml b/examples/jms/queue-requestor/pom.xml index f9e6eac5f8..1c644d973f 100644 --- a/examples/jms/queue-requestor/pom.xml +++ b/examples/jms/queue-requestor/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.QueueRequestorExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/queue-requestor/src/main/java/org/apache/activemq/jms/example/QueueRequestorExample.java b/examples/jms/queue-requestor/src/main/java/org/apache/activemq/jms/example/QueueRequestorExample.java index a0c23b1e1c..b2f3d5b7d8 100644 --- a/examples/jms/queue-requestor/src/main/java/org/apache/activemq/jms/example/QueueRequestorExample.java +++ b/examples/jms/queue-requestor/src/main/java/org/apache/activemq/jms/example/QueueRequestorExample.java @@ -51,10 +51,10 @@ public class QueueRequestorExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Look-up the JMS queue connection factory - QueueConnectionFactory cf = (QueueConnectionFactory)initialContext.lookup("/ConnectionFactory"); + QueueConnectionFactory cf = (QueueConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a TextReverserService which consumes messages from the queue and sends message with reversed // text diff --git a/examples/jms/queue-requestor/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/queue-requestor/src/main/resources/hornetq/server0/activemq-jms.xml index f38ed2d003..0d5c9537fb 100644 --- a/examples/jms/queue-requestor/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/queue-requestor/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/queue-selector/pom.xml b/examples/jms/queue-selector/pom.xml index 0cc242095a..cb7024accb 100644 --- a/examples/jms/queue-selector/pom.xml +++ b/examples/jms/queue-selector/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.QueueSelectorExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/queue-selector/src/main/java/org/apache/activemq/jms/example/QueueSelectorExample.java b/examples/jms/queue-selector/src/main/java/org/apache/activemq/jms/example/QueueSelectorExample.java index 57ef22752c..ccb5250bde 100644 --- a/examples/jms/queue-selector/src/main/java/org/apache/activemq/jms/example/QueueSelectorExample.java +++ b/examples/jms/queue-selector/src/main/java/org/apache/activemq/jms/example/QueueSelectorExample.java @@ -55,10 +55,10 @@ public class QueueSelectorExample extends ActiveMQExample initialContext = getContext(0); // Step 2. look-up the JMS queue object from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. look-up the JMS connection factory object from JNDI - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/queue-selector/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/queue-selector/src/main/resources/hornetq/server0/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/queue-selector/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/queue-selector/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/queue/pom.xml b/examples/jms/queue/pom.xml index 97797a0a5f..307d2f895d 100644 --- a/examples/jms/queue/pom.xml +++ b/examples/jms/queue/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.QueueExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/queue/src/main/java/org/apache/activemq/jms/example/QueueExample.java b/examples/jms/queue/src/main/java/org/apache/activemq/jms/example/QueueExample.java index a9dffeef86..a838c73773 100644 --- a/examples/jms/queue/src/main/java/org/apache/activemq/jms/example/QueueExample.java +++ b/examples/jms/queue/src/main/java/org/apache/activemq/jms/example/QueueExample.java @@ -50,10 +50,10 @@ public class QueueExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/queue/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/queue/src/main/resources/hornetq/server0/activemq-jms.xml index 3058fc865c..0d5c9537fb 100644 --- a/examples/jms/queue/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/queue/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/reattach-node/pom.xml b/examples/jms/reattach-node/pom.xml index f7d955ebc2..97fee3c44c 100644 --- a/examples/jms/reattach-node/pom.xml +++ b/examples/jms/reattach-node/pom.xml @@ -47,7 +47,7 @@ org.apache.activemq.jms.example.ReattachExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -103,11 +103,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/reattach-node/src/main/java/org/apache/activemq/jms/example/ReattachExample.java b/examples/jms/reattach-node/src/main/java/org/apache/activemq/jms/example/ReattachExample.java index 303f2daf71..65d40feffe 100644 --- a/examples/jms/reattach-node/src/main/java/org/apache/activemq/jms/example/ReattachExample.java +++ b/examples/jms/reattach-node/src/main/java/org/apache/activemq/jms/example/ReattachExample.java @@ -56,10 +56,10 @@ public class ReattachExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perform a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS Connection connection = cf.createConnection(); @@ -136,7 +136,7 @@ public class ReattachExample extends ActiveMQExample // when the main connection has been stopped private void stopStartAcceptor(final InitialContext initialContext, final boolean stop) throws Exception { - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory2"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory2"); Connection connection = null; try diff --git a/examples/jms/reattach-node/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/reattach-node/src/main/resources/hornetq/server0/activemq-jms.xml index c24e03b6a3..847659f7ad 100644 --- a/examples/jms/reattach-node/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/reattach-node/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,51 +1,8 @@ - - - - - - - - - - - - - 1000 - - - 1.0 - - - -1 - - - true - - - 1048576 - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/replicated-failback-static/pom.xml b/examples/jms/replicated-failback-static/pom.xml index 6617de197d..631b40f7b1 100644 --- a/examples/jms/replicated-failback-static/pom.xml +++ b/examples/jms/replicated-failback-static/pom.xml @@ -79,8 +79,8 @@ org.apache.activemq.jms.example.ReplicatedFailbackStaticExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -145,11 +145,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/replicated-failback-static/src/main/java/org/apache/activemq/jms/example/ReplicatedFailbackStaticExample.java b/examples/jms/replicated-failback-static/src/main/java/org/apache/activemq/jms/example/ReplicatedFailbackStaticExample.java index d9220b975e..73edb7e6c1 100644 --- a/examples/jms/replicated-failback-static/src/main/java/org/apache/activemq/jms/example/ReplicatedFailbackStaticExample.java +++ b/examples/jms/replicated-failback-static/src/main/java/org/apache/activemq/jms/example/ReplicatedFailbackStaticExample.java @@ -58,8 +58,8 @@ public class ReplicatedFailbackStaticExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look up the JMS resources from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); + ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 3. Create a JMS Connection connection = connectionFactory.createConnection(); diff --git a/examples/jms/replicated-failback-static/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/replicated-failback-static/src/main/resources/hornetq/server0/activemq-jms.xml index 889b59d885..0d5c9537fb 100644 --- a/examples/jms/replicated-failback-static/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/replicated-failback-static/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,33 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - - + diff --git a/examples/jms/replicated-failback-static/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/replicated-failback-static/src/main/resources/hornetq/server1/activemq-jms.xml index c3b039357d..0d5c9537fb 100644 --- a/examples/jms/replicated-failback-static/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/replicated-failback-static/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,32 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/replicated-failback/pom.xml b/examples/jms/replicated-failback/pom.xml index 570e4d8fa1..1aa611d890 100644 --- a/examples/jms/replicated-failback/pom.xml +++ b/examples/jms/replicated-failback/pom.xml @@ -79,8 +79,8 @@ org.apache.activemq.jms.example.ReplicatedFailbackExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -145,11 +145,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/replicated-failback/src/main/java/org/apache/activemq/jms/example/ReplicatedFailbackExample.java b/examples/jms/replicated-failback/src/main/java/org/apache/activemq/jms/example/ReplicatedFailbackExample.java index 7105a35f76..d216f0fb16 100644 --- a/examples/jms/replicated-failback/src/main/java/org/apache/activemq/jms/example/ReplicatedFailbackExample.java +++ b/examples/jms/replicated-failback/src/main/java/org/apache/activemq/jms/example/ReplicatedFailbackExample.java @@ -58,8 +58,8 @@ public class ReplicatedFailbackExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look up the JMS resources from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); + ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 3. Create a JMS Connection connection = connectionFactory.createConnection(); diff --git a/examples/jms/replicated-failback/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/replicated-failback/src/main/resources/hornetq/server0/activemq-jms.xml index 889b59d885..0d5c9537fb 100644 --- a/examples/jms/replicated-failback/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/replicated-failback/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,33 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - - + diff --git a/examples/jms/replicated-failback/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/replicated-failback/src/main/resources/hornetq/server1/activemq-jms.xml index c3b039357d..0d5c9537fb 100644 --- a/examples/jms/replicated-failback/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/replicated-failback/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,32 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/replicated-multiple-failover/pom.xml b/examples/jms/replicated-multiple-failover/pom.xml index e6c503a83d..1afd8abc96 100644 --- a/examples/jms/replicated-multiple-failover/pom.xml +++ b/examples/jms/replicated-multiple-failover/pom.xml @@ -101,9 +101,9 @@ org.apache.activemq.jms.example.ReplicatedMultipleFailoverExample - jnp://localhost:1099 - jnp://localhost:1199 - jnp://localhost:1299 + tcp://localhost:5445 + tcp://localhost:5446 + tcp://localhost:5447 @@ -177,11 +177,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/replicated-multiple-failover/src/main/java/org/apache/activemq/jms/example/ReplicatedMultipleFailoverExample.java b/examples/jms/replicated-multiple-failover/src/main/java/org/apache/activemq/jms/example/ReplicatedMultipleFailoverExample.java index 0512690dee..5ca8ffba95 100644 --- a/examples/jms/replicated-multiple-failover/src/main/java/org/apache/activemq/jms/example/ReplicatedMultipleFailoverExample.java +++ b/examples/jms/replicated-multiple-failover/src/main/java/org/apache/activemq/jms/example/ReplicatedMultipleFailoverExample.java @@ -55,8 +55,8 @@ public class ReplicatedMultipleFailoverExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look up the JMS resources from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); + ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 3. Create a JMS Connection connection = connectionFactory.createConnection(); diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/replicated-multiple-failover/src/main/resources/hornetq/server0/activemq-jms.xml index 889b59d885..0d5c9537fb 100644 --- a/examples/jms/replicated-multiple-failover/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/replicated-multiple-failover/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,33 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - - + diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/replicated-multiple-failover/src/main/resources/hornetq/server1/activemq-jms.xml index c3b039357d..0d5c9537fb 100644 --- a/examples/jms/replicated-multiple-failover/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/replicated-multiple-failover/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,32 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/hornetq/server2/activemq-jms.xml b/examples/jms/replicated-multiple-failover/src/main/resources/hornetq/server2/activemq-jms.xml index 41d711bd71..0d5c9537fb 100644 --- a/examples/jms/replicated-multiple-failover/src/main/resources/hornetq/server2/activemq-jms.xml +++ b/examples/jms/replicated-multiple-failover/src/main/resources/hornetq/server2/activemq-jms.xml @@ -1,32 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/replicated-transaction-failover/pom.xml b/examples/jms/replicated-transaction-failover/pom.xml index 02f9ea87c6..5d1dc030b7 100644 --- a/examples/jms/replicated-transaction-failover/pom.xml +++ b/examples/jms/replicated-transaction-failover/pom.xml @@ -79,8 +79,8 @@ org.apache.activemq.jms.example.ReplicatedTransactionFailoverExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -145,11 +145,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/replicated-transaction-failover/src/main/java/org/apache/activemq/jms/example/ReplicatedTransactionFailoverExample.java b/examples/jms/replicated-transaction-failover/src/main/java/org/apache/activemq/jms/example/ReplicatedTransactionFailoverExample.java index 3d2912eb11..fe0e9d1085 100644 --- a/examples/jms/replicated-transaction-failover/src/main/java/org/apache/activemq/jms/example/ReplicatedTransactionFailoverExample.java +++ b/examples/jms/replicated-transaction-failover/src/main/java/org/apache/activemq/jms/example/ReplicatedTransactionFailoverExample.java @@ -57,8 +57,8 @@ public class ReplicatedTransactionFailoverExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look-up the JMS resources from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); + ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 3. We create a JMS Connection connection = connectionFactory.createConnection(); diff --git a/examples/jms/replicated-transaction-failover/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/replicated-transaction-failover/src/main/resources/hornetq/server0/activemq-jms.xml index a4c9e68a69..0d5c9537fb 100644 --- a/examples/jms/replicated-transaction-failover/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/replicated-transaction-failover/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,31 +1,8 @@ - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/replicated-transaction-failover/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/replicated-transaction-failover/src/main/resources/hornetq/server1/activemq-jms.xml index a4c9e68a69..0d5c9537fb 100644 --- a/examples/jms/replicated-transaction-failover/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/replicated-transaction-failover/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,31 +1,8 @@ - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/request-reply/pom.xml b/examples/jms/request-reply/pom.xml index 3c50986132..72fcd0aba7 100644 --- a/examples/jms/request-reply/pom.xml +++ b/examples/jms/request-reply/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.RequestReplyExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/request-reply/src/main/java/org/apache/activemq/jms/example/RequestReplyExample.java b/examples/jms/request-reply/src/main/java/org/apache/activemq/jms/example/RequestReplyExample.java index a020f00a70..cd7341146c 100644 --- a/examples/jms/request-reply/src/main/java/org/apache/activemq/jms/example/RequestReplyExample.java +++ b/examples/jms/request-reply/src/main/java/org/apache/activemq/jms/example/RequestReplyExample.java @@ -70,10 +70,10 @@ public class RequestReplyExample extends ActiveMQExample initialContext = getContext(0); // Step 3. Lookup the queue for sending the request message - Queue requestQueue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue requestQueue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 4. Lookup for the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 5. Create a JMS Connection connection = cf.createConnection(); @@ -165,10 +165,10 @@ public class RequestReplyExample extends ActiveMQExample InitialContext initialContext = getContext(0); // Lookup the queue to receive the request message - Queue requestQueue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue requestQueue = (Queue)initialContext.lookup("queue/exampleQueue"); // Lookup for the Connection Factory - ConnectionFactory cfact = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cfact = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Create a connection connection = cfact.createConnection(); diff --git a/examples/jms/request-reply/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/request-reply/src/main/resources/hornetq/server0/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/request-reply/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/request-reply/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/rest/dup-send/src/main/resources/activemq-jms.xml b/examples/jms/rest/dup-send/src/main/resources/activemq-jms.xml index 873f44c739..1dd31140f9 100644 --- a/examples/jms/rest/dup-send/src/main/resources/activemq-jms.xml +++ b/examples/jms/rest/dup-send/src/main/resources/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/rest/javascript-chat/src/main/resources/activemq-jms.xml b/examples/jms/rest/javascript-chat/src/main/resources/activemq-jms.xml index 03f0a972fb..b19f027c35 100644 --- a/examples/jms/rest/javascript-chat/src/main/resources/activemq-jms.xml +++ b/examples/jms/rest/javascript-chat/src/main/resources/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/rest/jms-to-rest/src/main/resources/activemq-jms.xml b/examples/jms/rest/jms-to-rest/src/main/resources/activemq-jms.xml index 873f44c739..1dd31140f9 100644 --- a/examples/jms/rest/jms-to-rest/src/main/resources/activemq-jms.xml +++ b/examples/jms/rest/jms-to-rest/src/main/resources/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/rest/push/src/main/resources/activemq-jms.xml b/examples/jms/rest/push/src/main/resources/activemq-jms.xml index e4ade20f38..181444749c 100644 --- a/examples/jms/rest/push/src/main/resources/activemq-jms.xml +++ b/examples/jms/rest/push/src/main/resources/activemq-jms.xml @@ -1,22 +1,9 @@ - - - - - - - - - - - - - - - - + + + diff --git a/examples/jms/scale-down/pom.xml b/examples/jms/scale-down/pom.xml index 4264551707..f9a23af905 100644 --- a/examples/jms/scale-down/pom.xml +++ b/examples/jms/scale-down/pom.xml @@ -71,8 +71,8 @@ org.apache.activemq.jms.example.ScaleDownExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -137,11 +137,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/scale-down/src/main/java/org/apache/activemq/jms/example/ScaleDownExample.java b/examples/jms/scale-down/src/main/java/org/apache/activemq/jms/example/ScaleDownExample.java index ad9f48e2ae..d942b797d9 100644 --- a/examples/jms/scale-down/src/main/java/org/apache/activemq/jms/example/ScaleDownExample.java +++ b/examples/jms/scale-down/src/main/java/org/apache/activemq/jms/example/ScaleDownExample.java @@ -56,9 +56,9 @@ public class ScaleDownExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look up the JMS resources from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); - ConnectionFactory connectionFactory1 = (ConnectionFactory)initialContext1.lookup("/ConnectionFactory"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); + ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); + ConnectionFactory connectionFactory1 = (ConnectionFactory)initialContext1.lookup("ConnectionFactory"); // Step 3. Create a JMS Connections connection = connectionFactory.createConnection(); diff --git a/examples/jms/scale-down/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/scale-down/src/main/resources/hornetq/server0/activemq-jms.xml index 2bf8233891..847659f7ad 100644 --- a/examples/jms/scale-down/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/scale-down/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,30 +1,8 @@ - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + \ No newline at end of file diff --git a/examples/jms/scale-down/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/scale-down/src/main/resources/hornetq/server1/activemq-jms.xml index 2bf8233891..847659f7ad 100644 --- a/examples/jms/scale-down/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/scale-down/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,30 +1,8 @@ - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + \ No newline at end of file diff --git a/examples/jms/scheduled-message/pom.xml b/examples/jms/scheduled-message/pom.xml index ba480a8ac7..83f1a676ed 100644 --- a/examples/jms/scheduled-message/pom.xml +++ b/examples/jms/scheduled-message/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.ScheduledMessageExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/scheduled-message/src/main/java/org/apache/activemq/jms/example/ScheduledMessageExample.java b/examples/jms/scheduled-message/src/main/java/org/apache/activemq/jms/example/ScheduledMessageExample.java index 2211aad1f6..92ece47be5 100644 --- a/examples/jms/scheduled-message/src/main/java/org/apache/activemq/jms/example/ScheduledMessageExample.java +++ b/examples/jms/scheduled-message/src/main/java/org/apache/activemq/jms/example/ScheduledMessageExample.java @@ -54,10 +54,10 @@ public class ScheduledMessageExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/scheduled-message/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/scheduled-message/src/main/resources/hornetq/server0/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/scheduled-message/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/scheduled-message/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/security/pom.xml b/examples/jms/security/pom.xml index d943938ae3..8eb47f87a3 100644 --- a/examples/jms/security/pom.xml +++ b/examples/jms/security/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.SecurityExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/security/src/main/java/org/apache/activemq/jms/example/SecurityExample.java b/examples/jms/security/src/main/java/org/apache/activemq/jms/example/SecurityExample.java index 45375e0bd9..9a699fb4ae 100644 --- a/examples/jms/security/src/main/java/org/apache/activemq/jms/example/SecurityExample.java +++ b/examples/jms/security/src/main/java/org/apache/activemq/jms/example/SecurityExample.java @@ -58,12 +58,12 @@ public class SecurityExample extends ActiveMQExample initialContext = getContext(0); // Step 2. perform lookup on the topics - Topic genericTopic = (Topic)initialContext.lookup("/topic/genericTopic"); - Topic europeTopic = (Topic)initialContext.lookup("/topic/europeTopic"); - Topic usTopic = (Topic)initialContext.lookup("/topic/usTopic"); + Topic genericTopic = (Topic)initialContext.lookup("topic/genericTopic"); + Topic europeTopic = (Topic)initialContext.lookup("topic/europeTopic"); + Topic usTopic = (Topic)initialContext.lookup("topic/usTopic"); // Step 3. perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Try to create a JMS Connection without user/password. It will fail. try diff --git a/examples/jms/security/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/security/src/main/resources/hornetq/server0/activemq-jms.xml index d2d6100ce0..74a9f7993e 100644 --- a/examples/jms/security/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/security/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,28 +1,11 @@ - - - - - - true - true - - - - - - - + - - - + - - - + diff --git a/examples/jms/send-acknowledgements/pom.xml b/examples/jms/send-acknowledgements/pom.xml index 07485c6a12..9a766ca1af 100644 --- a/examples/jms/send-acknowledgements/pom.xml +++ b/examples/jms/send-acknowledgements/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.SendAcknowledgementsExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/send-acknowledgements/src/main/java/org/apache/activemq/jms/example/SendAcknowledgementsExample.java b/examples/jms/send-acknowledgements/src/main/java/org/apache/activemq/jms/example/SendAcknowledgementsExample.java index a0dc06b26b..31c284e8e4 100644 --- a/examples/jms/send-acknowledgements/src/main/java/org/apache/activemq/jms/example/SendAcknowledgementsExample.java +++ b/examples/jms/send-acknowledgements/src/main/java/org/apache/activemq/jms/example/SendAcknowledgementsExample.java @@ -58,10 +58,10 @@ public class SendAcknowledgementsExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/send-acknowledgements/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/send-acknowledgements/src/main/resources/hornetq/server0/activemq-jms.xml index 6bbe84ee6b..0d5c9537fb 100644 --- a/examples/jms/send-acknowledgements/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/send-acknowledgements/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,20 +1,8 @@ - - - - - - - - - 1048576 - - - - + diff --git a/examples/jms/spring-integration/pom.xml b/examples/jms/spring-integration/pom.xml index b0ec32c38a..22db0f20a6 100644 --- a/examples/jms/spring-integration/pom.xml +++ b/examples/jms/spring-integration/pom.xml @@ -47,7 +47,7 @@ org.apache.activemq.jms.example.SpringExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -88,11 +88,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/spring-integration/src/main/resources/activemq-jms.xml b/examples/jms/spring-integration/src/main/resources/activemq-jms.xml index bce97ab150..37589895ef 100644 --- a/examples/jms/spring-integration/src/main/resources/activemq-jms.xml +++ b/examples/jms/spring-integration/src/main/resources/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/ssl-enabled/pom.xml b/examples/jms/ssl-enabled/pom.xml index 8ff5d643ab..8fe25340fc 100644 --- a/examples/jms/ssl-enabled/pom.xml +++ b/examples/jms/ssl-enabled/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.SSLExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/ssl-enabled/src/main/java/org/apache/activemq/jms/example/SSLExample.java b/examples/jms/ssl-enabled/src/main/java/org/apache/activemq/jms/example/SSLExample.java index 520ba7f579..e025afd4d4 100644 --- a/examples/jms/ssl-enabled/src/main/java/org/apache/activemq/jms/example/SSLExample.java +++ b/examples/jms/ssl-enabled/src/main/java/org/apache/activemq/jms/example/SSLExample.java @@ -50,10 +50,10 @@ public class SSLExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Perfom a lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4.Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/ssl-enabled/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/ssl-enabled/src/main/resources/hornetq/server0/activemq-jms.xml index cc01481708..0d5c9537fb 100644 --- a/examples/jms/ssl-enabled/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/ssl-enabled/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/static-selector-jms/pom.xml b/examples/jms/static-selector-jms/pom.xml index f687e768f7..ba5cd8a1c5 100644 --- a/examples/jms/static-selector-jms/pom.xml +++ b/examples/jms/static-selector-jms/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.StaticSelectorJMSExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/static-selector-jms/src/main/java/org/apache/activemq/jms/example/StaticSelectorJMSExample.java b/examples/jms/static-selector-jms/src/main/java/org/apache/activemq/jms/example/StaticSelectorJMSExample.java index cba436731b..7b976e4d7a 100644 --- a/examples/jms/static-selector-jms/src/main/java/org/apache/activemq/jms/example/StaticSelectorJMSExample.java +++ b/examples/jms/static-selector-jms/src/main/java/org/apache/activemq/jms/example/StaticSelectorJMSExample.java @@ -55,10 +55,10 @@ public class StaticSelectorJMSExample extends ActiveMQExample initialContext = getContext(0); // Step 2. look-up the JMS queue object from JNDI, this is the queue that has filter configured with it. - Queue queue = (Queue)initialContext.lookup("/queue/selectorQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. look-up the JMS connection factory object from JNDI - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/static-selector-jms/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/static-selector-jms/src/main/resources/hornetq/server0/activemq-jms.xml index aa9dbf416f..c618cfba0b 100644 --- a/examples/jms/static-selector-jms/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/static-selector-jms/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,9 @@ - - - - - - - - - - - + diff --git a/examples/jms/static-selector/pom.xml b/examples/jms/static-selector/pom.xml index b8019cf7e4..a8a3f37b9f 100644 --- a/examples/jms/static-selector/pom.xml +++ b/examples/jms/static-selector/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.StaticSelectorExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/static-selector/src/main/java/org/apache/activemq/jms/example/StaticSelectorExample.java b/examples/jms/static-selector/src/main/java/org/apache/activemq/jms/example/StaticSelectorExample.java index cc23297c66..11cc7b3850 100644 --- a/examples/jms/static-selector/src/main/java/org/apache/activemq/jms/example/StaticSelectorExample.java +++ b/examples/jms/static-selector/src/main/java/org/apache/activemq/jms/example/StaticSelectorExample.java @@ -55,10 +55,10 @@ public class StaticSelectorExample extends ActiveMQExample initialContext = getContext(0); // Step 2. look-up the JMS queue object from JNDI, this is the queue that has filter configured with it. - Queue queue = (Queue)initialContext.lookup("/queue/selectorQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. look-up the JMS connection factory object from JNDI - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/static-selector/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/static-selector/src/main/resources/hornetq/server0/activemq-jms.xml index 1bf18ffe49..847659f7ad 100644 --- a/examples/jms/static-selector/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/static-selector/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/stomp-websockets/pom.xml b/examples/jms/stomp-websockets/pom.xml index cae3206e5c..3d56027787 100644 --- a/examples/jms/stomp-websockets/pom.xml +++ b/examples/jms/stomp-websockets/pom.xml @@ -47,7 +47,7 @@ org.apache.activemq.jms.example.StompWebSocketExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -108,11 +108,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/stomp-websockets/src/main/java/org/apache/activemq/jms/example/StompWebSocketExample.java b/examples/jms/stomp-websockets/src/main/java/org/apache/activemq/jms/example/StompWebSocketExample.java index 51bdb82255..dac21d91de 100644 --- a/examples/jms/stomp-websockets/src/main/java/org/apache/activemq/jms/example/StompWebSocketExample.java +++ b/examples/jms/stomp-websockets/src/main/java/org/apache/activemq/jms/example/StompWebSocketExample.java @@ -50,8 +50,8 @@ public class StompWebSocketExample extends ActiveMQExample try { initialContext = getContext(0); - Topic topic = (Topic)initialContext.lookup("/topic/chat"); - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + Topic topic = (Topic)initialContext.lookup("topic/chat"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); connection = cf.createConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); diff --git a/examples/jms/stomp-websockets/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/stomp-websockets/src/main/resources/hornetq/server0/activemq-jms.xml index c872ad6673..048f5d2d28 100644 --- a/examples/jms/stomp-websockets/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/stomp-websockets/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/stomp/pom.xml b/examples/jms/stomp/pom.xml index 61e45354e9..ebf7049a54 100644 --- a/examples/jms/stomp/pom.xml +++ b/examples/jms/stomp/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.StompExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -104,11 +104,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/stomp/src/main/java/org/apache/activemq/jms/example/StompExample.java b/examples/jms/stomp/src/main/java/org/apache/activemq/jms/example/StompExample.java index 0b2c59aa68..a27ae303f1 100644 --- a/examples/jms/stomp/src/main/java/org/apache/activemq/jms/example/StompExample.java +++ b/examples/jms/stomp/src/main/java/org/apache/activemq/jms/example/StompExample.java @@ -91,8 +91,8 @@ public class StompExample extends ActiveMQExample initialContext = getContext(0); // Step 7. Perform a lookup on the queue and the connection factory - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 8.Create a JMS Connection, Session and a MessageConsumer on the queue connection = cf.createConnection(); diff --git a/examples/jms/stomp/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/stomp/src/main/resources/hornetq/server0/activemq-jms.xml index 3058fc865c..0d5c9537fb 100644 --- a/examples/jms/stomp/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/stomp/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/stomp1.1/pom.xml b/examples/jms/stomp1.1/pom.xml index 71ace4abe9..251f5c8d85 100644 --- a/examples/jms/stomp1.1/pom.xml +++ b/examples/jms/stomp1.1/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.StompExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -104,11 +104,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/stomp1.1/src/main/java/org/apache/activemq/jms/example/StompExample.java b/examples/jms/stomp1.1/src/main/java/org/apache/activemq/jms/example/StompExample.java index 06f6bff668..35309c0ea6 100644 --- a/examples/jms/stomp1.1/src/main/java/org/apache/activemq/jms/example/StompExample.java +++ b/examples/jms/stomp1.1/src/main/java/org/apache/activemq/jms/example/StompExample.java @@ -98,8 +98,8 @@ public class StompExample extends ActiveMQExample initialContext = getContext(0); // Step 7. Perform a lookup on the queue and the connection factory - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 8.Create a JMS Connection, Session and a MessageConsumer on the queue connection = cf.createConnection(); diff --git a/examples/jms/stomp1.1/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/stomp1.1/src/main/resources/hornetq/server0/activemq-jms.xml index 3058fc865c..0d5c9537fb 100644 --- a/examples/jms/stomp1.1/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/stomp1.1/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/stomp1.2/pom.xml b/examples/jms/stomp1.2/pom.xml index 8e658ebe70..1876e38150 100644 --- a/examples/jms/stomp1.2/pom.xml +++ b/examples/jms/stomp1.2/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.StompExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -104,11 +104,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/stomp1.2/src/main/java/org/apache/activemq/jms/example/StompExample.java b/examples/jms/stomp1.2/src/main/java/org/apache/activemq/jms/example/StompExample.java index 8885328b5a..7b21107af2 100644 --- a/examples/jms/stomp1.2/src/main/java/org/apache/activemq/jms/example/StompExample.java +++ b/examples/jms/stomp1.2/src/main/java/org/apache/activemq/jms/example/StompExample.java @@ -97,8 +97,8 @@ public class StompExample extends ActiveMQExample initialContext = getContext(0); // Step 7. Perform a lookup on the queue and the connection factory - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 8.Create a JMS Connection, Session and a MessageConsumer on the queue connection = cf.createConnection(); diff --git a/examples/jms/stomp1.2/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/stomp1.2/src/main/resources/hornetq/server0/activemq-jms.xml index 3058fc865c..0d5c9537fb 100644 --- a/examples/jms/stomp1.2/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/stomp1.2/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/examples/jms/stop-server-failover/pom.xml b/examples/jms/stop-server-failover/pom.xml index 776da9530d..366ebfc621 100644 --- a/examples/jms/stop-server-failover/pom.xml +++ b/examples/jms/stop-server-failover/pom.xml @@ -79,8 +79,8 @@ org.apache.activemq.jms.example.StopServerFailoverExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -145,11 +145,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/stop-server-failover/src/main/java/org/apache/activemq/jms/example/StopServerFailoverExample.java b/examples/jms/stop-server-failover/src/main/java/org/apache/activemq/jms/example/StopServerFailoverExample.java index 4a90ee37b5..e5e669127e 100644 --- a/examples/jms/stop-server-failover/src/main/java/org/apache/activemq/jms/example/StopServerFailoverExample.java +++ b/examples/jms/stop-server-failover/src/main/java/org/apache/activemq/jms/example/StopServerFailoverExample.java @@ -56,8 +56,8 @@ public class StopServerFailoverExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look up the JMS resources from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); + ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 3. Create a JMS Connection connection = connectionFactory.createConnection(); diff --git a/examples/jms/stop-server-failover/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/stop-server-failover/src/main/resources/hornetq/server0/activemq-jms.xml index c3b039357d..0d5c9537fb 100644 --- a/examples/jms/stop-server-failover/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/stop-server-failover/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,32 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/stop-server-failover/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/stop-server-failover/src/main/resources/hornetq/server1/activemq-jms.xml index a5ea085775..0d5c9537fb 100644 --- a/examples/jms/stop-server-failover/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/stop-server-failover/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,32 +1,8 @@ - - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/symmetric-cluster/pom.xml b/examples/jms/symmetric-cluster/pom.xml index b1de2cfb82..585c5c44b5 100644 --- a/examples/jms/symmetric-cluster/pom.xml +++ b/examples/jms/symmetric-cluster/pom.xml @@ -167,12 +167,12 @@ org.apache.activemq.jms.example.SymmetricClusterExample - jnp://localhost:1099 - jnp://localhost:1199 - jnp://localhost:1299 - jnp://localhost:1399 - jnp://localhost:1499 - jnp://localhost:1599 + tcp://localhost:5445 + tcp://localhost:5446 + tcp://localhost:5447 + tcp://localhost:5448 + tcp://localhost:5449 + tcp://localhost:5450 @@ -273,11 +273,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/symmetric-cluster/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/symmetric-cluster/src/main/resources/hornetq/server0/activemq-jms.xml index d51eab9bd4..6e79642ec9 100644 --- a/examples/jms/symmetric-cluster/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/symmetric-cluster/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,22 +1,9 @@ - - - - - - - - - - - + - - - + \ No newline at end of file diff --git a/examples/jms/symmetric-cluster/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/symmetric-cluster/src/main/resources/hornetq/server1/activemq-jms.xml index c857e182db..7b26f36e64 100644 --- a/examples/jms/symmetric-cluster/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/symmetric-cluster/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,22 +1,9 @@ - - - - - - - - - - - + - - - + \ No newline at end of file diff --git a/examples/jms/symmetric-cluster/src/main/resources/hornetq/server2/activemq-jms.xml b/examples/jms/symmetric-cluster/src/main/resources/hornetq/server2/activemq-jms.xml index defe6e0d19..7b26f36e64 100644 --- a/examples/jms/symmetric-cluster/src/main/resources/hornetq/server2/activemq-jms.xml +++ b/examples/jms/symmetric-cluster/src/main/resources/hornetq/server2/activemq-jms.xml @@ -1,22 +1,9 @@ - - - - - - - - - - - + - - - + \ No newline at end of file diff --git a/examples/jms/symmetric-cluster/src/main/resources/hornetq/server3/activemq-jms.xml b/examples/jms/symmetric-cluster/src/main/resources/hornetq/server3/activemq-jms.xml index c857e182db..7b26f36e64 100644 --- a/examples/jms/symmetric-cluster/src/main/resources/hornetq/server3/activemq-jms.xml +++ b/examples/jms/symmetric-cluster/src/main/resources/hornetq/server3/activemq-jms.xml @@ -1,22 +1,9 @@ - - - - - - - - - - - + - - - + \ No newline at end of file diff --git a/examples/jms/symmetric-cluster/src/main/resources/hornetq/server4/activemq-jms.xml b/examples/jms/symmetric-cluster/src/main/resources/hornetq/server4/activemq-jms.xml index 7d1c77137f..7b26f36e64 100644 --- a/examples/jms/symmetric-cluster/src/main/resources/hornetq/server4/activemq-jms.xml +++ b/examples/jms/symmetric-cluster/src/main/resources/hornetq/server4/activemq-jms.xml @@ -2,21 +2,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd"> - - - - - - - - - - - + - - - + \ No newline at end of file diff --git a/examples/jms/symmetric-cluster/src/main/resources/hornetq/server5/activemq-jms.xml b/examples/jms/symmetric-cluster/src/main/resources/hornetq/server5/activemq-jms.xml index 7d1c77137f..7b26f36e64 100644 --- a/examples/jms/symmetric-cluster/src/main/resources/hornetq/server5/activemq-jms.xml +++ b/examples/jms/symmetric-cluster/src/main/resources/hornetq/server5/activemq-jms.xml @@ -2,21 +2,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd"> - - - - - - - - - - - + - - - + \ No newline at end of file diff --git a/examples/jms/temp-queue/pom.xml b/examples/jms/temp-queue/pom.xml index 88ed4b9e6e..c1649f1e3c 100644 --- a/examples/jms/temp-queue/pom.xml +++ b/examples/jms/temp-queue/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.TemporaryQueueExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/temp-queue/src/main/java/org/apache/activemq/jms/example/TemporaryQueueExample.java b/examples/jms/temp-queue/src/main/java/org/apache/activemq/jms/example/TemporaryQueueExample.java index 18f2cddcee..55b6438e51 100644 --- a/examples/jms/temp-queue/src/main/java/org/apache/activemq/jms/example/TemporaryQueueExample.java +++ b/examples/jms/temp-queue/src/main/java/org/apache/activemq/jms/example/TemporaryQueueExample.java @@ -51,7 +51,7 @@ public class TemporaryQueueExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look-up the JMS connection factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 3. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/temp-queue/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/temp-queue/src/main/resources/hornetq/server0/activemq-jms.xml index 6c898917bb..0baa197eda 100644 --- a/examples/jms/temp-queue/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/temp-queue/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/topic-hierarchies/pom.xml b/examples/jms/topic-hierarchies/pom.xml index 301caf3b0c..dd1b6d9ef0 100644 --- a/examples/jms/topic-hierarchies/pom.xml +++ b/examples/jms/topic-hierarchies/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.TopicHierarchyExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/topic-hierarchies/src/main/java/org/apache/activemq/jms/example/TopicHierarchyExample.java b/examples/jms/topic-hierarchies/src/main/java/org/apache/activemq/jms/example/TopicHierarchyExample.java index df5067ad50..8fff1593c2 100644 --- a/examples/jms/topic-hierarchies/src/main/java/org/apache/activemq/jms/example/TopicHierarchyExample.java +++ b/examples/jms/topic-hierarchies/src/main/java/org/apache/activemq/jms/example/TopicHierarchyExample.java @@ -54,7 +54,7 @@ public class TopicHierarchyExample extends ActiveMQExample initialContext = getContext(0); // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/topic-hierarchies/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/topic-hierarchies/src/main/resources/hornetq/server0/activemq-jms.xml index e0a778e7fe..dc498ccf75 100644 --- a/examples/jms/topic-hierarchies/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/topic-hierarchies/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,40 +1,19 @@ - - - - - - - - - - - - + - - - + - - - + - - - + - - - + - - - + diff --git a/examples/jms/topic-selector-example1/pom.xml b/examples/jms/topic-selector-example1/pom.xml index 73782ab34a..1779b3b5f3 100644 --- a/examples/jms/topic-selector-example1/pom.xml +++ b/examples/jms/topic-selector-example1/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.TopicSelectorExample1 - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/topic-selector-example1/src/main/java/org/apache/activemq/jms/example/TopicSelectorExample1.java b/examples/jms/topic-selector-example1/src/main/java/org/apache/activemq/jms/example/TopicSelectorExample1.java index 475d50f329..9cda2da95d 100644 --- a/examples/jms/topic-selector-example1/src/main/java/org/apache/activemq/jms/example/TopicSelectorExample1.java +++ b/examples/jms/topic-selector-example1/src/main/java/org/apache/activemq/jms/example/TopicSelectorExample1.java @@ -52,10 +52,10 @@ public class TopicSelectorExample1 extends ActiveMQExample initialContext = getContext(0); // Step 2. Look-up the JMS topic - Topic topic = (Topic)initialContext.lookup("/topic/exampleTopic"); + Topic topic = (Topic)initialContext.lookup("topic/exampleTopic"); // Step 3. Look-up the JMS connection factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS connection connection = cf.createConnection(); diff --git a/examples/jms/topic-selector-example1/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/topic-selector-example1/src/main/resources/hornetq/server0/activemq-jms.xml index 1dd09a682e..ab4841d633 100644 --- a/examples/jms/topic-selector-example1/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/topic-selector-example1/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/topic-selector-example2/pom.xml b/examples/jms/topic-selector-example2/pom.xml index 7e9c9a1751..8f43b603ee 100644 --- a/examples/jms/topic-selector-example2/pom.xml +++ b/examples/jms/topic-selector-example2/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.TopicSelectorExample2 - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/topic-selector-example2/src/main/java/org/apache/activemq/jms/example/TopicSelectorExample2.java b/examples/jms/topic-selector-example2/src/main/java/org/apache/activemq/jms/example/TopicSelectorExample2.java index 3ba729d4c1..e322ea17d8 100644 --- a/examples/jms/topic-selector-example2/src/main/java/org/apache/activemq/jms/example/TopicSelectorExample2.java +++ b/examples/jms/topic-selector-example2/src/main/java/org/apache/activemq/jms/example/TopicSelectorExample2.java @@ -55,10 +55,10 @@ public class TopicSelectorExample2 extends ActiveMQExample initialContext = getContext(0); // Step 2. perform a lookup on the topic - Topic topic = (Topic)initialContext.lookup("/topic/exampleTopic"); + Topic topic = (Topic)initialContext.lookup("topic/exampleTopic"); // Step 3. perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/topic-selector-example2/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/topic-selector-example2/src/main/resources/hornetq/server0/activemq-jms.xml index 1dd09a682e..ab4841d633 100644 --- a/examples/jms/topic-selector-example2/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/topic-selector-example2/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/topic/pom.xml b/examples/jms/topic/pom.xml index 51368c8122..f7b848676f 100644 --- a/examples/jms/topic/pom.xml +++ b/examples/jms/topic/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.TopicExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/topic/src/main/java/org/apache/activemq/jms/example/TopicExample.java b/examples/jms/topic/src/main/java/org/apache/activemq/jms/example/TopicExample.java index 761a5fac43..c7296384c4 100644 --- a/examples/jms/topic/src/main/java/org/apache/activemq/jms/example/TopicExample.java +++ b/examples/jms/topic/src/main/java/org/apache/activemq/jms/example/TopicExample.java @@ -50,10 +50,10 @@ public class TopicExample extends ActiveMQExample initialContext = getContext(0); // Step 2. perform a lookup on the topic - Topic topic = (Topic)initialContext.lookup("/topic/exampleTopic"); + Topic topic = (Topic)initialContext.lookup("topic/exampleTopic"); // Step 3. perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS Connection connection = cf.createConnection(); diff --git a/examples/jms/topic/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/topic/src/main/resources/hornetq/server0/activemq-jms.xml index 1dd09a682e..ab4841d633 100644 --- a/examples/jms/topic/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/topic/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/topic/src/main/resources/hornetq/server0/client-jndi.properties b/examples/jms/topic/src/main/resources/hornetq/server0/client-jndi.properties index 080524fbb8..6940f75d77 100644 --- a/examples/jms/topic/src/main/resources/hornetq/server0/client-jndi.properties +++ b/examples/jms/topic/src/main/resources/hornetq/server0/client-jndi.properties @@ -1,3 +1,2 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.provider.url=jnp://localhost:1099 -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory +java.naming.provider.url=tcp://localhost:5445 \ No newline at end of file diff --git a/examples/jms/transaction-failover/pom.xml b/examples/jms/transaction-failover/pom.xml index 1e72729083..177667e188 100644 --- a/examples/jms/transaction-failover/pom.xml +++ b/examples/jms/transaction-failover/pom.xml @@ -79,8 +79,8 @@ org.apache.activemq.jms.example.TransactionFailoverExample - jnp://localhost:1099 - jnp://localhost:1199 + tcp://localhost:5445 + tcp://localhost:5446 @@ -145,11 +145,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/transaction-failover/src/main/java/org/apache/activemq/jms/example/TransactionFailoverExample.java b/examples/jms/transaction-failover/src/main/java/org/apache/activemq/jms/example/TransactionFailoverExample.java index 5321f382cf..3f31b6e2fb 100644 --- a/examples/jms/transaction-failover/src/main/java/org/apache/activemq/jms/example/TransactionFailoverExample.java +++ b/examples/jms/transaction-failover/src/main/java/org/apache/activemq/jms/example/TransactionFailoverExample.java @@ -57,8 +57,8 @@ public class TransactionFailoverExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look-up the JMS resources from JNDI - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); - ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); + ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 3. We create a JMS Connection connection = connectionFactory.createConnection(); diff --git a/examples/jms/transaction-failover/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/transaction-failover/src/main/resources/hornetq/server0/activemq-jms.xml index a4c9e68a69..0d5c9537fb 100644 --- a/examples/jms/transaction-failover/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/transaction-failover/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,31 +1,8 @@ - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/transaction-failover/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/transaction-failover/src/main/resources/hornetq/server1/activemq-jms.xml index a4c9e68a69..0d5c9537fb 100644 --- a/examples/jms/transaction-failover/src/main/resources/hornetq/server1/activemq-jms.xml +++ b/examples/jms/transaction-failover/src/main/resources/hornetq/server1/activemq-jms.xml @@ -1,31 +1,8 @@ - - - - - - - - - - true - - 1000 - - - 1.0 - - - -1 - - - - + diff --git a/examples/jms/transactional/pom.xml b/examples/jms/transactional/pom.xml index f0925e0445..fd165b6f5e 100644 --- a/examples/jms/transactional/pom.xml +++ b/examples/jms/transactional/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.TransactionalExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/transactional/src/main/java/org/apache/activemq/jms/example/TransactionalExample.java b/examples/jms/transactional/src/main/java/org/apache/activemq/jms/example/TransactionalExample.java index 1a31cc65b1..d23f6b10a4 100644 --- a/examples/jms/transactional/src/main/java/org/apache/activemq/jms/example/TransactionalExample.java +++ b/examples/jms/transactional/src/main/java/org/apache/activemq/jms/example/TransactionalExample.java @@ -50,10 +50,10 @@ public class TransactionalExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Look-up the JMS topic - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Look-up the JMS connection factory - ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory"); + ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory"); // Step 4. Create a JMS connection connection = cf.createConnection(); diff --git a/examples/jms/transactional/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/transactional/src/main/resources/hornetq/server0/activemq-jms.xml index 452b958e9e..847659f7ad 100644 --- a/examples/jms/transactional/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/transactional/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/jms/xa-heuristic/pom.xml b/examples/jms/xa-heuristic/pom.xml index 64bb8a8be7..38e545e2c0 100644 --- a/examples/jms/xa-heuristic/pom.xml +++ b/examples/jms/xa-heuristic/pom.xml @@ -75,7 +75,7 @@ org.apache.activemq.jms.example.XAHeuristicExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -122,11 +122,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/jms/example/XAHeuristicExample.java b/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/jms/example/XAHeuristicExample.java index 2766aa528d..3a70346bb7 100644 --- a/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/jms/example/XAHeuristicExample.java +++ b/examples/jms/xa-heuristic/src/main/java/org/apache/activemq/jms/example/XAHeuristicExample.java @@ -74,10 +74,10 @@ public class XAHeuristicExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the XA Connection Factory - XAConnectionFactory cf = (XAConnectionFactory)initialContext.lookup("/XAConnectionFactory"); + XAConnectionFactory cf = (XAConnectionFactory)initialContext.lookup("XAConnectionFactory"); // Step 4.Create a JMS XAConnection connection = cf.createXAConnection(); diff --git a/examples/jms/xa-heuristic/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/xa-heuristic/src/main/resources/hornetq/server0/activemq-jms.xml index a0cf7b1d7c..0d5c9537fb 100644 --- a/examples/jms/xa-heuristic/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/xa-heuristic/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,20 +1,8 @@ - - - true - - - - - - - - - - + diff --git a/examples/jms/xa-receive/pom.xml b/examples/jms/xa-receive/pom.xml index a5e45be36c..0fddd12a31 100644 --- a/examples/jms/xa-receive/pom.xml +++ b/examples/jms/xa-receive/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.XAReceiveExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/xa-receive/src/main/java/org/apache/activemq/jms/example/XAReceiveExample.java b/examples/jms/xa-receive/src/main/java/org/apache/activemq/jms/example/XAReceiveExample.java index 65c02d2ddc..87e92f5872 100644 --- a/examples/jms/xa-receive/src/main/java/org/apache/activemq/jms/example/XAReceiveExample.java +++ b/examples/jms/xa-receive/src/main/java/org/apache/activemq/jms/example/XAReceiveExample.java @@ -59,10 +59,10 @@ public class XAReceiveExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the XA Connection Factory - XAConnectionFactory cf = (XAConnectionFactory)initialContext.lookup("/XAConnectionFactory"); + XAConnectionFactory cf = (XAConnectionFactory)initialContext.lookup("XAConnectionFactory"); // Step 4.Create a JMS XAConnection connection = cf.createXAConnection(); diff --git a/examples/jms/xa-receive/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/xa-receive/src/main/resources/hornetq/server0/activemq-jms.xml index a0cf7b1d7c..0d5c9537fb 100644 --- a/examples/jms/xa-receive/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/xa-receive/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,20 +1,8 @@ - - - true - - - - - - - - - - + diff --git a/examples/jms/xa-send/pom.xml b/examples/jms/xa-send/pom.xml index 48e12eb9ac..2e4fadb6b4 100644 --- a/examples/jms/xa-send/pom.xml +++ b/examples/jms/xa-send/pom.xml @@ -52,7 +52,7 @@ org.apache.activemq.jms.example.XASendExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -99,11 +99,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/xa-send/src/main/java/org/apache/activemq/jms/example/XASendExample.java b/examples/jms/xa-send/src/main/java/org/apache/activemq/jms/example/XASendExample.java index b99c3123ac..b5928262f4 100644 --- a/examples/jms/xa-send/src/main/java/org/apache/activemq/jms/example/XASendExample.java +++ b/examples/jms/xa-send/src/main/java/org/apache/activemq/jms/example/XASendExample.java @@ -65,10 +65,10 @@ public class XASendExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the XA Connection Factory - XAConnectionFactory cf = (XAConnectionFactory)initialContext.lookup("/XAConnectionFactory"); + XAConnectionFactory cf = (XAConnectionFactory)initialContext.lookup("XAConnectionFactory"); // Step 4.Create a JMS XAConnection connection = cf.createXAConnection(); diff --git a/examples/jms/xa-send/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/xa-send/src/main/resources/hornetq/server0/activemq-jms.xml index a0cf7b1d7c..0d5c9537fb 100644 --- a/examples/jms/xa-send/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/xa-send/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,20 +1,8 @@ - - - true - - - - - - - - - - + diff --git a/examples/jms/xa-with-jta/pom.xml b/examples/jms/xa-with-jta/pom.xml index 08c7f11a0f..9410de33f7 100644 --- a/examples/jms/xa-with-jta/pom.xml +++ b/examples/jms/xa-with-jta/pom.xml @@ -61,7 +61,7 @@ org.apache.activemq.jms.example.XAwithJTAExample - jnp://localhost:1099 + tcp://localhost:5445 @@ -108,11 +108,6 @@ jboss-jms-api 1.1.0.GA - - org.jboss.naming - jnpserver - 5.0.3.GA - false diff --git a/examples/jms/xa-with-jta/src/main/java/org/apache/activemq/jms/example/XAwithJTAExample.java b/examples/jms/xa-with-jta/src/main/java/org/apache/activemq/jms/example/XAwithJTAExample.java index 5940667e9a..1ec8b40e9f 100644 --- a/examples/jms/xa-with-jta/src/main/java/org/apache/activemq/jms/example/XAwithJTAExample.java +++ b/examples/jms/xa-with-jta/src/main/java/org/apache/activemq/jms/example/XAwithJTAExample.java @@ -59,10 +59,10 @@ public class XAwithJTAExample extends ActiveMQExample initialContext = getContext(0); // Step 2. Lookup on the queue - Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue"); + Queue queue = (Queue)initialContext.lookup("queue/exampleQueue"); // Step 3. Perform a lookup on the XA Connection Factory - XAConnectionFactory cf = (XAConnectionFactory)initialContext.lookup("/XAConnectionFactory"); + XAConnectionFactory cf = (XAConnectionFactory)initialContext.lookup("XAConnectionFactory"); // Step 4.Create a JMS XAConnection connection = cf.createXAConnection(); diff --git a/examples/jms/xa-with-jta/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/xa-with-jta/src/main/resources/hornetq/server0/activemq-jms.xml index a0cf7b1d7c..0d5c9537fb 100644 --- a/examples/jms/xa-with-jta/src/main/resources/hornetq/server0/activemq-jms.xml +++ b/examples/jms/xa-with-jta/src/main/resources/hornetq/server0/activemq-jms.xml @@ -1,20 +1,8 @@ - - - true - - - - - - - - - - + diff --git a/examples/soak/normal/pom.xml b/examples/soak/normal/pom.xml index d8b8ea0b96..a33fdfefe9 100644 --- a/examples/soak/normal/pom.xml +++ b/examples/soak/normal/pom.xml @@ -50,11 +50,6 @@ netty-all ${netty.version} - - org.jboss.naming - jnpserver - 5.0.3.GA - false @@ -99,7 +94,7 @@ org.apache.activemq.jms.soak.example.SoakReceiver - jnp://localhost:1099 + tcp://localhost:5445 @@ -111,7 +106,7 @@ org.apache.activemq.jms.soak.example.SoakSender - jnp://localhost:1099 + tcp://localhost:5445 @@ -145,7 +140,7 @@ org.apache.activemq.jms.soak.example.SoakReceiver - jnp://localhost:1099 + tcp://localhost:5445 @@ -157,7 +152,7 @@ org.apache.activemq.jms.soak.example.SoakSender - jnp://localhost:1099 + tcp://localhost:5445 diff --git a/examples/soak/normal/server0/activemq-jms.xml b/examples/soak/normal/server0/activemq-jms.xml index d84281b6ae..5e29c134f7 100644 --- a/examples/soak/normal/server0/activemq-jms.xml +++ b/examples/soak/normal/server0/activemq-jms.xml @@ -1,23 +1,7 @@ - - - - - - - - - 1000 - 1.0 - -1 - true - 5000 - - - - + diff --git a/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakReceiver.java b/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakReceiver.java index 270d3ccd63..bc890b8569 100644 --- a/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakReceiver.java +++ b/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakReceiver.java @@ -52,7 +52,7 @@ public class SoakReceiver String jndiURL = System.getProperty("jndi.address"); if(jndiURL == null) { - jndiURL = args.length > 0 ? args[0] : "jnp://localhost:1099"; + jndiURL = args.length > 0 ? args[0] : "tcp://localhost:5445"; } System.out.println("Connecting to JNDI at " + jndiURL); @@ -65,8 +65,7 @@ public class SoakReceiver Hashtable jndiProps = new Hashtable(); jndiProps.put("java.naming.provider.url", jndiURL); - jndiProps.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); - jndiProps.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); + jndiProps.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); final SoakReceiver receiver = new SoakReceiver(jndiProps, params); diff --git a/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakSender.java b/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakSender.java index ad0351cae3..360f88f39b 100644 --- a/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakSender.java +++ b/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakSender.java @@ -44,7 +44,7 @@ public class SoakSender String jndiURL = System.getProperty("jndi.address"); if(jndiURL == null) { - jndiURL = args.length > 0 ? args[0] : "jnp://localhost:1099"; + jndiURL = args.length > 0 ? args[0] : "tcp://localhost:5445"; } System.out.println("Connecting to JNDI at " + jndiURL); @@ -56,8 +56,7 @@ public class SoakSender Hashtable jndiProps = new Hashtable(); jndiProps.put("java.naming.provider.url", jndiURL); - jndiProps.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); - jndiProps.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); + jndiProps.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); final SoakSender sender = new SoakSender(jndiProps, params); diff --git a/pom.xml b/pom.xml index 55dafc6845..c868686917 100644 --- a/pom.xml +++ b/pom.xml @@ -381,17 +381,6 @@ - - org.jboss.naming - jnpserver - 5.0.3.GA - - - org.jboss.logging - jboss-logging-spi - - - apache-logging commons-logging diff --git a/tests/byteman-tests/pom.xml b/tests/byteman-tests/pom.xml index f6b848f57a..02e9d1bddf 100644 --- a/tests/byteman-tests/pom.xml +++ b/tests/byteman-tests/pom.xml @@ -118,10 +118,6 @@ org.jboss.security jbosssx - - org.jboss.naming - jnpserver - apache-logging commons-logging diff --git a/tests/config/server-start-stop-backup-jms-config1.xml b/tests/config/server-start-stop-backup-jms-config1.xml index 06291bed1e..12b78eac77 100644 --- a/tests/config/server-start-stop-backup-jms-config1.xml +++ b/tests/config/server-start-stop-backup-jms-config1.xml @@ -1,16 +1,7 @@ - - - - - - - - - - + - - - - - - - - - - - - + \ No newline at end of file diff --git a/tests/integration-tests/pom.xml b/tests/integration-tests/pom.xml index d09a5751a9..83848d88fb 100644 --- a/tests/integration-tests/pom.xml +++ b/tests/integration-tests/pom.xml @@ -48,6 +48,13 @@ org.apache.activemq activemq-jms-server ${project.version} + + + + org.jboss.spec.javax.resource + jboss-connector-api_1.5_spec + + org.apache.activemq diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java new file mode 100644 index 0000000000..680d429710 --- /dev/null +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java @@ -0,0 +1,722 @@ +/** + * 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. + */ +package org.apache.activemq.tests.integration.jms; + +import javax.jms.ConnectionFactory; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Queue; +import javax.jms.Topic; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; + +import org.apache.activemq.api.config.ActiveMQDefaultConfiguration; +import org.apache.activemq.api.core.BroadcastGroupConfiguration; +import org.apache.activemq.api.core.DiscoveryGroupConfiguration; +import org.apache.activemq.api.core.TransportConfiguration; +import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration; +import org.apache.activemq.api.jms.JMSFactoryType; +import org.apache.activemq.core.config.Configuration; +import org.apache.activemq.core.config.ha.SharedStoreMasterPolicyConfiguration; +import org.apache.activemq.core.remoting.impl.netty.TransportConstants; +import org.apache.activemq.core.server.ActiveMQServer; +import org.apache.activemq.core.server.ActiveMQServers; +import org.apache.activemq.jms.client.ActiveMQConnectionFactory; +import org.apache.activemq.jndi.ActiveMQInitialContextFactory; +import org.apache.activemq.tests.util.RandomUtil; +import org.apache.activemq.tests.util.UnitTestCase; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * + * A ActiveMQConnectionFactoryTest + * + * @author Tim Fox + * + * + */ +public class SimpleJNDIClientTest extends UnitTestCase +{ + private final String groupAddress = getUDPDiscoveryAddress(); + + private final int groupPort = getUDPDiscoveryPort(); + + private ActiveMQServer liveService; + + private TransportConfiguration liveTC; + + @Test + public void testDefaultConnectionFactories() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + Context ctx = new InitialContext(props); + + ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("ConnectionFactory"); + Assert.assertEquals(JMSFactoryType.CF.intValue(), ((ActiveMQConnectionFactory)connectionFactory).getFactoryType()); + connectionFactory.createConnection().close(); + + connectionFactory = (ConnectionFactory) ctx.lookup("XAConnectionFactory"); + Assert.assertEquals(JMSFactoryType.XA_CF.intValue(), ((ActiveMQConnectionFactory)connectionFactory).getFactoryType()); + connectionFactory.createConnection().close(); + + connectionFactory = (ConnectionFactory) ctx.lookup("TopicConnectionFactory"); + Assert.assertEquals(JMSFactoryType.TOPIC_CF.intValue(), ((ActiveMQConnectionFactory)connectionFactory).getFactoryType()); + connectionFactory.createConnection().close(); + + connectionFactory = (ConnectionFactory) ctx.lookup("QueueConnectionFactory"); + Assert.assertEquals(JMSFactoryType.QUEUE_CF.intValue(), ((ActiveMQConnectionFactory)connectionFactory).getFactoryType()); + connectionFactory.createConnection().close(); + } + + @Test + public void testCustomCF() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory"); + props.put("connection.myConnectionFactory.type", "CF"); + Context ctx = new InitialContext(props); + + ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("myConnectionFactory"); + + Assert.assertEquals(JMSFactoryType.CF.intValue(), ((ActiveMQConnectionFactory)connectionFactory).getFactoryType()); + + connectionFactory.createConnection().close(); + } + + @Test + public void testVMCF0() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(Context.PROVIDER_URL, "vm://0"); + Context ctx = new InitialContext(props); + + ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("ConnectionFactory"); + + connectionFactory.createConnection().close(); + } + + @Test + public void testVMCF1() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(Context.PROVIDER_URL, "vm://1"); + Context ctx = new InitialContext(props); + + ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("ConnectionFactory"); + + connectionFactory.createConnection().close(); + } + + @Test + public void testXACF() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory"); + props.put("connection.myConnectionFactory.type", "XA_CF"); + Context ctx = new InitialContext(props); + + ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory"); + + Assert.assertEquals(JMSFactoryType.XA_CF.intValue(), connectionFactory.getFactoryType()); + } + + @Test + public void testQueueCF() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory"); + props.put("connection.myConnectionFactory.type", "QUEUE_CF"); + Context ctx = new InitialContext(props); + + ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory"); + + Assert.assertEquals(JMSFactoryType.QUEUE_CF.intValue(), connectionFactory.getFactoryType()); + } + + @Test + public void testQueueXACF() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory"); + props.put("connection.myConnectionFactory.type", "QUEUE_XA_CF"); + Context ctx = new InitialContext(props); + + ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory"); + + Assert.assertEquals(JMSFactoryType.QUEUE_XA_CF.intValue(), connectionFactory.getFactoryType()); + } + + @Test + public void testTopicCF() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory"); + props.put("connection.myConnectionFactory.type", "TOPIC_CF"); + Context ctx = new InitialContext(props); + + ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory"); + + Assert.assertEquals(JMSFactoryType.TOPIC_CF.intValue(), connectionFactory.getFactoryType()); + } + + @Test + public void testTopicXACF() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory"); + props.put("connection.myConnectionFactory.type", "TOPIC_XA_CF"); + Context ctx = new InitialContext(props); + + ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory"); + + Assert.assertEquals(JMSFactoryType.TOPIC_XA_CF.intValue(), connectionFactory.getFactoryType()); + } + + @Test + public void testCFWithProperties() throws NamingException, JMSException + { + // we don't test the 'ha' property here because it's not supported on a local connection factory (i.e. one + // constructed from an InitialContext where the environment doesn't contain the property "java.naming.provider.url") + + long callFailoverTimeout = RandomUtil.randomPositiveLong(); + long callTimeout = RandomUtil.randomPositiveLong(); + long clientFailureCheckPeriod = RandomUtil.randomPositiveLong(); + String clientID = RandomUtil.randomString(); + int confirmationWindowSize = RandomUtil.randomPositiveInt(); + String connectionLoadBalancingPolicyClassName = RandomUtil.randomString(); + long connectionTTL = RandomUtil.randomPositiveLong(); + int consumerMaxRate = RandomUtil.randomPositiveInt(); + int consumerWindowSize = RandomUtil.randomPositiveInt(); + int minLargeMessageSize = RandomUtil.randomPositiveInt(); + int dupsOKBatchSize = RandomUtil.randomPositiveInt(); + String groupID = RandomUtil.randomString(); + int initialConnectAttempts = RandomUtil.randomPositiveInt(); + int initialMessagePacketSize = RandomUtil.randomPositiveInt(); + long maxRetryInterval = RandomUtil.randomPositiveLong(); + int producerMaxRate = RandomUtil.randomPositiveInt(); + int producerWindowSize = RandomUtil.randomPositiveInt(); + int reconnectAttempts = RandomUtil.randomPositiveInt(); + long retryInterval = RandomUtil.randomPositiveLong(); + double retryIntervalMultiplier = RandomUtil.randomDouble(); + int scheduledThreadPoolMaxSize = RandomUtil.randomPositiveInt(); + int threadPoolMaxSize = RandomUtil.randomPositiveInt(); + int transactionBatchSize = RandomUtil.randomPositiveInt(); + boolean autoGroup = RandomUtil.randomBoolean(); + boolean blockOnAcknowledge = RandomUtil.randomBoolean(); + boolean blockOnDurableSend = RandomUtil.randomBoolean(); + boolean blockOnNonDurableSend = RandomUtil.randomBoolean(); + boolean cacheLargeMessagesClient = RandomUtil.randomBoolean(); + boolean compressLargeMessage = RandomUtil.randomBoolean(); + boolean failoverOnInitialConnection = RandomUtil.randomBoolean(); + boolean preAcknowledge = RandomUtil.randomBoolean(); + boolean useGlobalPools = RandomUtil.randomBoolean(); + + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory"); + props.put("connection.myConnectionFactory.callFailoverTimeout", callFailoverTimeout); + props.put("connection.myConnectionFactory.callTimeout", callTimeout); + props.put("connection.myConnectionFactory.clientFailureCheckPeriod", clientFailureCheckPeriod); + props.put("connection.myConnectionFactory.clientID", clientID); + props.put("connection.myConnectionFactory.confirmationWindowSize", confirmationWindowSize); + props.put("connection.myConnectionFactory.connectionLoadBalancingPolicyClassName", connectionLoadBalancingPolicyClassName); + props.put("connection.myConnectionFactory.connectionTTL", connectionTTL); + props.put("connection.myConnectionFactory.consumerMaxRate", consumerMaxRate); + props.put("connection.myConnectionFactory.consumerWindowSize", consumerWindowSize); + props.put("connection.myConnectionFactory.minLargeMessageSize", minLargeMessageSize); + props.put("connection.myConnectionFactory.dupsOKBatchSize", dupsOKBatchSize); + props.put("connection.myConnectionFactory.groupID", groupID); + props.put("connection.myConnectionFactory.initialConnectAttempts", initialConnectAttempts); + props.put("connection.myConnectionFactory.initialMessagePacketSize", initialMessagePacketSize); + props.put("connection.myConnectionFactory.maxRetryInterval", maxRetryInterval); + props.put("connection.myConnectionFactory.producerMaxRate", producerMaxRate); + props.put("connection.myConnectionFactory.producerWindowSize", producerWindowSize); + props.put("connection.myConnectionFactory.reconnectAttempts", reconnectAttempts); + props.put("connection.myConnectionFactory.retryInterval", retryInterval); + props.put("connection.myConnectionFactory.retryIntervalMultiplier", retryIntervalMultiplier); + props.put("connection.myConnectionFactory.scheduledThreadPoolMaxSize", scheduledThreadPoolMaxSize); + props.put("connection.myConnectionFactory.threadPoolMaxSize", threadPoolMaxSize); + props.put("connection.myConnectionFactory.transactionBatchSize", transactionBatchSize); + props.put("connection.myConnectionFactory.blockOnAcknowledge", blockOnAcknowledge); + props.put("connection.myConnectionFactory.blockOnDurableSend", blockOnDurableSend); + props.put("connection.myConnectionFactory.blockOnNonDurableSend", blockOnNonDurableSend); + props.put("connection.myConnectionFactory.cacheLargeMessagesClient", cacheLargeMessagesClient); + props.put("connection.myConnectionFactory.compressLargeMessage", compressLargeMessage); + props.put("connection.myConnectionFactory.failoverOnInitialConnection", failoverOnInitialConnection); + props.put("connection.myConnectionFactory.autoGroup", autoGroup); + props.put("connection.myConnectionFactory.preAcknowledge", preAcknowledge); + props.put("connection.myConnectionFactory.useGlobalPools", useGlobalPools); + Context ctx = new InitialContext(props); + + ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory"); + + Assert.assertEquals(callFailoverTimeout, cf.getCallFailoverTimeout()); + Assert.assertEquals(callTimeout, cf.getCallTimeout()); + Assert.assertEquals(clientFailureCheckPeriod, cf.getClientFailureCheckPeriod()); + Assert.assertEquals(clientID, cf.getClientID()); + Assert.assertEquals(confirmationWindowSize, cf.getConfirmationWindowSize()); + Assert.assertEquals(connectionLoadBalancingPolicyClassName, cf.getConnectionLoadBalancingPolicyClassName()); + Assert.assertEquals(connectionTTL, cf.getConnectionTTL()); + Assert.assertEquals(consumerMaxRate, cf.getConsumerMaxRate()); + Assert.assertEquals(consumerWindowSize, cf.getConsumerWindowSize()); + Assert.assertEquals(minLargeMessageSize, cf.getMinLargeMessageSize()); + Assert.assertEquals(dupsOKBatchSize, cf.getDupsOKBatchSize()); + Assert.assertEquals(groupID, cf.getGroupID()); + Assert.assertEquals(initialConnectAttempts, cf.getInitialConnectAttempts()); + Assert.assertEquals(initialMessagePacketSize, cf.getInitialMessagePacketSize()); + Assert.assertEquals(maxRetryInterval, cf.getMaxRetryInterval()); + Assert.assertEquals(producerMaxRate, cf.getProducerMaxRate()); + Assert.assertEquals(producerWindowSize, cf.getProducerWindowSize()); + Assert.assertEquals(reconnectAttempts, cf.getReconnectAttempts()); + Assert.assertEquals(retryInterval, cf.getRetryInterval()); + Assert.assertEquals(retryIntervalMultiplier, cf.getRetryIntervalMultiplier(), 0.0001); + Assert.assertEquals(scheduledThreadPoolMaxSize, cf.getScheduledThreadPoolMaxSize()); + Assert.assertEquals(threadPoolMaxSize, cf.getThreadPoolMaxSize()); + Assert.assertEquals(transactionBatchSize, cf.getTransactionBatchSize()); + Assert.assertEquals(autoGroup, cf.isAutoGroup()); + Assert.assertEquals(blockOnAcknowledge, cf.isBlockOnAcknowledge()); + Assert.assertEquals(blockOnDurableSend, cf.isBlockOnDurableSend()); + Assert.assertEquals(blockOnNonDurableSend, cf.isBlockOnNonDurableSend()); + Assert.assertEquals(cacheLargeMessagesClient, cf.isCacheLargeMessagesClient()); + Assert.assertEquals(compressLargeMessage, cf.isCompressLargeMessage()); + Assert.assertEquals(failoverOnInitialConnection, cf.isFailoverOnInitialConnection()); + Assert.assertEquals(preAcknowledge, cf.isPreAcknowledge()); + Assert.assertEquals(useGlobalPools, cf.isUseGlobalPools()); + } + + @Test + public void testCFWithStringProperties() throws NamingException, JMSException + { + // we don't test the 'ha' property here because it's not supported on a local connection factory (i.e. one + // constructed from an InitialContext where the environment doesn't contain the property "java.naming.provider.url") + + String callFailoverTimeout = Long.toString(RandomUtil.randomPositiveLong()); + String callTimeout = Long.toString(RandomUtil.randomPositiveLong()); + String clientFailureCheckPeriod = Long.toString(RandomUtil.randomPositiveLong()); + String clientID = RandomUtil.randomString(); + String confirmationWindowSize = Integer.toString(RandomUtil.randomPositiveInt()); + String connectionLoadBalancingPolicyClassName = RandomUtil.randomString(); + String connectionTTL = Long.toString(RandomUtil.randomPositiveLong()); + String consumerMaxRate = Integer.toString(RandomUtil.randomPositiveInt()); + String consumerWindowSize = Integer.toString(RandomUtil.randomPositiveInt()); + String minLargeMessageSize = Integer.toString(RandomUtil.randomPositiveInt()); + String dupsOKBatchSize = Integer.toString(RandomUtil.randomPositiveInt()); + String groupID = RandomUtil.randomString(); + String initialConnectAttempts = Integer.toString(RandomUtil.randomPositiveInt()); + String initialMessagePacketSize = Integer.toString(RandomUtil.randomPositiveInt()); + String maxRetryInterval = Long.toString(RandomUtil.randomPositiveLong()); + String producerMaxRate = Integer.toString(RandomUtil.randomPositiveInt()); + String producerWindowSize = Integer.toString(RandomUtil.randomPositiveInt()); + String reconnectAttempts = Integer.toString(RandomUtil.randomPositiveInt()); + String retryInterval = Long.toString(RandomUtil.randomPositiveLong()); + String retryIntervalMultiplier = Double.toString(RandomUtil.randomDouble()); + String scheduledThreadPoolMaxSize = Integer.toString(RandomUtil.randomPositiveInt()); + String threadPoolMaxSize = Integer.toString(RandomUtil.randomPositiveInt()); + String transactionBatchSize = Integer.toString(RandomUtil.randomPositiveInt()); + String autoGroup = Boolean.toString(RandomUtil.randomBoolean()); + String blockOnAcknowledge = Boolean.toString(RandomUtil.randomBoolean()); + String blockOnDurableSend = Boolean.toString(RandomUtil.randomBoolean()); + String blockOnNonDurableSend = Boolean.toString(RandomUtil.randomBoolean()); + String cacheLargeMessagesClient = Boolean.toString(RandomUtil.randomBoolean()); + String compressLargeMessage = Boolean.toString(RandomUtil.randomBoolean()); + String failoverOnInitialConnection = Boolean.toString(RandomUtil.randomBoolean()); + String preAcknowledge = Boolean.toString(RandomUtil.randomBoolean()); + String useGlobalPools = Boolean.toString(RandomUtil.randomBoolean()); + + Hashtable props = new Hashtable(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory"); + props.put("connection.myConnectionFactory.callFailoverTimeout", callFailoverTimeout); + props.put("connection.myConnectionFactory.callTimeout", callTimeout); + props.put("connection.myConnectionFactory.clientFailureCheckPeriod", clientFailureCheckPeriod); + props.put("connection.myConnectionFactory.clientID", clientID); + props.put("connection.myConnectionFactory.confirmationWindowSize", confirmationWindowSize); + props.put("connection.myConnectionFactory.connectionLoadBalancingPolicyClassName", connectionLoadBalancingPolicyClassName); + props.put("connection.myConnectionFactory.connectionTTL", connectionTTL); + props.put("connection.myConnectionFactory.consumerMaxRate", consumerMaxRate); + props.put("connection.myConnectionFactory.consumerWindowSize", consumerWindowSize); + props.put("connection.myConnectionFactory.minLargeMessageSize", minLargeMessageSize); + props.put("connection.myConnectionFactory.dupsOKBatchSize", dupsOKBatchSize); + props.put("connection.myConnectionFactory.groupID", groupID); + props.put("connection.myConnectionFactory.initialConnectAttempts", initialConnectAttempts); + props.put("connection.myConnectionFactory.initialMessagePacketSize", initialMessagePacketSize); + props.put("connection.myConnectionFactory.maxRetryInterval", maxRetryInterval); + props.put("connection.myConnectionFactory.producerMaxRate", producerMaxRate); + props.put("connection.myConnectionFactory.producerWindowSize", producerWindowSize); + props.put("connection.myConnectionFactory.reconnectAttempts", reconnectAttempts); + props.put("connection.myConnectionFactory.retryInterval", retryInterval); + props.put("connection.myConnectionFactory.retryIntervalMultiplier", retryIntervalMultiplier); + props.put("connection.myConnectionFactory.scheduledThreadPoolMaxSize", scheduledThreadPoolMaxSize); + props.put("connection.myConnectionFactory.threadPoolMaxSize", threadPoolMaxSize); + props.put("connection.myConnectionFactory.transactionBatchSize", transactionBatchSize); + props.put("connection.myConnectionFactory.blockOnAcknowledge", blockOnAcknowledge); + props.put("connection.myConnectionFactory.blockOnDurableSend", blockOnDurableSend); + props.put("connection.myConnectionFactory.blockOnNonDurableSend", blockOnNonDurableSend); + props.put("connection.myConnectionFactory.cacheLargeMessagesClient", cacheLargeMessagesClient); + props.put("connection.myConnectionFactory.compressLargeMessage", compressLargeMessage); + props.put("connection.myConnectionFactory.failoverOnInitialConnection", failoverOnInitialConnection); + props.put("connection.myConnectionFactory.autoGroup", autoGroup); + props.put("connection.myConnectionFactory.preAcknowledge", preAcknowledge); + props.put("connection.myConnectionFactory.useGlobalPools", useGlobalPools); + Context ctx = new InitialContext(props); + + ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory"); + + Assert.assertEquals(Long.parseLong(callFailoverTimeout), cf.getCallFailoverTimeout()); + Assert.assertEquals(Long.parseLong(callTimeout), cf.getCallTimeout()); + Assert.assertEquals(Long.parseLong(clientFailureCheckPeriod), cf.getClientFailureCheckPeriod()); + Assert.assertEquals(clientID, cf.getClientID()); + Assert.assertEquals(Integer.parseInt(confirmationWindowSize), cf.getConfirmationWindowSize()); + Assert.assertEquals(connectionLoadBalancingPolicyClassName, cf.getConnectionLoadBalancingPolicyClassName()); + Assert.assertEquals(Long.parseLong(connectionTTL), cf.getConnectionTTL()); + Assert.assertEquals(Integer.parseInt(consumerMaxRate), cf.getConsumerMaxRate()); + Assert.assertEquals(Integer.parseInt(consumerWindowSize), cf.getConsumerWindowSize()); + Assert.assertEquals(Integer.parseInt(minLargeMessageSize), cf.getMinLargeMessageSize()); + Assert.assertEquals(Integer.parseInt(dupsOKBatchSize), cf.getDupsOKBatchSize()); + Assert.assertEquals(groupID, cf.getGroupID()); + Assert.assertEquals(Integer.parseInt(initialConnectAttempts), cf.getInitialConnectAttempts()); + Assert.assertEquals(Integer.parseInt(initialMessagePacketSize), cf.getInitialMessagePacketSize()); + Assert.assertEquals(Long.parseLong(maxRetryInterval), cf.getMaxRetryInterval()); + Assert.assertEquals(Integer.parseInt(producerMaxRate), cf.getProducerMaxRate()); + Assert.assertEquals(Integer.parseInt(producerWindowSize), cf.getProducerWindowSize()); + Assert.assertEquals(Integer.parseInt(reconnectAttempts), cf.getReconnectAttempts()); + Assert.assertEquals(Long.parseLong(retryInterval), cf.getRetryInterval()); + Assert.assertEquals(Double.parseDouble(retryIntervalMultiplier), cf.getRetryIntervalMultiplier(), 0.0001); + Assert.assertEquals(Integer.parseInt(scheduledThreadPoolMaxSize), cf.getScheduledThreadPoolMaxSize()); + Assert.assertEquals(Integer.parseInt(threadPoolMaxSize), cf.getThreadPoolMaxSize()); + Assert.assertEquals(Integer.parseInt(transactionBatchSize), cf.getTransactionBatchSize()); + Assert.assertEquals(Boolean.parseBoolean(autoGroup), cf.isAutoGroup()); + Assert.assertEquals(Boolean.parseBoolean(blockOnAcknowledge), cf.isBlockOnAcknowledge()); + Assert.assertEquals(Boolean.parseBoolean(blockOnDurableSend), cf.isBlockOnDurableSend()); + Assert.assertEquals(Boolean.parseBoolean(blockOnNonDurableSend), cf.isBlockOnNonDurableSend()); + Assert.assertEquals(Boolean.parseBoolean(cacheLargeMessagesClient), cf.isCacheLargeMessagesClient()); + Assert.assertEquals(Boolean.parseBoolean(compressLargeMessage), cf.isCompressLargeMessage()); + Assert.assertEquals(Boolean.parseBoolean(failoverOnInitialConnection), cf.isFailoverOnInitialConnection()); + Assert.assertEquals(Boolean.parseBoolean(preAcknowledge), cf.isPreAcknowledge()); + Assert.assertEquals(Boolean.parseBoolean(useGlobalPools), cf.isUseGlobalPools()); + } + + @Test + public void testRemoteCFWithTCP() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(Context.PROVIDER_URL, "tcp://127.0.0.1:5445"); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory"); + Context ctx = new InitialContext(props); + + ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("myConnectionFactory"); + + connectionFactory.createConnection().close(); + } + + @Test + public void testRemoteCFWithTCPandHA() throws NamingException, JMSException + { + boolean ha = true; + + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(Context.PROVIDER_URL, "tcp://127.0.0.1:5445"); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory"); + props.put("connection.myConnectionFactory.ha", ha); + Context ctx = new InitialContext(props); + + ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory"); + + Assert.assertEquals(ha, cf.isHA()); + } + + @Test + public void testRemoteCFWithJGroups() throws Exception + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(Context.PROVIDER_URL, "jgroups://test-jgroups-file_ping.xml"); + Context ctx = new InitialContext(props); + + ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) ctx.lookup("ConnectionFactory"); + connectionFactory.getDiscoveryGroupConfiguration().getBroadcastEndpointFactoryConfiguration().createBroadcastEndpointFactory().createBroadcastEndpoint().close(false); + } + + @Test + public void testRemoteCFWithJgroupsWithTransportConfig() throws Exception + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName()); + props.put(Context.PROVIDER_URL, "jgroups://test-jgroups-file_ping.xml?" + + ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" + + ActiveMQInitialContextFactory.DISCOVERY_INITIAL_WAIT_TIMEOUT + "=6000"); + Context ctx = new InitialContext(props); + + ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("ConnectionFactory"); + + DiscoveryGroupConfiguration discoveryGroupConfiguration = cf.getDiscoveryGroupConfiguration(); + Assert.assertEquals(5000, discoveryGroupConfiguration.getRefreshTimeout()); + Assert.assertEquals(6000, discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout()); + + cf.getDiscoveryGroupConfiguration().getBroadcastEndpointFactoryConfiguration().createBroadcastEndpointFactory().createBroadcastEndpoint().close(false); + } + + @Test + public void testRemoteCFWithUDP() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(Context.PROVIDER_URL, "udp://" + getUDPDiscoveryAddress() + ":" + getUDPDiscoveryPort()); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory"); + Context ctx = new InitialContext(props); + + ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("myConnectionFactory"); + + connectionFactory.createConnection().close(); + } + + @Test + public void testRemoteCFWithUDPWithTransportConfig() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName()); + props.put(Context.PROVIDER_URL, "udp://" + getUDPDiscoveryAddress() + ":" + getUDPDiscoveryPort() + "?" + + TransportConstants.LOCAL_ADDRESS_PROP_NAME + "=127.0.0.1&" + + TransportConstants.LOCAL_PORT_PROP_NAME + "=1198&" + + ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" + + ActiveMQInitialContextFactory.DISCOVERY_INITIAL_WAIT_TIMEOUT + "=6000"); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory"); + Context ctx = new InitialContext(props); + + ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory"); + + DiscoveryGroupConfiguration discoveryGroupConfiguration = cf.getDiscoveryGroupConfiguration(); + Assert.assertEquals(5000, discoveryGroupConfiguration.getRefreshTimeout()); + Assert.assertEquals(6000, discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout()); + + UDPBroadcastGroupConfiguration udpBroadcastGroupConfiguration = (UDPBroadcastGroupConfiguration) discoveryGroupConfiguration.getBroadcastEndpointFactoryConfiguration(); + Assert.assertEquals("127.0.0.1", udpBroadcastGroupConfiguration.getLocalBindAddress()); + Assert.assertEquals(1198, udpBroadcastGroupConfiguration.getLocalBindPort()); + Assert.assertEquals(getUDPDiscoveryAddress(), udpBroadcastGroupConfiguration.getGroupAddress()); + Assert.assertEquals(getUDPDiscoveryPort(), udpBroadcastGroupConfiguration.getGroupPort()); + } + + @Test + public void testRemoteCFWithMultipleHosts() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(Context.PROVIDER_URL, "tcp://127.0.0.1:5445,127.0.0.2:5446"); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory"); + Context ctx = new InitialContext(props); + + ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("myConnectionFactory"); + + connectionFactory.createConnection().close(); + } + + @Test + public void testRemoteCFWithTransportConfig() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put(Context.PROVIDER_URL, "tcp://127.0.0.1:5445?" + + TransportConstants.SSL_ENABLED_PROP_NAME + "=mySSLEnabledPropValue&" + + TransportConstants.HTTP_ENABLED_PROP_NAME + "=myHTTPEnabledPropValue&" + + TransportConstants.HTTP_CLIENT_IDLE_PROP_NAME + "=myHTTPClientIdlePropValue&" + + TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD + "=myHTTPClientIdleScanPeriodValue&" + + TransportConstants.HTTP_REQUIRES_SESSION_ID + "=myHTTPRequiresSessionIDValue&" + + TransportConstants.HTTP_UPGRADE_ENABLED_PROP_NAME + "=myHTTPUpgradeEnabledPropValue&" + + TransportConstants.HTTP_UPGRADE_ENDPOINT_PROP_NAME + "=myHTTPUpgradeEndpointPropValue&" + + TransportConstants.USE_SERVLET_PROP_NAME + "=myUseServletPropValue&" + + TransportConstants.SERVLET_PATH + "=myServletPathValue&" + + TransportConstants.USE_NIO_PROP_NAME + "=myUseNIOPropValue&" + + TransportConstants.USE_NIO_GLOBAL_WORKER_POOL_PROP_NAME + "=myUseNIOGlobalWorkerPoolPropValue&" + + TransportConstants.LOCAL_ADDRESS_PROP_NAME + "=myLocalAddressPropValue&" + + TransportConstants.LOCAL_PORT_PROP_NAME + "=myLocalPortPropValue&" + + TransportConstants.KEYSTORE_PROVIDER_PROP_NAME + "=myKeystoreProviderPropValue&" + + TransportConstants.KEYSTORE_PATH_PROP_NAME + "=myKeystorePathPropValue&" + + TransportConstants.KEYSTORE_PASSWORD_PROP_NAME + "=myKeystorePasswordPropValue&" + + TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME + "=myTruststoreProviderPropValue&" + + TransportConstants.TRUSTSTORE_PATH_PROP_NAME + "=myTruststorePathPropValue&" + + TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME + "=myTruststorePasswordPropValue&" + + TransportConstants.ENABLED_CIPHER_SUITES_PROP_NAME + "=myEnabledCipherSuitesPropValue&" + + TransportConstants.ENABLED_PROTOCOLS_PROP_NAME + "=myEnabledProtocolsPropValue&" + + TransportConstants.TCP_NODELAY_PROPNAME + "=myTCPNoDelayPropValue&" + + TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME + "=myTCPSendbufferSizePropValue&" + + TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME + "=myTCPReceivebufferSizePropValue&" + + TransportConstants.NIO_REMOTING_THREADS_PROPNAME + "=myNIORemotingThreadsPropValue&" + + TransportConstants.BATCH_DELAY + "=myBatchDelay&" + + ActiveMQDefaultConfiguration.getPropMaskPassword() + "=myPropMaskPassword&" + + ActiveMQDefaultConfiguration.getPropPasswordCodec() + "=myPropPasswordCodec&" + + TransportConstants.NETTY_CONNECT_TIMEOUT + "=myNettyConnectTimeout&"); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory"); + Context ctx = new InitialContext(props); + + ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory"); + + Map parametersFromJNDI = cf.getServerLocator().getStaticTransportConfigurations()[0].getParams(); + + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.SSL_ENABLED_PROP_NAME), "mySSLEnabledPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.HTTP_ENABLED_PROP_NAME), "myHTTPEnabledPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.HTTP_CLIENT_IDLE_PROP_NAME), "myHTTPClientIdlePropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD), "myHTTPClientIdleScanPeriodValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.HTTP_REQUIRES_SESSION_ID), "myHTTPRequiresSessionIDValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.HTTP_UPGRADE_ENABLED_PROP_NAME), "myHTTPUpgradeEnabledPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.HTTP_UPGRADE_ENDPOINT_PROP_NAME), "myHTTPUpgradeEndpointPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.USE_SERVLET_PROP_NAME), "myUseServletPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.SERVLET_PATH), "myServletPathValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.USE_NIO_PROP_NAME), "myUseNIOPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.USE_NIO_GLOBAL_WORKER_POOL_PROP_NAME), "myUseNIOGlobalWorkerPoolPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.LOCAL_ADDRESS_PROP_NAME), "myLocalAddressPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.LOCAL_PORT_PROP_NAME), "myLocalPortPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.KEYSTORE_PROVIDER_PROP_NAME), "myKeystoreProviderPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.KEYSTORE_PATH_PROP_NAME), "myKeystorePathPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME), "myKeystorePasswordPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME), "myTruststoreProviderPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.TRUSTSTORE_PATH_PROP_NAME), "myTruststorePathPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME), "myTruststorePasswordPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.ENABLED_CIPHER_SUITES_PROP_NAME), "myEnabledCipherSuitesPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.ENABLED_PROTOCOLS_PROP_NAME), "myEnabledProtocolsPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.TCP_NODELAY_PROPNAME), "myTCPNoDelayPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME), "myTCPSendbufferSizePropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME), "myTCPReceivebufferSizePropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.NIO_REMOTING_THREADS_PROPNAME), "myNIORemotingThreadsPropValue"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.BATCH_DELAY), "myBatchDelay"); + Assert.assertEquals(parametersFromJNDI.get(ActiveMQDefaultConfiguration.getPropMaskPassword()), "myPropMaskPassword"); + Assert.assertEquals(parametersFromJNDI.get(ActiveMQDefaultConfiguration.getPropPasswordCodec()), "myPropPasswordCodec"); + Assert.assertEquals(parametersFromJNDI.get(TransportConstants.NETTY_CONNECT_TIMEOUT), "myNettyConnectTimeout"); + } + + @Override + @Before + public void setUp() throws Exception + { + super.setUp(); + + startServer(); + } + + private void startServer() throws Exception + { + liveTC = new TransportConfiguration(INVM_CONNECTOR_FACTORY); + Map connectors = new HashMap(); + connectors.put(liveTC.getName(), liveTC); + List connectorNames = new ArrayList(); + connectorNames.add(liveTC.getName()); + + Map params = new HashMap(); + params.put("server-id", 1); + + Configuration liveConf = createBasicConfig() + .addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY)) + .addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params)) + .addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY)) + .setConnectorConfigurations(connectors) + .setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()); + + final long broadcastPeriod = 250; + + final String bcGroupName = "bc1"; + + final int localBindPort = 5432; + + BroadcastGroupConfiguration bcConfig1 = new BroadcastGroupConfiguration() + .setName(bcGroupName) + .setBroadcastPeriod(broadcastPeriod) + .setConnectorInfos(connectorNames) + .setEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration() + .setGroupAddress(groupAddress) + .setGroupPort(groupPort) + .setLocalBindPort(localBindPort)); + + List bcConfigs1 = new ArrayList(); + bcConfigs1.add(bcConfig1); + liveConf.setBroadcastGroupConfigurations(bcConfigs1); + + liveService = addServer(ActiveMQServers.newActiveMQServer(liveConf, false)); + liveService.start(); + } + + @Test + public void testQueue() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put("queue.myQueue", "myQueue"); + props.put("queue.queues/myQueue", "myQueue"); + Context ctx = new InitialContext(props); + + Destination destination = (Destination) ctx.lookup("myQueue"); + Assert.assertTrue(destination instanceof Queue); + + destination = (Destination) ctx.lookup("queues/myQueue"); + Assert.assertTrue(destination instanceof Queue); + } + + @Test + public void testDynamicQueue() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + Context ctx = new InitialContext(props); + + Destination destination = (Destination) ctx.lookup("dynamicQueues/myQueue"); + Assert.assertTrue(destination instanceof Queue); + } + + @Test + public void testTopic() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put("topic.myTopic", "myTopic"); + props.put("topic.topics/myTopic", "myTopic"); + Context ctx = new InitialContext(props); + + Destination destination = (Destination) ctx.lookup("myTopic"); + Assert.assertTrue(destination instanceof Topic); + + destination = (Destination) ctx.lookup("topics/myTopic"); + Assert.assertTrue(destination instanceof Topic); + } + + @Test + public void testDynamicTopic() throws NamingException, JMSException + { + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + Context ctx = new InitialContext(props); + + Destination destination = (Destination) ctx.lookup("dynamicTopics/myTopic"); + Assert.assertTrue(destination instanceof Topic); + } +} diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/JMSServerDeployerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/JMSServerDeployerTest.java index 4ce9f140b1..bede98b726 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/JMSServerDeployerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/JMSServerDeployerTest.java @@ -19,7 +19,6 @@ package org.apache.activemq.tests.integration.jms.server; import javax.jms.Queue; import javax.jms.Topic; import javax.naming.Context; -import java.net.URI; import org.apache.activemq.api.core.DiscoveryGroupConfiguration; import org.apache.activemq.api.core.TransportConfiguration; @@ -29,14 +28,12 @@ import org.apache.activemq.core.deployers.DeploymentManager; import org.apache.activemq.core.deployers.impl.FileDeploymentManager; import org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory; import org.apache.activemq.core.server.ActiveMQServer; -import org.apache.activemq.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.jms.server.JMSServerManager; import org.apache.activemq.jms.server.impl.JMSServerDeployer; import org.apache.activemq.jms.server.impl.JMSServerManagerImpl; import org.apache.activemq.tests.integration.IntegrationTestLogger; import org.apache.activemq.tests.unit.util.InVMNamingContext; import org.apache.activemq.tests.util.ServiceTestBase; -import org.apache.activemq.tests.util.UnitTestCase; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -93,7 +90,6 @@ public class JMSServerDeployerTest extends ServiceTestBase doTestDeployQueuesWithUnusualNames("queue\\with\\backslashes\\in\\name", "/myqueue4"); doTestDeployQueuesWithUnusualNames("queue with # chars and * chars in name", - "queue with # chars and * chars in name", "/myqueue5"); } @@ -109,21 +105,13 @@ public class JMSServerDeployerTest extends ServiceTestBase doTestDeployTopicsWithUnusualNames("topic\\with\\backslashes\\in\\name", "/mytopic4"); doTestDeployTopicsWithUnusualNames("topic with # chars and * chars in name", - "topic with # chars and * chars in name", "/mytopic5"); } private void doTestDeployQueuesWithUnusualNames(final String queueName, - final String htmlEncodedName, final String jndiName) throws Exception { - JMSServerDeployer deployer = new JMSServerDeployer(jmsServer, deploymentManager); - - String xml = "" + "" + ""; - - Element rootNode = org.apache.activemq.utils.XMLUtil.stringToElement(xml); - - deployer.deploy(rootNode); + jmsServer.createQueue(false, queueName, null, false, jndiName); Queue queue = (Queue) context.lookup(jndiName); Assert.assertNotNull(queue); @@ -131,206 +119,15 @@ public class JMSServerDeployerTest extends ServiceTestBase } private void doTestDeployTopicsWithUnusualNames(final String topicName, - final String htmlEncodedName, final String jndiName) throws Exception { - JMSServerDeployer deployer = new JMSServerDeployer(jmsServer, deploymentManager); - - String xml = - - "" + "" + ""; - - Element rootNode = org.apache.activemq.utils.XMLUtil.stringToElement(xml); - - deployer.deploy(rootNode); + jmsServer.createTopic(false, topicName, jndiName); Topic topic = (Topic) context.lookup(jndiName); Assert.assertNotNull(topic); Assert.assertEquals(topicName, topic.getTopicName()); } - private void doTestDeployQueuesWithUnusualNames(final String queueName, final String jndiName) throws Exception - { - doTestDeployQueuesWithUnusualNames(queueName, queueName, jndiName); - } - - private void doTestDeployTopicsWithUnusualNames(final String topicName, final String jndiName) throws Exception - { - doTestDeployTopicsWithUnusualNames(topicName, topicName, jndiName); - } - - @Test - public void testDeployFullConfiguration() throws Exception - { - JMSServerDeployer deployer = new JMSServerDeployer(jmsServer, deploymentManager); - - String conf = "activemq-jms-for-JMSServerDeployerTest.xml"; - URI confURL = Thread.currentThread().getContextClassLoader().getResource(conf).toURI(); - - String[] connectionFactoryBindings = new String[]{"/fullConfigurationConnectionFactory", - "/acme/fullConfigurationConnectionFactory", - "java:/xyz/tfullConfigurationConnectionFactory", - "java:/connectionfactories/acme/fullConfigurationConnectionFactory"}; - String[] queueBindings = new String[]{"/fullConfigurationQueue", "/queue/fullConfigurationQueue"}; - String[] topicBindings = new String[]{"/fullConfigurationTopic", "/topic/fullConfigurationTopic"}; - - for (String binding : connectionFactoryBindings) - { - UnitTestCase.checkNoBinding(context, binding); - } - for (String binding : queueBindings) - { - UnitTestCase.checkNoBinding(context, binding); - } - for (String binding : topicBindings) - { - UnitTestCase.checkNoBinding(context, binding); - } - - deployer.deploy(confURL); - - for (String binding : connectionFactoryBindings) - { - UnitTestCase.checkBinding(context, binding); - } - for (String binding : queueBindings) - { - UnitTestCase.checkBinding(context, binding); - } - for (String binding : topicBindings) - { - UnitTestCase.checkBinding(context, binding); - } - - for (String binding : connectionFactoryBindings) - { - ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) context.lookup(binding); - Assert.assertNotNull(cf); - Assert.assertEquals(1234, cf.getClientFailureCheckPeriod()); - Assert.assertEquals(5678, cf.getCallTimeout()); - Assert.assertEquals(12345, cf.getConsumerWindowSize()); - Assert.assertEquals(6789, cf.getConsumerMaxRate()); - Assert.assertEquals(123456, cf.getConfirmationWindowSize()); - Assert.assertEquals(7712652, cf.getProducerWindowSize()); - Assert.assertEquals(789, cf.getProducerMaxRate()); - Assert.assertEquals(12, cf.getMinLargeMessageSize()); - Assert.assertEquals("TestClientID", cf.getClientID()); - Assert.assertEquals(3456, cf.getDupsOKBatchSize()); - Assert.assertEquals(4567, cf.getTransactionBatchSize()); - Assert.assertEquals(true, cf.isBlockOnAcknowledge()); - Assert.assertEquals(false, cf.isBlockOnNonDurableSend()); - Assert.assertEquals(true, cf.isBlockOnDurableSend()); - Assert.assertEquals(false, cf.isAutoGroup()); - Assert.assertEquals(true, cf.isPreAcknowledge()); - Assert.assertEquals(2345, cf.getConnectionTTL()); - assertEquals(true, cf.isFailoverOnInitialConnection()); - Assert.assertEquals(34, cf.getReconnectAttempts()); - Assert.assertEquals(5, cf.getRetryInterval()); - Assert.assertEquals(6.0, cf.getRetryIntervalMultiplier(), 0.000001); - Assert.assertEquals(true, cf.isCacheLargeMessagesClient()); - } - - for (String binding : queueBindings) - { - Queue queue = (Queue) context.lookup(binding); - Assert.assertNotNull(queue); - Assert.assertEquals("fullConfigurationQueue", queue.getQueueName()); - } - - for (String binding : topicBindings) - { - Topic topic = (Topic) context.lookup(binding); - Assert.assertNotNull(topic); - Assert.assertEquals("fullConfigurationTopic", topic.getTopicName()); - } - } - - @Test - public void testDeployFullConfiguration2() throws Exception - { - JMSServerDeployer deployer = new JMSServerDeployer(jmsServer, deploymentManager); - - String conf = "activemq-jms-for-JMSServerDeployerTest2.xml"; - URI confURL = Thread.currentThread().getContextClassLoader().getResource(conf).toURI(); - - String[] connectionFactoryBindings = new String[]{"/fullConfigurationConnectionFactory", - "/acme/fullConfigurationConnectionFactory", - "java:/xyz/tfullConfigurationConnectionFactory", - "java:/connectionfactories/acme/fullConfigurationConnectionFactory"}; - String[] queueBindings = new String[]{"/fullConfigurationQueue", "/queue/fullConfigurationQueue"}; - String[] topicBindings = new String[]{"/fullConfigurationTopic", "/topic/fullConfigurationTopic"}; - - for (String binding : connectionFactoryBindings) - { - UnitTestCase.checkNoBinding(context, binding); - } - for (String binding : queueBindings) - { - UnitTestCase.checkNoBinding(context, binding); - } - for (String binding : topicBindings) - { - UnitTestCase.checkNoBinding(context, binding); - } - - deployer.deploy(confURL); - - for (String binding : connectionFactoryBindings) - { - UnitTestCase.checkBinding(context, binding); - } - for (String binding : queueBindings) - { - UnitTestCase.checkBinding(context, binding); - } - for (String binding : topicBindings) - { - UnitTestCase.checkBinding(context, binding); - } - - for (String binding : connectionFactoryBindings) - { - ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) context.lookup(binding); - Assert.assertNotNull(cf); - Assert.assertEquals(1234, cf.getClientFailureCheckPeriod()); - Assert.assertEquals(5678, cf.getCallTimeout()); - Assert.assertEquals(12345, cf.getConsumerWindowSize()); - Assert.assertEquals(6789, cf.getConsumerMaxRate()); - Assert.assertEquals(123456, cf.getConfirmationWindowSize()); - Assert.assertEquals(7712652, cf.getProducerWindowSize()); - Assert.assertEquals(789, cf.getProducerMaxRate()); - Assert.assertEquals(12, cf.getMinLargeMessageSize()); - Assert.assertEquals("TestClientID", cf.getClientID()); - Assert.assertEquals(3456, cf.getDupsOKBatchSize()); - Assert.assertEquals(4567, cf.getTransactionBatchSize()); - Assert.assertEquals(true, cf.isBlockOnAcknowledge()); - Assert.assertEquals(false, cf.isBlockOnNonDurableSend()); - Assert.assertEquals(true, cf.isBlockOnDurableSend()); - Assert.assertEquals(false, cf.isAutoGroup()); - Assert.assertEquals(true, cf.isPreAcknowledge()); - Assert.assertEquals(2345, cf.getConnectionTTL()); - assertEquals(true, cf.isFailoverOnInitialConnection()); - Assert.assertEquals(34, cf.getReconnectAttempts()); - Assert.assertEquals(5, cf.getRetryInterval()); - Assert.assertEquals(6.0, cf.getRetryIntervalMultiplier(), 0.000001); - Assert.assertEquals(true, cf.isCacheLargeMessagesClient()); - } - - for (String binding : queueBindings) - { - Queue queue = (Queue) context.lookup(binding); - Assert.assertNotNull(queue); - Assert.assertEquals("fullConfigurationQueue", queue.getQueueName()); - } - - for (String binding : topicBindings) - { - Topic topic = (Topic) context.lookup(binding); - Assert.assertNotNull(topic); - Assert.assertEquals("fullConfigurationTopic", topic.getTopicName()); - } - } - // Package protected --------------------------------------------- // Protected ----------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/config/JMSServerConfigParserTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/config/JMSServerConfigParserTest.java index 0255aab8e5..0957a31897 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/config/JMSServerConfigParserTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/config/JMSServerConfigParserTest.java @@ -24,7 +24,6 @@ import java.net.URL; import org.apache.activemq.api.core.TransportConfiguration; import org.apache.activemq.core.config.Configuration; import org.apache.activemq.jms.server.JMSServerConfigParser; -import org.apache.activemq.jms.server.config.ConnectionFactoryConfiguration; import org.apache.activemq.jms.server.config.JMSConfiguration; import org.apache.activemq.jms.server.config.JMSQueueConfiguration; import org.apache.activemq.jms.server.config.TopicConfiguration; @@ -69,49 +68,15 @@ public class JMSServerConfigParserTest extends ServiceTestBase JMSConfiguration jmsconfig = parser.parseConfiguration(stream); stream.close(); - ConnectionFactoryConfiguration cfConfig = jmsconfig.getConnectionFactoryConfigurations().get(0); - - assertEquals(1234, cfConfig.getClientFailureCheckPeriod()); - assertEquals(5678, cfConfig.getCallTimeout()); - assertEquals(12345, cfConfig.getConsumerWindowSize()); - assertEquals(6789, cfConfig.getConsumerMaxRate()); - assertEquals(123456, cfConfig.getConfirmationWindowSize()); - assertEquals(7712652, cfConfig.getProducerWindowSize()); - assertEquals(789, cfConfig.getProducerMaxRate()); - assertEquals(12, cfConfig.getMinLargeMessageSize()); - assertEquals(true, cfConfig.isCompressLargeMessages()); - assertEquals("TestClientID", cfConfig.getClientID()); - assertEquals(3456, cfConfig.getDupsOKBatchSize()); - assertEquals(4567, cfConfig.getTransactionBatchSize()); - assertEquals(true, cfConfig.isBlockOnAcknowledge()); - assertEquals(false, cfConfig.isBlockOnNonDurableSend()); - assertEquals(true, cfConfig.isBlockOnDurableSend()); - assertEquals(false, cfConfig.isAutoGroup()); - assertEquals(true, cfConfig.isPreAcknowledge()); - assertEquals(2345, cfConfig.getConnectionTTL()); - assertEquals("FooClass", cfConfig.getLoadBalancingPolicyClassName()); - assertEquals(34, cfConfig.getReconnectAttempts()); - assertEquals(5, cfConfig.getRetryInterval()); - assertEquals(6.0, cfConfig.getRetryIntervalMultiplier(), 0.000001); - assertEquals(300, cfConfig.getMaxRetryInterval()); - assertEquals(true, cfConfig.isCacheLargeMessagesClient()); - - assertEquals(1, jmsconfig.getQueueConfigurations().size()); JMSQueueConfiguration queueConfig = jmsconfig.getQueueConfigurations().get(0); assertEquals("fullConfigurationQueue", queueConfig.getName()); - assertEquals(2, queueConfig.getBindings().length); - assertEquals("/fullConfigurationQueue", queueConfig.getBindings()[0]); - assertEquals("/queue/fullConfigurationQueue", queueConfig.getBindings()[1]); assertEquals(1, jmsconfig.getTopicConfigurations().size()); TopicConfiguration topicConfig = jmsconfig.getTopicConfigurations().get(0); assertEquals("fullConfigurationTopic", topicConfig.getName()); - assertEquals(2, topicConfig.getBindings().length); - assertEquals("/fullConfigurationTopic", topicConfig.getBindings()[0]); - assertEquals("/topic/fullConfigurationTopic", topicConfig.getBindings()[1]); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQRATestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQRATestBase.java index 355b68c387..7778a45674 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQRATestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQRATestBase.java @@ -119,6 +119,7 @@ public abstract class ActiveMQRATestBase extends JMSTestBase isDeliveryTransacted = deliveryTransacted; } + @Override public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException { if (xaResource != null) @@ -196,11 +197,13 @@ public abstract class ActiveMQRATestBase extends JMSTestBase return null; } + @Override public WorkManager getWorkManager() { return workManager; } + @Override public XATerminator getXATerminator() { return null; @@ -208,29 +211,35 @@ public abstract class ActiveMQRATestBase extends JMSTestBase class DummyWorkManager implements WorkManager { + @Override public void doWork(Work work) throws WorkException { } + @Override public void doWork(Work work, long l, ExecutionContext executionContext, WorkListener workListener) throws WorkException { } + @Override public long startWork(Work work) throws WorkException { return 0; } + @Override public long startWork(Work work, long l, ExecutionContext executionContext, WorkListener workListener) throws WorkException { return 0; } + @Override public void scheduleWork(Work work) throws WorkException { work.run(); } + @Override public void scheduleWork(Work work, long l, ExecutionContext executionContext, WorkListener workListener) throws WorkException { } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/spring/SpringIntegrationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/spring/SpringIntegrationTest.java index ff9d7dc110..b9cd6f2419 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/spring/SpringIntegrationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/spring/SpringIntegrationTest.java @@ -50,9 +50,10 @@ public class SpringIntegrationTest extends UnitTestCase public void testSpring() throws Exception { System.out.println("Creating bean factory..."); - ApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"spring-jms-beans.xml"}); + ApplicationContext context = null; try { + context = new ClassPathXmlApplicationContext(new String[]{"spring-jms-beans.xml"}); MessageSender sender = (MessageSender) context.getBean("MessageSender"); System.out.println("Sending message..."); ExampleListener.latch.countUp(); @@ -66,8 +67,11 @@ public class SpringIntegrationTest extends UnitTestCase { try { - DefaultMessageListenerContainer container = (DefaultMessageListenerContainer) context.getBean("listenerContainer"); - container.stop(); + if (context != null) + { + DefaultMessageListenerContainer container = (DefaultMessageListenerContainer) context.getBean("listenerContainer"); + container.stop(); + } } catch (Throwable ignored) { @@ -75,8 +79,11 @@ public class SpringIntegrationTest extends UnitTestCase } try { - EmbeddedJMS jms = (EmbeddedJMS) context.getBean("EmbeddedJms"); - jms.stop(); + if (context != null) + { + EmbeddedJMS jms = (EmbeddedJMS) context.getBean("EmbeddedJms"); + jms.stop(); + } } catch (Throwable ignored) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/NonSerializableFactory.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/NonSerializableFactory.java index f1a62d50b5..6d1bba70d1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/NonSerializableFactory.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/NonSerializableFactory.java @@ -21,14 +21,12 @@ import javax.naming.Name; import javax.naming.NamingException; import javax.naming.RefAddr; import javax.naming.Reference; -import javax.naming.StringRefAddr; import javax.naming.spi.ObjectFactory; import java.util.Collections; import java.util.HashMap; import java.util.Hashtable; import java.util.Map; -import org.jboss.util.naming.Util; /** * used by the default context when running in embedded local configuration @@ -43,47 +41,47 @@ public final class NonSerializableFactory implements ObjectFactory // Utility } - public static void unbind(final Context ctx, final String strName) throws NamingException - { - Name name = ctx.getNameParser("").parse(strName); - int size = name.size(); - String atom = name.get(size - 1); - Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); - String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); - NonSerializableFactory.getWrapperMap().remove(key); - Util.unbind(ctx, strName); - } - - public static void rebind(final Context ctx, final String strName, final Object value) throws NamingException - { - Name name = ctx.getNameParser("").parse(strName); - int size = name.size(); - String atom = name.get(size - 1); - Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); - String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); - NonSerializableFactory.getWrapperMap().put(key, value); - String className = value.getClass().getName(); - String factory = NonSerializableFactory.class.getName(); - StringRefAddr addr = new StringRefAddr("nns", key); - Reference memoryRef = new Reference(className, addr, factory, null); - parentCtx.rebind(atom, memoryRef); - } - - public static void bind(final Context ctx, final String strName, final Object value) throws NamingException - { - Name name = ctx.getNameParser("").parse(strName); - int size = name.size(); - String atom = name.get(size - 1); - Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); - String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); - NonSerializableFactory.getWrapperMap().put(key, value); - String className = value.getClass().getName(); - String factory = NonSerializableFactory.class.getName(); - StringRefAddr addr = new StringRefAddr("nns", key); - Reference memoryRef = new Reference(className, addr, factory, null); - - parentCtx.bind(atom, memoryRef); - } +// public static void unbind(final Context ctx, final String strName) throws NamingException +// { +// Name name = ctx.getNameParser("").parse(strName); +// int size = name.size(); +// String atom = name.get(size - 1); +// Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); +// String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); +// NonSerializableFactory.getWrapperMap().remove(key); +// Util.unbind(ctx, strName); +// } +// +// public static void rebind(final Context ctx, final String strName, final Object value) throws NamingException +// { +// Name name = ctx.getNameParser("").parse(strName); +// int size = name.size(); +// String atom = name.get(size - 1); +// Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); +// String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); +// NonSerializableFactory.getWrapperMap().put(key, value); +// String className = value.getClass().getName(); +// String factory = NonSerializableFactory.class.getName(); +// StringRefAddr addr = new StringRefAddr("nns", key); +// Reference memoryRef = new Reference(className, addr, factory, null); +// parentCtx.rebind(atom, memoryRef); +// } +// +// public static void bind(final Context ctx, final String strName, final Object value) throws NamingException +// { +// Name name = ctx.getNameParser("").parse(strName); +// int size = name.size(); +// String atom = name.get(size - 1); +// Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); +// String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); +// NonSerializableFactory.getWrapperMap().put(key, value); +// String className = value.getClass().getName(); +// String factory = NonSerializableFactory.class.getName(); +// StringRefAddr addr = new StringRefAddr("nns", key); +// Reference memoryRef = new Reference(className, addr, factory, null); +// +// parentCtx.bind(atom, memoryRef); +// } public static Object lookup(final String name) throws NamingException { diff --git a/tests/integration-tests/src/test/resources/activemq-jms-for-JMSServerDeployerTest.xml b/tests/integration-tests/src/test/resources/activemq-jms-for-JMSServerDeployerTest.xml index 021796c6dd..8fb11a95ef 100644 --- a/tests/integration-tests/src/test/resources/activemq-jms-for-JMSServerDeployerTest.xml +++ b/tests/integration-tests/src/test/resources/activemq-jms-for-JMSServerDeployerTest.xml @@ -2,52 +2,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq ../../src/schemas/activemq-jms.xsd "> - - - - - - - - - - - 1234 - 5678 - 12345 - 6789 - 123456 - 7712652 - 789 - 12 - true - TestClientID - 3456 - 4567 - true - false - true - false - true - 2345 - true - false - FooClass - 34 - 5 - 6.0 - 300 - true - + - - - - - - - - - + \ No newline at end of file diff --git a/tests/integration-tests/src/test/resources/activemq-jms-for-JMSServerDeployerTest2.xml b/tests/integration-tests/src/test/resources/activemq-jms-for-JMSServerDeployerTest2.xml index 0e59ead68b..8fb11a95ef 100644 --- a/tests/integration-tests/src/test/resources/activemq-jms-for-JMSServerDeployerTest2.xml +++ b/tests/integration-tests/src/test/resources/activemq-jms-for-JMSServerDeployerTest2.xml @@ -2,52 +2,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq ../../src/schemas/activemq-jms.xsd "> - - - - - - - - - - - - 1234 - 5678 - 12345 - 6789 - 123456 - 7712652 - 789 - 12 - TestClientID - 3456 - 4567 - true - false - true - false - true - 2345 - true - false - FooClass - 34 - 5 - 6.0 - 300 - true - + - - - - - - - - - + \ No newline at end of file diff --git a/tests/integration-tests/src/test/resources/colocated-server-start-stop-jms-config1.xml b/tests/integration-tests/src/test/resources/colocated-server-start-stop-jms-config1.xml index b57c8a5877..00b7d07c34 100644 --- a/tests/integration-tests/src/test/resources/colocated-server-start-stop-jms-config1.xml +++ b/tests/integration-tests/src/test/resources/colocated-server-start-stop-jms-config1.xml @@ -1,18 +1,7 @@ - - - - - - - - - - - - + diff --git a/tests/integration-tests/src/test/resources/colocated-server-start-stop-jms-config2.xml b/tests/integration-tests/src/test/resources/colocated-server-start-stop-jms-config2.xml index b57c8a5877..00b7d07c34 100644 --- a/tests/integration-tests/src/test/resources/colocated-server-start-stop-jms-config2.xml +++ b/tests/integration-tests/src/test/resources/colocated-server-start-stop-jms-config2.xml @@ -1,18 +1,7 @@ - - - - - - - - - - - - + diff --git a/tests/integration-tests/src/test/resources/server-start-stop-jms-config1.xml b/tests/integration-tests/src/test/resources/server-start-stop-jms-config1.xml index f2fb22c40e..5987e7e738 100644 --- a/tests/integration-tests/src/test/resources/server-start-stop-jms-config1.xml +++ b/tests/integration-tests/src/test/resources/server-start-stop-jms-config1.xml @@ -1,18 +1,7 @@ - - - - - - - - - - - - + \ No newline at end of file diff --git a/tests/integration-tests/src/test/resources/spring-activemq-jms.xml b/tests/integration-tests/src/test/resources/spring-activemq-jms.xml index bce97ab150..37589895ef 100644 --- a/tests/integration-tests/src/test/resources/spring-activemq-jms.xml +++ b/tests/integration-tests/src/test/resources/spring-activemq-jms.xml @@ -1,19 +1,8 @@ - - - - - - - - - - - - + diff --git a/tests/integration-tests/src/test/resources/spring-jms-beans.xml b/tests/integration-tests/src/test/resources/spring-jms-beans.xml index 7dee3194de..38bb94441e 100644 --- a/tests/integration-tests/src/test/resources/spring-jms-beans.xml +++ b/tests/integration-tests/src/test/resources/spring-jms-beans.xml @@ -9,16 +9,29 @@ + + + + + + + + + + + + + - - + + - - + + diff --git a/tests/jms-tests/pom.xml b/tests/jms-tests/pom.xml index e9a6aee00c..287a0da5f1 100644 --- a/tests/jms-tests/pom.xml +++ b/tests/jms-tests/pom.xml @@ -78,10 +78,6 @@ junit junit - - org.jboss.naming - jnpserver - apache-logging commons-logging diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ActiveMQServerTestCase.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ActiveMQServerTestCase.java index 7bc2a0c5cc..12247ea4d0 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ActiveMQServerTestCase.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ActiveMQServerTestCase.java @@ -39,6 +39,7 @@ import java.util.Set; import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple; import org.apache.activemq.api.core.SimpleString; +import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.core.postoffice.Binding; import org.apache.activemq.core.postoffice.impl.LocalQueueBinding; import org.apache.activemq.core.security.Role; @@ -245,6 +246,9 @@ public abstract class ActiveMQServerTestCase createQueue("Queue2"); createQueue("Queue3"); createQueue("Queue4"); + deployConnectionFactory(0, JMSFactoryType.CF, "ConnectionFactory", "/ConnectionFactory"); + deployConnectionFactory(0, JMSFactoryType.TOPIC_CF, "CF_TOPIC", "/CF_TOPIC"); + deployConnectionFactory(0, JMSFactoryType.XA_CF, "CF_XA_TRUE", "/CF_XA_TRUE"); } private void lookUp() throws Exception @@ -276,6 +280,10 @@ public abstract class ActiveMQServerTestCase destroyQueue("Queue2"); destroyQueue("Queue3"); destroyQueue("Queue4"); + + undeployConnectionFactory("ConnectionFactory"); + undeployConnectionFactory("CF_TOPIC"); + undeployConnectionFactory("CF_XA_TRUE"); } @AfterClass @@ -490,6 +498,11 @@ public abstract class ActiveMQServerTestCase ActiveMQServerTestCase.servers.get(server).deployConnectionFactory(objectName, jndiBindings); } + public static void deployConnectionFactory(final int server, JMSFactoryType type, final String objectName, final String... jndiBindings) throws Exception + { + ActiveMQServerTestCase.servers.get(server).deployConnectionFactory(objectName, type, jndiBindings); + } + public void deployConnectionFactory(final String clientId, final String objectName, final int prefetchSize, @@ -503,6 +516,7 @@ public abstract class ActiveMQServerTestCase final String... jndiBindings) throws Exception { ActiveMQServerTestCase.servers.get(0).deployConnectionFactory(clientId, + JMSFactoryType.CF, objectName, prefetchSize, defaultTempQueueFullSize, diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ConnectionFactoryTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ConnectionFactoryTest.java index 5c2650c875..cafe37f5b5 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ConnectionFactoryTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ConnectionFactoryTest.java @@ -39,6 +39,7 @@ import javax.jms.XAQueueConnectionFactory; import javax.jms.XATopicConnection; import javax.jms.XATopicConnectionFactory; +import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.jms.tests.util.ProxyAssertSupport; import org.junit.Assert; @@ -69,9 +70,11 @@ public class ConnectionFactoryTest extends JMSTestCase @Test public void testQueueConnectionFactory() throws Exception { + deployConnectionFactory(0, JMSFactoryType.QUEUE_CF, "CF_QUEUE_XA_FALSE", "/CF_QUEUE_XA_FALSE"); QueueConnectionFactory qcf = (QueueConnectionFactory)ic.lookup("/CF_QUEUE_XA_FALSE"); QueueConnection qc = qcf.createQueueConnection(); qc.close(); + undeployConnectionFactory("CF_QUEUE_XA_FALSE"); } /** @@ -81,9 +84,11 @@ public class ConnectionFactoryTest extends JMSTestCase @Test public void testTopicConnectionFactory() throws Exception { + deployConnectionFactory(0, JMSFactoryType.TOPIC_CF, "CF_TOPIC_XA_FALSE", "/CF_TOPIC_XA_FALSE"); TopicConnectionFactory qcf = (TopicConnectionFactory)ic.lookup("/CF_TOPIC_XA_FALSE"); TopicConnection tc = qcf.createTopicConnection(); tc.close(); + undeployConnectionFactory("CF_TOPIC_XA_FALSE"); } @Test @@ -117,12 +122,14 @@ public class ConnectionFactoryTest extends JMSTestCase // the ConnectionFactories that ship with ActiveMQ do not have their clientID // administratively configured. + deployConnectionFactory(0, JMSFactoryType.TOPIC_CF, "CF_XA_FALSE", "/CF_XA_FALSE"); ConnectionFactory cf = (ConnectionFactory)ic.lookup("/CF_XA_FALSE"); Connection c = cf.createConnection(); ProxyAssertSupport.assertNull(c.getClientID()); c.close(); + undeployConnectionFactory("CF_XA_FALSE"); } @Test @@ -131,6 +138,7 @@ public class ConnectionFactoryTest extends JMSTestCase // the ConnectionFactories that ship with ActiveMQ do not have their clientID // administratively configured. + deployConnectionFactory(0, JMSFactoryType.TOPIC_CF, "CF_XA_FALSE", "/CF_XA_FALSE"); ConnectionFactory cf = (ConnectionFactory)ic.lookup("/CF_XA_FALSE"); Connection c = cf.createConnection(); @@ -140,6 +148,7 @@ public class ConnectionFactoryTest extends JMSTestCase ProxyAssertSupport.assertEquals(testClientId, c.getClientID()); c.close(); + undeployConnectionFactory("CF_XA_FALSE"); } // Added for http://jira.jboss.org/jira/browse/JBMESSAGING-939 @@ -337,6 +346,19 @@ public class ConnectionFactoryTest extends JMSTestCase @Test public void testFactoryTypes() throws Exception { + deployConnectionFactory(0, JMSFactoryType.CF, "ConnectionFactory", "/ConnectionFactory"); + deployConnectionFactory(0, JMSFactoryType.QUEUE_XA_CF, "CF_QUEUE_XA_TRUE", "/CF_QUEUE_XA_TRUE"); + deployConnectionFactory(0, JMSFactoryType.QUEUE_CF, "CF_QUEUE_XA_FALSE", "/CF_QUEUE_XA_FALSE"); + deployConnectionFactory(0, JMSFactoryType.XA_CF, "CF_XA_TRUE", "/CF_XA_TRUE"); + deployConnectionFactory(0, JMSFactoryType.CF, "CF_XA_FALSE", "/CF_XA_FALSE"); + deployConnectionFactory(0, JMSFactoryType.QUEUE_CF, "CF_QUEUE", "/CF_QUEUE"); + deployConnectionFactory(0, JMSFactoryType.TOPIC_CF, "CF_TOPIC", "/CF_TOPIC"); + deployConnectionFactory(0, JMSFactoryType.TOPIC_XA_CF, "CF_TOPIC_XA_TRUE", "/CF_TOPIC_XA_TRUE"); + deployConnectionFactory(0, JMSFactoryType.CF, "CF_GENERIC", "/CF_GENERIC"); + deployConnectionFactory(0, JMSFactoryType.XA_CF, "CF_GENERIC_XA_TRUE", "/CF_GENERIC_XA_TRUE"); + deployConnectionFactory(0, JMSFactoryType.CF, "CF_GENERIC_XA_FALSE", "/CF_GENERIC_XA_FALSE"); + deployConnectionFactory(0, JMSFactoryType.TOPIC_CF, "CF_TOPIC_XA_FALSE", "/CF_TOPIC_XA_FALSE"); + ActiveMQConnectionFactory factory = null; factory = (ActiveMQConnectionFactory)ic.lookup("/ConnectionFactory"); @@ -398,11 +420,31 @@ public class ConnectionFactoryTest extends JMSTestCase Assert.assertTrue(factory instanceof TopicConnectionFactory); assertNTypes(factory, 3); + + undeployConnectionFactory("ConnectionFactory"); + undeployConnectionFactory("CF_QUEUE_XA_TRUE"); + undeployConnectionFactory("CF_QUEUE_XA_FALSE"); + undeployConnectionFactory("CF_XA_TRUE"); + undeployConnectionFactory("CF_XA_FALSE"); + undeployConnectionFactory("CF_QUEUE"); + undeployConnectionFactory("CF_TOPIC"); + undeployConnectionFactory("CF_TOPIC_XA_TRUE"); + undeployConnectionFactory("CF_GENERIC"); + undeployConnectionFactory("CF_GENERIC_XA_TRUE"); + undeployConnectionFactory("CF_GENERIC_XA_FALSE"); + undeployConnectionFactory("CF_TOPIC_XA_FALSE"); } @Test public void testConnectionTypes() throws Exception { + deployConnectionFactory(0, JMSFactoryType.CF, "ConnectionFactory", "/ConnectionFactory"); + deployConnectionFactory(0, JMSFactoryType.QUEUE_XA_CF, "CF_QUEUE_XA_TRUE", "/CF_QUEUE_XA_TRUE"); + deployConnectionFactory(0, JMSFactoryType.XA_CF, "CF_XA_TRUE", "/CF_XA_TRUE"); + deployConnectionFactory(0, JMSFactoryType.QUEUE_CF, "CF_QUEUE", "/CF_QUEUE"); + deployConnectionFactory(0, JMSFactoryType.TOPIC_CF, "CF_TOPIC", "/CF_TOPIC"); + deployConnectionFactory(0, JMSFactoryType.TOPIC_XA_CF, "CF_TOPIC_XA_TRUE", "/CF_TOPIC_XA_TRUE"); + Connection genericConnection = null; XAConnection xaConnection = null; QueueConnection queueConnection = null; @@ -440,6 +482,13 @@ public class ConnectionFactoryTest extends JMSTestCase topicConnection.close(); xaQueueConnection.close(); xaTopicConnection.close(); + + undeployConnectionFactory("ConnectionFactory"); + undeployConnectionFactory("CF_QUEUE_XA_TRUE"); + undeployConnectionFactory("CF_XA_TRUE"); + undeployConnectionFactory("CF_QUEUE"); + undeployConnectionFactory("CF_TOPIC"); + undeployConnectionFactory("CF_TOPIC_XA_TRUE"); } private void assertConnectionType(Connection conn, String type) diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/SessionTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/SessionTest.java index bf48bcac64..c062fe8339 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/SessionTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/SessionTest.java @@ -33,6 +33,7 @@ import javax.jms.TopicSession; import javax.jms.XAConnection; import javax.jms.XASession; +import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.jms.tests.util.ProxyAssertSupport; import org.junit.Test; @@ -97,6 +98,7 @@ public class SessionTest extends ActiveMQServerTestCase @Test public void testGetSession2() throws Exception { + deployConnectionFactory(0, JMSFactoryType.CF, "ConnectionFactory", "/ConnectionFactory"); XAConnection conn = getXAConnectionFactory().createXAConnection(); XASession sess = conn.createXASession(); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/message/SimpleJMSStreamMessage.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/message/SimpleJMSStreamMessage.java index bd8b1428d0..09274e6433 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/message/SimpleJMSStreamMessage.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/message/SimpleJMSStreamMessage.java @@ -26,8 +26,6 @@ import javax.jms.MessageNotReadableException; import javax.jms.MessageNotWriteableException; import javax.jms.StreamMessage; -import org.jboss.util.Primitives; - /** * @author Ovidiu Feodorov * @version $Revision$ @@ -555,7 +553,7 @@ public class SimpleJMSStreamMessage extends SimpleJMSMessage implements StreamMe { throw new MessageNotWriteableException("The message body is readonly"); } - content.add(Primitives.valueOf(value)); + content.add(new Boolean(value)); } public void writeByte(final byte value) throws JMSException diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/WrappedJNDIServer.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/WrappedJNDIServer.java deleted file mode 100644 index b1d55db41d..0000000000 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/WrappedJNDIServer.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * 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. - */ -package org.apache.activemq.jms.tests.tools; - -import java.net.UnknownHostException; - -import org.jnp.server.Main; -import org.jnp.server.NamingBean; - -/** - * A WrappedJNDIServer - * - * We wrap the JBoss AS JNDI server, since we want to introduce a pause of 500 milliseconds on stop() - * - * This is because there is a bug in the JBoss AS class whereby the socket can remaining open some time after - * stop() is called. - * - * So if you call stop() then start() quickly after, you can hit an exception: - * - * java.rmi.server.ExportException: Port already in use: 1098; nested exception is: - * java.net.BindException: Address already in use - * - * @author Tim Fox - * - * - */ -public class WrappedJNDIServer -{ - private final Main main; - - public WrappedJNDIServer() - { - main = new Main(); - } - - public void start() throws Exception - { - main.start(); - } - - public void stop() - { - main.stop(); - - try - { - Thread.sleep(500); - } - catch (Exception e) - { - } - } - - public void setNamingInfo(final NamingBean naming) - { - main.setNamingInfo(naming); - } - - public void setPort(final int port) - { - main.setPort(port); - } - - public void setBindAddress(final String bindAddress) throws UnknownHostException - { - main.setBindAddress(bindAddress); - } - - public void setRmiPort(final int port) - { - main.setRmiPort(port); - } - - public void setRmiBindAddress(final String address) throws UnknownHostException - { - main.setRmiBindAddress(address); - } -} diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/InVMContext.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/InVMContext.java index bcf1236694..4acc3674c7 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/InVMContext.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/InVMContext.java @@ -276,7 +276,6 @@ public class InVMContext implements Context, Serializable { Hashtable env = new Hashtable(); env.put("java.naming.factory.initial", InVMInitialContextFactory.class.getCanonicalName()); - env.put("java.naming.provider.url", "org.jboss.naming:org.jnp.interface"); return env; } diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/InVMInitialContextFactory.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/InVMInitialContextFactory.java index 6d6c2a494b..2924514d4c 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/InVMInitialContextFactory.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/InVMInitialContextFactory.java @@ -56,8 +56,6 @@ public class InVMInitialContextFactory implements InitialContextFactory { Hashtable env = new Hashtable(); env.put("java.naming.factory.initial", "org.apache.activemq.jms.tests.tools.container.InVMInitialContextFactory"); - env.put("java.naming.provider.url", "org.jboss.naming:org.jnp.interface"); - // env.put("java.naming.factory.url.pkgs", ""); env.put(Constants.SERVER_INDEX_PROPERTY_NAME, Integer.toString(serverIndex)); return env; } diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/LocalTestServer.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/LocalTestServer.java index 25bede3d61..920ac217ac 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/LocalTestServer.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/LocalTestServer.java @@ -45,8 +45,6 @@ import org.apache.activemq.jms.server.JMSServerManager; import org.apache.activemq.jms.server.impl.JMSServerManagerImpl; import org.apache.activemq.jms.tests.JmsTestLogger; import org.apache.activemq.spi.core.security.ActiveMQSecurityManagerImpl; -import org.jnp.server.Main; -import org.jnp.server.NamingBeanImpl; /** * @author Ovidiu Feodorov @@ -62,7 +60,6 @@ public class LocalTestServer implements Server, Runnable private boolean started = false; private final HashMap> allBindings = new HashMap>(); - private Main jndiServer; private JMSServerManagerImpl jmsServerManager; // Static --------------------------------------------------------------------------------------- @@ -116,14 +113,6 @@ public class LocalTestServer implements Server, Runnable JmsTestLogger.LOGGER.info("Deleted dir: " + dir.getAbsolutePath() + " deleted: " + deleted); } - org.jnp.server.NamingBeanImpl namingBean = new NamingBeanImpl(); - jndiServer = new Main(); - jndiServer.setNamingInfo(namingBean); - jndiServer.setPort(1099); - jndiServer.setBindAddress("localhost"); - jndiServer.setRmiPort(1098); - jndiServer.setRmiBindAddress("localhost"); - javax.management.MBeanServer beanServer = java.lang.management.ManagementFactory.getPlatformMBeanServer(); FileConfiguration fileConfiguration = new FileConfiguration(); ActiveMQSecurityManagerImpl securityManager = new ActiveMQSecurityManagerImpl(); @@ -131,8 +120,6 @@ public class LocalTestServer implements Server, Runnable jmsServerManager = new JMSServerManagerImpl(activeMQServer); System.setProperty(Constants.SERVER_INDEX_PROPERTY_NAME, "" + getServerID()); - namingBean.start(); - jndiServer.start(); fileConfiguration.start(); jmsServerManager.start(); started = true; @@ -160,11 +147,9 @@ public class LocalTestServer implements Server, Runnable public synchronized boolean stop() throws Exception { jmsServerManager.stop(); - jndiServer.stop(); started = false; unbindAll(); jmsServerManager = null; - jndiServer.stop(); return true; } @@ -242,19 +227,24 @@ public class LocalTestServer implements Server, Runnable public void deployConnectionFactory(final String clientId, final String objectName, final String ... jndiBindings) throws Exception { - deployConnectionFactory(clientId, objectName, -1, -1, -1, -1, false, false, -1, false, jndiBindings); + deployConnectionFactory(clientId, JMSFactoryType.CF, objectName, -1, -1, -1, -1, false, false, -1, false, jndiBindings); } public void deployConnectionFactory(final String objectName, final int consumerWindowSize, final String ... jndiBindings) throws Exception { - deployConnectionFactory(null, objectName, consumerWindowSize, -1, -1, -1, false, false, -1, false, jndiBindings); + deployConnectionFactory(null, JMSFactoryType.CF, objectName, consumerWindowSize, -1, -1, -1, false, false, -1, false, jndiBindings); } public void deployConnectionFactory(final String objectName, final String ... jndiBindings) throws Exception { - deployConnectionFactory(null, objectName, -1, -1, -1, -1, false, false, -1, false, jndiBindings); + deployConnectionFactory(null, JMSFactoryType.CF, objectName, -1, -1, -1, -1, false, false, -1, false, jndiBindings); + } + + public void deployConnectionFactory(final String objectName, JMSFactoryType type, final String ... jndiBindings) throws Exception + { + deployConnectionFactory(null, type, objectName, -1, -1, -1, -1, false, false, -1, false, jndiBindings); } public void deployConnectionFactory(final String objectName, @@ -265,6 +255,7 @@ public class LocalTestServer implements Server, Runnable final String ... jndiBindings) throws Exception { this.deployConnectionFactory(null, + JMSFactoryType.CF, objectName, prefetchSize, defaultTempQueueFullSize, @@ -283,6 +274,7 @@ public class LocalTestServer implements Server, Runnable final String ... jndiBindings) throws Exception { this.deployConnectionFactory(null, + JMSFactoryType.CF, objectName, -1, -1, @@ -296,6 +288,7 @@ public class LocalTestServer implements Server, Runnable } public void deployConnectionFactory(final String clientId, + final JMSFactoryType type, final String objectName, final int prefetchSize, final int defaultTempQueueFullSize, @@ -315,7 +308,7 @@ public class LocalTestServer implements Server, Runnable getJMSServerManager().createConnectionFactory(objectName, false, - JMSFactoryType.CF, + type, connectors, clientId, ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD, @@ -392,7 +385,6 @@ public class LocalTestServer implements Server, Runnable props.setProperty("java.naming.factory.initial", "org.apache.activemq.jms.tests.tools.container.InVMInitialContextFactory"); props.setProperty(Constants.SERVER_INDEX_PROPERTY_NAME, "" + getServerID()); - // props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); return new InitialContext(props); } diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/NonSerializableFactory.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/NonSerializableFactory.java index deec225cda..dcf7c9a580 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/NonSerializableFactory.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/NonSerializableFactory.java @@ -26,11 +26,8 @@ import javax.naming.Name; import javax.naming.NamingException; import javax.naming.RefAddr; import javax.naming.Reference; -import javax.naming.StringRefAddr; import javax.naming.spi.ObjectFactory; -import org.jboss.util.naming.Util; - /** * used by the default context when running in embedded local configuration * @author Andy Taylor @@ -42,47 +39,47 @@ public final class NonSerializableFactory implements ObjectFactory { } - public static void unbind(final Context ctx, final String strName) throws NamingException - { - Name name = ctx.getNameParser("").parse(strName); - int size = name.size(); - String atom = name.get(size - 1); - Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); - String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); - NonSerializableFactory.getWrapperMap().remove(key); - Util.unbind(ctx, strName); - } - - public static void rebind(final Context ctx, final String strName, final Object value) throws NamingException - { - Name name = ctx.getNameParser("").parse(strName); - int size = name.size(); - String atom = name.get(size - 1); - Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); - String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); - NonSerializableFactory.getWrapperMap().put(key, value); - String className = value.getClass().getName(); - String factory = NonSerializableFactory.class.getName(); - StringRefAddr addr = new StringRefAddr("nns", key); - Reference memoryRef = new Reference(className, addr, factory, null); - parentCtx.rebind(atom, memoryRef); - } - - public static void bind(final Context ctx, final String strName, final Object value) throws NamingException - { - Name name = ctx.getNameParser("").parse(strName); - int size = name.size(); - String atom = name.get(size - 1); - Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); - String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); - NonSerializableFactory.getWrapperMap().put(key, value); - String className = value.getClass().getName(); - String factory = NonSerializableFactory.class.getName(); - StringRefAddr addr = new StringRefAddr("nns", key); - Reference memoryRef = new Reference(className, addr, factory, null); - - parentCtx.bind(atom, memoryRef); - } +// public static void unbind(final Context ctx, final String strName) throws NamingException +// { +// Name name = ctx.getNameParser("").parse(strName); +// int size = name.size(); +// String atom = name.get(size - 1); +// Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); +// String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); +// NonSerializableFactory.getWrapperMap().remove(key); +// Util.unbind(ctx, strName); +// } +// +// public static void rebind(final Context ctx, final String strName, final Object value) throws NamingException +// { +// Name name = ctx.getNameParser("").parse(strName); +// int size = name.size(); +// String atom = name.get(size - 1); +// Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); +// String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); +// NonSerializableFactory.getWrapperMap().put(key, value); +// String className = value.getClass().getName(); +// String factory = NonSerializableFactory.class.getName(); +// StringRefAddr addr = new StringRefAddr("nns", key); +// Reference memoryRef = new Reference(className, addr, factory, null); +// parentCtx.rebind(atom, memoryRef); +// } +// +// public static void bind(final Context ctx, final String strName, final Object value) throws NamingException +// { +// Name name = ctx.getNameParser("").parse(strName); +// int size = name.size(); +// String atom = name.get(size - 1); +// Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); +// String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); +// NonSerializableFactory.getWrapperMap().put(key, value); +// String className = value.getClass().getName(); +// String factory = NonSerializableFactory.class.getName(); +// StringRefAddr addr = new StringRefAddr("nns", key); +// Reference memoryRef = new Reference(className, addr, factory, null); +// +// parentCtx.bind(atom, memoryRef); +// } public static Object lookup(final String name) throws NamingException { diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/Server.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/Server.java index 1015473293..efa597fb69 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/Server.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/Server.java @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.List; import java.util.Set; +import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.core.security.Role; import org.apache.activemq.core.server.ActiveMQServer; import org.apache.activemq.jms.server.JMSServerManager; @@ -136,6 +137,7 @@ public interface Server extends Remote */ // boolean undeployDestinationProgrammatically(boolean isQueue, String name) throws Exception; void deployConnectionFactory(String clientId, + JMSFactoryType type, String objectName, int prefetchSize, int defaultTempQueueFullSize, @@ -168,6 +170,10 @@ public interface Server extends Remote void deployConnectionFactory(String objectName, final String... jndiBindings) throws Exception; + void deployConnectionFactory(String objectName, + JMSFactoryType type, + final String... jndiBindings) throws Exception; + void undeployConnectionFactory(String objectName) throws Exception; void configureSecurityForDestination(String destName, boolean isQueue, Set roles) throws Exception; diff --git a/tests/jms-tests/src/test/resources/activemq-jms.xml b/tests/jms-tests/src/test/resources/activemq-jms.xml index 8d32412567..36b800abe5 100644 --- a/tests/jms-tests/src/test/resources/activemq-jms.xml +++ b/tests/jms-tests/src/test/resources/activemq-jms.xml @@ -2,125 +2,5 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd"> - - - - - - - - - - - - - - - true - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - false - - - - - - - - diff --git a/tests/jms-tests/src/test/resources/jndi.properties b/tests/jms-tests/src/test/resources/jndi.properties index e2a9832f8e..ca08725ffe 100644 --- a/tests/jms-tests/src/test/resources/jndi.properties +++ b/tests/jms-tests/src/test/resources/jndi.properties @@ -1,2 +1 @@ -java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces \ No newline at end of file +java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory \ No newline at end of file diff --git a/tests/joram-tests/pom.xml b/tests/joram-tests/pom.xml index 5e59d20acc..b157500d09 100644 --- a/tests/joram-tests/pom.xml +++ b/tests/joram-tests/pom.xml @@ -66,10 +66,6 @@ junit junit - - org.jboss.naming - jnpserver - apache-logging commons-logging diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/jms/AbstractAdmin.java b/tests/joram-tests/src/test/java/org/apache/activemq/jms/AbstractAdmin.java index 65b863951c..d123e6d9c0 100644 --- a/tests/joram-tests/src/test/java/org/apache/activemq/jms/AbstractAdmin.java +++ b/tests/joram-tests/src/test/java/org/apache/activemq/jms/AbstractAdmin.java @@ -19,7 +19,6 @@ package org.apache.activemq.jms; import javax.naming.InitialContext; import javax.naming.NamingException; -import org.jboss.util.NotImplementedException; import org.objectweb.jtests.jms.admin.Admin; /** @@ -51,22 +50,22 @@ public class AbstractAdmin implements Admin public void createConnectionFactory(final String name) { - throw new NotImplementedException("FIXME NYI createConnectionFactory"); + throw new RuntimeException("FIXME NYI createConnectionFactory"); } public void deleteConnectionFactory(final String name) { - throw new NotImplementedException("FIXME NYI deleteConnectionFactory"); + throw new RuntimeException("FIXME NYI deleteConnectionFactory"); } public void createQueue(final String name) { - throw new NotImplementedException("FIXME NYI createQueue"); + throw new RuntimeException("FIXME NYI createQueue"); } public void deleteQueue(final String name) { - throw new NotImplementedException("FIXME NYI deleteQueue"); + throw new RuntimeException("FIXME NYI deleteQueue"); } public void createQueueConnectionFactory(final String name) @@ -81,12 +80,12 @@ public class AbstractAdmin implements Admin public void createTopic(final String name) { - throw new NotImplementedException("FIXME NYI createTopic"); + throw new RuntimeException("FIXME NYI createTopic"); } public void deleteTopic(final String name) { - throw new NotImplementedException("FIXME NYI deleteTopic"); + throw new RuntimeException("FIXME NYI deleteTopic"); } public void createTopicConnectionFactory(final String name) diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/jms/ActiveMQQAdmin.java b/tests/joram-tests/src/test/java/org/apache/activemq/jms/ActiveMQAdmin.java similarity index 95% rename from tests/joram-tests/src/test/java/org/apache/activemq/jms/ActiveMQQAdmin.java rename to tests/joram-tests/src/test/java/org/apache/activemq/jms/ActiveMQAdmin.java index acd05bb08e..4e9779ba2f 100644 --- a/tests/joram-tests/src/test/java/org/apache/activemq/jms/ActiveMQQAdmin.java +++ b/tests/joram-tests/src/test/java/org/apache/activemq/jms/ActiveMQAdmin.java @@ -44,7 +44,7 @@ import org.objectweb.jtests.jms.admin.Admin; * * @author Jeff Mesnil */ -public class ActiveMQQAdmin implements Admin +public class ActiveMQAdmin implements Admin { private ClientSession clientSession; @@ -59,8 +59,8 @@ public class ActiveMQQAdmin implements Admin ServerLocator serverLocator; /** - * Determines whether to act or 'no-op' on {@link ActiveMQQAdmin#serverStart()} and - * {@link ActiveMQQAdmin#serverStop()}. This is used when testing combinations of client and + * Determines whether to act or 'no-op' on {@link ActiveMQAdmin#serverStart()} and + * {@link ActiveMQAdmin#serverStop()}. This is used when testing combinations of client and * servers with different versions. * * @see https://github.com/activemq/activemq-version-tests @@ -68,15 +68,14 @@ public class ActiveMQQAdmin implements Admin private final boolean serverLifeCycleActive; private static final String SERVER_LIVE_CYCLE_PROPERTY = "org.apache.activemq.jms.ActiveMQAdmin.serverLifeCycle"; - public ActiveMQQAdmin() + public ActiveMQAdmin() { serverLifeCycleActive = Boolean.valueOf(System.getProperty(SERVER_LIVE_CYCLE_PROPERTY, "true")); try { Hashtable env = new Hashtable(); - env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); - env.put("java.naming.provider.url", "jnp://localhost:1099"); - env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); + env.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + env.put("java.naming.provider.url", "tcp://localhost:5445"); context = new InitialContext(env); } catch (NamingException e) diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/jms/SpawnedJMSServer.java b/tests/joram-tests/src/test/java/org/apache/activemq/jms/SpawnedJMSServer.java index b624cdc196..3a8b2fbbad 100644 --- a/tests/joram-tests/src/test/java/org/apache/activemq/jms/SpawnedJMSServer.java +++ b/tests/joram-tests/src/test/java/org/apache/activemq/jms/SpawnedJMSServer.java @@ -18,9 +18,6 @@ package org.apache.activemq.jms; import java.io.BufferedReader; import java.io.InputStreamReader; -import java.util.Hashtable; - -import javax.naming.InitialContext; import org.apache.activemq.api.core.TransportConfiguration; import org.apache.activemq.core.config.Configuration; @@ -31,8 +28,6 @@ import org.apache.activemq.core.server.ActiveMQServer; import org.apache.activemq.core.server.ActiveMQServers; import org.apache.activemq.jms.server.JMSServerManager; import org.apache.activemq.jms.server.impl.JMSServerManagerImpl; -import org.jnp.server.Main; -import org.jnp.server.NamingBeanImpl; /** * A SpawnedServer @@ -53,20 +48,6 @@ public class SpawnedJMSServer { try { - System.setProperty("java.rmi.server.hostname", "localhost"); - System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); - System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); - - final NamingBeanImpl namingInfo = new NamingBeanImpl(); - namingInfo.start(); - final Main jndiServer = new Main(); - jndiServer.setNamingInfo(namingInfo); - jndiServer.setPort(1099); - jndiServer.setBindAddress("localhost"); - jndiServer.setRmiPort(1098); - jndiServer.setRmiBindAddress("localhost"); - jndiServer.start(); - Configuration conf = new ConfigurationImpl() .addAcceptorConfiguration(new TransportConfiguration(NettyAcceptorFactory.class.getName())) .setSecurityEnabled(false) @@ -77,11 +58,7 @@ public class SpawnedJMSServer // disable server persistence since JORAM tests do not restart server final ActiveMQServer server = ActiveMQServers.newActiveMQServer(conf, false); - Hashtable env = new Hashtable(); - env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); - env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); JMSServerManager serverManager = new JMSServerManagerImpl(server); - serverManager.setContext(new InitialContext(env)); serverManager.start(); System.out.println("Server started, ready to start client test"); @@ -99,8 +76,6 @@ public class SpawnedJMSServer if ("STOP".equals(line.trim())) { server.stop(); - jndiServer.stop(); - namingInfo.stop(); System.out.println("Server stopped"); System.exit(0); } diff --git a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/admin/AdminFactory.java b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/admin/AdminFactory.java index a6c1b94590..650bfd0b39 100644 --- a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/admin/AdminFactory.java +++ b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/admin/AdminFactory.java @@ -18,8 +18,6 @@ package org.objectweb.jtests.jms.admin; import java.util.Properties; -import org.jboss.util.NestedRuntimeException; - public class AdminFactory { private static final String PROP_NAME = "jms.provider.admin.class"; @@ -36,7 +34,7 @@ public class AdminFactory Admin admin = null; if (adminClassName == null) { - throw new NestedRuntimeException("Property " + AdminFactory.PROP_NAME + " has not been found in input props"); + throw new RuntimeException("Property " + AdminFactory.PROP_NAME + " has not been found in input props"); } try { @@ -45,11 +43,11 @@ public class AdminFactory } catch (ClassNotFoundException e) { - throw new NestedRuntimeException("Class " + adminClassName + " not found.", e); + throw new RuntimeException("Class " + adminClassName + " not found.", e); } catch (Exception e) { - throw new NestedRuntimeException(e); + throw new RuntimeException(e); } return admin; } diff --git a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/message/headers/MessageHeaderTest.java b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/message/headers/MessageHeaderTest.java index ff15eef7e3..530e8a1cbe 100644 --- a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/message/headers/MessageHeaderTest.java +++ b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/message/headers/MessageHeaderTest.java @@ -23,8 +23,11 @@ import javax.jms.Message; import javax.jms.Queue; import javax.jms.TemporaryQueue; import javax.naming.Context; +import javax.naming.InitialContext; import javax.naming.NamingException; +import java.util.Hashtable; + import org.junit.Assert; import org.junit.Test; import org.objectweb.jtests.jms.framework.PTPTestCase; @@ -204,7 +207,12 @@ public class MessageHeaderTest extends PTPTestCase try { admin.createQueue("anotherQueue"); - Context ctx = admin.createContext(); + + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); + props.put("queue.anotherQueue", "anotherQueue"); + + Context ctx = new InitialContext(props); Queue anotherQueue = (Queue)ctx.lookup("anotherQueue"); Assert.assertTrue(anotherQueue != senderQueue); diff --git a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/queue/QueueBrowserTest.java b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/queue/QueueBrowserTest.java index 7e1496bd71..7626a5498c 100644 --- a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/queue/QueueBrowserTest.java +++ b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/queue/QueueBrowserTest.java @@ -22,7 +22,6 @@ import javax.jms.Message; import javax.jms.QueueBrowser; import javax.jms.TextMessage; -import org.jboss.util.NestedRuntimeException; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -164,7 +163,7 @@ public class QueueBrowserTest extends PTPTestCase } catch (JMSException e) { - throw new NestedRuntimeException(e); + throw new RuntimeException(e); } } diff --git a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/session/UnifiedSessionTest.java b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/session/UnifiedSessionTest.java index 6d8bc0cb66..1496579fe8 100644 --- a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/session/UnifiedSessionTest.java +++ b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/session/UnifiedSessionTest.java @@ -23,7 +23,6 @@ import javax.jms.Session; import javax.jms.TopicConnection; import javax.jms.TopicSession; -import org.jboss.util.NestedRuntimeException; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -279,7 +278,7 @@ public class UnifiedSessionTest extends UnifiedTestCase } catch (Exception e) { - throw new NestedRuntimeException(e); + throw new RuntimeException(e); } } diff --git a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PTPTestCase.java b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PTPTestCase.java index 6b39eb6a7d..7d72a3f0b8 100644 --- a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PTPTestCase.java +++ b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PTPTestCase.java @@ -23,8 +23,11 @@ import javax.jms.QueueSender; import javax.jms.QueueSession; import javax.jms.Session; import javax.naming.Context; +import javax.naming.InitialContext; -import org.jboss.util.NestedRuntimeException; +import java.util.Hashtable; + +import org.apache.activemq.jndi.ActiveMQInitialContextFactory; import org.junit.After; import org.junit.Before; @@ -117,8 +120,12 @@ public abstract class PTPTestCase extends JMSTestCase admin.createQueueConnectionFactory(PTPTestCase.QCF_NAME); admin.createQueue(PTPTestCase.QUEUE_NAME); - // end of admin step, start of JMS client step - ctx = admin.createContext(); + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName()); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, PTPTestCase.QCF_NAME); + props.put(Context.PROVIDER_URL, "tcp://127.0.0.1:5445"); + props.put("queue." + PTPTestCase.QUEUE_NAME, PTPTestCase.QUEUE_NAME); + Context ctx = new InitialContext(props); senderQCF = (QueueConnectionFactory)ctx.lookup(PTPTestCase.QCF_NAME); senderQueue = (Queue)ctx.lookup(PTPTestCase.QUEUE_NAME); @@ -138,7 +145,7 @@ public abstract class PTPTestCase extends JMSTestCase } catch (Exception e) { - throw new NestedRuntimeException(e); + throw new RuntimeException(e); } } diff --git a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PubSubTestCase.java b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PubSubTestCase.java index a4cf57f417..fa0282be49 100644 --- a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PubSubTestCase.java +++ b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PubSubTestCase.java @@ -23,8 +23,11 @@ import javax.jms.TopicPublisher; import javax.jms.TopicSession; import javax.jms.TopicSubscriber; import javax.naming.Context; +import javax.naming.InitialContext; -import org.jboss.util.NestedRuntimeException; +import java.util.Hashtable; + +import org.apache.activemq.jndi.ActiveMQInitialContextFactory; import org.junit.After; import org.junit.Before; @@ -117,8 +120,12 @@ public abstract class PubSubTestCase extends JMSTestCase admin.createTopicConnectionFactory(PubSubTestCase.TCF_NAME); admin.createTopic(PubSubTestCase.TOPIC_NAME); - // end of admin step, start of JMS client step - ctx = admin.createContext(); + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName()); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, PubSubTestCase.TCF_NAME); + props.put(Context.PROVIDER_URL, "tcp://127.0.0.1:5445"); + props.put("topic." + PubSubTestCase.TOPIC_NAME, PubSubTestCase.TOPIC_NAME); + Context ctx = new InitialContext(props); publisherTCF = (TopicConnectionFactory)ctx.lookup(PubSubTestCase.TCF_NAME); publisherTopic = (Topic)ctx.lookup(PubSubTestCase.TOPIC_NAME); @@ -140,7 +147,7 @@ public abstract class PubSubTestCase extends JMSTestCase } catch (Exception e) { - throw new NestedRuntimeException(e); + throw new RuntimeException(e); } } diff --git a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/UnifiedTestCase.java b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/UnifiedTestCase.java index 2f4b5b2112..3264bd5c6b 100644 --- a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/UnifiedTestCase.java +++ b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/UnifiedTestCase.java @@ -26,8 +26,11 @@ import javax.jms.Session; import javax.jms.Topic; import javax.jms.TopicConnectionFactory; import javax.naming.Context; +import javax.naming.InitialContext; -import org.jboss.util.NestedRuntimeException; +import java.util.Hashtable; + +import org.apache.activemq.jndi.ActiveMQInitialContextFactory; import org.junit.After; import org.junit.Before; @@ -166,8 +169,14 @@ public abstract class UnifiedTestCase extends JMSTestCase admin.createQueue(UnifiedTestCase.QUEUE_NAME); admin.createTopic(UnifiedTestCase.TOPIC_NAME); - // end of admin step, start of JMS client step - ctx = admin.createContext(); + Hashtable props = new Hashtable<>(); + props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName()); + props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, UnifiedTestCase.CF_NAME + ", " + UnifiedTestCase.QCF_NAME + ", " + UnifiedTestCase.TCF_NAME); + props.put(Context.PROVIDER_URL, "tcp://127.0.0.1:5445"); + props.put("queue." + UnifiedTestCase.DESTINATION_NAME, UnifiedTestCase.DESTINATION_NAME); + props.put("queue." + UnifiedTestCase.QUEUE_NAME, UnifiedTestCase.QUEUE_NAME); + props.put("topic." + UnifiedTestCase.TOPIC_NAME, UnifiedTestCase.TOPIC_NAME); + Context ctx = new InitialContext(props); producerCF = (ConnectionFactory)ctx.lookup(UnifiedTestCase.CF_NAME); // we see destination of the unified domain as a javax.jms.Destination @@ -197,7 +206,7 @@ public abstract class UnifiedTestCase extends JMSTestCase } catch (Exception e) { - throw new NestedRuntimeException(e); + throw new RuntimeException(e); } } diff --git a/tests/joram-tests/src/test/resources/provider.properties b/tests/joram-tests/src/test/resources/provider.properties index b8f137f732..49829f37a1 100644 --- a/tests/joram-tests/src/test/resources/provider.properties +++ b/tests/joram-tests/src/test/resources/provider.properties @@ -27,7 +27,7 @@ # Uncomment the chosen provider and comment the other ones ## -jms.provider.admin.class=org.apache.activemq.jms.ActiveMQQAdmin +jms.provider.admin.class=org.apache.activemq.jms.ActiveMQAdmin #jms.provider.admin.class = org.apache.activemq.api.jms.GenericAdmin #jms.provider.admin.class = org.objectweb.jtests.providers.admin.JoramAdmin #jms.provider.admin.class = org.objectweb.jtests.providers.admin.AshnaMQAdmin diff --git a/tests/performance-tests/pom.xml b/tests/performance-tests/pom.xml index 7737c3d6fb..ea82e65983 100644 --- a/tests/performance-tests/pom.xml +++ b/tests/performance-tests/pom.xml @@ -84,10 +84,6 @@ junit junit - - org.jboss.naming - jnpserver - org.apache.geronimo.specs geronimo-ejb_3.0_spec diff --git a/tests/soak-tests/pom.xml b/tests/soak-tests/pom.xml index 7605f74612..b876dc1a71 100644 --- a/tests/soak-tests/pom.xml +++ b/tests/soak-tests/pom.xml @@ -99,10 +99,6 @@ junit junit - - org.jboss.naming - jnpserver - apache-logging commons-logging diff --git a/tests/stress-tests/pom.xml b/tests/stress-tests/pom.xml index c9571905b2..9918a61260 100644 --- a/tests/stress-tests/pom.xml +++ b/tests/stress-tests/pom.xml @@ -99,10 +99,6 @@ junit junit - - org.jboss.naming - jnpserver - apache-logging commons-logging diff --git a/tests/timing-tests/pom.xml b/tests/timing-tests/pom.xml index 202ea26ea1..3b1fb1af7c 100644 --- a/tests/timing-tests/pom.xml +++ b/tests/timing-tests/pom.xml @@ -81,10 +81,6 @@ junit junit - - org.jboss.naming - jnpserver - org.apache.geronimo.specs geronimo-ejb_3.0_spec diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/util/InVMContext.java b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/util/InVMContext.java index 4103b80eaa..88ef024473 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/util/InVMContext.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/util/InVMContext.java @@ -277,7 +277,6 @@ public class InVMContext implements Context, Serializable { Hashtable env = new Hashtable(); env.put("java.naming.factory.initial", "org.apache.activemq.jms.tests.tools.container.InVMInitialContextFactory"); - env.put("java.naming.provider.url", "org.jboss.naming:org.jnp.interface"); return env; } diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/util/InVMNamingContext.java b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/util/InVMNamingContext.java index edfeae87f5..7fab4fa7ea 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/util/InVMNamingContext.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/util/InVMNamingContext.java @@ -276,7 +276,6 @@ public class InVMNamingContext implements Context, Serializable { Hashtable env = new Hashtable(); env.put("java.naming.factory.initial", "org.apache.activemq.jms.tests.tools.container.InVMInitialContextFactory"); - env.put("java.naming.provider.url", "org.jboss.naming:org.jnp.interface"); return env; } diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/util/NonSerializableFactory.java b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/util/NonSerializableFactory.java index 4fe692f87c..767fabf808 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/util/NonSerializableFactory.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/util/NonSerializableFactory.java @@ -21,15 +21,12 @@ import javax.naming.Name; import javax.naming.NamingException; import javax.naming.RefAddr; import javax.naming.Reference; -import javax.naming.StringRefAddr; import javax.naming.spi.ObjectFactory; import java.util.Collections; import java.util.HashMap; import java.util.Hashtable; import java.util.Map; -import org.jboss.util.naming.Util; - /** * used by the default context when running in embedded local configuration * @@ -42,47 +39,47 @@ public class NonSerializableFactory implements ObjectFactory { } - public static void unbind(final Context ctx, final String strName) throws NamingException - { - Name name = ctx.getNameParser("").parse(strName); - int size = name.size(); - String atom = name.get(size - 1); - Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); - String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); - NonSerializableFactory.getWrapperMap().remove(key); - Util.unbind(ctx, strName); - } +// public static void unbind(final Context ctx, final String strName) throws NamingException +// { +// Name name = ctx.getNameParser("").parse(strName); +// int size = name.size(); +// String atom = name.get(size - 1); +// Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); +// String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); +// NonSerializableFactory.getWrapperMap().remove(key); +// Util.unbind(ctx, strName); +// } - public static void rebind(final Context ctx, final String strName, final Object value) throws NamingException - { - Name name = ctx.getNameParser("").parse(strName); - int size = name.size(); - String atom = name.get(size - 1); - Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); - String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); - NonSerializableFactory.getWrapperMap().put(key, value); - String className = value.getClass().getName(); - String factory = NonSerializableFactory.class.getName(); - StringRefAddr addr = new StringRefAddr("nns", key); - Reference memoryRef = new Reference(className, addr, factory, null); - parentCtx.rebind(atom, memoryRef); - } +// public static void rebind(final Context ctx, final String strName, final Object value) throws NamingException +// { +// Name name = ctx.getNameParser("").parse(strName); +// int size = name.size(); +// String atom = name.get(size - 1); +// Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); +// String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); +// NonSerializableFactory.getWrapperMap().put(key, value); +// String className = value.getClass().getName(); +// String factory = NonSerializableFactory.class.getName(); +// StringRefAddr addr = new StringRefAddr("nns", key); +// Reference memoryRef = new Reference(className, addr, factory, null); +// parentCtx.rebind(atom, memoryRef); +// } - public static void bind(final Context ctx, final String strName, final Object value) throws NamingException - { - Name name = ctx.getNameParser("").parse(strName); - int size = name.size(); - String atom = name.get(size - 1); - Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); - String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); - NonSerializableFactory.getWrapperMap().put(key, value); - String className = value.getClass().getName(); - String factory = NonSerializableFactory.class.getName(); - StringRefAddr addr = new StringRefAddr("nns", key); - Reference memoryRef = new Reference(className, addr, factory, null); - - parentCtx.bind(atom, memoryRef); - } +// public static void bind(final Context ctx, final String strName, final Object value) throws NamingException +// { +// Name name = ctx.getNameParser("").parse(strName); +// int size = name.size(); +// String atom = name.get(size - 1); +// Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); +// String key = new StringBuilder().append(parentCtx.getNameInNamespace()).append("/").append(atom).toString(); +// NonSerializableFactory.getWrapperMap().put(key, value); +// String className = value.getClass().getName(); +// String factory = NonSerializableFactory.class.getName(); +// StringRefAddr addr = new StringRefAddr("nns", key); +// Reference memoryRef = new Reference(className, addr, factory, null); +// +// parentCtx.bind(atom, memoryRef); +// } public static Object lookup(final String name) throws NamingException {