You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "jmdev (JIRA)" <ji...@apache.org> on 2007/02/27 00:19:02 UTC

[jira] Created: (SM-858) Unable to access a JBIContainer using the supplied component context in various endpoints (i.e. JSR181)

Unable to access a JBIContainer using the supplied component context in various endpoints (i.e. JSR181)
-------------------------------------------------------------------------------------------------------

                 Key: SM-858
                 URL: https://issues.apache.org/activemq/browse/SM-858
             Project: ServiceMix
          Issue Type: Bug
          Components: servicemix-core, servicemix-http, servicemix-jsr181
    Affects Versions: 3.1
            Reporter: jmdev


Following the instructions at 

http://incubator.apache.org/servicemix/how-can-i-access-the-jbicontainer-from-inside-a-component-.html 

a developer should be able to access the JBIContainer from within a JSR181 POJO.  However, there is a ClassCastException due to the fact that the ComponentContext returned is of type EndpointComponentContext.  In turn, an EndpointComponentContext does not provide access to it's internal context of type ComponentContext, which allows the developer to get a reference to the JBIContainer.

Temporary fix can be found here:

http://www.nabble.com/Error-Accessing-JBI-Container-from-JSR181-Component---Is-it-Possible--tf3281290s12049.html#a9132255

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


[jira] Commented: (SM-858) Unable to access a JBIContainer using the supplied component context in various endpoints (i.e. JSR181)

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_38645 ] 

Guillaume Nodet commented on SM-858:
------------------------------------

Here is a workaround:

{code:lang=java}
  public void setContext(ComponentContext context) {
       this.context = context;
       try {
           Field field = context.getClass().getDeclaredField("context");
           field.setAccessible(true);
           Object smxContext = field.get(context);
           field = smxContext.getClass().getDeclaredField("container");
           field.setAccessible(true);
           JBIContainer container = (JBIContainer) field.get(smxContext);
           ...
       } catch (Exception e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
       }
   }
{code}

> Unable to access a JBIContainer using the supplied component context in various endpoints (i.e. JSR181)
> -------------------------------------------------------------------------------------------------------
>
>                 Key: SM-858
>                 URL: https://issues.apache.org/activemq/browse/SM-858
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-core, servicemix-http, servicemix-jsr181
>    Affects Versions: 3.1
>            Reporter: jmdev
>
> Following the instructions at 
> http://incubator.apache.org/servicemix/how-can-i-access-the-jbicontainer-from-inside-a-component-.html 
> a developer should be able to access the JBIContainer from within a JSR181 POJO.  However, there is a ClassCastException due to the fact that the ComponentContext returned is of type EndpointComponentContext.  In turn, an EndpointComponentContext does not provide access to it's internal context of type ComponentContext, which allows the developer to get a reference to the JBIContainer.
> Temporary fix can be found here:
> http://www.nabble.com/Error-Accessing-JBI-Container-from-JSR181-Component---Is-it-Possible--tf3281290s12049.html#a9132255

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


[jira] Resolved: (SM-858) Unable to access a JBIContainer using the supplied component context in various endpoints (i.e. JSR181)

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

Guillaume Nodet resolved SM-858.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 3.2
         Assignee: Guillaume Nodet

The JBIContainer can now be injected on the POJO, the same way than the ComponentContext.

public void setContainer(JBIContainer container) {
}

such a method will be called when the pojo is instanciated.

Author: gnodet
Date: Fri Mar  2 05:54:59 2007
New Revision: 513764

URL: http://svn.apache.org/viewvc?view=rev&rev=513764
Log:
SM-858: The JBIContainer can now be injected on the POJO

Modified:
   incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181Endpoint.java


> Unable to access a JBIContainer using the supplied component context in various endpoints (i.e. JSR181)
> -------------------------------------------------------------------------------------------------------
>
>                 Key: SM-858
>                 URL: https://issues.apache.org/activemq/browse/SM-858
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-core, servicemix-http, servicemix-jsr181
>    Affects Versions: 3.1
>            Reporter: jmdev
>         Assigned To: Guillaume Nodet
>             Fix For: 3.2
>
>
> Following the instructions at 
> http://incubator.apache.org/servicemix/how-can-i-access-the-jbicontainer-from-inside-a-component-.html 
> a developer should be able to access the JBIContainer from within a JSR181 POJO.  However, there is a ClassCastException due to the fact that the ComponentContext returned is of type EndpointComponentContext.  In turn, an EndpointComponentContext does not provide access to it's internal context of type ComponentContext, which allows the developer to get a reference to the JBIContainer.
> Temporary fix can be found here:
> http://www.nabble.com/Error-Accessing-JBI-Container-from-JSR181-Component---Is-it-Possible--tf3281290s12049.html#a9132255

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