So I managed to get rid of the error message. I'm not sure if it is possible
to make the error message more informative. For example, in a very similar
situation, I had an error message when I had a route builder with jms, when
I didn't have camel-jms loaded and I got:

1) Failed to resolve endpoint: jms://test.MyQueue due to: No component found
with scheme: jms
  while locating org.apache.camel.guice.GuiceCamelContext
  while locating org.apache.camel.CamelContext

Anyway, just a minor point.

I do have a couple of general questions in trying to understand things.

So is .beanRef() a Guice specific method or is it used for Spring, also? Or
is it simply built for using JNDI and it is just the fact that Guice acts as
a JNDI store backed by Guice beans?

And what is the thinking behind Guice JNDI? Is it just there to allow for a
simple way for retrieving beans that have been initialized by Guice without
carrying around the injector? I see that it is used to inject values that
have been defined in jndi.properties, but is it more generally usable to get
any and all Guice enhanced beans as long as they have been annotated? Do I
need to do anything other than annotate the bean? Will it serve to fully
build up the bean graph of all components associated with the bean annotated
with JMS?

--Tim


willem.jiang wrote:
> 
> Hi,
> 
>   camel-guice has a jndi context which hold the reference of the JMS 
> component and the someBean. So you need to create that context in your 
> GuceServletConfig.
> 
> You can find use code in the MyActivitor[1] about how to create that 
> context.
> 
> [1] 
> https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-guice-jms/src/main/java/org/apache/camel/example/guice/jms/MyActivator.java
> 
> Willem
> mumbly wrote:
>> Thanks for all the help so far. You're example worked great.
>> 
>> I'm running into an error when integrating the camel routes into a webapp
>> where I use the guice servlet for initialization. I have the same set of
>> changes you included in your diff, but the startup happens from a
>> listener
>> defined in web.xml and looking like:
>> 
>> public class GuiceServletConfig extends GuiceServletContextListener {
>>     protected Injector getInjector() {
>>         Module camel = new MyModule();
>>         return Guice.createInjector(camel);
>>     }
>> 
>> there is some other code in there, but I've tried it with this simple
>> version. When I run, the error I get is:
>> 
>> com.google.inject.CreationException: Guice creation errors:
>> 
>>   while locating org.apache.camel.guice.GuiceCamelContext
>>   while locating org.apache.camel.CamelContext
>> 
>> 1 error
>>      at
>> com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:354)
>>      at
>> com.google.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:179)
>>      at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:113)
>>      at com.google.inject.Guice.createInjector(Guice.java:92)
>>      .
>> 
>> Any thoughts on this? I've confirmed that both the camel-guice and
>> camel-core jars are in the WEB-INF/lib.
>> 
>> --Tim
>>  
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Using-Guice-with-Camel-tp26517323p26594078.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to