[jboss-user] [Messaging, JMS & JBossMQ] - Unable to Connect to Connection Factory

gopal1.v@tcs.com do-not-reply at jboss.com
Thu May 17 07:42:39 EDT 2007


HI I am a newbie.to JBoss..I am using JbossIDE...JemsInstaller...
I selected ejb3.0 option while installing...

Here is my Client code which sends messages to JMS queue...
@Resource(mappedName = "java:JmsXA")
  |     private static ConnectionFactory connectionFactory;
  |     @Resource(mappedName = "queue/myqueue")
  |     private static Queue queue;
  | public static void main(String[] args) {
  |         final int NUM_MSGS = 3;
  |         try {
  | 	connection = connectionFactory.createConnection();
  |             session = connection.createSession(false,AUTO_ACKNOWLEDGE);
  |             messageProducer = session.createProducer(queue);
  |             message = session.createTextMessage();
  | 
  |             for (int i = 0; i < NUM_MSGS; i++) {
  |                 message.setText("This is message " + (i + 1));
  |                 System.out.println("Sending message: " + message.getText());
  |                 messageProducer.send(message);
  |             }
  | 


But The ConnectionFactory object after @resource is null...

If i try to lookup using IntiallookUp()
it is giving this error:
JmsXA not bound

If i use ConnectionFactory in the place of JmsXA 
It will give unmarshelled exception....
In the server side i am not using any deployment descriptor as i am using EJB3.0
MDB looks like this:
@MessageDriven(activationConfig =
  | {
  | @ActivationConfigProperty(propertyName="messagingType", propertyValue="javax.jms.MessageListener"),
  | @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
  | @ActivationConfigProperty(propertyName="Destination", propertyValue="testqueue"),
  | @ActivationConfigProperty(propertyName="ConnectionFactoryName", propertyValue="ConnectionFactory"),
  | @ActivationConfigProperty(propertyName="Transacted", propertyValue="true"),
  | @ActivationConfigProperty(propertyName="Xa", propertyValue="true"),
  | @ActivationConfigProperty(propertyName="DeliveryOption", propertyValue="B"),
  | @ActivationConfigProperty(propertyName="SubscriptionDurability", propertyValue="Durable"),
  | @ActivationConfigProperty(propertyName="MaxPoolSize", propertyValue="20"),
  | @ActivationConfigProperty(propertyName="MaxMessages", propertyValue="1"),
  | @ActivationConfigProperty(propertyName="resourceAdaptorName", propertyValue="swiftmq.rar")
  | })
  | 
  | public class AnnotatedTestMDBBean implements MessageListener {
  | 
  | 	public void onMessage(Message arg0) {
  | 		if(arg0 instanceof TextMessage){
  | 			TextMessage tm = (TextMessage)arg0;
  | 			try{
  | 				String text = tm.getText();
  | 				System.out.println("Received text:"+text);
  | 			}catch(JMSException e){
  | 				e.printStackTrace();
  | 			}
  | 		}
  | 
  | 
  | 

Is there anything i have to use....
Any links or tutorials are welcome....
Thanks in advance...
Gopal V

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046456#4046456

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046456



More information about the jboss-user mailing list