You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Philippe Pinheiro (JIRA)" <ji...@apache.org> on 2010/07/12 17:34:51 UTC

[jira] Created: (SMX4NMR-214) Error in Bootstrap init when accessing ComponentContext logger through the InstallationContext

Error in Bootstrap init when accessing ComponentContext logger through the InstallationContext  
------------------------------------------------------------------------------------------------

                 Key: SMX4NMR-214
                 URL: https://issues.apache.org/activemq/browse/SMX4NMR-214
             Project: ServiceMix NMR
          Issue Type: Bug
            Reporter: Philippe Pinheiro
             Fix For: 1.2.0


In a JBI component working on Servicemix 3, I have this code on its Bootstrap class :

	public void init(InstallationContext context) throws JBIException {
		Logger mLogger = context.getContext().getLogger(this.getClass().getName(),null);
		mLogger.info("Bootstrap instance init");
	}

When I install this component on Servicemix 4,  I get the error :

<loc-message>This operation is not available at installation time</loc-message>
[jbi-install-component] <stack-trace><![CDATA[java.lang.IllegalStateException: This operation is not available at installation time
[jbi-install-component] 
[jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.InstallationContextImpl.getLogger(InstallationContextImpl.java:284)
[jbi-install-component] 
[jbi-install-component] 	at integra.common.BootstrapTemplate.init(BootstrapTemplate.java:19)
[jbi-install-component] 
[jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.ComponentInstaller.initBootstrap(ComponentInstaller.java:335)
[jbi-install-component] 
[jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.ComponentInstaller.init(ComponentInstaller.java:121)
[jbi-install-component] 
[jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.InstallationService.doLoadNewInstaller(InstallationService.java:219)
[jbi-install-component] 
[jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.InstallationService.install(InstallationService.java:165)
[jbi-install-component] 
[jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.AdminCommandsImpl.installComponent(AdminCommandsImpl.java:56)

is it a bug ? if not, what kind of Logger do we have access at the BootStrap level ?

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


[jira] Issue Comment Edited: (SMX4NMR-214) Error in Bootstrap init when accessing ComponentContext logger through the InstallationContext

Posted by "Gert Vanthienen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMX4NMR-214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=60879#action_60879 ] 

Gert Vanthienen edited comment on SMX4NMR-214 at 7/24/10 7:42 AM:
------------------------------------------------------------------

The ServiceMix 4 code implements this part of the JBI specification:
{code}
/**
 * Get the JBI context for this component. The following methods are valid to use on the context:
 * <ul>
 * <li>{@link ComponentContext#getMBeanNames()}</li>
 * <li>{@link ComponentContext#getMBeanServer()}</li>
 * <li>{@link ComponentContext#getNamingContext()}</li>
 * <li>{@link ComponentContext#getTransactionManager()}</li>
 * </ul>
 * All other methods on the returned context must throw a <code>IllegalStateException</code> exception if invoked.
 * 
 * @return the JBI context for this component, which must be non-null.
 */
public ComponentContext getContext();
{code}

However, since ServiceMix 3 does implement the getLogger() method (in fact, it uses a full-blown ComponentContext implementation), so I wonder if we could ignore the specification here for ServiceMix 4 as well.  What do people think?

The obvious workaround would be to use any kind of logger (slf4j, commons-logging,...) in your own code  -- in ServiceMix 4, all of those are provided by pax-logging anyway so whichever you choose will be nicely integrated with the rest of the logging.

      was (Author: gertvanthienen):
    The ServiceMix 4 code implements this part of the JBI specification:
{code}
    /**
     * Get the JBI context for this component. The following methods are valid to use on the context:
     * <ul>
     * <li>{@link ComponentContext#getMBeanNames()}</li>
     * <li>{@link ComponentContext#getMBeanServer()}</li>
     * <li>{@link ComponentContext#getNamingContext()}</li>
     * <li>{@link ComponentContext#getTransactionManager()}</li>
     * </ul>
     * All other methods on the returned context must throw a <code>IllegalStateException</code> exception if invoked.
     * 
     * @return the JBI context for this component, which must be non-null.
     */
     public ComponentContext getContext();
{code}

However, since ServiceMix 3 does implement the getLogger() method (in fact, it uses a full-blown ComponentContext implementation), so I wonder if we could ignore the specification here for ServiceMix 4 as well.  What do people think?

The obvious workaround would be to use any kind of logger (slf4j, commons-logging,...) in your own code  -- in ServiceMix 4, all of those are provided by pax-logging anyway so whichever you choose will be nicely integrated with the rest of the logging.
  
> Error in Bootstrap init when accessing ComponentContext logger through the InstallationContext  
> ------------------------------------------------------------------------------------------------
>
>                 Key: SMX4NMR-214
>                 URL: https://issues.apache.org/activemq/browse/SMX4NMR-214
>             Project: ServiceMix NMR
>          Issue Type: Bug
>            Reporter: Philippe Pinheiro
>             Fix For: 1.2.0
>
>
> In a JBI component working on Servicemix 3, I have this code on its Bootstrap class :
> 	public void init(InstallationContext context) throws JBIException {
> 		Logger mLogger = context.getContext().getLogger(this.getClass().getName(),null);
> 		mLogger.info("Bootstrap instance init");
> 	}
> When I install this component on Servicemix 4,  I get the error :
> <loc-message>This operation is not available at installation time</loc-message>
> [jbi-install-component] <stack-trace><![CDATA[java.lang.IllegalStateException: This operation is not available at installation time
> [jbi-install-component] 
> [jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.InstallationContextImpl.getLogger(InstallationContextImpl.java:284)
> [jbi-install-component] 
> [jbi-install-component] 	at integra.common.BootstrapTemplate.init(BootstrapTemplate.java:19)
> [jbi-install-component] 
> [jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.ComponentInstaller.initBootstrap(ComponentInstaller.java:335)
> [jbi-install-component] 
> [jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.ComponentInstaller.init(ComponentInstaller.java:121)
> [jbi-install-component] 
> [jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.InstallationService.doLoadNewInstaller(InstallationService.java:219)
> [jbi-install-component] 
> [jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.InstallationService.install(InstallationService.java:165)
> [jbi-install-component] 
> [jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.AdminCommandsImpl.installComponent(AdminCommandsImpl.java:56)
> is it a bug ? if not, what kind of Logger do we have access at the BootStrap level ?

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


[jira] Commented: (SMX4NMR-214) Error in Bootstrap init when accessing ComponentContext logger through the InstallationContext

Posted by "Gert Vanthienen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMX4NMR-214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=60879#action_60879 ] 

Gert Vanthienen commented on SMX4NMR-214:
-----------------------------------------

The ServiceMix 4 code implements this part of the JBI specification:
{code}
    /**
     * Get the JBI context for this component. The following methods are valid to use on the context:
     * <ul>
     * <li>{@link ComponentContext#getMBeanNames()}</li>
     * <li>{@link ComponentContext#getMBeanServer()}</li>
     * <li>{@link ComponentContext#getNamingContext()}</li>
     * <li>{@link ComponentContext#getTransactionManager()}</li>
     * </ul>
     * All other methods on the returned context must throw a <code>IllegalStateException</code> exception if invoked.
     * 
     * @return the JBI context for this component, which must be non-null.
     */
     public ComponentContext getContext();
{code}

However, since ServiceMix 3 does implement the getLogger() method (in fact, it uses a full-blown ComponentContext implementation), so I wonder if we could ignore the specification here for ServiceMix 4 as well.  What do people think?

The obvious workaround would be to use any kind of logger (slf4j, commons-logging,...) in your own code  -- in ServiceMix 4, all of those are provided by pax-logging anyway so whichever you choose will be nicely integrated with the rest of the logging.

> Error in Bootstrap init when accessing ComponentContext logger through the InstallationContext  
> ------------------------------------------------------------------------------------------------
>
>                 Key: SMX4NMR-214
>                 URL: https://issues.apache.org/activemq/browse/SMX4NMR-214
>             Project: ServiceMix NMR
>          Issue Type: Bug
>            Reporter: Philippe Pinheiro
>             Fix For: 1.2.0
>
>
> In a JBI component working on Servicemix 3, I have this code on its Bootstrap class :
> 	public void init(InstallationContext context) throws JBIException {
> 		Logger mLogger = context.getContext().getLogger(this.getClass().getName(),null);
> 		mLogger.info("Bootstrap instance init");
> 	}
> When I install this component on Servicemix 4,  I get the error :
> <loc-message>This operation is not available at installation time</loc-message>
> [jbi-install-component] <stack-trace><![CDATA[java.lang.IllegalStateException: This operation is not available at installation time
> [jbi-install-component] 
> [jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.InstallationContextImpl.getLogger(InstallationContextImpl.java:284)
> [jbi-install-component] 
> [jbi-install-component] 	at integra.common.BootstrapTemplate.init(BootstrapTemplate.java:19)
> [jbi-install-component] 
> [jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.ComponentInstaller.initBootstrap(ComponentInstaller.java:335)
> [jbi-install-component] 
> [jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.ComponentInstaller.init(ComponentInstaller.java:121)
> [jbi-install-component] 
> [jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.InstallationService.doLoadNewInstaller(InstallationService.java:219)
> [jbi-install-component] 
> [jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.InstallationService.install(InstallationService.java:165)
> [jbi-install-component] 
> [jbi-install-component] 	at org.apache.servicemix.jbi.deployer.impl.AdminCommandsImpl.installComponent(AdminCommandsImpl.java:56)
> is it a bug ? if not, what kind of Logger do we have access at the BootStrap level ?

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