Sorry, forgot about that.  I'd written a dummy class to replace the
Spring dependency in camel-mail, since, out of the twenty-some methods
in the Spring class, camel-mail uses maybe two.

There should maybe be a JIRA to make this a soft dependency like JMX's
dependency  appears to be.

On Tue, Jun 28, 2011 at 9:37 AM, Michael Furtak <[email protected]> wrote:
> I looked into continuing my testing with camel-mail, but stopped short 
> because it also has a dependency on Spring (JavaMailSender).
>
> However, I did test with camel-xmpp to great success. Besides bringing in the 
> correct libraries, the only code change was to ensure that my starter also 
> bound a ComponentResolver (component=xmpp) before activating.
>
>
> One other Spring dependency worth noting is that JMX management seems to 
> depend on it. From my log:
>
> [27 Jun 2011 12:20:12]  INFO  [Component Resolve Thread] 
> OsgiDefaultCamelContext - JMX enabled. Using ManagedManagementStrategy.
> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] ServiceHelper - 
> Starting service: 
> org.apache.camel.management.ManagedManagementStrategy@1865b28
> [27 Jun 2011 12:20:12]  WARN  [Component Resolve Thread] 
> OsgiDefaultCamelContext - Cannot find needed classes for JMX lifecycle 
> strategy. Needed class is in spring-context.jar using Spring 2.5 or newer 
> (spring-jmx.jar using Spring 2.0.x). NoClassDefFoundError: 
> org/springframework/jmx/export/metadata/JmxAttributeSource
> [27 Jun 2011 12:20:12]  WARN  [Component Resolve Thread] 
> OsgiDefaultCamelContext - Cannot use JMX. Fallback to using 
> DefaultManagementStrategy (non JMX).
>
>
> Thanks to everyone who helped me work this out. I'm feeling a bit more 
> confident that I can use Camel in my project now.
>
> Best,
> -Mike Furtak
>
>
>
>
>
>
>
> THIS MESSAGE IS INTENDED FOR THE USE OF THE PERSON TO WHOM IT IS ADDRESSED. 
> IT MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM 
> DISCLOSURE UNDER APPLICABLE LAW. If you are not the intended recipient, your 
> use of this message for any purpose is strictly prohibited. If you have 
> received this communication in error, please delete the message and notify 
> the sender so that we may correct our records.
>
> -----Original Message-----
>
>
>
> From: Donald Whytock [mailto:[email protected]]
> Sent: Monday, June 27, 2011 4:42 PM
> To: [email protected]
> Subject: Re: Camel under OSGi without Spring et al.
>
> Seems reasonable, since presumably OsgiPackageScanClassResolver is
> more made to be used in an OSGI environment than the
> DefaultPackageScanClassResolver.  This might also solve a problem I
> was having, where OsgiDefaultCamelContext.getComponentNames() was
> coming up empty.
>
> Can you test with a non-core component as well, such as mail?
>
> On Mon, Jun 27, 2011 at 4:21 PM, Michael Furtak <[email protected]> wrote:
>> Ok. I seem to have found a resolution. Now the question is whether or not it 
>> is appropriate. :)
>>
>> Since we seemed to agree that classes are not being found by their 
>> annotations, I tried to backtrace how that was being resolved. Where I wound 
>> up was in 
>> org.apache.camel.core.osgi.OsgiTypeConverter.createRegistry(OsgiTypeConverter.java:166)
>>
>> There, it seems to be setting up the DefaultTypeConverter which will be used 
>> as the delegate. It sets it up to use a DefaultPackageScanClassResolver, 
>> which seems to be failing to find anything. If I change:
>>
>> protected DefaultTypeConverter createRegistry() {
>>  // base the osgi type converter on the default type converter
>>  DefaultTypeConverter answer = new DefaultTypeConverter(new 
>> DefaultPackageScanClassResolver() {
>>    @Override
>>    public Set<ClassLoader> getClassLoaders() {
>>      // we don't need any classloaders as we use osgi service tracker instead
>>      return Collections.emptySet();
>>    }
>>  }, injector, factoryFinder);
>> // ...
>>
>> to:
>>
>> protected DefaultTypeConverter createRegistry() {
>>  // base the osgi type converter on the default type converter
>>  PackageScanClassResolver resolver = new 
>> OsgiPackageScanClassResolver(bundleContext);
>>  DefaultTypeConverter answer = new DefaultTypeConverter(resolver, injector, 
>> factoryFinder);
>>
>>
>> then I get a successful startup and a working test case:
>>
>> from("file:data/inbox").to("file:data/outbox");
>>
>>
>> Hurrah! So, is this a reasonable fix? Does the code I replaced in 
>> OsgiTypeConverter make sense as written?
>>
>> Thanks to all who've helped so far.
>>
>> -Mike
>>
>>
>>
>>
>>
>>
>>
>> THIS MESSAGE IS INTENDED FOR THE USE OF THE PERSON TO WHOM IT IS ADDRESSED. 
>> IT MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM 
>> DISCLOSURE UNDER APPLICABLE LAW. If you are not the intended recipient, your 
>> use of this message for any purpose is strictly prohibited. If you have 
>> received this communication in error, please delete the message and notify 
>> the sender so that we may correct our records.
>>
>> -----Original Message-----
>>
>>
>>
>> From: Donald Whytock [mailto:[email protected]]
>> Sent: Monday, June 27, 2011 1:56 PM
>> To: [email protected]
>> Subject: Re: Camel under OSGi without Spring et al.
>>
>> No specific thoughts, no.  It's fairly clear you're waiting for
>> TypeConverterLoader to be registered before you're trying to start the
>> CamelContext, and (if this is all the code you have loaded) you're not
>> trying to access a file component.  Honestly, I think it should work,
>> but again I'm not familiar with Declarative Services.
>>
>> My startup log file has some lines yours doesn't...
>>
>> org.apache.camel.camel-core[org.apache.camel.impl.osgi.Activator] :
>> Found 13 @Converter classes to load
>> org.apache.camel.camel-core[org.apache.camel.impl.osgi.Activator] :
>> Loading converter class:
>> org.apache.camel.component.file.GenericFileConverter
>> org.apache.camel.camel-core[org.apache.camel.impl.osgi.Activator] :
>> Loading converter class: org.apache.camel.component.bean.BeanConverter
>> org.apache.camel.camel-core[org.apache.camel.impl.osgi.Activator] :
>> Loading converter class: org.apache.camel.converter.CamelConverter
>> org.apache.camel.camel-core[org.apache.camel.impl.osgi.Activator] :
>> Loading converter class:
>> org.apache.camel.converter.CollectionConverter
>> org.apache.camel.camel-core[org.apache.camel.impl.osgi.Activator] :
>> Loading converter class: org.apache.camel.converter.IOConverter
>> org.apache.camel.camel-core[org.apache.camel.impl.osgi.Activator] :
>> Loading converter class: org.apache.camel.converter.NIOConverter
>> org.apache.camel.camel-core[org.apache.camel.impl.osgi.Activator] :
>> Loading converter class: org.apache.camel.converter.ObjectConverter
>> org.apache.camel.camel-core[org.apache.camel.impl.osgi.Activator] :
>> Loading converter class:
>> org.apache.camel.converter.TimePatternConverter
>> org.apache.camel.camel-core[org.apache.camel.impl.osgi.Activator] :
>> Loading converter class: org.apache.camel.converter.jaxp.DomConverter
>> org.apache.camel.camel-core[org.apache.camel.impl.osgi.Activator] :
>> Loading converter class: org.apache.camel.converter.jaxp.StaxConverter
>> org.apache.camel.camel-core[org.apache.camel.impl.osgi.Activator] :
>> Loading converter class:
>> org.apache.camel.converter.jaxp.StreamSourceConverter
>> org.apache.camel.camel-core[org.apache.camel.impl.osgi.Activator] :
>> Loading converter class: org.apache.camel.converter.jaxp.XmlConverter
>> org.apache.camel.camel-core[org.apache.camel.impl.osgi.Activator] :
>> Loading converter class:
>> org.apache.camel.converter.stream.StreamCacheConverter
>>
>> which might correspond to the "Searching for annotations" line in your
>> log.  Random thought...are annotations enabled in your JVM?
>>
>> I'm sending the rest of the pieces of my bundle (under separate cover,
>> as the list apparently eats attachments; available to others on
>> request).  If that doesn't work for you either, my guess is something
>> in your Camel config.
>>
>> Don
>>
>> On Mon, Jun 27, 2011 at 12:26 PM, Michael Furtak <[email protected]> wrote:
>>> Hi Don,
>>>
>>> Thanks for your continued help. I've had my efforts diverted elsewhere for 
>>> a bit, but I'm back to trying to explore this again today.
>>>
>>> Following this message: 
>>> http://camel.465427.n5.nabble.com/Camel-under-OSGi-without-Spring-et-al-tp4507473p4511826.html
>>>
>>> I've modified my test environment slightly. I've added the 
>>> TypeConverterLoader to the list of services that my CamelStarter requires 
>>> before it activates. That means that it now binds a ComponentResolver with 
>>> (component=file) and a TypeConverterLoader before the activate method is 
>>> invoked. That is also visible in the log. However, the call to 
>>> camelContext.start() still produces an exception.
>>>
>>>
>>>
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"; 
>>> name="com.cra.camelsandbox.CamelStarter">
>>>   <implementation class="com.cra.camelsandbox.CamelStarter"/>
>>>   <reference bind="bindComponentResolver" cardinality="1..1" 
>>> interface="org.apache.camel.spi.ComponentResolver" name="ComponentResolver" 
>>> policy="dynamic" target="(component=file)" 
>>> unbind="unbindComponentResolver"/>
>>>   <reference bind="bindTypeConverterLoader" cardinality="1..1" 
>>> interface="org.apache.camel.spi.TypeConverterLoader" 
>>> name="TypeConverterLoader" policy="dynamic" 
>>> unbind="unbindTypeConverterLoader"/>
>>> </scr:component>
>>>
>>>
>>>
>>>
>>> public class CamelStarter
>>> {
>>>  private static final transient Logger LOG = 
>>> LoggerFactory.getLogger(CamelStarter.class);
>>>
>>>  protected void activate(ComponentContext context)
>>>  {
>>>    try
>>>    {
>>>      LOG.trace("activating");
>>>      CamelContext camelContext = new 
>>> OsgiDefaultCamelContext(context.getBundleContext());
>>>      camelContext.start();
>>>    }
>>>    catch (Throwable t)
>>>    {
>>>      t.printStackTrace();
>>>    }
>>>  }
>>>
>>>  protected void deactivate(ComponentContext context)
>>>  {
>>>    LOG.trace("deactivating");
>>>  }
>>>
>>>  protected void bindComponentResolver(ComponentResolver cr)
>>>  {
>>>    LOG.trace("Binding ComponentResolver");
>>>    // Ignored, since the ComponentResolver is not directly used
>>>  }
>>>
>>>  protected void unbindComponentResolver(ComponentResolver cr)
>>>  {
>>>    LOG.trace("Unbinding ComponentResolver");
>>>    // Ignored, since the ComponentResolver is not directly used
>>>  }
>>>
>>>  protected void bindTypeConverterLoader(TypeConverterLoader tcl)
>>>  {
>>>    LOG.trace("Binding TypeConverterLoader");
>>>    // Ignored, since the ComponentResolver is not directly used
>>>  }
>>>
>>>  protected void unbindTypeConverterLoader(TypeConverterLoader tcl)
>>>  {
>>>    LOG.trace("Unbinding TypeConverterLoader");
>>>    // Ignored, since the ComponentResolver is not directly used
>>>  }
>>> }
>>>
>>>
>>>
>>> I've also tweaked my logging settings to capture Camel's output, in the 
>>> hope that it provides some more context:
>>>
>>>
>>>
>>> <START CONSOLE>
>>>
>>> [27 Jun 2011 12:20:11]  INFO  [Start Level Event Dispatcher] Activator - 
>>> Camel activator starting
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Bundle started: scala-library
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Bundle started: org.eclipse.osgi.services
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Bundle started: org.eclipse.equinox.event
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Bundle started: org.eclipse.equinox.util
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Bundle started: org.eclipse.equinox.ds
>>> [27 Jun 2011 12:20:11]  INFO  [Start Level Event Dispatcher] Activator - 
>>> Camel activator started
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Bundle started: org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/component/bean in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/component/browse in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/component/class in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/component/dataset in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/component/direct in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/component/file in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/component/language in 
>>> bundle org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/component/log in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/component/mock in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/component/properties in 
>>> bundle org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/component/ref in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/component/seda in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/component/timer in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/component/vm in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/language/bean in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/language/constant in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/language/file in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/language/header in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/language/property in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/language/simple in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/language/tokenize in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Found entry: META-INF/services/org/apache/camel/language/xpath in bundle 
>>> org.apache.camel.camel-core
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Bundle started: org.eclipse.osgi.util
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Bundle started: com.cra.camel.core.osgi
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Bundle started: se.scalablesolutions.akka.actor
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Bundle started: commons-management
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Bundle started: org.eclipse.equinox.log
>>> [27 Jun 2011 12:20:11]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Bundle started: org.apache.log4j
>>> [27 Jun 2011 12:20:11]  TRACE [Component Resolve Thread] CamelStarter - 
>>> Binding ComponentResolver
>>> [27 Jun 2011 12:20:11]  TRACE [Component Resolve Thread] CamelStarter - 
>>> Binding TypeConverterLoader
>>> [27 Jun 2011 12:20:11]  TRACE [Component Resolve Thread] CamelStarter - 
>>> activating
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] 
>>> DefaultPackageScanClassResolver - Adding ContextClassLoader from current 
>>> thread: org.eclipse.core.runtime.internal.adaptor.ContextFinder@193722c
>>> [27 Jun 2011 12:20:12]  DEBUG [Component Resolve Thread] 
>>> OsgiCamelContextHelper - Using OsgiCamelContextNameStrategy
>>> [27 Jun 2011 12:20:12]  DEBUG [Component Resolve Thread] 
>>> OsgiCamelContextHelper - Using OsgiClassResolver
>>> [27 Jun 2011 12:20:12]  DEBUG [Component Resolve Thread] 
>>> OsgiCamelContextHelper - Using OsgiFactoryFinderResolver
>>> [27 Jun 2011 12:20:12]  DEBUG [Component Resolve Thread] 
>>> OsgiCamelContextHelper - Using OsgiPackageScanClassResolver
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] 
>>> OsgiPackageScanClassResolver - Adding ContextClassLoader from current 
>>> thread: org.eclipse.core.runtime.internal.adaptor.ContextFinder@193722c
>>> [27 Jun 2011 12:20:12]  DEBUG [Component Resolve Thread] 
>>> OsgiCamelContextHelper - Using OsgiComponentResolver
>>> [27 Jun 2011 12:20:12]  DEBUG [Component Resolve Thread] 
>>> OsgiCamelContextHelper - Using OsgiLanguageResolver
>>> [27 Jun 2011 12:20:12]  DEBUG [Component Resolve Thread] 
>>> OsgiCamelContextHelper - Using OsgiDataFormatResolver
>>> [27 Jun 2011 12:20:12]  INFO  [Component Resolve Thread] 
>>> OsgiDefaultCamelContext - Apache Camel  (CamelContext: 13-camel-2) is 
>>> starting
>>> [27 Jun 2011 12:20:12]  INFO  [Component Resolve Thread] 
>>> OsgiDefaultCamelContext - JMX enabled. Using ManagedManagementStrategy.
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] ServiceHelper - 
>>> Starting service: 
>>> org.apache.camel.management.ManagedManagementStrategy@1865b28
>>> [27 Jun 2011 12:20:12]  WARN  [Component Resolve Thread] 
>>> OsgiDefaultCamelContext - Cannot find needed classes for JMX lifecycle 
>>> strategy. Needed class is in spring-context.jar using Spring 2.5 or newer 
>>> (spring-jmx.jar using Spring 2.0.x). NoClassDefFoundError: 
>>> org/springframework/jmx/export/metadata/JmxAttributeSource
>>> [27 Jun 2011 12:20:12]  WARN  [Component Resolve Thread] 
>>> OsgiDefaultCamelContext - Cannot use JMX. Fallback to using 
>>> DefaultManagementStrategy (non JMX).
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] ServiceHelper - 
>>> Starting service: org.apache.camel.core.osgi.OsgiTypeConverter@1d62270
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] OsgiTypeConverter 
>>> - AddingService: {org.apache.camel.spi.TypeConverterLoader}={service.id=36}
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] 
>>> OsgiTypeConverter$1 - Adding ContextClassLoader from current thread: 
>>> org.eclipse.core.runtime.internal.adaptor.ContextFinder@193722c
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] 
>>> DefaultTypeConverter - Adding fallback type converter: 
>>> org.apache.camel.impl.converter.ToStringTypeConverter@d73c7a which can 
>>> promote: false
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] 
>>> DefaultTypeConverter - Adding fallback type converter: 
>>> org.apache.camel.impl.converter.PropertyEditorTypeConverter@1e845c2 which 
>>> can promote: false
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] 
>>> DefaultTypeConverter - Adding fallback type converter: 
>>> org.apache.camel.impl.converter.EnumTypeConverter@125fefa which can 
>>> promote: true
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] 
>>> DefaultTypeConverter - Adding fallback type converter: 
>>> org.apache.camel.impl.converter.ArrayTypeConverter@19e8f17 which can 
>>> promote: true
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] 
>>> DefaultTypeConverter - Adding fallback type converter: 
>>> org.apache.camel.impl.converter.FutureTypeConverter@13ad33d which can 
>>> promote: false
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] 
>>> DefaultTypeConverter - Adding fallback type converter: 
>>> org.apache.camel.impl.converter.AsyncProcessorTypeConverter@7109c4 which 
>>> can promote: true
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] ServiceHelper - 
>>> Starting service: 
>>> org.apache.camel.impl.converter.DefaultTypeConverter@1aed5f9
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] ServiceHelper - 
>>> Starting service: 
>>> org.apache.camel.impl.converter.PropertyEditorTypeConverter@1e845c2
>>> [27 Jun 2011 12:20:12]  DEBUG [Component Resolve Thread] 
>>> DefaultTypeConverter - Loading type converters ...
>>> [27 Jun 2011 12:20:12]  INFO  [Component Resolve Thread] 
>>> AnnotationTypeConverterLoader - Loading file 
>>> META-INF/services/org/apache/camel/TypeConverter to retrieve list of 
>>> packages, from url: 
>>> bundleresource://5.fwk5184781/META-INF/services/org/apache/camel/TypeConverter
>>> [27 Jun 2011 12:20:12]  DEBUG [Component Resolve Thread] 
>>> OsgiTypeConverter$1 - Searching for annotations of 
>>> org.apache.camel.Converter in packages: [org.apache.camel.component.file, 
>>> org.apache.camel.component.bean, org.apache.camel.converter]
>>> [27 Jun 2011 12:20:12]  DEBUG [Component Resolve Thread] 
>>> OsgiTypeConverter$1 - Found: []
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] ServiceHelper - 
>>> Stopping service 
>>> org.apache.camel.impl.converter.PropertyEditorTypeConverter@1e845c2
>>> [27 Jun 2011 12:20:12]  INFO  [Component Resolve Thread] 
>>> OsgiDefaultCamelContext - Apache Camel  (CamelContext:13-camel-2) is 
>>> shutting down
>>> [27 Jun 2011 12:20:12]  INFO  [Component Resolve Thread] 
>>> DefaultShutdownStrategy - Starting to graceful shutdown 0 routes (timeout 
>>> 300 seconds)
>>> [27 Jun 2011 12:20:12]  DEBUG [Component Resolve Thread] 
>>> DefaultExecutorServiceStrategy - Created new single thread pool for source: 
>>> org.apache.camel.impl.DefaultShutdownStrategy@4ecfdd with name: 
>>> ShutdownTask. -> 
>>> java.util.concurrent.Executors$FinalizableDelegatedExecutorService@30d82d
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] 
>>> ExecutorServiceHelper - Created thread[ShutdownTask]: Thread[Camel Thread 0 
>>> - ShutdownTask,5,main]
>>> [27 Jun 2011 12:20:12]  DEBUG [Camel Thread 0 - ShutdownTask] 
>>> DefaultShutdownStrategy - There are 0 routes to shutdown
>>> [27 Jun 2011 12:20:12]  INFO  [Component Resolve Thread] 
>>> DefaultShutdownStrategy - Graceful shutdown of 0 routes completed in 0 
>>> seconds
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] ServiceHelper - 
>>> Service already stopped: 
>>> org.apache.camel.core.osgi.OsgiTypeConverter@1d62270
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] ServiceHelper - 
>>> Shutting down service org.apache.camel.core.osgi.OsgiTypeConverter@1d62270
>>> [27 Jun 2011 12:20:12]  TRACE [Component Resolve Thread] ServiceHelper - 
>>> Stopping service 
>>> org.apache.camel.management.DefaultManagementStrategy@164dbd5
>>> [27 Jun 2011 12:20:12]  INFO  [Component Resolve Thread] 
>>> OsgiDefaultCamelContext - Uptime: 0.063 seconds
>>> [27 Jun 2011 12:20:12]  INFO  [Component Resolve Thread] 
>>> OsgiDefaultCamelContext - Apache Camel  (CamelContext: 13-camel-2) is 
>>> shutdown in 0.016 seconds
>>> org.apache.camel.RuntimeCamelException: Error staring OSGiTypeConverter 
>>> due: Failed to load type converters because of: Cannot find any type 
>>> converter classes from the following packages: 
>>> [org.apache.camel.component.file, org.apache.camel.component.bean, 
>>> org.apache.camel.converter]
>>>        at 
>>> org.apache.camel.core.osgi.OsgiTypeConverter.createRegistry(OsgiTypeConverter.java:206)
>>>        at 
>>> org.apache.camel.core.osgi.OsgiTypeConverter.getDelegate(OsgiTypeConverter.java:164)
>>>        at 
>>> org.apache.camel.core.osgi.OsgiTypeConverter.addingService(OsgiTypeConverter.java:69)
>>>        at 
>>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)
>>>        at 
>>> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)
>>>        at 
>>> org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:184)
>>>        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:339)
>>>        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:273)
>>>        at 
>>> org.apache.camel.core.osgi.OsgiTypeConverter.doStart(OsgiTypeConverter.java:102)
>>>        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>>>        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>>>        at 
>>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>>>        at 
>>> org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1613)
>>>        at 
>>> org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:899)
>>>        at 
>>> org.apache.camel.impl.DefaultCamelContext.getTypeConverter(DefaultCamelContext.java:984)
>>>        at 
>>> org.apache.camel.impl.DefaultCamelContext.getTypeConverterRegistry(DefaultCamelContext.java:1001)
>>>        at 
>>> org.apache.camel.impl.DefaultCamelContext.forceLazyInitialization(DefaultCamelContext.java:1940)
>>>        at 
>>> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1423)
>>>        at 
>>> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1336)
>>>        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>>>        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>>>        at 
>>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1314)
>>>        at com.cra.camelsandbox.CamelStarter.activate(CamelStarter.java:21)
>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>        at 
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>        at 
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>>        at 
>>> org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:210)
>>>        at 
>>> org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:139)
>>>        at 
>>> org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:339)
>>>        at 
>>> org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:588)
>>>        at 
>>> org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:196)
>>>        at 
>>> org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:441)
>>>        at 
>>> org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:213)
>>>        at 
>>> org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:800)
>>>        at 
>>> org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:767)
>>>        at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)
>>>        at java.lang.Thread.run(Thread.java:619)
>>> Caused by: org.apache.camel.TypeConverterLoaderException: Failed to load 
>>> type converters because of: Cannot find any type converter classes from the 
>>> following packages: [org.apache.camel.component.file, 
>>> org.apache.camel.component.bean, org.apache.camel.converter]
>>>        at 
>>> org.apache.camel.impl.converter.AnnotationTypeConverterLoader.load(AnnotationTypeConverterLoader.java:79)
>>>        at 
>>> org.apache.camel.impl.converter.BaseTypeConverterRegistry.loadTypeConverters(BaseTypeConverterRegistry.java:395)
>>>        at 
>>> org.apache.camel.impl.converter.DefaultTypeConverter.doStart(DefaultTypeConverter.java:41)
>>>        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>>>        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>>>        at 
>>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>>>        at 
>>> org.apache.camel.core.osgi.OsgiTypeConverter.createRegistry(OsgiTypeConverter.java:202)
>>>        ... 37 more
>>> [27 Jun 2011 12:20:12]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Bundle started: com.cra.camelsandbox.core
>>> [27 Jun 2011 12:20:12]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Bundle started: slf4j.api
>>> [27 Jun 2011 12:20:12]  DEBUG [Start Level Event Dispatcher] Activator - 
>>> Bundle started: org.eclipse.osgi
>>>
>>> <END CONSOLE>
>>>
>>>
>>>
>>> The lines:
>>>
>>> [27 Jun 2011 12:20:12]  DEBUG [Component Resolve Thread] 
>>> OsgiTypeConverter$1 - Searching for annotations of 
>>> org.apache.camel.Converter in packages: [org.apache.camel.component.file, 
>>> org.apache.camel.component.bean, org.apache.camel.converter]
>>> [27 Jun 2011 12:20:12]  DEBUG [Component Resolve Thread] 
>>> OsgiTypeConverter$1 - Found: []
>>>
>>> ...seem indicative of the problem to my untrained eye. Do you have any 
>>> further thoughts about what I am doing wrong?
>>>
>>>
>>>
>>> Thanks again,
>>> -Mike
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> THIS MESSAGE IS INTENDED FOR THE USE OF THE PERSON TO WHOM IT IS ADDRESSED. 
>>> IT MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM 
>>> DISCLOSURE UNDER APPLICABLE LAW. If you are not the intended recipient, 
>>> your use of this message for any purpose is strictly prohibited. If you 
>>> have received this communication in error, please delete the message and 
>>> notify the sender so that we may correct our records.
>>>
>>> -----Original Message-----
>>>
>>>
>>>
>>> From: Donald Whytock [mailto:[email protected]]
>>> Sent: Tuesday, June 21, 2011 4:10 PM
>>> To: [email protected]
>>> Subject: Re: Camel under OSGi without Spring et al.
>>>
>>> Not familiar with OSGi Declarative Services, so there will be some
>>> guesswork on my part...
>>>
>>> Yes, I use OsgiCamelTracker to control the Camel-using bundles.  But
>>> it also tracks whether the CamelContext-singleton-providing service
>>> (ContextUtil) is up.  That service in turn depends on an instance of
>>> org.apache.camel.spi.TypeConverterLoader service.
>>>
>>> camel-core has a BundleActivator.  That activator starts a
>>> BundleTracker that checks every bundle that launches (including
>>> itself) to see if it contains components that need to be loaded.  It
>>> registers the components as services first, then it registers
>>> TypeConverterLoader.
>>>
>>> From the example you gave, it looks like you need to create another
>>> class that binds to TypeConverterLoader, generates and starts a
>>> CamelContext, and then registers itself as a service; then your
>>> CamelStarter class would bind to that service along with the
>>> ComponentResolver(s), and fetch the CamelContext from that service.
>>>
>>> Can you bind to multiple services via your XML, such that your class
>>> won't activate until all the other services are found?
>>>
>>> Don
>>>
>>> On Tue, Jun 21, 2011 at 3:21 PM, Michael Furtak <[email protected]> wrote:
>>>> Hi Don,
>>>>
>>>> I reviewed your sample code. Thanks very much for sharing that with me. If 
>>>> I understand the intent and explanation correctly, you are using your 
>>>> OsgiCamelTracker to delay the start-up of your Camel-using code until you 
>>>> can be sure that the requisite ComponentResolver services have become 
>>>> available.
>>>>
>>>> In my current project we use OSGi Declarative Services, so I have set up 
>>>> an OSGi component (yay, overloaded terms!) that requests a service 
>>>> reference for a ComponentResolver that can provide the Camel 'file' 
>>>> component. This should have the same effect of delaying the activation of 
>>>> my CamelStarter class until that service can be bound. Here's the DS xml:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"; 
>>>> name="com.cra.camelsandbox.CamelStarter">
>>>>   <implementation class="com.cra.camelsandbox.CamelStarter"/>
>>>>   <reference bind="bindComponentResolver" cardinality="1..1" 
>>>> interface="org.apache.camel.spi.ComponentResolver" 
>>>> name="ComponentResolver" policy="dynamic" target="(component=file)" 
>>>> unbind="unbindComponentResolver"/>
>>>> </scr:component>
>>>>
>>>>
>>>> And the Java class itself:
>>>>
>>>> public class CamelStarter
>>>> {
>>>>  private static final transient Logger LOG = 
>>>> LoggerFactory.getLogger(CamelStarter.class);
>>>>
>>>>  protected void activate(ComponentContext context) throws Exception
>>>>  {
>>>>    LOG.trace("activating");
>>>>    CamelContext camelContext = new 
>>>> OsgiDefaultCamelContext(context.getBundleContext());
>>>>    // camelContext.start();
>>>>  }
>>>>
>>>>  protected void deactivate(ComponentContext context)
>>>>  {
>>>>    LOG.trace("deactivating");
>>>>  }
>>>>
>>>>  protected void bindComponentResolver(ComponentResolver cr)
>>>>  {
>>>>    LOG.trace("Binding ComponentResolver");
>>>>    // Ignored, since the ComponentResolver is not directly used
>>>>  }
>>>>
>>>>  protected void unbindComponentResolver(ComponentResolver cr)
>>>>  {
>>>>    LOG.trace("Unbinding ComponentResolver");
>>>>    // Ignored, since the ComponentResolver is not directly used
>>>>  }
>>>> }
>>>>
>>>> With the third line of the activate method commented out, everything seems 
>>>> to go as planned:
>>>>
>>>> [21 Jun 2011 15:08:19]  TRACE [Component Resolve Thread (Bundle 12)] 
>>>> CamelStarter - Binding ComponentResolver
>>>> [21 Jun 2011 15:08:19]  TRACE [Component Resolve Thread (Bundle 12)] 
>>>> CamelStarter - activating
>>>>
>>>>
>>>> But if I uncomment it, I get this:
>>>>
>>>> java.lang.reflect.InvocationTargetException
>>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>        at 
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>        at 
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:210)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:139)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:339)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:588)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:196)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:441)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:213)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:800)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:767)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)
>>>>        at 
>>>> org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run(Executor.java:70)
>>>> Caused by: org.apache.camel.RuntimeCamelException: Error staring 
>>>> OSGiTypeConverter due: Failed to load type converters because of: Cannot 
>>>> find any type converter classes from the following packages: 
>>>> [org.apache.camel.component.file, org.apache.camel.component.bean, 
>>>> org.apache.camel.converter]
>>>>        at 
>>>> org.apache.camel.core.osgi.OsgiTypeConverter.createRegistry(OsgiTypeConverter.java:206)
>>>>        at 
>>>> org.apache.camel.core.osgi.OsgiTypeConverter.getDelegate(OsgiTypeConverter.java:164)
>>>>        at 
>>>> org.apache.camel.core.osgi.OsgiTypeConverter.addingService(OsgiTypeConverter.java:69)
>>>>        at 
>>>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)
>>>>        at 
>>>> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)
>>>>        at 
>>>> org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:184)
>>>>        at 
>>>> org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:339)
>>>>        at 
>>>> org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:273)
>>>>        at 
>>>> org.apache.camel.core.osgi.OsgiTypeConverter.doStart(OsgiTypeConverter.java:102)
>>>>        at 
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>>>>        at 
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>>>>        at 
>>>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1613)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:899)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.getTypeConverter(DefaultCamelContext.java:984)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.getTypeConverterRegistry(DefaultCamelContext.java:1001)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.forceLazyInitialization(DefaultCamelContext.java:1940)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1423)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1336)
>>>>        at 
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>>>>        at 
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1314)
>>>>        at com.cra.camelsandbox.CamelStarter.activate(CamelStarter.java:18)
>>>>        ... 15 more
>>>> Caused by: org.apache.camel.TypeConverterLoaderException: Failed to load 
>>>> type converters because of: Cannot find any type converter classes from 
>>>> the following packages: [org.apache.camel.component.file, 
>>>> org.apache.camel.component.bean, org.apache.camel.converter]
>>>>        at 
>>>> org.apache.camel.impl.converter.AnnotationTypeConverterLoader.load(AnnotationTypeConverterLoader.java:79)
>>>>        at 
>>>> org.apache.camel.impl.converter.BaseTypeConverterRegistry.loadTypeConverters(BaseTypeConverterRegistry.java:395)
>>>>        at 
>>>> org.apache.camel.impl.converter.DefaultTypeConverter.doStart(DefaultTypeConverter.java:41)
>>>>        at 
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>>>>        at 
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>>>>        at 
>>>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>>>>        at 
>>>> org.apache.camel.core.osgi.OsgiTypeConverter.createRegistry(OsgiTypeConverter.java:202)
>>>>        ... 37 more
>>>> Root exception:
>>>> org.apache.camel.RuntimeCamelException: Error staring OSGiTypeConverter 
>>>> due: Failed to load type converters because of: Cannot find any type 
>>>> converter classes from the following packages: 
>>>> [org.apache.camel.component.file, org.apache.camel.component.bean, 
>>>> org.apache.camel.converter]
>>>>        at 
>>>> org.apache.camel.core.osgi.OsgiTypeConverter.createRegistry(OsgiTypeConverter.java:206)
>>>>        at 
>>>> org.apache.camel.core.osgi.OsgiTypeConverter.getDelegate(OsgiTypeConverter.java:164)
>>>>        at 
>>>> org.apache.camel.core.osgi.OsgiTypeConverter.addingService(OsgiTypeConverter.java:69)
>>>>        at 
>>>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)
>>>>        at 
>>>> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)
>>>>        at 
>>>> org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:184)
>>>>        at 
>>>> org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:339)
>>>>        at 
>>>> org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:273)
>>>>        at 
>>>> org.apache.camel.core.osgi.OsgiTypeConverter.doStart(OsgiTypeConverter.java:102)
>>>>        at 
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>>>>        at 
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>>>>        at 
>>>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1613)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:899)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.getTypeConverter(DefaultCamelContext.java:984)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.getTypeConverterRegistry(DefaultCamelContext.java:1001)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.forceLazyInitialization(DefaultCamelContext.java:1940)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1423)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1336)
>>>>        at 
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>>>>        at 
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>>>>        at 
>>>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1314)
>>>>        at com.cra.camelsandbox.CamelStarter.activate(CamelStarter.java:18)
>>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>        at 
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>        at 
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:210)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:139)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:339)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:588)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:196)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:441)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:213)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:800)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:767)
>>>>        at 
>>>> org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)
>>>>        at 
>>>> org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run(Executor.java:70)
>>>> Caused by: org.apache.camel.TypeConverterLoaderException: Failed to load 
>>>> type converters because of: Cannot find any type converter classes from 
>>>> the following packages: [org.apache.camel.component.file, 
>>>> org.apache.camel.component.bean, org.apache.camel.converter]
>>>>        at 
>>>> org.apache.camel.impl.converter.AnnotationTypeConverterLoader.load(AnnotationTypeConverterLoader.java:79)
>>>>        at 
>>>> org.apache.camel.impl.converter.BaseTypeConverterRegistry.loadTypeConverters(BaseTypeConverterRegistry.java:395)
>>>>        at 
>>>> org.apache.camel.impl.converter.DefaultTypeConverter.doStart(DefaultTypeConverter.java:41)
>>>>        at 
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>>>>        at 
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>>>>        at 
>>>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>>>>        at 
>>>> org.apache.camel.core.osgi.OsgiTypeConverter.createRegistry(OsgiTypeConverter.java:202)
>>>>        ... 37 more
>>>>
>>>> Slightly off topic, your advice about needing to share the CamelContext 
>>>> object as a singleton (wrt. SEDA, etc.) was received loud and clear. What 
>>>> you see here is me just trying to keep my test cases simple for now.
>>>>
>>>>
>>>> So that's where I am stuck at the moment. I'm sorry not to be working more 
>>>> directly from your sample code, but please correct me if its service 
>>>> management strategy/intent is different from my understanding. Does my 
>>>> current problem make sense? What am I missing?
>>>>
>>>>
>>>> Thanks,
>>>> -Mike
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> THIS MESSAGE IS INTENDED FOR THE USE OF THE PERSON TO WHOM IT IS 
>>>> ADDRESSED. IT MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND 
>>>> EXEMPT FROM DISCLOSURE UNDER APPLICABLE LAW. If you are not the intended 
>>>> recipient, your use of this message for any purpose is strictly 
>>>> prohibited. If you have received this communication in error, please 
>>>> delete the message and notify the sender so that we may correct our 
>>>> records.
>>>>
>>>> -----Original Message-----
>>>>
>>>>
>>>>
>>>> From: Donald Whytock [mailto:[email protected]]
>>>> Sent: Monday, June 20, 2011 4:45 PM
>>>> To: [email protected]
>>>> Subject: Re: Camel under OSGi without Spring et al.
>>>>
>>>> OsgiCamelTracker.java (attached) is a work in progress.  There's a
>>>> reference to ContextUtil; that's the service class that supplies the
>>>> CamelContext singleton.
>>>>
>>>> Use it by subclassing it and implementing methods start() and stop().
>>>> Call setBundleContext(bundleContext) first, then startTracking().
>>>>
>>>> OsgiCamelTracker.startTracking() accepts no parameters, a single
>>>> String, or a Collection<String>.  The strings are the names of
>>>> components that you need.  It'll track instances of ComponentResolver,
>>>> maintaining a list of what components are available and what
>>>> components are still needed.  When all the components you need are
>>>> available, it'll call start(); when any of the components cease to be
>>>> available, it'll call stop().
>>>>
>>>> If you don't supply component names, it'll react to camel-core itself
>>>> becoming active, which is all you need for core components like mock,
>>>> bean and file.
>>>>
>>>> Use routeId(<name>) in your route definitions.  Use
>>>> camelcontext.startRoute(<name>) from the OsgiCamelTracker.start(); use
>>>> camelcontext.stopRoute(<name>) from the OsgiCamelTracker.stop().
>>>>
>>>> Be advised, you'll need to use a singleton CamelContext if you're
>>>> using SEDA queues, because SEDA queues are local to a CamelContext
>>>> instance.  A route that consumes from a SEDA queue from one
>>>> CamelContext instance won't see anything produced to a SEDA queue from
>>>> a different CamelContext instance.
>>>>
>>>> For OsgiDefaultCamelContext...
>>>>
>>>>> On Mon, Jun 20, 2011 at 3:31 PM, Michael Furtak <[email protected]> wrote:
>>>>>> I did come across mention of this in my troubleshooting exploration. It 
>>>>>> seems to be part of a bundle called camel-core-osgi, is that right? I 
>>>>>> don't think I have it in my 2.7.2 distribution. Is it something I need 
>>>>>> to bundle myself? I also saw mention of it being private to the Spring 
>>>>>> bundle, which is what prompted my discussion about not wanting to bring 
>>>>>> in Spring.
>>>>
>>>> org.apache.camel.core.osgi is in camel-blueprint.jar.  I split it out
>>>> into its own .jar so as to not worry about the Blueprint dependencies.
>>>>  You'll need to modify the manifest, or make your own.
>>>>
>>>> Don
>>>>
>>>>
>>>
>>>
>>
>>
>
>

Reply via email to