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 F37E399A2 for ; Mon, 11 Jun 2012 18:46:42 +0000 (UTC) Received: (qmail 64904 invoked by uid 500); 11 Jun 2012 18:46:42 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 64874 invoked by uid 500); 11 Jun 2012 18:46:42 -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 64865 invoked by uid 99); 11 Jun 2012 18:46:42 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jun 2012 18:46:42 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id AE51D14002F for ; Mon, 11 Jun 2012 18:46:42 +0000 (UTC) Date: Mon, 11 Jun 2012 18:46:42 +0000 (UTC) From: "jacob vandergoot (JIRA)" To: issues@camel.apache.org Message-ID: <1243696908.3623.1339440402716.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Created] (CAMEL-5358) camel-castor does not work in apache service mix modules MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 jacob vandergoot created CAMEL-5358: --------------------------------------- Summary: camel-castor does not work in apache service mix modules Key: CAMEL-5358 URL: https://issues.apache.org/jira/browse/CAMEL-5358 Project: Camel Issue Type: Bug Components: osgi Affects Versions: 2.9.2, 2.8.5 Environment: Apache Service Mix: MacOS, Linux, Windows Reporter: jacob vandergoot Fix For: 2.8.6, 2.9.3 Sorry for putting this in the wrong component but I did not see a camel-castor component. By default, the castor org.exolab.castor.mapping.Mapping will use the class's class loader to resolve java classes declared in the castor mapping XML file. However when the CastorDataFormat is used an a service mix OSGi module, the class loader the contains the Java classes is not the same as the class loader that loads the Mapping object. Therefore it cannot load the mapping file because the Java classes cannot be resolved. Instead the constructor that takes Classloader as an argument should be called when initializing the mapping object. The classloader it should use is the same classloader used to resolve the castor mapping XML file. The following change in AbstractCastorDataFormat seemed to resolve the problem. public XMLContext getXmlContext(ClassResolver resolver) throws Exception { if (xmlContext == null) { xmlContext = new XMLContext(); if (ObjectHelper.isNotEmpty(getMappingFile())) { Mapping xmlMap = new Mapping( Thread.currentThread().getContextClassLoader()); xmlMap.loadMapping(resolver.loadResourceAsURL(getMappingFile())); xmlContext.addMapping(xmlMap); } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira