Willem,

Just rebuilt Camel with the latest changes. It now works.

Thanks a lot - I really appreciate your help,

/Bengt

2010/6/14 Willem Jiang <willem.ji...@gmail.com>

> Bengt Rodehav wrote:
>
>> Helllo Willem,
>>
>> Really interesting URL about the OSGi improvements in Camel. Will these
>> things be part of Camel 2.4? When? In what state is the new OSGi support?
>> Guillaume mentions that he is creating services that one can depend on
>> (which is what I have discussed with hime on another thread). If this
>> works
>> now, then I can probably drop my OSGi extender that I use for that
>> purpose.
>> It would be interesting to know the new pattern/best practice for using
>> Camel in OSGi.
>>
> There are some JIRA number (CAMEL-2693, 2793) about the refactoring,
> Guillaume already finished them, please try it.
>
>
>
>> Anyway, I tried adding the import you mentioned. I'm not sure I understood
>> you correctly. I first tried adding it as a dynamic import. This didn't
>> work
>> since neither the dash nor forward slash characters are accepted by the
>> maven-bundle-plugin in a DynamicImport-Package instruction. I then
>> added META-INF/services/org/apache/camel/component/ in an Import-Package.
>> The maven-bundle-plugin accepted this. However my bundle then no longer
>> resolves since that import is not found in runtime. I then marked it as
>> optional. My bundle then resolves but when the camel context is started I
>> get the same exception as before.
>>
>> When I look at camel-core and camel-ftp they don't seem to export
>> the META-INF/services/org/apache/camel/component/ package. How then could
>> I
>> hope to being able to import it?
>>
>>  It's my fault, I didn't write a test to verify my thought.
> As camel-core doesn't export the package of
> "META-INF/services/org/apache/camel/component/" your bundle will not start
> rightly.
> So I revert the change of OsgiFactoryFinder(CAMEL-2809), now it can find
> the factory without importing the package of
> "META-INF/services/org/apache/camel/component/" in your bundle.
>
>
>
>  I'm probably missing something here. The error message indicates that
>> Camel
>> is looking for "strategy.factory.file"
>> in META-INF/services/org/apache/camel/component/. I'm not sure what that
>> means. I can see that in camel-core there is a file called "file" in
>> the META-INF/services/org/apache/camel/component/ folder. That file
>> contains
>> a property called "strategy.factory.class". I assume the value of that
>> property is what we are looking for. Still can't figure out how my bundle
>> can access the directory if it's not exported.
>>
>
> The issue is caused by application bundle has the right to access the
> properties file, I workaround it by reverting the change of
> OsgiFactoryFinder.
>
> Willem
>
>
>
>> /Bengt
>>
>>
>> 2010/6/13 Willem Jiang <willem.ji...@gmail.com>
>>
>>  Hi Bengt,
>>>
>>> You need also add the package import of
>>> "META-INF/services/org/apache/camel/component/"
>>>
>>> As the OsgiFactoryFinder is changed to use camel application bundle to
>>> load
>>> the resource, you need to make sure your application bundle has the right
>>> to
>>> access the file.
>>>
>>> BTW, there are some discusses about the refactoring that you can take a
>>> look[1]
>>>
>>> [1]
>>>
>>> http://old.nabble.com/-DISCUSS--OSGi-improvements-and-type-converters-ts28776216.html#a28776216
>>>
>>> Willem
>>>
>>> Bengt Rodehav wrote:
>>>
>>>  Willem,
>>>>
>>>> There might still be some OSGi related problems. When testing different
>>>> failing scenarios I got the following exception:
>>>>
>>>> 21:44:59,398 | DEBUG | guration Updater | FileEndpoint
>>>> |
>>>> mponent.file.GenericFileEndpoint  138 | No strategy factory defined in
>>>> 'META-INF/services/org/apache/camel/component/'
>>>> org.apache.camel.NoFactoryAvailableException: Could not find factory
>>>> class
>>>> for resource: strategy.factory.file
>>>> at
>>>>
>>>>
>>>> org.apache.camel.core.osgi.OsgiFactoryFinder.findClass(OsgiFactoryFinder.java:71)
>>>> at
>>>>
>>>>
>>>> org.apache.camel.component.file.GenericFileEndpoint.createGenericFileStrategy(GenericFileEndpoint.java:134)
>>>> at
>>>>
>>>>
>>>> org.apache.camel.component.file.GenericFileEndpoint.getGenericFileProcessStrategy(GenericFileEndpoint.java:118)
>>>> at
>>>>
>>>>
>>>> org.apache.camel.component.file.GenericFileConsumer.doStart(GenericFileConsumer.java:397)
>>>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:56)
>>>> at
>>>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:53)
>>>> at
>>>>
>>>>
>>>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1015)
>>>>
>>>> Seems like Camel cannot find any factory class for
>>>> "strategy.factory.file".
>>>> Sounds fishy to me and seems related to the class loading issues I had
>>>> before. Can you check that the OSGi refactoring that has been made in
>>>> Camel
>>>> 2.4 takes this into account? I'll try to reproduce the error.
>>>>
>>>> /Bengt
>>>>
>>>>
>>>>
>>
>

Reply via email to