You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by shantanu_chawla <sh...@gmail.com> on 2006/10/12 18:27:18 UTC

using ActiveMQ with java on one end and C# on the other

Hi,

I am newbie to activemq and and I am trying to send/consume message from
java and consume/send message fro C# client using active mq. I have
downloaded activemq 4.0.1 and C# ActiveMQ and NMS library from svn. I tried
the TestNMS program with the C# sharp client to send and receive message and
it works. so is from the java client, but when I send message from java I
cannt receive the message in C# client and when I try to receive a message
send from C# client in java client I get java.lang.OutOfMemoryError
exception.

Can someone provide a working sample of message produce and receiver from
java to c# or viceversa.

Thanks

Shantanu
-- 
View this message in context: http://www.nabble.com/using-ActiveMQ-with-java-on-one-end-and-C--on-the-other-tf2431461.html#a6779677
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: JournalPersistenceAdapter.recover hangs

Posted by Adrian Tarau <ad...@daxtechnologies.com>.
It says there that the last release is 4.0.1, even if there is 4.0.2 in 
the list, at the previous releases??!!!
And I read somewhere that is recommended 4.0.1, because 4.0.2 is not 
official???


    Latest Releases

You can find all the distributions for 4.x and above within the 
Distribution Area^ 
<http://people.apache.org/repository/incubator-activemq/>.


The latest release is ActiveMQ 4.0.1 Release 
<http://www.activemq.org/site/activemq-401-release.html>

Other releases are available

    * Current Maven 2 snapshot releases^
      <http://people.apache.org/maven-snapshot-repository/org/apache/activemq/apache-activemq/>
      or older Maven 2 snapshots^
      <http://people.apache.org/maven-snapshot-repository/incubator-activemq/incubator-activemq/>
    * Other development SNAPSHOT releases^
      <http://people.apache.org/repository/incubator-activemq/zips/>
    * Previous distributions^
      <http://people.apache.org/repository/incubator-activemq/distributions/>


    Previous Releases

    * ActiveMQ 1.0 Release
      <http://www.activemq.org/site/activemq-10-release.html>
    * ActiveMQ 1.1 Release
      <http://www.activemq.org/site/activemq-11-release.html>
    * ActiveMQ 1.2 Release
      <http://www.activemq.org/site/activemq-12-release.html>
    * ActiveMQ 1.3 Release
      <http://www.activemq.org/site/activemq-13-release.html>
    * ActiveMQ 1.4 Release
      <http://www.activemq.org/site/activemq-14-release.html>
    * ActiveMQ 1.5 Release
      <http://www.activemq.org/site/activemq-15-release.html>
    * ActiveMQ 2.0 Release
      <http://www.activemq.org/site/activemq-20-release.html>
    * ActiveMQ 2.1 Release
      <http://www.activemq.org/site/activemq-21-release.html>
    * ActiveMQ 3.0 Release
      <http://www.activemq.org/site/activemq-30-release.html>
    * ActiveMQ 3.1 Release
      <http://www.activemq.org/site/activemq-31-release.html>
    * ActiveMQ 3.2 Release
      <http://www.activemq.org/site/activemq-32-release.html>
    * ActiveMQ 3.2.1 Release
      <http://www.activemq.org/site/activemq-321-release.html>
    * ActiveMQ 3.2.2 Release
      <http://www.activemq.org/site/activemq-322-release.html>
    * ActiveMQ 4.0 M4 Release
      <http://www.activemq.org/site/activemq-40-m4-release.html>
    * ActiveMQ 4.0 RC2 Release
      <http://www.activemq.org/site/activemq-40-rc2-release.html>
    * ActiveMQ 4.0 Release
      <http://www.activemq.org/site/activemq-40-release.html>
    * ActiveMQ 4.0.1 Release
      <http://www.activemq.org/site/activemq-401-release.html>
    * ActiveMQ 4.0.2 Release
      <http://www.activemq.org/site/activemq-402-release.html>





Rob Davies wrote:
> Perhaps you'd be better to use 4.0.2 ?
>
> cheers,
>
> Rob
> On 12 Oct 2006, at 21:08, Adrian Tarau wrote:
>
>> More about this. I found where it is the problem. The problem is in 
>> LogFileManager. Look at the first source code, code from version 
>> 4.0.1, which should work fine and return null when the next data 
>> record belongs to a log with an id less or equal that the current one.
>> The second source code is a decompilation with JAD and the second 
>> test is not there.
>>
>> How could be possible? The code seems to be behind the source code !!!!!
>>
>> Thanks.
>>
>> *Source from 4.0.1*
>>
>> public Location getNextDataRecordLocation(Location lastLocation) 
>> throws IOException, InvalidRecordLocationException {
>>        RecordInfo ri = readRecordInfo(lastLocation);
>>        while (true) {
>>
>>            int logFileId = ri.getLocation().getLogFileId();
>>            int offset = ri.getNextLocation();
>>
>>            // Are we overflowing into next logFile?
>>            if (offset >= ri.getLogFileState().getAppendOffset()) {
>>                LogFileNode nextActive = 
>> ri.getLogFileState().getNextActive();
>>                *if (nextActive == null || nextActive.getId() <= 
>> ri.getLogFileState().getId() ) {*
>>                    return null;
>>                }
>>                logFileId = nextActive.getId();
>>                offset = 0;
>>            }
>>
>>            try {
>>                ri = readRecordInfo(new Location(logFileId, offset));
>>            } catch (InvalidRecordLocationException e) {
>>                return null;
>>            }
>>
>>            // Is the next record the right record type?
>>            if (ri.getHeader().getRecordType() == DATA_RECORD_TYPE) {
>>                return ri.getLocation();
>>            }
>>            // No? go onto the next record.
>>        }
>>    }
>>
>> *Decompiled class*
>>
>> public Location getNextDataRecordLocation(Location lastLocation) 
>> throws IOException, InvalidRecordLocationException {
>> /* 409*/        RecordInfo ri = readRecordInfo(lastLocation);
>> /* 412*/        do {
>> /* 412*/            int logFileId = ri.getLocation().getLogFileId();
>> /* 413*/            int offset = ri.getNextLocation();
>> /* 416*/            if(offset >= 
>> ri.getLogFileState().getAppendOffset()) {
>> /* 417*/                LogFileNode nextActive = 
>> ri.getLogFileState().getNextActive();
>> /* 418*/                *if(nextActive == null)*
>> /* 419*/                    return null;
>> /* 421*/                logFileId = nextActive.getId();
>> /* 422*/                offset = 0;
>>                    }
>> /* 426*/            try {
>> /* 426*/                ri = readRecordInfo(new Location(logFileId, 
>> offset));
>>                    }
>> /* 427*/            catch(InvalidRecordLocationException e) {
>> /* 428*/                return null;
>>                    }
>>                } while(ri.getHeader().getRecordType() != 1);
>> /* 433*/        return ri.getLocation();
>>            }
>>
>> Adrian Tarau wrote:
>>> I got recently into a problem with the journal, when the application 
>>> starts it hangs. After some debug, I noticed that
>>> JournalPersistenceAdapter.recover() {
>>>    ...
>>>    while ((pos = journal.getNextRecordLocation(pos)) != null) {
>>>     ...
>>>    }
>>>    ...
>>> }
>>>
>>> loops infinitely .
>>>
>>> RecordLocation indicate that the position goes to the end of the 
>>> journal and start again.
>>>
>>> Anybody experienced something like that? It is a know bug in 4.0.1, 
>>> I couldn't find something, but maybe I missed somehow.
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>
>


Re: JournalPersistenceAdapter.recover hangs

Posted by Rob Davies <ra...@gmail.com>.
Perhaps you'd be better to use 4.0.2 ?

cheers,

Rob
On 12 Oct 2006, at 21:08, Adrian Tarau wrote:

> More about this. I found where it is the problem. The problem is in  
> LogFileManager. Look at the first source code, code from version  
> 4.0.1, which should work fine and return null when the next data  
> record belongs to a log with an id less or equal that the current one.
> The second source code is a decompilation with JAD and the second  
> test is not there.
>
> How could be possible? The code seems to be behind the source  
> code !!!!!
>
> Thanks.
>
> *Source from 4.0.1*
>
> public Location getNextDataRecordLocation(Location lastLocation)  
> throws IOException, InvalidRecordLocationException {
>        RecordInfo ri = readRecordInfo(lastLocation);
>        while (true) {
>
>            int logFileId = ri.getLocation().getLogFileId();
>            int offset = ri.getNextLocation();
>
>            // Are we overflowing into next logFile?
>            if (offset >= ri.getLogFileState().getAppendOffset()) {
>                LogFileNode nextActive = ri.getLogFileState 
> ().getNextActive();
>                *if (nextActive == null || nextActive.getId() <=  
> ri.getLogFileState().getId() ) {*
>                    return null;
>                }
>                logFileId = nextActive.getId();
>                offset = 0;
>            }
>
>            try {
>                ri = readRecordInfo(new Location(logFileId, offset));
>            } catch (InvalidRecordLocationException e) {
>                return null;
>            }
>
>            // Is the next record the right record type?
>            if (ri.getHeader().getRecordType() == DATA_RECORD_TYPE) {
>                return ri.getLocation();
>            }
>            // No? go onto the next record.
>        }
>    }
>
> *Decompiled class*
>
> public Location getNextDataRecordLocation(Location lastLocation)  
> throws IOException, InvalidRecordLocationException {
> /* 409*/        RecordInfo ri = readRecordInfo(lastLocation);
> /* 412*/        do {
> /* 412*/            int logFileId = ri.getLocation().getLogFileId();
> /* 413*/            int offset = ri.getNextLocation();
> /* 416*/            if(offset >= ri.getLogFileState 
> ().getAppendOffset()) {
> /* 417*/                LogFileNode nextActive = ri.getLogFileState 
> ().getNextActive();
> /* 418*/                *if(nextActive == null)*
> /* 419*/                    return null;
> /* 421*/                logFileId = nextActive.getId();
> /* 422*/                offset = 0;
>                    }
> /* 426*/            try {
> /* 426*/                ri = readRecordInfo(new Location(logFileId,  
> offset));
>                    }
> /* 427*/            catch(InvalidRecordLocationException e) {
> /* 428*/                return null;
>                    }
>                } while(ri.getHeader().getRecordType() != 1);
> /* 433*/        return ri.getLocation();
>            }
>
> Adrian Tarau wrote:
>> I got recently into a problem with the journal, when the  
>> application starts it hangs. After some debug, I noticed that
>> JournalPersistenceAdapter.recover() {
>>    ...
>>    while ((pos = journal.getNextRecordLocation(pos)) != null) {
>>     ...
>>    }
>>    ...
>> }
>>
>> loops infinitely .
>>
>> RecordLocation indicate that the position goes to the end of the  
>> journal and start again.
>>
>> Anybody experienced something like that? It is a know bug in  
>> 4.0.1, I couldn't find something, but maybe I missed somehow.
>>
>> Thanks.
>>
>>
>>
>>
>


Re: JournalPersistenceAdapter.recover hangs

Posted by Adrian Tarau <ad...@daxtechnologies.com>.
More about this. I found where it is the problem. The problem is in 
LogFileManager. Look at the first source code, code from version 4.0.1, 
which should work fine and return null when the next data record belongs 
to a log with an id less or equal that the current one.
The second source code is a decompilation with JAD and the second test 
is not there.

How could be possible? The code seems to be behind the source code !!!!!

Thanks.

*Source from 4.0.1*

public Location getNextDataRecordLocation(Location lastLocation) throws 
IOException, InvalidRecordLocationException {
        RecordInfo ri = readRecordInfo(lastLocation);
        while (true) {

            int logFileId = ri.getLocation().getLogFileId();
            int offset = ri.getNextLocation();

            // Are we overflowing into next logFile?
            if (offset >= ri.getLogFileState().getAppendOffset()) {
                LogFileNode nextActive = 
ri.getLogFileState().getNextActive();
                *if (nextActive == null || nextActive.getId() <= 
ri.getLogFileState().getId() ) {*
                    return null;
                }
                logFileId = nextActive.getId();
                offset = 0;
            }

            try {
                ri = readRecordInfo(new Location(logFileId, offset));
            } catch (InvalidRecordLocationException e) {
                return null;
            }

            // Is the next record the right record type?
            if (ri.getHeader().getRecordType() == DATA_RECORD_TYPE) {
                return ri.getLocation();
            }
            // No? go onto the next record.
        }
    }

*Decompiled class*

public Location getNextDataRecordLocation(Location lastLocation) throws 
IOException, InvalidRecordLocationException {
/* 409*/        RecordInfo ri = readRecordInfo(lastLocation);
/* 412*/        do {
/* 412*/            int logFileId = ri.getLocation().getLogFileId();
/* 413*/            int offset = ri.getNextLocation();
/* 416*/            if(offset >= ri.getLogFileState().getAppendOffset()) {
/* 417*/                LogFileNode nextActive = 
ri.getLogFileState().getNextActive();
/* 418*/                *if(nextActive == null)*
/* 419*/                    return null;
/* 421*/                logFileId = nextActive.getId();
/* 422*/                offset = 0;
                    }
/* 426*/            try {
/* 426*/                ri = readRecordInfo(new Location(logFileId, 
offset));
                    }
/* 427*/            catch(InvalidRecordLocationException e) {
/* 428*/                return null;
                    }
                } while(ri.getHeader().getRecordType() != 1);
/* 433*/        return ri.getLocation();
            }

Adrian Tarau wrote:
> I got recently into a problem with the journal, when the application 
> starts it hangs. After some debug, I noticed that
> JournalPersistenceAdapter.recover() {
>    ...
>    while ((pos = journal.getNextRecordLocation(pos)) != null) {
>     ...
>    }
>    ...
> }
>
> loops infinitely .
>
> RecordLocation indicate that the position goes to the end of the 
> journal and start again.
>
> Anybody experienced something like that? It is a know bug in 4.0.1, I 
> couldn't find something, but maybe I missed somehow.
>
> Thanks.
>
>
>
>


JournalPersistenceAdapter.recover hangs

Posted by Adrian Tarau <ad...@daxtechnologies.com>.
I got recently into a problem with the journal, when the application 
starts it hangs. After some debug, I noticed that 

JournalPersistenceAdapter.recover() {
    ...
    while ((pos = journal.getNextRecordLocation(pos)) != null) {
     ...
    }
    ...
}

loops infinitely .

RecordLocation indicate that the position goes to the end of the journal 
and start again.

Anybody experienced something like that? It is a know bug in 4.0.1, I 
couldn't find something, but maybe I missed somehow.

Thanks.





Re: using ActiveMQ with java on one end and C# on the other

Posted by shantanu_chawla <sh...@gmail.com>.

I was getting this error when I was trying to send message from C# produce
to Java consumer using Text message but when I used BytesMessage the problem
was eliminated.

Shantanu


Hiram Chirino wrote:
> 
> HI Shantanu,
> 
> If you can create a JIRA and attach the source for the c# and java clients
> that cause the problem that should help us setup a test case for your
> scenario.
> 
> On 10/12/06, shantanu_chawla <sh...@gmail.com> wrote:
>>
>>
>> Hi,
>>
>> I am newbie to activemq and and I am trying to send/consume message from
>> java and consume/send message fro C# client using active mq. I have
>> downloaded activemq 4.0.1 and C# ActiveMQ and NMS library from svn. I
>> tried
>> the TestNMS program with the C# sharp client to send and receive message
>> and
>> it works. so is from the java client, but when I send message from java I
>> cannt receive the message in C# client and when I try to receive a
>> message
>> send from C# client in java client I get java.lang.OutOfMemoryError
>> exception.
>>
>> Can someone provide a working sample of message produce and receiver from
>> java to c# or viceversa.
>>
>> Thanks
>>
>> Shantanu
>> --
>> View this message in context:
>> http://www.nabble.com/using-ActiveMQ-with-java-on-one-end-and-C--on-the-other-tf2431461.html#a6779677
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Regards,
> Hiram
> 
> Blog: http://hiramchirino.com
> 
> 

-- 
View this message in context: http://www.nabble.com/using-ActiveMQ-with-java-on-one-end-and-C--on-the-other-tf2431461.html#a6837044
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: using ActiveMQ with java on one end and C# on the other

Posted by Hiram Chirino <hi...@hiramchirino.com>.
HI Shantanu,

If you can create a JIRA and attach the source for the c# and java clients
that cause the problem that should help us setup a test case for your
scenario.

On 10/12/06, shantanu_chawla <sh...@gmail.com> wrote:
>
>
> Hi,
>
> I am newbie to activemq and and I am trying to send/consume message from
> java and consume/send message fro C# client using active mq. I have
> downloaded activemq 4.0.1 and C# ActiveMQ and NMS library from svn. I
> tried
> the TestNMS program with the C# sharp client to send and receive message
> and
> it works. so is from the java client, but when I send message from java I
> cannt receive the message in C# client and when I try to receive a message
> send from C# client in java client I get java.lang.OutOfMemoryError
> exception.
>
> Can someone provide a working sample of message produce and receiver from
> java to c# or viceversa.
>
> Thanks
>
> Shantanu
> --
> View this message in context:
> http://www.nabble.com/using-ActiveMQ-with-java-on-one-end-and-C--on-the-other-tf2431461.html#a6779677
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 
Regards,
Hiram

Blog: http://hiramchirino.com

Re: using ActiveMQ with java on one end and C# on the other

Posted by sileshi <si...@yahoo.com>.
I have a similar problem with Perl Stomp client and Java Producer/Consumer
interact.
I have filed a bug report and see bug AMQ-978 for details.

-Sileshi


shantanu_chawla wrote:
> 
> Hi,
> 
> I am newbie to activemq and and I am trying to send/consume message from
> java and consume/send message fro C# client using active mq. I have
> downloaded activemq 4.0.1 and C# ActiveMQ and NMS library from svn. I
> tried the TestNMS program with the C# sharp client to send and receive
> message and it works. so is from the java client, but when I send message
> from java I cannt receive the message in C# client and when I try to
> receive a message send from C# client in java client I get
> java.lang.OutOfMemoryError exception.
> 
> Can someone provide a working sample of message produce and receiver from
> java to c# or viceversa.
> 
> Thanks
> 
> Shantanu
> 

-- 
View this message in context: http://www.nabble.com/using-ActiveMQ-with-java-on-one-end-and-C--on-the-other-tf2431461.html#a6824019
Sent from the ActiveMQ - User mailing list archive at Nabble.com.