Are you running this code in web container? If so, which? Tomcat,
Jetty, JBoss?
If you are just running as a standalone Java app, you can just use
"SimpleRegistry", which is basically a Map.
CamelContext context = new DefaultCamelContext(new SimpleRegistry());
Registry registry = context.getRegistry();
if (registry instanceof PropertyPlaceholderDelegateRegistry)
registry =
((PropertyPlaceholderDelegateRegistry)registry).getRegistry();
Then, instead of JndiRegistry.bind(...), just use Map's put(..) method:
((SimpleRegistry)registry).put("bean-name", new SomeBean());
On Mon, Mar 18, 2013 at 2:49 PM, Gert Villemos <[email protected]> wrote:
> I meant that I in the RouteBuilder::configure have;
>
> JndiRegistry registry = (JndiRegistry) getContext().getRegistry(); // DO NOT
> WORK!
>
>
> -----------
>
> Thanks for the suggestion. The code
>
> PropertyPlaceholderDelegateRegistry registry =
> (PropertyPlaceholderDelegateRegistry) getContext().getRegistry();
> JndiRegistry jndiRegistry = (JndiRegistry) registry.getRegistry();
>
> Gives me a reference to the JndiRegistry, but on first bind() I get an
> exception;
>
> javax.naming.NoInitialContextException: Need to specify class name in
> environment or system property, or as an applet parameter, or in an
> application resource file: java.naming.factory.initial
>
> If I need to manually initialize the JNDI context, then this smells like Im
> doing something I should not be doing, i.e. bypassing the 'right' way of
> doing things...
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Programatically-adding-beans-to-a-registry-in-a-RouteBuilder-tp5729358p5729370.html
> Sent from the Camel - Users mailing list archive at Nabble.com.