camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-8500) ClassCastException when something other than PropertiesComponent is bound to "properties" JNDI name
Date Wed, 18 Mar 2015 06:43:38 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-8500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14366729#comment-14366729
] 

Claus Ibsen commented on CAMEL-8500:
------------------------------------

We love contributions, so you are welcome to work on a patch.
http://camel.apache.org/contributing.html

> 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
>             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)

Mime
View raw message