Hello Piero,
I encountered the same issue before. Obviously the firewall needs to be configured to allow the appropriate ports to be accessible first off. The second part for the random port number is what I experienced as well.
There is probably a parameter you can pass to the vm to configure this but what I ended up doing was configuring the options in the domains/<yourdomain>/imq/instances/imqbroker/props/config.properties file. The jms.tcp.port kept changing on me randomly so at the end of this file I added the property imq.jms.tcp.port=38669. After a restart it locked this service/protocal to port 38669.
Hope this helps.
S.D.
[Message sent by forum member 'samdoyle' (samdoyle)]
http://forums.java.net/jive/thread.jspa?messageID=239237