[ 
https://issues.apache.org/activemq/browse/SM-944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40421
 ] 

Andreas Schaefer commented on SM-944:
-------------------------------------

So far I figured out that one part of the problem is caused by the private 
member of "request". I saw that there are two different Bean Endpoint instances 
used, one for the provider and one for the consumer and so they cannot see each 
others requests.
I fixed that problem by finding the other endpoints of the same Bean and 
searching for the request of all of them. This way the request can be found if 
the consumer and provider are both based on a Bean BC. Unfortunately because of 
the issue SM-1110 (https://issues.apache.org/activemq/browse/SM-1110) the same 
exception will be thrown as well because it even tries to call a Bean Endpoint 
without an Bean SU.

This fix may not solve the issue or is not caused what this fix tries to 
accomplish because of the tight integration with SM-1110.

This is the diff:

Index: BeanEndpoint.java
===================================================================
--- BeanEndpoint.java   (revision 586179)
+++ BeanEndpoint.java   (working copy)
@@ -82,12 +82,15 @@
     private ComponentContext context;
     private DeliveryChannel channel;
 
+    private BeanComponent mBeanComponent;
+
     public BeanEndpoint() {
     }
 
     public BeanEndpoint(BeanComponent component, ServiceEndpoint 
serviceEndpoint) {
         super(component, serviceEndpoint);
         this.applicationContext = component.getApplicationContext();
+        mBeanComponent = component;
     }
 
     public void start() throws Exception {
@@ -103,6 +106,9 @@
         if (getMethodInvocationStrategy() == null) {
             throw new IllegalArgumentException("No 'methodInvocationStrategy' 
property set");
         }
+        if (mBeanComponent == null) {
+            mBeanComponent = (BeanComponent) getServiceUnit().getComponent();
+        }
     }
 
 
@@ -262,7 +268,8 @@
     
     protected void onConsumerExchange(MessageExchange exchange) throws 
Exception {
         Object corId = exchange.getExchangeId();
-        Request req = requests.remove(corId);
+//        Request req = requests.remove(corId);
+        Request req = findRequest(corId, true);
         if (req == null) {
             throw new IllegalStateException("Receiving unknown consumer 
exchange: " + exchange);
         }
@@ -431,4 +438,18 @@
     public void 
setCorrelationExpression(org.apache.servicemix.expression.Expression 
correlationExpression) {
         this.correlationExpression = correlationExpression;
     }
+
+    private Request findRequest(Object pCorrelationId, boolean pDoRemove) {
+        Request lReturn = null;
+        for (BeanEndpoint lEndpoint : mBeanComponent.getEndpoints()) {
+            lReturn = lEndpoint.requests.get(pCorrelationId);
+            if (lReturn != null) {
+                if (pDoRemove) {
+                    lEndpoint.requests.remove(pCorrelationId);
+                }
+                break;
+            }
+        }
+        return lReturn;
+    }
 }



> IllegalStateException between servicemix-jms and servicemix-bean
> ----------------------------------------------------------------
>
>                 Key: SM-944
>                 URL: https://issues.apache.org/activemq/browse/SM-944
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-bean
>    Affects Versions: 3.1.1
>         Environment: Linux Redhat 4
>            Reporter: Noseda Anne
>
> 08:11:11,840 | ERROR | pool-flow.seda.servicemix-jms-thread-2 | BeanComponent 
>            | ervicemix.common.BaseLifeCycle   48 | Error processing exchange 
> InOnly[
>   id: ID:127.0.0.1-111e98f3e46-5:3
>   status: Done
>   role: consumer
>   service: {http://www.etnic.be/janus}JmsIn
>   endpoint: endpoint
>   in: <?xml version="1.0" encoding="UTF-8"?><janusRequest 
> xmlns="http://www.etnic.be/janus";><content><metadata><messageId>c5b55899-e985-11db-abd1-9dbf85725783</messageId><to>http://www.etnic.be/janus/OrchestrationAsync/AsyncOrchestration</to><from>http://www.etnic.be/simulate/client</from><mode>async</mode><iterationNumber>0</iterationNumber><cn>WSJanusTEST_LDU1</cn><ns2:authorization
>  
> xmlns:ns2="http://www.etnic.be/janus";><userId/><nom/><prenom/><profiles><profile><code>cfwb.enseignement.fase.poxx.vwfrom</code><organismes><organisme><type>ns_po_id</type><valeur>24</valeur></organisme></organismes></profile><profile><code>cfwb.enseignement.fase.etabxx.vwfrom</code><organismes><organisme><type>ns_etab_id</type><valeur>196</valeur></organisme></organismes></profile><profile><code>cfwb.enseignement.janus.test.wss</code><organismes/></profile></profiles></ns2:authorization></metadata><data><request><FaseRequete
>  xmlns="http://www.etnic.be/janus/fase";>
>                       <Organisation>
>                               <Type>PO</Type>
>                               <Identifiant>100</Identifiant>
>                       </Organisation>
>                       <Dmd>FICHE</Dmd>
>               </FaseRequete></request></data></content></janusRequest>
> ]
> java.lang.IllegalStateException: Receiving unknown consumer exchange: InOnly[
>   id: ID:127.0.0.1-111e98f3e46-5:3
>   status: Done
>   role: consumer
>   service: {http://www.etnic.be/janus}JmsIn
>   endpoint: endpoint
>   in: <?xml version="1.0" encoding="UTF-8"?><janusRequest 
> xmlns="http://www.etnic.be/janus";><content><metadata><messageId>c5b55899-e985-11db-abd1-9dbf85725783</messageId><to>http://www.etnic.be/janus/OrchestrationAsync/AsyncOrchestration</to><from>http://www.etnic.be/simulate/client</from><mode>async</mode><iterationNumber>0</iterationNumber><cn>WSJanusTEST_LDU1</cn><ns2:authorization
>  
> xmlns:ns2="http://www.etnic.be/janus";><userId/><nom/><prenom/><profiles><profile><code>cfwb.enseignement.fase.poxx.vwfrom</code><organismes><organisme><type>ns_po_id</type><valeur>24</valeur></organisme></organismes></profile><profile><code>cfwb.enseignement.fase.etabxx.vwfrom</code><organismes><organisme><type>ns_etab_id</type><valeur>196</valeur></organisme></organismes></profile><profile><code>cfwb.enseignement.janus.test.wss</code><organismes/></profile></profiles></ns2:authorization></metadata><data><request><FaseRequete
>  xmlns="http://www.etnic.be/janus/fase";>
>                       <Organisation>
>                               <Type>PO</Type>
>                               <Identifiant>100</Identifiant>
>                       </Organisation>
>                       <Dmd>FICHE</Dmd>
>               </FaseRequete></request></data></content></janusRequest>
> ]
>       at 
> org.apache.servicemix.bean.BeanEndpoint.onConsumerExchange(BeanEndpoint.java:268)
>       at 
> org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:198)
>       at 
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:489)
>       at 
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:463)
>       at 
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
>       at 
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:595)
>       at 
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
>       at 
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
>       at 
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>       at 
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
>       at 
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
>       at java.lang.Thread.run(Thread.java:595)
> 08:11:11,845 | ERROR | pool-flow.seda.servicemix-jms-thread-2 | BeanComponent 
>            | ervicemix.common.BaseLifeCycle   60 | Error setting exchange 
> status to ERROR
> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
>       at 
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(MessageExchangeImpl.java:571)
>       at 
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:372)
>       at 
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:419)
>       at 
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:58)
>       at 
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:595)
>       at 
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
>       at 
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
>       at 
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>       at 
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
>       at 
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
>       at java.lang.Thread.run(Thread.java:595)
> 08:13:20,539 | WARN  | pool-flow.seda.servicemix-bean-thread-5 | 
> HeaderServiceImpl        | rchestration.HeaderServiceImpl   66 | Unknown 
> namespace: 
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
> 08:13:20,542 | WARN  | pool-flow.seda.servicemix-bean-thread-5 | 
> HeaderServiceImpl        | rchestration.HeaderServiceImpl   68 | Suggestion 
> namespace: http://www.w3.org/2005/08/addressing
> 08:13:20,675 | ERROR | pool-flow.seda.servicemix-jms-thread-4 | BeanComponent 
>            | ervicemix.common.BaseLifeCycle   48 | Error processing exchange 
> InOnly[
>   id: ID:127.0.0.1-111e98f3e46-5:7
>   status: Done
>   role: consumer
>   service: {http://www.etnic.be/janus}JmsIn
>   endpoint: endpoint
>   in: <?xml version="1.0" encoding="UTF-8"?><janusRequest 
> xmlns="http://www.etnic.be/janus";><content><metadata><messageId>13d7a28a-e986-11db-abd1-9dbf85725783</messageId><to>http://www.etnic.be/janus/OrchestrationAsync/AsyncOrchestration</to><from>http://www.etnic.be/simulate/client</from><mode>async</mode><iterationNumber>0</iterationNumber><cn>WSJanusTEST_LDU1</cn><ns2:authorization
>  
> xmlns:ns2="http://www.etnic.be/janus";><userId/><nom/><prenom/><profiles><profile><code>cfwb.enseignement.fase.poxx.vwfrom</code><organismes><organisme><type>ns_po_id</type><valeur>24</valeur></organisme></organismes></profile><profile><code>cfwb.enseignement.fase.etabxx.vwfrom</code><organismes><organisme><type>ns_etab_id</type><valeur>196</valeur></organisme></organismes></profile><profile><code>cfwb.enseignement.janus.test.wss</code><organismes/></profile></profiles></ns2:authorization></metadata><data><request><FaseRequete
>  xmlns="http://www.etnic.be/janus/fase";>
>                       <Organisation>
>                               <Type>PO</Type>
>                               <Identifiant>100</Identifiant>
>                       </Organisation>
>                       <Dmd>FICHE</Dmd>
>               </FaseRequete></request></data></content></janusRequest>
> ]
> java.lang.IllegalStateException: Receiving unknown consumer exchange: InOnly[
>   id: ID:127.0.0.1-111e98f3e46-5:7
>   status: Done
>   role: consumer
>   service: {http://www.etnic.be/janus}JmsIn
>   endpoint: endpoint
>   in: <?xml version="1.0" encoding="UTF-8"?><janusRequest 
> xmlns="http://www.etnic.be/janus";><content><metadata><messageId>13d7a28a-e986-11db-abd1-9dbf85725783</messageId><to>http://www.etnic.be/janus/OrchestrationAsync/AsyncOrchestration</to><from>http://www.etnic.be/simulate/client</from><mode>async</mode><iterationNumber>0</iterationNumber><cn>WSJanusTEST_LDU1</cn><ns2:authorization
>  
> xmlns:ns2="http://www.etnic.be/janus";><userId/><nom/><prenom/><profiles><profile><code>cfwb.enseignement.fase.poxx.vwfrom</code><organismes><organisme><type>ns_po_id</type><valeur>24</valeur></organisme></organismes></profile><profile><code>cfwb.enseignement.fase.etabxx.vwfrom</code><organismes><organisme><type>ns_etab_id</type><valeur>196</valeur></organisme></organismes></profile><profile><code>cfwb.enseignement.janus.test.wss</code><organismes/></profile></profiles></ns2:authorization></metadata><data><request><FaseRequete
>  xmlns="http://www.etnic.be/janus/fase";>
>                       <Organisation>
>                               <Type>PO</Type>
>                               <Identifiant>100</Identifiant>
>                       </Organisation>
>                       <Dmd>FICHE</Dmd>
>               </FaseRequete></request></data></content></janusRequest>
> ]
>       at 
> org.apache.servicemix.bean.BeanEndpoint.onConsumerExchange(BeanEndpoint.java:268)
>       at 
> org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:198)
>       at 
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:489)
>       at 
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:463)
>       at 
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
>       at 
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:595)
>       at 
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
>       at 
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
>       at 
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>       at 
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
>       at 
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
>       at java.lang.Thread.run(Thread.java:595)
> 08:13:20,676 | ERROR | pool-flow.seda.servicemix-jms-thread-4 | BeanComponent 
>            | ervicemix.common.BaseLifeCycle   60 | Error setting exchange 
> status to ERROR
> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
>       at 
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(MessageExchangeImpl.java:571)
>       at 
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:372)
>       at 
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:419)
>       at 
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:58)
>       at 
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:595)
>       at 
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
>       at 
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
>       at 
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>       at 
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
>       at 
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
>       at java.lang.Thread.run(Thread.java:595)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to