I need to send a message to a remote server's queue (running "JBoss MQ") so that it can process the message and act on it.
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
properties.put(Context.PROVIDER_URL, "jnp://192.168.1.131.129:1299");
InitialContext jndiContext = new InitialContext(properties);
//[2] Look up connection factory and queue.
ConnectionFactory connectionFactory = (ConnectionFactory)jndiContext.lookup("UIL2XAConnectionFactory");
Queue queue = (Queue)jndiContext.lookup("Queue/DataTransferQueue");
but I get an exception when running the above code :
(even though, I can ping the remote server).
javax.naming.CommunicationException: Could not obtain connection to any of these urls: 192.168.1.131.129:1299 and
discovery failed with error: javax.naming.CommunicationException:
Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
[Root exception is javax.naming.CommunicationException: Failed to connect to server 192.168.1.131.129:1299
Is there anything special to do to connect to a remote queue ?
The IP address you're using is incorrect: 192.168.1.131.129 has 5 numbers, it should only have 4.
I solved the problem by restarting my JBoss server with the following process arguments :
-b 0.0.0.0
the JBoss server is started by default to only allow local connections. by starting it with the afore mentionned arguments, you instruct it to accept remote connections.
Related
My requirement is to connect an application deployed in weblogic server, i will use a shell script to invoke a java EJB client residing in the same server but i need to use via SSL port.
When i try connecting with non-ssl port the connection is established but when SSL port is used im getting the below error:
"javax.namin.CommunicationException: Failed to initialize JNDI context, tried 2 time or times, the interval of each time is 0ms.
[Login failed for an unknown reason:P] [Root exception is weblogic.socket.UnrecoverableConnectException: [Login faile dfor an unknown reason:P]
Current java client arguments doesnot include SSL parameters, please help on this how do i achieve this.
I'm using Datadog to collect metrics from Kafka running on my localhost.
When I run the -info command on my Datadog agent this is the error I get for Kafka. Any ideas whats causing this?
kafka
-----
- instance #kafka-localhost-9999 [ERROR]: 'Cannot connect to instance localhost:9999 java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: \n\tjava.net.ConnectException: Connection refused]' collected 0 metrics
- Collected 0 metrics, 0 events & 0 service checks
It looks like that you have not set your JMX_PORT for kafka from where your datadog agent can listen information abouot the metrics.
Restart your Kafka with the following additional key/value pair parameter:
'JMX_PORT=9999'
$ JMX_PORT=9999 ./kafka-server-start.sh ../config/server.properties
This error essentially means that the Datadog Agent is unable to connect to the Kafka instance to retrieve metrics from the exposed mBeans over the RMI protocol. This error can be resolved by including the following JVM (Java Virtual Machine) arguments when starting the Kafka instance (required for Producer, Consumer, and Broker as they are all separate Java instances)
please
Please read this article
I have 2 processes on separate servers. One is running the Quartz scheduler and I want to connect to it from the other to manage triggers.
On the scheduler server the config is:
org.quartz.scheduler.rmi.export = true
org.quartz.scheduler.rmi.createRegistry = always
org.quartz.scheduler.rmi.registryHost = localhost
org.quartz.scheduler.rmi.registryPort = 1099
org.quartz.scheduler.rmi.serverPort = 1100
On the remote server the config is:
org.quartz.scheduler.rmi.proxy = true
org.quartz.scheduler.rmi.registryHost = ip-172-16-5-11.eu-west-1.compute.internal
org.quartz.scheduler.rmi.registryPort = 1099
When I try and connect to the remote scheduler I get the following error in the log:
ERROR [2016-07-28 09:10:23,017] xxxx: Error communicating with remote scheduler.
! java.net.ConnectException: Connection refused
! ... 83 common frames omitted
! Causing: java.rmi.ConnectException: Connection refused to host: log-emea-1; nested exception is:
! java.net.ConnectException: Connection refused
Although this host is a host on our network I have no idea why it is being returned by the remote registry.
There are no connectivity issues. If I run tcpdump on the remote machine I can see it connecting to the scheduler. It's just that the scheduler is returning this invalid host:
09:19:02.047589 IP 172.16.5.11.1099 > 172.16.0.81.54065: Flags [P.], seq 19:235, ack 105, win 210, options [nop,nop,TS val 1231389006 ecr 562121102], length 216
E.....#.#..........Q.K.1}.Z... ......c.....
Ie.N!.I.Q....w..9.e2...V0.|...sr.$org.quartz.core.QuartzScheduler_Stub...........pxr..java.rmi.server.RemoteStub......e....pxr..java.rmi.server.RemoteObject.a...a3....pxpw3.
UnicastRef.
log-emea-1...L/8. .a.69.e2...V0.|....x
Where is the Quartz RMI registry getting this hostname from? There are no clues in the hosts file or DNS. It appears to be random.
You could start your scheduler with the following JVM-Flag
java -Djava.rmi.server.hostname=...
(see RMI-FAQ or Why does java rmi keep connecting to 127.0.1.1. When ip is 192.168.X.X?)
I tried the JVM flag but that made no difference however it did lead me to a solution. I set the property in code and that fixed the problem.
System.setProperty("java.rmi.server.hostname", "quartz");
I have an EJB container that is deployed on JBoss 5.1 on to a Amazon AWS Fedora 8 virtual machine. I have another application which I want to access this EJB container remotely over the internet. But I am getting the following exception
javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: xxx.xxx.xx.x; nested exception is: java.net.ConnectException: Connection timed out]
Caused by: java.rmi.ConnectException: Connection refused to host: xxx.xxx.xx.x; nested exception is: java.net.ConnectException: Connection timed out
Caused by: java.net.ConnectException: Connection timed out
Here xxx.xxx.xx.x is the internal IP of the machine running the EJB.
Here is the code I used to access it
Properties props = new Properties();
props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,org.jboss.security.jndi.JndiLoginInitialContextFactory");
props.setProperty(Context.PROVIDER_URL, "<external-ip>:1099");
props.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
props.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
props.put("java.naming.provider.url", "jnp://<external-ip>:1099");
InitialContext ic = new InitialContext(props);
ic.lookup("EJBName");
I have also edited the /etc/hosts file like
127.0.0.1 localhost.localdomain localhost
xxx.xxx.xx.x hostname alias
and started JBoss with
-Djboss.bind.address=0.0.0.0 -Djava.rmi.server.hostname=xxx.xxx.xx.x -Dremoting.bind_by_host=false
I guess I have done all the necassary configurations and correct code for this but doesn't seems to work. Please help me solving this issue it has been bugging me for over a week now. And sorry for hiding the actual ips for security reasons.
Connection timeout It could be a firewall issue. Verify that the port is open: http://www.canyouseeme.org/
You can also try setting the properties: "org.omg.CORBA.ORBInitialHost" and "org.omg.CORBA.ORBInitialPort".
Can you telnet on: host address and orb port. i.e. 127.0.0.xxx 3700
If you do not get answer then it's definitely a firwall issue.
I want to be able to send messages to a remote JBoss server (JBoss MQ).
I can do it for a local one but i'm stuck when trying with a remote one.
can anyone explain to me how to do it ?
are there any specific steps to take ?
[what i've tried so far]
I need to send a message to a remote server's queue (running "JBoss MQ") so that it can process the message and act on it.
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
properties.put(Context.PROVIDER_URL, "jnp://192.168.131.129:1299");
InitialContext jndiContext = new InitialContext(properties);
//[2] Look up connection factory and queue.
ConnectionFactory connectionFactory = (ConnectionFactory)jndiContext.lookup("UIL2XAConnectionFactory");
Queue queue = (Queue)jndiContext.lookup("Queue/DataTransferQueue");
but I get an exception when running the above code :
(even though, I can ping the remote server).
javax.naming.CommunicationException: Could not obtain connection to any of these urls: 192.168.1.131.129:1299 and
discovery failed with error: javax.naming.CommunicationException:
Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
[Root exception is javax.naming.CommunicationException: Failed to connect to server 192.168.1.131.129:1299
Is there anything special to do to connect to a remote queue ?
Have you verified that you can connect to that remote host and port, i.e. telnet 192.168.131.129 1299? You might have a firewall that's blocking some traffic but allowing pings.
OK, so after trying a lot, I finally found out what the problem was :
I didn't start JBoss on the remote server in a way it could accept remote connections. by default, JBoss starts allowing only local connections.
so, I restarted it with this argument : -b 0.0.0.0 and it works fine now.
Thanks for your help and support.