You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2015/03/21 08:00:47 UTC

[jira] [Resolved] (CAMEL-8500) ClassCastException when something other than PropertiesComponent is bound to "properties" JNDI name

     [ https://issues.apache.org/jira/browse/CAMEL-8500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-8500.
--------------------------------
    Resolution: Fixed
      Assignee: Claus Ibsen

Got this fixed now. Thanks for reporting.

> ClassCastException when something other than PropertiesComponent is bound to "properties" JNDI name
> ---------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-8500
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8500
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.13.4
>         Environment: Apache Camel 2.13.4 running on JBoss EAP4
>            Reporter: Carsten Erker
>            Assignee: Claus Ibsen
>             Fix For: 2.14.3, 2.15.1, 2.16.0
>
>
> *Problem*
> When starting the DefaultCamelContext, Camel tries to get a PropertiesComponent object from JNDI under the name "properties" (which is hard-coded in DefaultCamelContext.lookupPropertiesComponent() resp. CamelContextHelper.lookupPropertiesComponent() in newer Camel versions).
> During start we get the following Error:
> {code}
> org.apache.camel.NoSuchBeanException: Found bean: properties in JNDI Context: javax.naming.InitialContext@a37a18 of type: org.jnp.interfaces.NamingContext expected type was: class org.apache.camel.component.properties.PropertiesComponent
> 	at org.apache.camel.impl.JndiRegistry.lookupByNameAndType(JndiRegistry.java:61)
> 	at org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookupByNameAndType(PropertyPlaceholderDelegateRegistry.java:63)
> 	at org.apache.camel.impl.DefaultCamelContext.lookupPropertiesComponent(DefaultCamelContext.java:2788)
> 	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1834)
> 	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1716)
> 	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
> 	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1684)
> 	at de.bwb.ubi.vs.automat.mbean.CamelStarter.startService(CamelStarter.java:21)
> 	at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
> [...]
> Caused by: java.lang.ClassCastException
> 	at java.lang.Class.cast(Class.java:2999)
> 	at org.apache.camel.impl.JndiRegistry.lookupByNameAndType(JndiRegistry.java:57)
> 	... 145 more
> {code}
> *Reason*
> In our installation, some properties are bound to the name "properties/..." in the JNDI global namespace.
> *Proposed Solution*
> Camel can manage if it finds nothing under the JNDI name, the problem is just finding something different than the expected PropertiesComponent instance. Instead of calling JndiRegistry.lookupByNameAndType(String, Class) -- this is where the cast fails -- we should call JndiRegistry.lookupByName(String name). If an instance other than a PropertiesComponent is returned here, we should go on as if nothing was found in the JNDI lookup.
> I can provide a pull request for this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)