Unable to Connect to Connection Factory
gopal1.v May 17, 2007 7:42 AMHI 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