[rabbitmq-discuss] socket error while using rabbitmq and a NAT (Network address translation)

mysurf mail stammailbox at gmail.com
Wed Mar 2 07:41:20 GMT 2011


Flash News :
I am sorry to bother you a lot this morning . But I have an interesting
finding
When I activate my client with the tracer - it connects well to the rabbitmq
server .
when I connect directly - it throws that exception .

So maybe my problem is with the connection string ?
here it is - I only replace the  ip and port
BasicChannel(Username, Password, VirtualHost, BrokerIp, BrokerPort,
Heartbeat);
BasicChannel(Username, Password, VirtualHost, "127.0.0.1",5672, Heartbeat);

and my ctor is

public BasicChannel(final String username, final String password,
final String virtualHost, final String brokerIp, final int brokerPort,
int heartbeat) {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setUsername(username);
        factory.setPassword(password);
        factory.setVirtualHost(virtualHost);
        factory.setRequestedHeartbeat(heartbeat);
        factory.setHost(brokerIp);
        factory.setPort(brokerPort);

        connection = null;
        try {
            connection = factory.newConnection();
        } catch (IOException e) {
            throw new PlatformException("could not create connection", e);
        }



Thanks


On Wed, Mar 2, 2011 at 9:26 AM, mysurf mail <stammailbox at gmail.com> wrote:

> Sorry,
> I get PossibleAuthenticationFailureException
>
> PlatformException: could not create connection
> 	at com.programa17.mmm.modules.stopwatch.util.BasicChannel.<init>(BasicChannel.java:40)
> 	at com.programa17.mmm.modules.stopwatch.util.BasicChannel.<init>(BasicChannel.java:23)
> 	at com.programa17.mmm.modules.stopwatch.util.RabbitMQTest$Manager.<init>(RabbitMQTest.java:94)
> 	at com.programa17.mmm.modules.stopwatch.util.RabbitMQTest.test1(RabbitMQTest.java:22)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> 	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> 	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
> 	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
> Caused by: com.rabbitmq.client.PossibleAuthenticationFailureException: Possibly caused by authentication failure
> 	at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:289)
> 	at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:383)
> 	at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:403)
> 	at com.programa17.mmm.modules.stopwatch.util.BasicChannel.<init>(BasicChannel.java:38)
> 	... 23 more
> Caused by: com.rabbitmq.client.AlreadyClosedException: clean connection shutdown; reason: Attempt to use closed channel
> 	at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:181)
> 	at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel.java:208)
> 	at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel.java:194)
> 	at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:281)
> 	... 26 more
>
>
> On Wed, Mar 2, 2011 at 9:01 AM, mysurf mail <stammailbox at gmail.com> wrote:
>
>> Ok,
>> I will repeat my test results fully .
>> It happens only from certain computers.
>> It usually throws an exception when the command
>> factory.newConnection() is invoked.
>> the exception is ConnectionException. I have it in the initial mail of
>> this thread.
>> ( I can telnet that port. I can connect from other computers. I can
>> connect to it with 1.7.0 clients )
>>
>> I dont think I am acking until that point.
>>
>>
>> On Tue, Mar 1, 2011 at 5:59 PM, Emile Joubert <emile at rabbitmq.com> wrote:
>>
>>> Hi,
>>>
>>>
>>> On 01/03/11 14:57, mysurf mail wrote:
>>>
>>>> Hi,
>>>>
>>>>
>>>> I setup a trace at the client app server. Set the listen port and
>>>> connection port and got a log for the unsuccessful
>>>> factory.newConnection() . I added it in attached the tracelog.txt.
>>>>
>>>
>>> This looks like a normal trace with a successful connection
>>> establishment, and subsequent exchange and queue declarations. I would be
>>> surprised if the broker logfile contained an abrupt connection failure at
>>> the corresponding time. Can you please confirm? If possible please supply a
>>> trace of a case where an error occurs.
>>>
>>>
>>>  now regarding the other references you gave me
>>>>
>>>> 1 Protocol errors:
>>>>  Acknowledging with an unknown delivery tag
>>>>  Redeclaring exchanges with different parameters
>>>>
>>>> you recommended not acking more than once. This whole thing started when
>>>> we upgraded the rabbitmq version and Matthias sujested we will change
>>>> the consumer to ack (i.e. we changed it to
>>>> channel.basicConsume(queueName, FALSE, queueingConsumer);)
>>>> (This is if I understood him right )
>>>> So How can I control the acking . How do I know if I ack more then once.
>>>>
>>>
>>> This is more than a recommendation. From the specification:
>>>
>>>  "a client MUST not acknowledge the same message more than once."
>>>
>>> Check whether your client contains instances of "channel.basicAck". If
>>> you acknowledge messages more than once you will see a channel exception.
>>>
>>>
>>> Emile
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110302/c6d31058/attachment.htm>


More information about the rabbitmq-discuss mailing list