-
1. Re: Can anybody help me to create temporary topic or queue in jboss7?
nickarls Nov 19, 2013 5:10 AM (in response to srimanta.maji)Show your code. What happens? An error message? A durable queue?
-
2. Re: Can anybody help me to create temporary topic or queue in jboss7?
srimanta.maji Nov 22, 2013 2:46 AM (in response to nickarls)Class.forName("org.hornetq.jms.client.HornetQTemporaryTopic",false,MessagingFactory.class.getClassLoader());
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
props.put(Context.SECURITY_PRINCIPAL, "appAdmin");
props.put(Context.SECURITY_CREDENTIALS, "GlobalIDsAdmin2013");
props.put(Context.PROVIDER_URL, "remote://192.168.33.55:45447");
InitialContext iniCtx = new InitialContext(props);
Object tmp = iniCtx.lookup("jms/RemoteConnectionFactory");
TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;
TopicConnection topicConn = tcf.createTopicConnection((String) props.get(Context.SECURITY_PRINCIPAL),
(String) props.get(Context.SECURITY_CREDENTIALS));
TopicSession topicSession = topicConn.createTopicSession(false, TopicSession.CLIENT_ACKNOWLEDGE);
topicConn.start();
Topic serverTopic = topicSession.createTemporaryTopic();
//binding the temporary server topic
String serverTopicBindName = "ServerTopic";
try {
iniCtx.rebind(serverTopicBindName, serverTopic);
} catch (NameAlreadyBoundException e) {
KLogger.error(e);
}
---------Produces errors-----------added jboss-client.jar in class path ------
Exception in thread "main" javax.naming.NamingException: Failed to rebind [Root exception is java.io.IOException: java.lang.ClassNotFoundException: org.hornetq.jms.client.HornetQTemporaryTopic from [Module "org.jboss.as.remoting:main" from local module loader @eebafe (roots: D:\gid\jboss\modules)]]
at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)
at org.jboss.naming.remote.protocol.v1.Protocol$3.execute(Protocol.java:306)
at org.jboss.naming.remote.protocol.v1.Protocol$3.execute(Protocol.java:265)
at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.rebind(RemoteNamingStoreV1.java:95)
at org.jboss.naming.remote.client.RemoteContext.rebind(RemoteContext.java:95)
at org.jboss.naming.remote.client.RemoteContext.rebind(RemoteContext.java:99)
at javax.naming.InitialContext.rebind(InitialContext.java:427)
at com.globalids.server.messaging.ConnectionManager.main(ConnectionManager.java:391)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.io.IOException: java.lang.ClassNotFoundException: org.hornetq.jms.client.HornetQTemporaryTopic from [Module "org.jboss.as.remoting:main" from local module loader @eebafe (roots: D:\gid\jboss\modules)]
at org.jboss.naming.remote.protocol.v1.Protocol$3.handleServerMessage(Protocol.java:329)
at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: org.hornetq.jms.client.HornetQTemporaryTopic from [Module "org.jboss.as.remoting:main" from local module loader @eebafe (roots: D:\gid\jboss\modules)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:266)
at org.jboss.marshalling.AbstractClassResolver.loadClass(AbstractClassResolver.java:135)
at org.jboss.marshalling.AbstractClassResolver.resolveClass(AbstractClassResolver.java:116)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:892)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1204)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)
at org.jboss.naming.remote.protocol.v1.Protocol$3.handleServerMessage(Protocol.java:327)
... 4 more
-
3. Re: Can anybody help me to create temporary topic or queue in jboss7?
jbertram Nov 22, 2013 9:17 AM (in response to srimanta.maji)What is the purpose of binding the temporary topic into JNDI? It will only exist as long as the connection remains open and you already have a reference to it. A temporary topic is not something other clients should be using.
-
4. Re: Can anybody help me to create temporary topic or queue in jboss7?
srimanta.maji Nov 25, 2013 10:12 AM (in response to jbertram)Actually we have a software having distributed backend where we can start a java remote agent on the fly and communication between that remote agent and server is done via hornetq by creating a temporary queue for this habitat.
-
5. Re: Can anybody help me to create temporary topic or queue in jboss7?
jbertram Nov 25, 2013 10:31 AM (in response to srimanta.maji)That sounds perfectly reasonable, but it doesn't answer the question of why the temporary topic is being bound into JNDI.
-
6. Re: Can anybody help me to create temporary topic or queue in jboss7?
srimanta.maji Nov 27, 2013 4:37 AM (in response to jbertram)Actually i need to create a temporary queue with name of the java agent that is create one the fly. That is why temporary topic or queue is being bound into a specific name.
-
7. Re: Can anybody help me to create temporary topic or queue in jboss7?
jbertram Nov 27, 2013 9:46 AM (in response to srimanta.maji)All you're doing is restating the problem (i.e. you want to bind a temporary JMS destination into JNDI). You've still not indicated why you want to do this (at least not that I can tell).
In any event, the problem appears to be related to classloading. There's probably a module dependency that needs to be added somewhere.
-
8. Re: Can anybody help me to create temporary topic or queue in jboss7?
jaikiran Nov 27, 2013 11:50 PM (in response to jbertram)To add to what Justin said, even if you get past that classloading issue, I don't think you'll be able to bind anything to the server side JNDI context from a remote client using the remote naming API because as far as I remember, that API only allows read only JNDI operations like lookup (see "JNDI operations allowed using remote-naming project" section in this article Remote EJB invocations via JNDI - EJB client API or remote-naming project - JBoss AS 7.1 - Project Documentation Editor)