-
1. Accessing a remote queue (appendix)
fane Feb 4, 2003 4:30 AM (in response to fane)Also, I haven't changed anything in the jboss configuration files. Do I need to change anything, like adding a JMS remote provider or something? If so, why do I need to do it?
-
2. Re: Accessing a remote queue
wmprice Feb 4, 2003 8:11 PM (in response to fane)Trying setting the following option in your run.sh file:
At the JAVA_OPTS section use
-Djava.rmi.server.hostname=IPADDRESS
Bounce the server and give it a shot.
Weston -
3. Re: Accessing a remote queue
suedehead33 Feb 4, 2003 10:00 PM (in response to fane)Try using a jndi.properties file to specify the location of the JBoss server where you want to send the message.
Content of jndi.properties file:
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=192.168.192.252:1099
For the client, here's the sample code that will automatically use the jndi.properties file for location the server. Make sure to add the jndi.properties file to the classpath when running the client app:
try {
InitialContext iniCtx = new InitialContext(env);
QueueConnectionFactory qcf = (QueueConnectionFactory)iniCtx.lookup("ConnectionFactory");
qcf.createQueueConnection();
Queue queue = (Queue) iniCtx.lookup("queue/B");
QueueSession queueSession = queueConn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
QueueSender queueSender = queueSession.createSender(queue);
TextMessage txtMsg = queueSender.createTextMessage();
txtMsg.setText("Hello Queue");
queueSender.send(txtMsg);
queueSession.close();
queueConn.close();
} catch (Exception e) {
e.printStackTrace();
} -
4. Re: Accessing a remote queue
suedehead33 Feb 4, 2003 10:16 PM (in response to fane)correction on line 2:
InitialContext iniCtx = new InitialContext(); -
5. Re: Accessing a remote queue
fane Feb 5, 2003 3:21 AM (in response to fane)wmprince, thank you for your suggestion but the hack doesn't make the error go away. In fact, it doesn't change a thing.
I use jnp for JNDI resolution and OIL (which is over TCP/IP, not RMI) for JMS, actually, the second seems to be JBoss's default. Sniffing both the nic and the loopback interface, I can see some RMI activity which is carried out succesfully between me and the destination, so the problem seems to be of a different kind. -
6. Re: Accessing a remote queue
fane Feb 5, 2003 3:49 AM (in response to fane)Thanks suedehead33, but your solution also doesn't work, setting the environment overrides the properties file, as shown by calling iniCtx.getEnvironment(). Nevertheless, I've tried using the jndi.properties file and commenting out the lines that set up the environment in the client, to no avail. Any other ideas?
I've seen some old comments on the forum (a year old ones, all concerning JBoss 2.4.6) saying you need to configure a remote JMS provider. How did things change for JBoss 3.0.x? -
7. Re: Accessing a remote queue
tristar Feb 5, 2003 5:30 AM (in response to fane)I'm still beginner in the JBoss environment, so I can't help you yet. But I can give additional info. Both of the parties (c/s) run on a single W2K machine, using jboss-3.0.5RC1 along with the jdk1.4.0.
First, I adopted an MDB example of the J2EE to the JBoss: a client sending 3 msg to the MDB. The server announced the error (1) as described by fane. Msg 2 was received by the MDB! Then the server reported a final error(2):
(1) 09:20:34,177 ERROR [OILClientIL] Cannot connect to the ConnectionReceiver/Server
09:20:34,378 WARN [OILServerILService] Client request resulted in a server exception:
org.jboss.mq.SpyJMSException: Could not pong;
...
(2) 09:20:34,768 INFO [STDOUT] TestMessageDrivenBean.onMessage() got message
org.jboss.mq.SpyTextMessage
ERROR: invalid console appender config detected, console stream is looping
Then I tried out one of the MDB examples of the JBoss AdminDevel, but with the same result. Here, instead of (2) another warning was given by the server:
10:22:03,282 WARN [SecurityManager] No SecurityMetadadata was available for A adding default security conf -
8. Re: Accessing a remote queue
suedehead33 Feb 5, 2003 7:28 AM (in response to fane)I also encountered the same error as described by tristar. I'm running JBoss 3.0.4 in Windows 2000 while my clients are sending messages from Red Hat Linux 8.0.
What seems to be the problem here? Do we have to make some configurations on the JBoss server? -
9. Re: Accessing a remote queue
fane Feb 5, 2003 7:40 AM (in response to fane)Hello tristar,
for me JMS works perfectly on the same machine, these problems appear when trying to connect to remote queues (on other computers). The documentation is clearly lacking here. -
10. Re: Accessing a remote queue
suedehead33 Feb 6, 2003 5:31 AM (in response to fane)Hi fane!
I think the problem is not with the JBoss server and JMS client app. The "Cannot connect to the ConnectionReceiver/Server" error can be accounted to the /etc/hosts configuration of the linux box you are using.
Let's say you have the JMS client app running at 192.168.192.250 (let's use gandalf for the PC's name) and the JBoss server at 192.168.192.252 (merlin). Edit the /etc/hosts for both PCs and use the config contents below:
127.0.0.1 localhost.localdomain localhost
192.168.192.250 gandalf
192.168.192.252 merlin
After editing, restart the JBoss server. You're client app at "gandalf" should be able to send messages to "merlin" with no problems.
We were able to tweak this problem here at our office using Red Hat 8.0/7.3 and Windows 2000. No exception errors so far =D -
11. Re: Accessing a remote queue
tristar Feb 6, 2003 7:21 AM (in response to fane)Hi suedehead33,
sounds good - but how to configure hosts on W2K? This evening I will have a laptop available, then I will run the test in the distributed env (but on 2 W2K machines!) ... -
12. Re: Accessing a remote queue
fane Feb 6, 2003 8:50 AM (in response to fane)Hi suedehead33, I think that could have been the problem, since I had merlin in hosts with an old IP. I have a static address, while merlin was getting its address through DHCP, so it always changes. Now we've made merlin use a static IP and I've put *that* IP in my hosts file.
Now we've compiled jboss and the apps using the 1.4.1 JDK and everything works well. Seems that JMS (JNDI) and DHCP don't mix too well.
Hey,thanks for your reply and good luck! One problem off my chest :D. -
13. Re: Accessing a remote queue
suedehead33 Feb 6, 2003 9:55 PM (in response to fane)To tristar:
For Win2k, you can find the hosts file at WINNT\system32\drivers\etc folder.
To fane:
Nice to hear that your system works perfectly fine now! =D -
14. Re: Accessing a remote queue
tristar Feb 7, 2003 5:31 AM (in response to fane)Hi suedehead33,
thanks a lot for your tips! But it doesn't help. While entity beans and servlets can be accessed remotely (even before changing the hosts file), the message problems remain. ;-(( I will do some other stuff for a while ...