You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Alexander Zobkov (JIRA)" <ji...@apache.org> on 2009/05/07 13:56:38 UTC

[jira] Created: (SM-1855) Registration/deregistration problem for consumer endpoint

Registration/deregistration problem for consumer endpoint
---------------------------------------------------------

                 Key: SM-1855
                 URL: https://issues.apache.org/activemq/browse/SM-1855
             Project: ServiceMix
          Issue Type: Bug
          Components: servicemix-cxf-bc
    Affects Versions: 3.3
         Environment: SMX 3.3, servicemix-shared-2008.01
            Reporter: Alexander Zobkov
             Fix For: 3.3


             I think there is registration/deregistration problem for consumer endpoint in servicemix-cxf-bc 2009.01 and 2009.02-SNAPSHOT component. 

	I have SA with SU installed on servicemix-cxf-bc component. SU has only one endpoint. Problem with registration/deregistation consumer endpoint happens in case of problem with connection initilization to JMS message broker. 

	There is no possiblity to deregister endpoint correctly in case of no possibility to start SU, for example because of wrong connectivy parameters in endpoint consumer configuration files: xbean.xml, config file for cxf bus, wsdl file or JMS message broker wrong configuration.  There is no possibity to deregister endpoint even with SA undeploy process, bacause of SU remains in "shutdown" state if there was problem at SU startup. If SU in shutdown state then SMX does not deregister endpoints for this SU. (please see code listing). Such behavior leads to error message: "An endpoint is already registered for key: FOO BAR" if user tries to redeploy SA with changed endpoint configuration, but with the same endpoint name. There is only one way to deregister endpoint - restart SMX, but it is not very good way if user needs use SMX in non-stop mode. 

Please find below related source code parts with small comments.

org.apache.servicemix.jbi.framework.ServiceAssemblyLifeCycle.java

   public synchronized String shutDown(boolean writeState) throws Exception {
        LOG.info("Shutting down service assembly: " + getName());
        List<Element> componentFailures = new ArrayList<Element>();
        for (int i = 0; i < sus.length; i++) {
            if (sus[i].isStarted()) {
                try {
                    sus[i].stop();
                } catch (DeploymentException e) {
                    componentFailures.add(getComponentFailure(e, "shutDown", sus[i].getComponentName()));
                }
            }
        }
        for (int i = 0; i < sus.length; i++) {
            if (sus[i].isStopped()) {  <-  false for SU in shutdown state.
                try {
                    sus[i].shutDown();
                } catch (DeploymentException e) {
                    componentFailures.add(getComponentFailure(e, "shutDown", sus[i].getComponentName()));
                }
            }
        }
        if (componentFailures.size() == 0) {
            currentState = SHUTDOWN;
            if (writeState) {
                writeRunningState();
            }
            fireEvent(ServiceAssemblyEvent.ASSEMBLY_SHUTDOWN);
            return ManagementSupport.createSuccessMessage("shutDown");
        } else {
            throw ManagementSupport.failure("shutDown", componentFailures);
        }
    }


org.apache.servicemix.common.DefaultServiceUnit.java

    public synchronized void init() throws Exception {
        if (this.status == LifeCycleMBean.SHUTDOWN) {
            // Activate endpoints
            List<Endpoint> activated = new ArrayList<Endpoint>();
            try {
                for (Endpoint endpoint : getEndpoints()) {
                    endpoint.activate();  <-  registration inside activate method of cxf-bc consumer endpoint
                    activated.add(endpoint);
                }
                this.status = LifeCycleMBean.STOPPED;
            } catch (Exception e) {
                // Deactivate activated endpoints
                for (Endpoint endpoint : activated) {
                    try {
                        endpoint.deactivate();  <- deregistration does not work, if (1) thown exception, because of there is no broken endpoint in list "activated"
                    } catch (Exception e2) {
                        // do nothing
                    }
                }
                throw e;
            }
        }
    }


org.apache.servicemix.cxfbc.CxfBcConsumer.java

    @Override
    public void activate() throws Exception {
        super.activate(); <-  registration inside activate method. There is no recovery process for registration, in case of any problems after super.activate() call.
        registerListServiceHandler();                                        
        applyFeatures();
        checkJmsTransportTransaction();
        server.start(); 
    }

I propose the following fix on BC level:

    @Override
    public void activate() throws Exception {
        super.activate();
        try {
        	registerListServiceHandler();
        	applyFeatures();
        	checkJmsTransportTransaction();
        	server.start();
        } catch (Exception ex){
        	super.deactivate();   <- recovery process for registration in case of any problems with connection.
        	throw ex;
        }
    }


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


[jira] Resolved: (SMXCOMP-540) Registration/deregistration problem for consumer endpoint

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SMXCOMP-540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Freeman Fang resolved SMXCOMP-540.
----------------------------------

    Resolution: Fixed

commit fix
http://svn.apache.org/viewvc?rev=774643&view=rev for 3.2 branch
http://svn.apache.org/viewvc?rev=774645&view=rev for servicemix-cxf-bc component project
thanks Alexander

> Registration/deregistration problem for consumer endpoint
> ---------------------------------------------------------
>
>                 Key: SMXCOMP-540
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-540
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-cxf-bc
>         Environment: SMX 3.3, servicemix-shared-2008.01
>            Reporter: Alexander Zobkov
>            Assignee: Freeman Fang
>             Fix For: 3.2.4, servicemix-cxf-bc-2009.02
>
>
>              I think there is registration/deregistration problem for consumer endpoint in servicemix-cxf-bc 2009.01 and 2009.02-SNAPSHOT component. 
> 	I have SA with SU installed on servicemix-cxf-bc component. SU has only one endpoint. Problem with registration/deregistation consumer endpoint happens in case of problem with connection initilization to JMS message broker. 
> 	There is no possiblity to deregister endpoint correctly in case of no possibility to start SU, for example because of wrong connectivy parameters in endpoint consumer configuration files: xbean.xml, config file for cxf bus, wsdl file or JMS message broker wrong configuration.  There is no possibity to deregister endpoint even with SA undeploy process, bacause of SU remains in "shutdown" state if there was problem at SU startup. If SU in shutdown state then SMX does not deregister endpoints for this SU. (please see code listing). Such behavior leads to error message: "An endpoint is already registered for key: FOO BAR" if user tries to redeploy SA with changed endpoint configuration, but with the same endpoint name. There is only one way to deregister endpoint - restart SMX, but it is not very good way if user needs use SMX in non-stop mode. 
> Please find below related source code parts with small comments.
> org.apache.servicemix.jbi.framework.ServiceAssemblyLifeCycle.java
> {code:java}
>    public synchronized String shutDown(boolean writeState) throws Exception {
>         LOG.info("Shutting down service assembly: " + getName());
>         List<Element> componentFailures = new ArrayList<Element>();
>         for (int i = 0; i < sus.length; i++) {
>             if (sus[i].isStarted()) {
>                 try {
>                     sus[i].stop();
>                 } catch (DeploymentException e) {
>                     componentFailures.add(getComponentFailure(e, "shutDown", sus[i].getComponentName()));
>                 }
>             }
>         }
>         for (int i = 0; i < sus.length; i++) {
>             if (sus[i].isStopped()) {  //<-  false for SU in shutdown state.
>                 try {
>                     sus[i].shutDown();
>                 } catch (DeploymentException e) {
>                     componentFailures.add(getComponentFailure(e, "shutDown", sus[i].getComponentName()));
>                 }
>             }
>         }
>         if (componentFailures.size() == 0) {
>             currentState = SHUTDOWN;
>             if (writeState) {
>                 writeRunningState();
>             }
>             fireEvent(ServiceAssemblyEvent.ASSEMBLY_SHUTDOWN);
>             return ManagementSupport.createSuccessMessage("shutDown");
>         } else {
>             throw ManagementSupport.failure("shutDown", componentFailures);
>         }
>     }
> {code}
> org.apache.servicemix.common.DefaultServiceUnit.java
> {code:java}
>     public synchronized void init() throws Exception {
>         if (this.status == LifeCycleMBean.SHUTDOWN) {
>             // Activate endpoints
>             List<Endpoint> activated = new ArrayList<Endpoint>();
>             try {
>                 for (Endpoint endpoint : getEndpoints()) {
>                     endpoint.activate();  // <-  registration inside activate method of cxf-bc consumer endpoint
>                     activated.add(endpoint);
>                 }
>                 this.status = LifeCycleMBean.STOPPED;
>             } catch (Exception e) {
>                 // Deactivate activated endpoints
>                 for (Endpoint endpoint : activated) {
>                     try {
>                         endpoint.deactivate();  // <- deregistration does not work, if (1) thown exception, because of there is no broken endpoint in list "activated"
>                     } catch (Exception e2) {
>                         // do nothing
>                     }
>                 }
>                 throw e;
>             }
>         }
>     }
> {code}
> org.apache.servicemix.cxfbc.CxfBcConsumer.java
> {code:java}
>     @Override
>     public void activate() throws Exception {
>         super.activate(); //<-  registration inside activate method. There is no recovery process for registration, in case of any problems after super.activate() call.
>         registerListServiceHandler();                                        
>         applyFeatures();
>         checkJmsTransportTransaction();
>         server.start(); 
>     }
> {code}
> I propose the following fix on BC level:
> {code:java}
>     @Override
>     public void activate() throws Exception {
>         super.activate();
>         try {
>         	registerListServiceHandler();
>         	applyFeatures();
>         	checkJmsTransportTransaction();
>         	server.start();
>         } catch (Exception ex){
>         	super.deactivate();   //<- recovery process for registration in case of any problems with connection.
>         	throw ex;
>         }
>     }
> {code}

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


[jira] Moved: (SMXCOMP-540) Registration/deregistration problem for consumer endpoint

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SMXCOMP-540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Freeman Fang moved SM-1855 to SMXCOMP-540:
------------------------------------------

          Component/s:     (was: servicemix-cxf-bc)
                       servicemix-cxf-bc
        Fix Version/s:     (was: 3.3)
                       servicemix-cxf-bc-2009.02
                       3.2.4
    Affects Version/s:     (was: 3.3)
                  Key: SMXCOMP-540  (was: SM-1855)
              Project: ServiceMix Components  (was: ServiceMix)

> Registration/deregistration problem for consumer endpoint
> ---------------------------------------------------------
>
>                 Key: SMXCOMP-540
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-540
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-cxf-bc
>         Environment: SMX 3.3, servicemix-shared-2008.01
>            Reporter: Alexander Zobkov
>            Assignee: Freeman Fang
>             Fix For: 3.2.4, servicemix-cxf-bc-2009.02
>
>
>              I think there is registration/deregistration problem for consumer endpoint in servicemix-cxf-bc 2009.01 and 2009.02-SNAPSHOT component. 
> 	I have SA with SU installed on servicemix-cxf-bc component. SU has only one endpoint. Problem with registration/deregistation consumer endpoint happens in case of problem with connection initilization to JMS message broker. 
> 	There is no possiblity to deregister endpoint correctly in case of no possibility to start SU, for example because of wrong connectivy parameters in endpoint consumer configuration files: xbean.xml, config file for cxf bus, wsdl file or JMS message broker wrong configuration.  There is no possibity to deregister endpoint even with SA undeploy process, bacause of SU remains in "shutdown" state if there was problem at SU startup. If SU in shutdown state then SMX does not deregister endpoints for this SU. (please see code listing). Such behavior leads to error message: "An endpoint is already registered for key: FOO BAR" if user tries to redeploy SA with changed endpoint configuration, but with the same endpoint name. There is only one way to deregister endpoint - restart SMX, but it is not very good way if user needs use SMX in non-stop mode. 
> Please find below related source code parts with small comments.
> org.apache.servicemix.jbi.framework.ServiceAssemblyLifeCycle.java
> {code:java}
>    public synchronized String shutDown(boolean writeState) throws Exception {
>         LOG.info("Shutting down service assembly: " + getName());
>         List<Element> componentFailures = new ArrayList<Element>();
>         for (int i = 0; i < sus.length; i++) {
>             if (sus[i].isStarted()) {
>                 try {
>                     sus[i].stop();
>                 } catch (DeploymentException e) {
>                     componentFailures.add(getComponentFailure(e, "shutDown", sus[i].getComponentName()));
>                 }
>             }
>         }
>         for (int i = 0; i < sus.length; i++) {
>             if (sus[i].isStopped()) {  //<-  false for SU in shutdown state.
>                 try {
>                     sus[i].shutDown();
>                 } catch (DeploymentException e) {
>                     componentFailures.add(getComponentFailure(e, "shutDown", sus[i].getComponentName()));
>                 }
>             }
>         }
>         if (componentFailures.size() == 0) {
>             currentState = SHUTDOWN;
>             if (writeState) {
>                 writeRunningState();
>             }
>             fireEvent(ServiceAssemblyEvent.ASSEMBLY_SHUTDOWN);
>             return ManagementSupport.createSuccessMessage("shutDown");
>         } else {
>             throw ManagementSupport.failure("shutDown", componentFailures);
>         }
>     }
> {code}
> org.apache.servicemix.common.DefaultServiceUnit.java
> {code:java}
>     public synchronized void init() throws Exception {
>         if (this.status == LifeCycleMBean.SHUTDOWN) {
>             // Activate endpoints
>             List<Endpoint> activated = new ArrayList<Endpoint>();
>             try {
>                 for (Endpoint endpoint : getEndpoints()) {
>                     endpoint.activate();  // <-  registration inside activate method of cxf-bc consumer endpoint
>                     activated.add(endpoint);
>                 }
>                 this.status = LifeCycleMBean.STOPPED;
>             } catch (Exception e) {
>                 // Deactivate activated endpoints
>                 for (Endpoint endpoint : activated) {
>                     try {
>                         endpoint.deactivate();  // <- deregistration does not work, if (1) thown exception, because of there is no broken endpoint in list "activated"
>                     } catch (Exception e2) {
>                         // do nothing
>                     }
>                 }
>                 throw e;
>             }
>         }
>     }
> {code}
> org.apache.servicemix.cxfbc.CxfBcConsumer.java
> {code:java}
>     @Override
>     public void activate() throws Exception {
>         super.activate(); //<-  registration inside activate method. There is no recovery process for registration, in case of any problems after super.activate() call.
>         registerListServiceHandler();                                        
>         applyFeatures();
>         checkJmsTransportTransaction();
>         server.start(); 
>     }
> {code}
> I propose the following fix on BC level:
> {code:java}
>     @Override
>     public void activate() throws Exception {
>         super.activate();
>         try {
>         	registerListServiceHandler();
>         	applyFeatures();
>         	checkJmsTransportTransaction();
>         	server.start();
>         } catch (Exception ex){
>         	super.deactivate();   //<- recovery process for registration in case of any problems with connection.
>         	throw ex;
>         }
>     }
> {code}

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


[jira] Assigned: (SM-1855) Registration/deregistration problem for consumer endpoint

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-1855?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Freeman Fang reassigned SM-1855:
--------------------------------

    Assignee: Freeman Fang

> Registration/deregistration problem for consumer endpoint
> ---------------------------------------------------------
>
>                 Key: SM-1855
>                 URL: https://issues.apache.org/activemq/browse/SM-1855
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-cxf-bc
>         Environment: SMX 3.3, servicemix-shared-2008.01
>            Reporter: Alexander Zobkov
>            Assignee: Freeman Fang
>             Fix For: 3.2.4, servicemix-cxf-bc-2009.02
>
>
>              I think there is registration/deregistration problem for consumer endpoint in servicemix-cxf-bc 2009.01 and 2009.02-SNAPSHOT component. 
> 	I have SA with SU installed on servicemix-cxf-bc component. SU has only one endpoint. Problem with registration/deregistation consumer endpoint happens in case of problem with connection initilization to JMS message broker. 
> 	There is no possiblity to deregister endpoint correctly in case of no possibility to start SU, for example because of wrong connectivy parameters in endpoint consumer configuration files: xbean.xml, config file for cxf bus, wsdl file or JMS message broker wrong configuration.  There is no possibity to deregister endpoint even with SA undeploy process, bacause of SU remains in "shutdown" state if there was problem at SU startup. If SU in shutdown state then SMX does not deregister endpoints for this SU. (please see code listing). Such behavior leads to error message: "An endpoint is already registered for key: FOO BAR" if user tries to redeploy SA with changed endpoint configuration, but with the same endpoint name. There is only one way to deregister endpoint - restart SMX, but it is not very good way if user needs use SMX in non-stop mode. 
> Please find below related source code parts with small comments.
> org.apache.servicemix.jbi.framework.ServiceAssemblyLifeCycle.java
> {code:java}
>    public synchronized String shutDown(boolean writeState) throws Exception {
>         LOG.info("Shutting down service assembly: " + getName());
>         List<Element> componentFailures = new ArrayList<Element>();
>         for (int i = 0; i < sus.length; i++) {
>             if (sus[i].isStarted()) {
>                 try {
>                     sus[i].stop();
>                 } catch (DeploymentException e) {
>                     componentFailures.add(getComponentFailure(e, "shutDown", sus[i].getComponentName()));
>                 }
>             }
>         }
>         for (int i = 0; i < sus.length; i++) {
>             if (sus[i].isStopped()) {  //<-  false for SU in shutdown state.
>                 try {
>                     sus[i].shutDown();
>                 } catch (DeploymentException e) {
>                     componentFailures.add(getComponentFailure(e, "shutDown", sus[i].getComponentName()));
>                 }
>             }
>         }
>         if (componentFailures.size() == 0) {
>             currentState = SHUTDOWN;
>             if (writeState) {
>                 writeRunningState();
>             }
>             fireEvent(ServiceAssemblyEvent.ASSEMBLY_SHUTDOWN);
>             return ManagementSupport.createSuccessMessage("shutDown");
>         } else {
>             throw ManagementSupport.failure("shutDown", componentFailures);
>         }
>     }
> {code}
> org.apache.servicemix.common.DefaultServiceUnit.java
> {code:java}
>     public synchronized void init() throws Exception {
>         if (this.status == LifeCycleMBean.SHUTDOWN) {
>             // Activate endpoints
>             List<Endpoint> activated = new ArrayList<Endpoint>();
>             try {
>                 for (Endpoint endpoint : getEndpoints()) {
>                     endpoint.activate();  // <-  registration inside activate method of cxf-bc consumer endpoint
>                     activated.add(endpoint);
>                 }
>                 this.status = LifeCycleMBean.STOPPED;
>             } catch (Exception e) {
>                 // Deactivate activated endpoints
>                 for (Endpoint endpoint : activated) {
>                     try {
>                         endpoint.deactivate();  // <- deregistration does not work, if (1) thown exception, because of there is no broken endpoint in list "activated"
>                     } catch (Exception e2) {
>                         // do nothing
>                     }
>                 }
>                 throw e;
>             }
>         }
>     }
> {code}
> org.apache.servicemix.cxfbc.CxfBcConsumer.java
> {code:java}
>     @Override
>     public void activate() throws Exception {
>         super.activate(); //<-  registration inside activate method. There is no recovery process for registration, in case of any problems after super.activate() call.
>         registerListServiceHandler();                                        
>         applyFeatures();
>         checkJmsTransportTransaction();
>         server.start(); 
>     }
> {code}
> I propose the following fix on BC level:
> {code:java}
>     @Override
>     public void activate() throws Exception {
>         super.activate();
>         try {
>         	registerListServiceHandler();
>         	applyFeatures();
>         	checkJmsTransportTransaction();
>         	server.start();
>         } catch (Exception ex){
>         	super.deactivate();   //<- recovery process for registration in case of any problems with connection.
>         	throw ex;
>         }
>     }
> {code}

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


[jira] Updated: (SM-1855) Registration/deregistration problem for consumer endpoint

Posted by "Alexander Zobkov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-1855?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Zobkov updated SM-1855:
---------------------------------

    Description: 
             I think there is registration/deregistration problem for consumer endpoint in servicemix-cxf-bc 2009.01 and 2009.02-SNAPSHOT component. 

	I have SA with SU installed on servicemix-cxf-bc component. SU has only one endpoint. Problem with registration/deregistation consumer endpoint happens in case of problem with connection initilization to JMS message broker. 

	There is no possiblity to deregister endpoint correctly in case of no possibility to start SU, for example because of wrong connectivy parameters in endpoint consumer configuration files: xbean.xml, config file for cxf bus, wsdl file or JMS message broker wrong configuration.  There is no possibity to deregister endpoint even with SA undeploy process, bacause of SU remains in "shutdown" state if there was problem at SU startup. If SU in shutdown state then SMX does not deregister endpoints for this SU. (please see code listing). Such behavior leads to error message: "An endpoint is already registered for key: FOO BAR" if user tries to redeploy SA with changed endpoint configuration, but with the same endpoint name. There is only one way to deregister endpoint - restart SMX, but it is not very good way if user needs use SMX in non-stop mode. 

Please find below related source code parts with small comments.

org.apache.servicemix.jbi.framework.ServiceAssemblyLifeCycle.java
{code:java}
   public synchronized String shutDown(boolean writeState) throws Exception {
        LOG.info("Shutting down service assembly: " + getName());
        List<Element> componentFailures = new ArrayList<Element>();
        for (int i = 0; i < sus.length; i++) {
            if (sus[i].isStarted()) {
                try {
                    sus[i].stop();
                } catch (DeploymentException e) {
                    componentFailures.add(getComponentFailure(e, "shutDown", sus[i].getComponentName()));
                }
            }
        }
        for (int i = 0; i < sus.length; i++) {
            if (sus[i].isStopped()) {  //<-  false for SU in shutdown state.
                try {
                    sus[i].shutDown();
                } catch (DeploymentException e) {
                    componentFailures.add(getComponentFailure(e, "shutDown", sus[i].getComponentName()));
                }
            }
        }
        if (componentFailures.size() == 0) {
            currentState = SHUTDOWN;
            if (writeState) {
                writeRunningState();
            }
            fireEvent(ServiceAssemblyEvent.ASSEMBLY_SHUTDOWN);
            return ManagementSupport.createSuccessMessage("shutDown");
        } else {
            throw ManagementSupport.failure("shutDown", componentFailures);
        }
    }
{code}

org.apache.servicemix.common.DefaultServiceUnit.java
{code:java}
    public synchronized void init() throws Exception {
        if (this.status == LifeCycleMBean.SHUTDOWN) {
            // Activate endpoints
            List<Endpoint> activated = new ArrayList<Endpoint>();
            try {
                for (Endpoint endpoint : getEndpoints()) {
                    endpoint.activate();  // <-  registration inside activate method of cxf-bc consumer endpoint
                    activated.add(endpoint);
                }
                this.status = LifeCycleMBean.STOPPED;
            } catch (Exception e) {
                // Deactivate activated endpoints
                for (Endpoint endpoint : activated) {
                    try {
                        endpoint.deactivate();  // <- deregistration does not work, if (1) thown exception, because of there is no broken endpoint in list "activated"
                    } catch (Exception e2) {
                        // do nothing
                    }
                }
                throw e;
            }
        }
    }
{code}

org.apache.servicemix.cxfbc.CxfBcConsumer.java
{code:java}
    @Override
    public void activate() throws Exception {
        super.activate(); //<-  registration inside activate method. There is no recovery process for registration, in case of any problems after super.activate() call.
        registerListServiceHandler();                                        
        applyFeatures();
        checkJmsTransportTransaction();
        server.start(); 
    }
{code}
I propose the following fix on BC level:
{code:java}
    @Override
    public void activate() throws Exception {
        super.activate();
        try {
        	registerListServiceHandler();
        	applyFeatures();
        	checkJmsTransportTransaction();
        	server.start();
        } catch (Exception ex){
        	super.deactivate();   //<- recovery process for registration in case of any problems with connection.
        	throw ex;
        }
    }
{code}

  was:
             I think there is registration/deregistration problem for consumer endpoint in servicemix-cxf-bc 2009.01 and 2009.02-SNAPSHOT component. 

	I have SA with SU installed on servicemix-cxf-bc component. SU has only one endpoint. Problem with registration/deregistation consumer endpoint happens in case of problem with connection initilization to JMS message broker. 

	There is no possiblity to deregister endpoint correctly in case of no possibility to start SU, for example because of wrong connectivy parameters in endpoint consumer configuration files: xbean.xml, config file for cxf bus, wsdl file or JMS message broker wrong configuration.  There is no possibity to deregister endpoint even with SA undeploy process, bacause of SU remains in "shutdown" state if there was problem at SU startup. If SU in shutdown state then SMX does not deregister endpoints for this SU. (please see code listing). Such behavior leads to error message: "An endpoint is already registered for key: FOO BAR" if user tries to redeploy SA with changed endpoint configuration, but with the same endpoint name. There is only one way to deregister endpoint - restart SMX, but it is not very good way if user needs use SMX in non-stop mode. 

Please find below related source code parts with small comments.

org.apache.servicemix.jbi.framework.ServiceAssemblyLifeCycle.java

   public synchronized String shutDown(boolean writeState) throws Exception {
        LOG.info("Shutting down service assembly: " + getName());
        List<Element> componentFailures = new ArrayList<Element>();
        for (int i = 0; i < sus.length; i++) {
            if (sus[i].isStarted()) {
                try {
                    sus[i].stop();
                } catch (DeploymentException e) {
                    componentFailures.add(getComponentFailure(e, "shutDown", sus[i].getComponentName()));
                }
            }
        }
        for (int i = 0; i < sus.length; i++) {
            if (sus[i].isStopped()) {  <-  false for SU in shutdown state.
                try {
                    sus[i].shutDown();
                } catch (DeploymentException e) {
                    componentFailures.add(getComponentFailure(e, "shutDown", sus[i].getComponentName()));
                }
            }
        }
        if (componentFailures.size() == 0) {
            currentState = SHUTDOWN;
            if (writeState) {
                writeRunningState();
            }
            fireEvent(ServiceAssemblyEvent.ASSEMBLY_SHUTDOWN);
            return ManagementSupport.createSuccessMessage("shutDown");
        } else {
            throw ManagementSupport.failure("shutDown", componentFailures);
        }
    }


org.apache.servicemix.common.DefaultServiceUnit.java

    public synchronized void init() throws Exception {
        if (this.status == LifeCycleMBean.SHUTDOWN) {
            // Activate endpoints
            List<Endpoint> activated = new ArrayList<Endpoint>();
            try {
                for (Endpoint endpoint : getEndpoints()) {
                    endpoint.activate();  <-  registration inside activate method of cxf-bc consumer endpoint
                    activated.add(endpoint);
                }
                this.status = LifeCycleMBean.STOPPED;
            } catch (Exception e) {
                // Deactivate activated endpoints
                for (Endpoint endpoint : activated) {
                    try {
                        endpoint.deactivate();  <- deregistration does not work, if (1) thown exception, because of there is no broken endpoint in list "activated"
                    } catch (Exception e2) {
                        // do nothing
                    }
                }
                throw e;
            }
        }
    }


org.apache.servicemix.cxfbc.CxfBcConsumer.java

    @Override
    public void activate() throws Exception {
        super.activate(); <-  registration inside activate method. There is no recovery process for registration, in case of any problems after super.activate() call.
        registerListServiceHandler();                                        
        applyFeatures();
        checkJmsTransportTransaction();
        server.start(); 
    }

I propose the following fix on BC level:

    @Override
    public void activate() throws Exception {
        super.activate();
        try {
        	registerListServiceHandler();
        	applyFeatures();
        	checkJmsTransportTransaction();
        	server.start();
        } catch (Exception ex){
        	super.deactivate();   <- recovery process for registration in case of any problems with connection.
        	throw ex;
        }
    }



> Registration/deregistration problem for consumer endpoint
> ---------------------------------------------------------
>
>                 Key: SM-1855
>                 URL: https://issues.apache.org/activemq/browse/SM-1855
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-cxf-bc
>    Affects Versions: 3.3
>         Environment: SMX 3.3, servicemix-shared-2008.01
>            Reporter: Alexander Zobkov
>             Fix For: 3.3
>
>
>              I think there is registration/deregistration problem for consumer endpoint in servicemix-cxf-bc 2009.01 and 2009.02-SNAPSHOT component. 
> 	I have SA with SU installed on servicemix-cxf-bc component. SU has only one endpoint. Problem with registration/deregistation consumer endpoint happens in case of problem with connection initilization to JMS message broker. 
> 	There is no possiblity to deregister endpoint correctly in case of no possibility to start SU, for example because of wrong connectivy parameters in endpoint consumer configuration files: xbean.xml, config file for cxf bus, wsdl file or JMS message broker wrong configuration.  There is no possibity to deregister endpoint even with SA undeploy process, bacause of SU remains in "shutdown" state if there was problem at SU startup. If SU in shutdown state then SMX does not deregister endpoints for this SU. (please see code listing). Such behavior leads to error message: "An endpoint is already registered for key: FOO BAR" if user tries to redeploy SA with changed endpoint configuration, but with the same endpoint name. There is only one way to deregister endpoint - restart SMX, but it is not very good way if user needs use SMX in non-stop mode. 
> Please find below related source code parts with small comments.
> org.apache.servicemix.jbi.framework.ServiceAssemblyLifeCycle.java
> {code:java}
>    public synchronized String shutDown(boolean writeState) throws Exception {
>         LOG.info("Shutting down service assembly: " + getName());
>         List<Element> componentFailures = new ArrayList<Element>();
>         for (int i = 0; i < sus.length; i++) {
>             if (sus[i].isStarted()) {
>                 try {
>                     sus[i].stop();
>                 } catch (DeploymentException e) {
>                     componentFailures.add(getComponentFailure(e, "shutDown", sus[i].getComponentName()));
>                 }
>             }
>         }
>         for (int i = 0; i < sus.length; i++) {
>             if (sus[i].isStopped()) {  //<-  false for SU in shutdown state.
>                 try {
>                     sus[i].shutDown();
>                 } catch (DeploymentException e) {
>                     componentFailures.add(getComponentFailure(e, "shutDown", sus[i].getComponentName()));
>                 }
>             }
>         }
>         if (componentFailures.size() == 0) {
>             currentState = SHUTDOWN;
>             if (writeState) {
>                 writeRunningState();
>             }
>             fireEvent(ServiceAssemblyEvent.ASSEMBLY_SHUTDOWN);
>             return ManagementSupport.createSuccessMessage("shutDown");
>         } else {
>             throw ManagementSupport.failure("shutDown", componentFailures);
>         }
>     }
> {code}
> org.apache.servicemix.common.DefaultServiceUnit.java
> {code:java}
>     public synchronized void init() throws Exception {
>         if (this.status == LifeCycleMBean.SHUTDOWN) {
>             // Activate endpoints
>             List<Endpoint> activated = new ArrayList<Endpoint>();
>             try {
>                 for (Endpoint endpoint : getEndpoints()) {
>                     endpoint.activate();  // <-  registration inside activate method of cxf-bc consumer endpoint
>                     activated.add(endpoint);
>                 }
>                 this.status = LifeCycleMBean.STOPPED;
>             } catch (Exception e) {
>                 // Deactivate activated endpoints
>                 for (Endpoint endpoint : activated) {
>                     try {
>                         endpoint.deactivate();  // <- deregistration does not work, if (1) thown exception, because of there is no broken endpoint in list "activated"
>                     } catch (Exception e2) {
>                         // do nothing
>                     }
>                 }
>                 throw e;
>             }
>         }
>     }
> {code}
> org.apache.servicemix.cxfbc.CxfBcConsumer.java
> {code:java}
>     @Override
>     public void activate() throws Exception {
>         super.activate(); //<-  registration inside activate method. There is no recovery process for registration, in case of any problems after super.activate() call.
>         registerListServiceHandler();                                        
>         applyFeatures();
>         checkJmsTransportTransaction();
>         server.start(); 
>     }
> {code}
> I propose the following fix on BC level:
> {code:java}
>     @Override
>     public void activate() throws Exception {
>         super.activate();
>         try {
>         	registerListServiceHandler();
>         	applyFeatures();
>         	checkJmsTransportTransaction();
>         	server.start();
>         } catch (Exception ex){
>         	super.deactivate();   //<- recovery process for registration in case of any problems with connection.
>         	throw ex;
>         }
>     }
> {code}

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