Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 73CDA17A34 for ; Wed, 18 Mar 2015 06:43:39 +0000 (UTC) Received: (qmail 82176 invoked by uid 500); 18 Mar 2015 06:43:39 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 82144 invoked by uid 500); 18 Mar 2015 06:43:39 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 82135 invoked by uid 99); 18 Mar 2015 06:43:39 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Mar 2015 06:43:39 +0000 Date: Wed, 18 Mar 2015 06:43:39 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CAMEL-8500) ClassCastException when something other than PropertiesComponent is bound to "properties" JNDI name MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-8500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Claus Ibsen updated CAMEL-8500: ------------------------------- Fix Version/s: 2.16.0 2.15.1 2.14.3 > 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)