History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: AMQ-895
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Manuel Teira
Votes: 4
Watchers: 6
Operations

If you were logged in you would be able to see more operations.
ActiveMQ

JMS to JMS Bridge never reconnects under remote broker restarts.

Created: 25/Aug/06 03:52 AM   Updated: Monday 10:38 AM
Component/s: Broker
Affects Version/s: 4.0 RC2, 4.0.1
Fix Version/s: 5.2.0

Time Tracking:
Not Specified

File Attachments: 1. File Licensed for inclusion in ASF works test_patch.diff (3 kb)

Issue Links:
Duplicate
 


 Description  « Hide

I'm using ActiveMQ (4.0.1) JMS to JMS Bridge functionality to connect to a SunMQ JMS Broker (3.6 SP3 (Build 02-A)). I'm using two queues, an input and an output one, with the following configuration:

<jmsBridgeConnectors>
<jmsQueueConnector outboundQueueConnectionFactory="#REMOTE">
<outboundQueueBridges>
<outboundQueueBridge outboundQueueName="SUNRECV"/>
</outboundQueueBridges>
<inboundQueueBridges>
<inboundQueueBridge inboundQueueName="SUNSEND"/>
</inboundQueueBridges>
</jmsQueueConnector>
</jmsBridgeConnectors>

The system works really well until the SunMQ broker needed to be restarted. This is what I found:
1.-ActiveMQ is not aware of the remote broker shutdown. I waited for a while, but no log on ActiveMQ indicates knowledge about the new situation.
2.-When I send a message to the output queue SUNRECV, ActiveMQ complains that the producer is closed:

[ERROR][2006/08/25.09:47:12.039][ActiveMQ Session Task]failed to forward message: ActiveMQTextMessage {commandId = 5, responseRequired = false, messageId = ID:trabucco-43457-1156491843149-3:4:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:trabucco-43457-1156491843149-3:4:1:1, destination = queue://SUNRECV, transactionId = null, expiration = 0, timestamp = 1156492032027, arrival = 0, correlationId = null, replyTo = null, persistent = false, type = null, priority = 0, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 2, properties = null, readOnlyProperties = true, readOnlyBody = true, text = 1}([C4064]: Cannot perform operation, producer is closed.)

After this, it is automatically queueing messages without sending them, showing the log:

[DEBUG][2006/08/25.09:47:42.721][RMI TCP Connection(4)-10.95.89.20]No subscriptions registered, will not dispatch message at this time.

Even if SunMQ is started again, ActiveMQ is not detecting the new situation, and continues queueing messages sent to SUNRECV.

Please, make me know if more information is needed to understand the situation.



 All   Comments   Work Log   Change History   Subversion Commits   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
James Strachan - 25/Aug/06 04:00 AM
I've tried adding a fix to SVN trunk. I wonder could you try it out for me to see if it fixes your issue? Basically I've patched the code to try reconnecting (by default a maximum of 10 times per message) if the send() fails before stopping the bridge.

Grab the latest code here...
http://incubator.apache.org/activemq/source.html

then build it...
http://incubator.apache.org/activemq/building.html


Manuel Teira - 25/Aug/06 04:41 AM
Thanks a lot, James.

I'm not familiar with maven usage and I'm getting an error I don't know the cause of:

Downloading: http://ibiblio.org/maven2//directory-shared/ldap-common/0.9.1/ldap-
common-0.9.1.pom
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).

Project ID: directory-shared:ldap-common

Reason: Error getting POM for 'directory-shared:ldap-common' from the repository
: Error transferring file
directory-shared:ldap-common:pom:0.9.1

Thanks.


Manuel Teira - 28/Aug/06 12:26 AM
I've updated my local svn copy this morning, and have seen that the ldap-common version have been bumped up to 0.9.2. But now, I'm running into a different problem:

...
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/codehaus/p
lexus/plexus-archiver/1.0-alpha-7-SNAPSHOT/plexus-archiver-1.0-alpha-7-SNAPSHOT.
jar
[WARNING] Unable to get resource from repository apache.snapshots (http://people
.apache.org/repo/m2-snapshot-repository)
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/mav
en/maven-archiver/2.2-SNAPSHOT/maven-archiver-2.2-20060826.152218-3.jar
11K downloaded
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) org.codehaus.plexus:plexus-archiver:jar:1.0-alpha-7-SNAPSHOT

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=org.codehaus.plexus -DartifactId=plexus
-archiver \
-Dversion=1.0-alpha-7-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

Path to dependency:
1) org.apache.maven.plugins:maven-jar-plugin:maven-plugin:2.1-20060826.1
62339-6
2) org.apache.maven:maven-archiver:jar:2.2-SNAPSHOT
3) org.codehaus.plexus:plexus-archiver:jar:1.0-alpha-7-SNAPSHOT

----------
1 required artifact is missing.

for artifact:
org.apache.maven.plugins:maven-jar-plugin:maven-plugin:2.1-20060826.162339-6

from the specified remote repositories:
central (http://repo1.maven.org/maven2),
apache.snapshots (http://people.apache.org/repo/m2-snapshot-repository),
apache-snapshots (http://people.apache.org/maven-snapshot-repository)

I tried to follow the intructions into the error, downloaded a version of plexus-archiver and got this new error:

C:\src\activemq\trunk>mvn install:install-file -DgroupId=org.codehaus.plexus -Da
rtifactId=plexus-archiver -Dversion=1.0-alpha-7-SNAPSHOT -Dpackaging=jar -Dfile=
"C:\Documents and Settings\Administrador\Escritorio\plexus-archiver-1.0-alpha-7-
20060827.121315-6.jar"
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).

Project ID: org.apache.activemq:activemq-core
POM Location: C:\src\activemq\trunk\activemq-core\pom.xml
Validation Messages:

[0] 'dependencies.dependency.version' is missing for org.apache.activemq:activemq-jaas

Reason: Failed to validate POM

[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Failed to validate POM
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:365)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:278)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.project.InvalidProjectModelException: Failed to vali
date POM
at org.apache.maven.project.DefaultMavenProjectBuilder.processProjectLog
ic(DefaultMavenProjectBuilder.java:926)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(Def
aultMavenProjectBuilder.java:737)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFi
leInternal(DefaultMavenProjectBuilder.java:416)
at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMave
nProjectBuilder.java:192)
at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:515)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:447)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:491)
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:351)
... 11 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Mon Aug 28 09:17:31 CEST 2006
[INFO] Final Memory: 1M/3M
[INFO] ------------------------------------------------------------------------

At this stage, I don't know if this error is produced by a wrong setup of maven (I just followed the instructions in the ActiveMQ website (running maven 2.0.4)) or is something related with activemq itself.

Any hint?

Thanks.


Manuel Teira - 28/Aug/06 12:49 AM
I've avoided the previous problem launching 'mvn install:install-file ...' outside of the activemq directory. This way I reached compiling activemq-core, but it failed with this error:

Downloading: http://repo1.maven.org/maven2/ant/ant/1.6.2/ant-1.6.2.jar
976K downloaded
[INFO] [xbean:mapping {execution: default}]
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] com.thoughtworks.qdox.parser.ParseException: syntax error @[90,25] in fil
e:/C:/src/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network
/jms/JmsConnector.java
[INFO] ------------------------------------------------------------------------
[INFO] Trace
com.thoughtworks.qdox.parser.ParseException: syntax error @[90,25] in file:/C:/s
rc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/Jm
sConnector.java
at org.apache.xbean.maven.XBeanMojo.execute(XBeanMojo.java:185)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:412)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:534)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
fecycle(DefaultLifecycleExecutor.java:475)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:454)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:306)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:273)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:140)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: com.thoughtworks.qdox.parser.ParseException: syntax error @[90,25] in
file:/C:/src/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/net
work/jms/JmsConnector.java
at com.thoughtworks.qdox.parser.impl.Parser.yyerror(Parser.java:611)
at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:719)
at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:592)
at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:30
0)
at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:31
6)
at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:31
2)
at org.apache.xbean.spring.generator.QdoxMappingLoader.loadNamespaces(Qd
oxMappingLoader.java:96)
at org.apache.xbean.maven.XBeanMojo.execute(XBeanMojo.java:153)
... 18 more
— Nested Exception —
com.thoughtworks.qdox.parser.ParseException: syntax error @[90,25] in file:/C:/s
rc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/Jm
sConnector.java
at com.thoughtworks.qdox.parser.impl.Parser.yyerror(Parser.java:611)
at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:719)
at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:592)
at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:30
0)
at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:31
6)
at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:31
2)
at org.apache.xbean.spring.generator.QdoxMappingLoader.loadNamespaces(Qd
oxMappingLoader.java:96)
at org.apache.xbean.maven.XBeanMojo.execute(XBeanMojo.java:153)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:412)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:534)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
fecycle(DefaultLifecycleExecutor.java:475)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:454)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:306)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:273)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:140)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 minutes 10 seconds
[INFO] Finished at: Mon Aug 28 09:35:45 CEST 2006
[INFO] Final Memory: 15M/28M
[INFO] ------------------------------------------------------------------------

It seems that JmsConnector.java is one of the modified files for the fix we're on. Anyway, I don't know what that qdox.parser is expecting to find, the java code looks fine to me, and making a diff against the previous svn version of the file at that point is only finding some cosmetic changes.

Waiting for help.


Manuel Teira - 30/Aug/06 03:47 AM
Previous error was produced by bug: https://issues.apache.org/activemq/browse/AMQ-901

Checking todays svn trunk version finished with a successful compilation. However, reconnection seems not to work.

The scenario is as follows:

===Scenario #1===
ActiveMQ broker with a bridged Sun MQ Broker.

  • Start ActiveMQ
  • Send a message to a bridged queue.
    • The message gets into the queue, the jmx console shows:
      EnqueueCount: 1
      DequeueCount: 0
      QueueSize: 1
  • Start SunMQ
  • Send a new message to the bridged queue.
    • Messages are not delivered to the SunMQ broker.

===Scenario #2===
ActiveMQ broker with a bridged SunMQ Broker.

  • Start SunMQ
  • Start ActiveMQ
  • Send a message to a bridged queue.
    • The message is bridged to SunMQ Broker queue. The jmx console shows:
      ConsumerCount: 1
      EnqueueCount: 1
      DequeueCount: 1
      QueueSize: 0
  • Stop SunMQ
  • Send a new message to the bridged queue.
    • Message is not delivered to the SunMQ broker.
    • The jmx console shows, for the queue:
      ConsumerCount: 1
      EnqueueCount: 2
      DequeueCount: 2
      QueueSize: 1
      **The log shows:
      [DEBUG][2006/08/30.12:40:57.849][ActiveMQ Transport Server: tcp://localhost:61635]Sending: WireFormatInfo
      Unknown macro: { version=2, properties={TightEncodingEnabled=true, TcpNoDelayEnabled=true, SizePrefixDisabled=false, StackTraceEnabled=true, MaxInactivityDuration=30000, CacheEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
      [DEBUG][2006/08/30.12:40:57.849][ActiveMQ Transport Server: tcp://localhost:61635]Sending: WireFormatInfo { version=2, properties={TightEncodingEnabled=true, TcpNoDelayEnabled=true, SizePrefixDisabled=false, StackTraceEnabled=true, MaxInactivityDuration=30000, CacheEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}

      [DEBUG][2006/08/30.12:40:57.887][ActiveMQ Transport: tcp:///127.0.0.1:47305]Received WireFormat: WireFormatInfo
      Unknown macro: { version=2, properties={StackTraceEnabled=true, TightEncodingEnabled=true, TcpNoDelayEnabled=true, SizePrefixDisabled=false, MaxInactivityDuration=30000, CacheEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
      [DEBUG][2006/08/30.12:40:57.888][ActiveMQ Transport: tcp:///127.0.0.1:47305]tcp:///127.0.0.1:47305 before negotiation: OpenWireFormat{version=1, cacheEnabled=false, stackTraceEnabled=false, tightEncodingEnabled=false, sizePrefixDisabled=false}
      [DEBUG][2006/08/30.12:40:57.889][ActiveMQ Transport: tcp:///127.0.0.1:47305]tcp:///127.0.0.1:47305 after negotiation: OpenWireFormat{version=2, cacheEnabled=true, stackTraceEnabled=true, tightEncodingEnabled=true, sizePrefixDisabled=false}
      [DEBUG][2006/08/30.12:40:57.887][ActiveMQ Transport: tcp:///127.0.0.1:47305]Received WireFormat: WireFormatInfo { version=2, properties={StackTraceEnabled=true, TightEncodingEnabled=true, TcpNoDelayEnabled=true, SizePrefixDisabled=false, MaxInactivityDuration=30000, CacheEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}

      [DEBUG][2006/08/30.12:40:57.888][ActiveMQ Transport: tcp:///127.0.0.1:47305]tcp:///127.0.0.1:47305 before negotiation: OpenWireFormat{version=1, cacheEnabled=false, stackTraceEnabled=false, tightEncodingEnabled=false, sizePrefixDisabled=false}
      [DEBUG][2006/08/30.12:40:57.889][ActiveMQ Transport: tcp:///127.0.0.1:47305]tcp:///127.0.0.1:47305 after negotiation: OpenWireFormat{version=2, cacheEnabled=true, stackTraceEnabled=true, tightEncodingEnabled=true, sizePrefixDisabled=false}
      [DEBUG][2006/08/30.12:40:58.479][ActiveMQ Transport: tcp:///127.0.0.1:47305]Adding consumer: ID:trabucco-47304-1156934456973-1:0:-1:1
      [DEBUG][2006/08/30.12:40:58.479][ActiveMQ Transport: tcp:///127.0.0.1:47305]Adding consumer: ID:trabucco-47304-1156934456973-1:0:-1:1
      [DEBUG][2006/08/30.12:40:58.976][ActiveMQ Transport: tcp:///127.0.0.1:47305]Removing consumer: ID:trabucco-47304-1156934456973-1:0:-1:1
      [ERROR][2006/08/30.12:40:59.266][ActiveMQ Session Task]failed to forward message on attempt: 1 reason: javax.jms.IllegalStateException: [C4064]: Cannot perform operation, producer is closed. message: ActiveMQBytesMessage {commandId = 5, responseRequired = true, messageId = ID:trabucco-47304-1156934456973-1:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:trabucco-47304-1156934456973-1:0:1:1, destination = queue://SUNRECV, transactionId = null, expiration = 0, timestamp = 1156934458928, arrival = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activeio.packet.ByteSequence@1a5e68a, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 529, properties = null, readOnlyProperties = true, readOnlyBody = true} ActiveMQBytesMessage{ bytesOut = null, dataOut = null, dataIn = null }([C4064]: Cannot perform operation, producer is closed.)
      [DEBUG][2006/08/30.12:40:58.976][ActiveMQ Transport: tcp:///127.0.0.1:47305]Removing consumer: ID:trabucco-47304-1156934456973-1:0:-1:1
      [ERROR][2006/08/30.12:40:59.266][ActiveMQ Session Task]failed to forward message on attempt: 1 reason: javax.jms.IllegalStateException: [C4064]: Cannot perform operation, producer is closed. message: ActiveMQBytesMessage {commandId = 5, responseRequired = true, messageId = ID:trabucco-47304-1156934456973-1:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:trabucco-47304-1156934456973-1:0:1:1, destination = queue://SUNRECV, transactionId = null, expiration = 0, timestamp = 1156934458928, arrival = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activeio.packet.ByteSequence@1a5e68a, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 529, properties = null, readOnlyProperties = true, readOnlyBody = true} ActiveMQBytesMessage{ bytesOut = null, dataOut = null, dataIn = null }([C4064]: Cannot perform operation, producer is closed.)
      *Start SunMQ again
      ** Nothing happens in activemq (as expected)
      *Send a new message to the bridged queue.
      ** Message is not delivered to the SunMQ Broker.
      **The jmx console shows, for the queue:
      ConsumerCount: 1
      EnqueueCount: 3
      DequeueCount: 3
      QueueSize: 2
      **The log shows this:
      [DEBUG][2006/08/30.12:43:19.803][ActiveMQ Transport Server: tcp://localhost:61635]Sending: WireFormatInfo { version=2, properties={TightEncodingEnabled=true, TcpNoDelayEnabled=true, SizePrefixDisabled=false, StackTraceEnabled=true, MaxInactivityDuration=30000, CacheEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
      [DEBUG][2006/08/30.12:43:19.805][ActiveMQ Transport: tcp:///127.0.0.1:47315]Received WireFormat: WireFormatInfo { version=2, properties={StackTraceEnabled=true, TightEncodingEnabled=true, TcpNoDelayEnabled=true, SizePrefixDisabled=false, MaxInactivityDuration=30000, CacheEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
      [DEBUG][2006/08/30.12:43:19.806][ActiveMQ Transport: tcp:///127.0.0.1:47315]tcp:///127.0.0.1:47315 before negotiation: OpenWireFormat{version=1, cacheEnabled=false, stackTraceEnabled=false, tightEncodingEnabled=false, sizePrefixDisabled=false}
      [DEBUG][2006/08/30.12:43:19.807][ActiveMQ Transport: tcp:///127.0.0.1:47315]tcp:///127.0.0.1:47315 after negotiation: OpenWireFormat{version=2, cacheEnabled=true, stackTraceEnabled=true, tightEncodingEnabled=true, sizePrefixDisabled=false}
      [DEBUG][2006/08/30.12:43:19.803][ActiveMQ Transport Server: tcp://localhost:61635]Sending: WireFormatInfo { version=2, properties={TightEncodingEnabled=true, TcpNoDelayEnabled=true, SizePrefixDisabled=false, StackTraceEnabled=true, MaxInactivityDuration=30000, CacheEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
      [DEBUG][2006/08/30.12:43:19.805][ActiveMQ Transport: tcp:///127.0.0.1:47315]Received WireFormat: WireFormatInfo { version=2, properties={StackTraceEnabled=true, TightEncodingEnabled=true, TcpNoDelayEnabled=true, SizePrefixDisabled=false, MaxInactivityDuration=30000, CacheEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
      [DEBUG][2006/08/30.12:43:19.806][ActiveMQ Transport: tcp:///127.0.0.1:47315]tcp:///127.0.0.1:47315 before negotiation: OpenWireFormat{version=1, cacheEnabled=false, stackTraceEnabled=false, tightEncodingEnabled=false, sizePrefixDisabled=false}
      [DEBUG][2006/08/30.12:43:19.807][ActiveMQ Transport: tcp:///127.0.0.1:47315]tcp:///127.0.0.1:47315 after negotiation: OpenWireFormat{version=2, cacheEnabled=true, stackTraceEnabled=true, tightEncodingEnabled=true, sizePrefixDisabled=false}
      [DEBUG][2006/08/30.12:43:20.433][ActiveMQ Transport: tcp:///127.0.0.1:47315]Adding consumer: ID:trabucco-47314-1156934598004-1:0:-1:1
      [DEBUG][2006/08/30.12:43:20.433][ActiveMQ Transport: tcp:///127.0.0.1:47315]Adding consumer: ID:trabucco-47314-1156934598004-1:0:-1:1
      [ERROR][2006/08/30.12:43:20.921][ActiveMQ Session Task]failed to forward message on attempt: 1 reason: javax.jms.IllegalStateException: [C4064]: Cannot perform operation, producer is closed. message: ActiveMQBytesMessage {commandId = 5, responseRequired = true, messageId = ID:trabucco-47314-1156934598004-1:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:trabucco-47314-1156934598004-1:0:1:1, destination = queue://SUNRECV, transactionId = null, expiration = 0, timestamp = 1156934600848, arrival = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activeio.packet.ByteSequence@1e29b99, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 529, properties = null, readOnlyProperties = true, readOnlyBody = true} ActiveMQBytesMessage{ bytesOut = null, dataOut = null, dataIn = null }([C4064]: Cannot perform operation, producer is closed.)
      [DEBUG][2006/08/30.12:43:20.933][ActiveMQ Transport: tcp:///127.0.0.1:47315]Removing consumer: ID:trabucco-47314-1156934598004-1:0:-1:1
      [ERROR][2006/08/30.12:43:20.921][ActiveMQ Session Task]failed to forward message on attempt: 1 reason: javax.jms.IllegalStateException: [C4064]: Cannot perform operation, producer is closed. message: ActiveMQBytesMessage {commandId = 5, responseRequired = true, messageId = ID:trabucco-47314-1156934598004-1:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:trabucco-47314-1156934598004-1:0:1:1, destination = queue://SUNRECV, transactionId = null, expiration = 0, timestamp = 1156934600848, arrival = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activeio.packet.ByteSequence@1e29b99, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 529, properties = null, readOnlyProperties = true, readOnlyBody = true} ActiveMQBytesMessage{ bytesOut = null, dataOut = null, dataIn = null }([C4064]: Cannot perform operation, producer is closed.)
      [DEBUG][2006/08/30.12:43:20.933][ActiveMQ Transport: tcp:///127.0.0.1:47315]Removing consumer: ID:trabucco-47314-1156934598004-1:0:-1:1

Furthermore, after restarting the activeMQ broker with non delivered messages in the bridged queue, can lead to lose those messages.

Regards


Tom Kaitchuck - 21/Sep/06 02:03 PM
This patch fixes what appears to be a bug in the origional fix. I have not yet been able to test it, as I have not yet setup a system to reproduce the problem, but can someone try it out?

Thanks.


William MacDonald - 12/Apr/07 07:02 AM
I have come across this issue in an attempt to use the JMS to JMS bridge in version 4.1.1.

I am trying to bridge ActiveMQ to Websphere MQ and I am running the bridge in its own process and everything connects and works properly.

The remote Websphere MQ broker is being shutdown every night for backups and when this occurs the bridge does not see the disconnect of the remote broker.

I performed a netstat of the socket connections to see if the bridge was still attempting a connection and found that the socket connections to the remote broker are in a CLOSE_WAIT state.

If you have any ideas or wish to try a test I am willing to do what every is needed to resolve this issue.

Thanks,

William


Alf E. Helseth - 13/Apr/07 01:47 AM
I'm currently trying out a similar issue bridging ActiveMQ to Sun CAPS, but is struggling.

Could you share some light and tell me how you hav configured the "#REMOTE" element in the XML-file.
Might just be helpful!

br
-Alf


Manuel Teira - 13/Apr/07 02:32 AM
It was a little tricked, perhaps caused by my ignorance, but I didn't find a suitable way to directly create a bean for the sunmq broker, as broker hostname and port are configured using a common method: setProperty.
So, I had to write a simple wrapper to adapt it to have standard setters. like this:

package es.tid.planb.spci.sunmq;

import com.sun.messaging.ConnectionFactory;
import com.sun.messaging.ConnectionConfiguration;
import javax.jms.JMSException;

public class ConnectionFactoryBean extends com.sun.messaging.QueueConnectionFactory
{
public ConnectionFactoryBean()

{ super(); }

public void setBrokerHostName( String hostname )
throws JMSException

{ super.setProperty( ConnectionConfiguration.imqBrokerHostName, hostname ); }

public void setBrokerHostPort( String port )
throws JMSException

{ super.setProperty( ConnectionConfiguration.imqBrokerHostPort, port ); }

public String getBrokerHostName()
throws JMSException

{ return super.getProperty( ConnectionConfiguration.imqBrokerHostName ); }

public String getBrokerHostPort()
throws JMSException

{ return super.getProperty( ConnectionConfiguration.imqBrokerHostPort ); }

}

And then, use it in a bean like this:

<bean id="REMOTE"
class="es.tid.planb.spci.sunmq.ConnectionFactoryBean">
<property name="brokerHostName" value="localhost"/>
<property name="brokerHostPort" value="7676"/>
</bean>

Regards.


William MacDonald - 13/Apr/07 06:31 AM
Alf,

Here is the bridge settings that I am using for Websphere MQ.

<jmsQueueConnector name="bridge-test-request"
outboundQueueConnectionFactory="#remoteFactory"
localPassword="test2"
localQueueConnectionFactory="#localFactory"
localUsername="test2">
<inboundQueueBridges>
<inboundQueueBridge
localQueueName="test.request"
inboundQueueName="queue:///SIT.TEST.REQ" />
</inboundQueueBridges>
</jmsQueueConnector>

<jmsQueueConnector name="bridge-test-response"
outboundQueueConnectionFactory="#remoteFactory"
localPassword="test4"
localQueueConnectionFactory="#localFactory"
localUsername="test4">
<outboundQueueBridges>
<outboundQueueBridge
localQueueName="test.response"
outboundQueueName="queue:///SIT.TEST.RSP" />
</outboundQueueBridges>
</jmsQueueConnector>

<bean id="remoteFactory"
class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType" value="1" />
<property name="hostName" value="127.0.0.1" />
<property name="port" value="9876" />
<property name="queueManager" value="QMUAT" />
<property name="channel" value="SIT.UAT.SVR" />
</bean>

I hope this helps.

Thx,
William


Alf E. Helseth - 13/Apr/07 06:43 AM
Thanks, that really helped me a lot!

I was now able to create a simple wrapper similar to yours and managed finally to make i all work.
Am wrapping around the class com.stc.jms.client.STCQueueConnectionFactory (from JCAPS), and this must have hostname & port number in the constructor. Handled this by hard-coding these values in the wrapper so far, but would like to fetch these from properties as well, but don't know how...?
Like this:

public class connectionFactoryWrapper extends com.stc.jms.client.STCQueueConnectionFactory {

public connectionFactoryWrapper() throws JMSException

{ super("localhost", 18007); }

....

Then the bridging works only one way, namely from AMQ to JCAPS.
The other way AMQ gets a ClassCastException upon receiving the message from the JCAPS queue:

ERROR DestinationBridge - failed to forward message on attempt: 1 reason: java.lang.ClassCastException: org.apache.activemq.command.ActiveMQQueue message: com.stc.jms.message.STCTextMessage@1e22632
java.lang.ClassCastException: org.apache.activemq.command.ActiveMQQueue
at com.stc.jms.message.STCMessage.setJMSDestination(STCMessage.java:611)
at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1505)
at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:465)
at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:415)
at org.apache.activemq.ActiveMQQueueSender.send(ActiveMQQueueSender.java:116)
at org.apache.activemq.network.jms.QueueBridge.sendMessage(QueueBridge.java:87)
at org.apache.activemq.network.jms.DestinationBridge.onMessage(DestinationBridge.java:134)
at com.stc.jms.client.SessionImpl.processAsyncDataAvailable(SessionImpl.java:1659)
at com.stc.jms.client.SessionImpl.processAsync(SessionImpl.java:1748)
at com.stc.jms.client.SessionImpl.asyncEnter(SessionImpl.java:1776)
at com.stc.jms.client.SessionImpl.access$500(SessionImpl.java:56)
at com.stc.jms.client.SessionImpl$3.run(SessionImpl.java:1899)
at com.stc.jms.client.SessionImpl$2.run(SessionImpl.java:1807)
at java.lang.Thread.run(Thread.java:595)

The problem seems to be the STCTextMessage class, is it possible to handle this in some way?

Regards
-Alf


Manuel Teira - 16/Apr/07 05:57 AM
I think you don't need to wrap STCQueueConnectionFactory, as it provides a constructor with the required arguments, and spring is able to handle that directly. That is not the case for imq, that doesn't have such a constructor neither the required setters. It should be enough for you to use:

<bean id="REMOTE"
class="com.stc.jms.client.STCQueueConnectionFactory">
<constructor-arg><value>localhost</value></constructor-arg>
<constructor-arg><value>18007</value></constructor-arg>
</bean>

About the error you get, it seems you're trying to handle directly a STC message implementation using AMQ. That's not the right way. The bridge should automatically convert incoming messages to the AMQ native types. You shouldn't need to use directly the STC nor AMQ Message classes, just ask for java.jmx.Message or javax.jms.TextMessage to your consumers. The AMQ broker will redirect incoming messages from the bridged foreign broker to your