You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Triquoit Mathieu <ma...@gmail.com> on 2009/05/05 07:09:48 UTC

iPojo Extender Pattern => ClassNotFoundException

Hi,

I have a module A which could be viewed as an Editor (with the GUI etc). In
this module I have implemented the iPojo Extender Pattern for the Help
package in different language.
So, in each help package, I have in the manifest something like
<HelpExtension> which contains the class name to instanciate to retrieve
some useful information...

My problem is that I can deploy the first extension... but with the second
one, I have a ClassNotFoundException ? If I deploy the second extension as
first extension, it is ok but for the other, ClassNotFoundException again ?

Any idea ?

Thanks,
Regards,
Mathieu

Re: iPojo Extender Pattern => ClassNotFoundException

Posted by Triquoit Mathieu <ma...@gmail.com>.
Ah yes, sorry... I had a <Export-Package> in my pom.xml ... Now it works.

Thanks to you for the quick reply :),
Mathieu

2009/5/5 Clement Escoffier <cl...@gmail.com>

>
> On 05.05.2009, at 09:36, Triquoit Mathieu wrote:
>
>  Yes I follow the same schema...
>>
>> EditorModule which contains my HelpExtender with onBundleArrival
>>
>> English help module: in the MF, I have HelpExtension:
>> org.mtr.EnglishHelpService
>> French help module: in the MF, HelpExtension: org.mtr.FrenchHelpService
>>
>> In the onBundleArrival method, I have exactly what you mention, for the
>> first extension, OK... for the second one, I have the exception when I
>> perform the bundle.loadClass(clazz);
>>
>
> Hum, sounds tricky. Are you sure to use the good bundle object (the
> received one). Did you try to get the name of the class that cannot be
> loaded?
>
> I might be related to a classloading conflict, like a duplicated package.
>
> Clement
>
>
>
>
>>
>> Regards,
>> Mathieu
>>
>> 2009/5/5 Clement Escoffier <cl...@gmail.com>
>>
>>  Hi,
>>>
>>> Do you know which class cannot be loaded ? Is it the instantiated class,
>>> or
>>> a used class ?
>>>
>>> To load the class, you must follow such kind of pattern:
>>> void onBundleArrival(Bundle bundle, String header) {
>>>  String clazz = ... // Get the class to load from the header
>>>  Class theClass = bundle.loadClass(clazz);
>>>  // Create the object
>>>  Object obj = theClass.newInstance();
>>> }
>>>
>>> Regards,
>>>
>>> Clement
>>>
>>>
>>>
>>> On 05.05.2009, at 07:09, Triquoit Mathieu wrote:
>>>
>>> Hi,
>>>
>>>>
>>>> I have a module A which could be viewed as an Editor (with the GUI etc).
>>>> In
>>>> this module I have implemented the iPojo Extender Pattern for the Help
>>>> package in different language.
>>>> So, in each help package, I have in the manifest something like
>>>> <HelpExtension> which contains the class name to instanciate to retrieve
>>>> some useful information...
>>>>
>>>> My problem is that I can deploy the first extension... but with the
>>>> second
>>>> one, I have a ClassNotFoundException ? If I deploy the second extension
>>>> as
>>>> first extension, it is ok but for the other, ClassNotFoundException
>>>> again
>>>> ?
>>>>
>>>> Any idea ?
>>>>
>>>> Thanks,
>>>> Regards,
>>>> Mathieu
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: iPojo Extender Pattern => ClassNotFoundException

Posted by Clement Escoffier <cl...@gmail.com>.
On 05.05.2009, at 09:36, Triquoit Mathieu wrote:

> Yes I follow the same schema...
>
> EditorModule which contains my HelpExtender with onBundleArrival
>
> English help module: in the MF, I have HelpExtension:
> org.mtr.EnglishHelpService
> French help module: in the MF, HelpExtension:  
> org.mtr.FrenchHelpService
>
> In the onBundleArrival method, I have exactly what you mention, for  
> the
> first extension, OK... for the second one, I have the exception when I
> perform the bundle.loadClass(clazz);

Hum, sounds tricky. Are you sure to use the good bundle object (the  
received one). Did you try to get the name of the class that cannot be  
loaded?

I might be related to a classloading conflict, like a duplicated  
package.

Clement


>
>
> Regards,
> Mathieu
>
> 2009/5/5 Clement Escoffier <cl...@gmail.com>
>
>> Hi,
>>
>> Do you know which class cannot be loaded ? Is it the instantiated  
>> class, or
>> a used class ?
>>
>> To load the class, you must follow such kind of pattern:
>> void onBundleArrival(Bundle bundle, String header) {
>>   String clazz = ... // Get the class to load from the header
>>   Class theClass = bundle.loadClass(clazz);
>>   // Create the object
>>  Object obj = theClass.newInstance();
>> }
>>
>> Regards,
>>
>> Clement
>>
>>
>>
>> On 05.05.2009, at 07:09, Triquoit Mathieu wrote:
>>
>> Hi,
>>>
>>> I have a module A which could be viewed as an Editor (with the GUI  
>>> etc).
>>> In
>>> this module I have implemented the iPojo Extender Pattern for the  
>>> Help
>>> package in different language.
>>> So, in each help package, I have in the manifest something like
>>> <HelpExtension> which contains the class name to instanciate to  
>>> retrieve
>>> some useful information...
>>>
>>> My problem is that I can deploy the first extension... but with  
>>> the second
>>> one, I have a ClassNotFoundException ? If I deploy the second  
>>> extension as
>>> first extension, it is ok but for the other,  
>>> ClassNotFoundException again
>>> ?
>>>
>>> Any idea ?
>>>
>>> Thanks,
>>> Regards,
>>> Mathieu
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: iPojo Extender Pattern => ClassNotFoundException

Posted by Triquoit Mathieu <ma...@gmail.com>.
Yes I follow the same schema...

EditorModule which contains my HelpExtender with onBundleArrival

English help module: in the MF, I have HelpExtension:
org.mtr.EnglishHelpService
French help module: in the MF, HelpExtension: org.mtr.FrenchHelpService

In the onBundleArrival method, I have exactly what you mention, for the
first extension, OK... for the second one, I have the exception when I
perform the bundle.loadClass(clazz);

Regards,
Mathieu

2009/5/5 Clement Escoffier <cl...@gmail.com>

> Hi,
>
> Do you know which class cannot be loaded ? Is it the instantiated class, or
> a used class ?
>
> To load the class, you must follow such kind of pattern:
>  void onBundleArrival(Bundle bundle, String header) {
>    String clazz = ... // Get the class to load from the header
>    Class theClass = bundle.loadClass(clazz);
>    // Create the object
>   Object obj = theClass.newInstance();
> }
>
> Regards,
>
> Clement
>
>
>
> On 05.05.2009, at 07:09, Triquoit Mathieu wrote:
>
>  Hi,
>>
>> I have a module A which could be viewed as an Editor (with the GUI etc).
>> In
>> this module I have implemented the iPojo Extender Pattern for the Help
>> package in different language.
>> So, in each help package, I have in the manifest something like
>> <HelpExtension> which contains the class name to instanciate to retrieve
>> some useful information...
>>
>> My problem is that I can deploy the first extension... but with the second
>> one, I have a ClassNotFoundException ? If I deploy the second extension as
>> first extension, it is ok but for the other, ClassNotFoundException again
>> ?
>>
>> Any idea ?
>>
>> Thanks,
>> Regards,
>> Mathieu
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: iPojo Extender Pattern => ClassNotFoundException

Posted by Clement Escoffier <cl...@gmail.com>.
Hi,

Do you know which class cannot be loaded ? Is it the instantiated  
class, or a used class ?

To load the class, you must follow such kind of pattern:
  void onBundleArrival(Bundle bundle, String header) {
     String clazz = ... // Get the class to load from the header
     Class theClass = bundle.loadClass(clazz);
     // Create the object
    Object obj = theClass.newInstance();
}

Regards,

Clement


On 05.05.2009, at 07:09, Triquoit Mathieu wrote:

> Hi,
>
> I have a module A which could be viewed as an Editor (with the GUI  
> etc). In
> this module I have implemented the iPojo Extender Pattern for the Help
> package in different language.
> So, in each help package, I have in the manifest something like
> <HelpExtension> which contains the class name to instanciate to  
> retrieve
> some useful information...
>
> My problem is that I can deploy the first extension... but with the  
> second
> one, I have a ClassNotFoundException ? If I deploy the second  
> extension as
> first extension, it is ok but for the other, ClassNotFoundException  
> again ?
>
> Any idea ?
>
> Thanks,
> Regards,
> Mathieu


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org