Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JBoss/WildFly
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Tim Cooke
Liutauras Vilda
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Rob Spoor
Junilu Lacar
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Piet Souris
Carey Brown
Bartenders:
Forum:
JBoss/WildFly
Jboss 6.1.0 hornetq JMS configuration
velgapudi suresh
Ranch Hand
Posts: 32
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Dear All,
In my ear using JMS queues, i am unable to configure the JMS . I include queue name in hornetq-jms.xml as
<queue name="STBLogProcessor"> <entry name="/queue/STBLogProcessor"/> </queue>
and in my
servlet
calling like this
HashMap<String,String> stbDetailsMap=new HashMap<String,String>(); stbDetailsMap.put("accountId", hotelId); stbDetailsMap.put("roomNo","mg"); stbDetailsMap.put("ua","mg"); stbDetailsMap.put("serialNo",ipAddress); stbDetailsMap.put("requestStr",requestStr); stbDetailsMap.put("responseStr",responseStr); stbDetailsMap.put("timeStamp",new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(requestDate)); stbDetailsMap.put("totalSpace",totalSpace); stbDetailsMap.put("freeSpace",freeSpace); stbDetailsMap.put("logFileCount",logFileCount); sendQueMessage(stbDetailsMap);
and my method will be
public void sendQueMessage(HashMap<String,String> stbDetailsMap) { Context jndiContext = null; QueueConnectionFactory queueConnectionFactory = null; QueueConnection queueConnection = null; QueueSession queueSession = null; Queue queue = null; XMLConfig config= new XMLConfig("billing-config.xml"); try { Hashtable<String, String> props = new Hashtable<String, String>(); props.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); props.put(InitialContext.PROVIDER_URL, config.getString("MB_Billing_Common.queue.queuePath")); jndiContext = new InitialContext(props); queue = (Queue) jndiContext.lookup("queue/STBLogProcessor"); queueConnectionFactory = (QueueConnectionFactory) jndiContext.lookup("QueueConnectionFactory"); queueConnection = queueConnectionFactory.createQueueConnection(); queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); QueueSender sender = queueSession.createSender(queue); //TextMessage msg = queueSession.createTextMessage(); MapMessage msg=queueSession.createMapMessage(); //msg.setText("Message " + System.currentTimeMillis()); msg.setString("roomNo", stbDetailsMap.get("roomNo")); msg.setString("ua", stbDetailsMap.get("ua")); msg.setString("serialNo", stbDetailsMap.get("serialNo")); msg.setString("request", stbDetailsMap.get("requestStr")); msg.setString("response", stbDetailsMap.get("responseStr")); msg.setString("timeStamp", stbDetailsMap.get("timeStamp")); msg.setString("accountId", stbDetailsMap.get("accountId")); msg.setString("freeSpace", stbDetailsMap.get("freeSpace")); msg.setString("totalSpace", stbDetailsMap.get("totalSpace")); msg.setString("logFileCount", stbDetailsMap.get("logFileCount")); sender.send(msg); } catch (NamingException e) { System.out.println("Could not create JNDI API " + "context: " + e.toString()); } catch (JMSException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } finally { if (queueConnection != null) { try { queueConnection.close(); } catch (JMSException e) { } } } }
is any file i have to change for running the my queue.
Regards,
Suresh.V
velgapudi suresh
Ranch Hand
Posts: 32
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Dear All,
Anyone help out JMS configuration in
Jboss
6.1.0 using horentq .
Guru Bojja
Greenhorn
Posts: 14
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
what is the error you are getting .
velgapudi suresh
Ranch Hand
Posts: 32
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi Guru,
Now i removed my ear and started server . I am able to see the jms name in my jmx-console.
When i run my servlet getting below error.
Could not create JNDI API context: javax.naming.NameNotFoundException: QueueConnectionFactory not bound
Guru Bojja
Greenhorn
Posts: 14
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
HI
Did you add the connection factory "QueueConnectionFactory" in respective JBOSS JMS config files ?
otherwise use default "ConnectionFactory". it will work.
velgapudi suresh
Ranch Hand
Posts: 32
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi Guru,
Sorry for late response.
As per your suggestion modified to ConnectionFactory, now i am able to send the JMS.
Now, from my servlet calling remote server JMS queue. My message is going to the jnp url but unable to receive in server side.
Is any configuration i need to change.
My servlet communicate to ear.
Regards,
Suresh
Guru Bojja
Greenhorn
Posts: 14
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
What is your receiver ?
it is MDB or any other?
regards
Guru...
velgapudi suresh
Ranch Hand
Posts: 32
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
Its MDB.
And i configured my jboss.xml like this
<message-driven>
<ejb-name>STBLogProcessor</ejb-name>
<destination-jndi-name>queue/STBLogProcessor</destination-jndi-name>
</message-driven>
and in ejb.xml i am added
<message-driven >
<description><![CDATA[Description for STBLogProcessor]]></description>
<display-name>Name for STBLogProcessor</display-name>
<ejb-name>STBLogProcessor</ejb-name>
<ejb-class>com.mb.logapp.processor.STBLogProcessor</ejb-class>
<transaction-type>Container</transaction-type>
<acknowledge-mode>Auto-acknowledge</acknowledge-mode>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>
</message-driven>
but when change another jboss 6.1.0 ip then unable to send the message.
regards,
SureshV
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
can I integrate JMS with Servlets???
A simple JNDI question....
New To JMS
Message is created but not received by the receiver
P2P using WSAD's embedded JMS- Naming Exception
More...