Skip to content

Commit

Permalink
CAMEL-4231: Fixed camel not being able to run in Apache ServiceMix, d…
Browse files Browse the repository at this point in the history
…ue osgi and type converter loading issue. Thanks to Freeman for the patch.

git-svn-id: https://svn.apache.org/repos/asf/camel/trunk@1147021 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
davsclaus committed Jul 15, 2011
1 parent bfccf08 commit b4d43c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Expand Up @@ -383,7 +383,7 @@ protected TypeConverter doLookup(Class<?> toType, Class<?> fromType, boolean isS
/**
* Loads the core type converters which is mandatory to use Camel
*/
protected void loadCoreTypeConverters() throws Exception {
public void loadCoreTypeConverters() throws Exception {
int before = typeMappings.size();

// load all the type converters from camel-core
Expand Down
Expand Up @@ -147,6 +147,14 @@ public Set<ClassLoader> getClassLoaders() {
}
}, injector, factoryFinder);

try {
// only load the core type converters, as osgi activator will keep track on bundles
// being installed/uninstalled and load type converters as part of that process
answer.loadCoreTypeConverters();
} catch (Exception e) {
throw new RuntimeCamelException("Error loading CoreTypeConverter due: " + e.getMessage(), e);
}

// load the type converters the tracker has been tracking
Object[] services = this.tracker.getServices();
if (services != null) {
Expand All @@ -159,12 +167,6 @@ public Set<ClassLoader> getClassLoaders() {
}
}

try {
ServiceHelper.startService(answer);
} catch (Exception e) {
throw new RuntimeCamelException("Error staring OSGiTypeConverter due: " + e.getMessage(), e);
}

LOG.trace("Created TypeConverter: {}", answer);
return answer;
}
Expand Down

0 comments on commit b4d43c2

Please sign in to comment.