Problems with sending message to remote JBoss server
mbarger Feb 15, 2002 4:06 PMOkay I've seen versions of this problem but still can't get my client code running on my PC to connect to the queue created by my Sun machine. I have JBoss running successfully on my Sun. The example that I am using is my version of the message-driven bean example from the JBoss paid documentation. On my machine the version I used comes from c:\JBossBook-2.4.x\examples\src\main\org\jboss\chap4\ex2. I can get the MDB deployed and JBoss to run on the PC and connect to it with my PC client code. I also took the exact same code and was able to do the same on my Sun machine. Now I need to communicate from my PC to my remote Sun host. Here is the output from my PC (Windows 2000) when running the example:
Buildfile: build.xml
run-example-s:
[echo] Target run-example-s
prepare:
[echo] prepare dir: C:\JBossBook-2.4.x\examples/build/chap4
chap4-ex4-jar:
run-example-s:
[echo] Sending messages....
[java] Begin sendAsync
[java] Begin setupPTP
[java] javax.naming.ServiceUnavailableException: Connection refused: connect. Root exception is java.net.ConnectException: Connection refused: connect
[java] at java.net.PlainSocketImpl.socketConnect(Native Method)
[java] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:355)
[java] at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:142)
[java] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:129)
[java] at java.net.Socket.(Socket.java:273)
[java] at java.net.Socket.(Socket.java:100)
[java] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:102)
[java] at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:776)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:340)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:333)
[java] at javax.naming.InitialContext.lookup(InitialContext.java:350)
[java] at org.jboss.chap4.ex4.SendClient.setupPTP(SendClient.java:60)
[java] at org.jboss.chap4.ex4.SendClient.sendAsync(SendClient.java:81)
[java] at org.jboss.chap4.ex4.SendClient.main(SendClient.java:110)
[java] Exception in thread "main"
[java] Java Result: 1
-------------------------------------------------------
Client side files:
My changes to jboss.xml are:
<!-- For Remote Message Driven Beans -->
MyRemoteProvider
jnp:192.150.113.23:1099
org.jboss.jms.jndi.JBossMQProvider
java:/XAConnectionFactory
java:/XAConnectionFactory
.....................................................
and jboss.xml:
.....................................................
<?xml version="1.0"?>
false
<resource-managers>
<resource-manager>
<res-name>queuefactoryref</res-name>
<res-jndi-name>java:/RemoteJmsXA</res-jndi-name>
</resource-manager>
<resource-manager>
<res-name>queueref</res-name>
<res-jndi-name>jnp://192.150.113.23:1099/queue/B</res-jndi-name>
</resource-manager>
</resource-managers>
<enterprise-beans>
<message-driven>
<ejb-name>TextMDB</ejb-name>
<destination-jndi-name>queue/B</destination-jndi-name>
<resource-ref>
<res-ref-name>jms/QCF</res-ref-name>
<jndi-name>QueueConnectionFactory</jndi-name>
</resource-ref>
</message-driven>
</enterprise-beans>
.......................................................
on the server side:
my changes to JBoss-2.4.4_Tomcat-4.0.1/jboss/conf/catalina/jboss.jcml are:
<!-- For Remote Message Driven Beans -->
MyRemoteProvider
jnp:192.150.113.23:1099
org.jboss.jms.jndi.JBossMQProvider
java:/XAConnectionFactory
java:/XAConnectionFactory
.....................................................
and farther below in the file:
.....................................................
<!-- JMS Remote XA Resource adapter, use this to get transacted JMS in beans -->
RemoteJmsXA
JCA:service=RARDeployer
JMS Adapter
MinervaXACMFactory
<!-- See the documentation for the specific connection manager
implementation you are using for the properties you can set -->
JmsProviderAdapterJNDI=java:MyRemoteProvider
# Pool type - uncomment to force, otherwise it is the default
#PoolConfiguration=per-factory
# Connection pooling properties - see
# org.jboss.pool.PoolParameters
MinSize=0
MaxSize=10
Blocking=true
GCEnabled=false
IdleTimeoutEnabled=false
InvalidateOnError=false
TrackLastUsed=false
GCIntervalMillis=120000
GCMinIdleMillis=1200000
IdleTimeoutMillis=1800000
MaxIdleTimeoutPercent=1.0
<!-- Principal mapping configuration -->
org.jboss.resource.security.ManyToOnePrincipalMapping
....................................................
and my jndi.properties file
....................................................
java.naming.factory.initial=org.jnp.interfaces.Namin
java.naming.factory.url.pkgs=org.jboss.naming:org.jn
# Do NOT uncomment this line as it causes in VM call
# RMI!
#java.naming.provider.url=localhost
java.naming.provider.url=jnp://192.150.113.23:1099
.......................................................
lastly, my /etc/hosts file on my Sun is:
.......................................................
127.0.0.1 localhost
192.150.113.23 reaper loghost
Help!!
Thanks in advance.