it works very well so i post it here.
thank u again.
And wish it would help others.
/************** sean's mail *************************/
Here is a program, based on your program that works for me. I had to
re-arrange a few things in your program.
You will need to change the JNDI details to suit your environment.
I think the main thing wrong was that the connection.start() has to
after everything else has been set up.
Hope this helps. If it works, please post to the jython list.
from java.util import Properties
from javax.jms import MessageListener, Session
from javax.naming import Context, InitialContext
msg = message.getText()
print "Got a message",
#look up connection factory and queue in jndi
properties = Properties()
properties[Context.PROVIDER_URL] = "file:///C:/temp"
initialContext = InitialContext(properties)
connectionFactory = initialContext.lookup("MyQueueConnectionFactory")
queue = initialContext.lookup("PMQ1")
#create a connection
connection = connectionFactory.createQueueConnection()
session = connection.createQueueSession(0, Session.AUTO_ACKNOWLEDGE)
receiver = session.createReceiver(queue)
listener = textListener()
receiver.messageListener = listener
x = raw_input ("Listening. Press a key to stop.\n")
Do You Yahoo!?