[
https://issues.apache.org/activemq/browse/CAMEL-577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43490#action_43490
]
Claus Ibsen commented on CAMEL-577:
-----------------------------------
Guillaume, thanks for reporting this.
What would be a good strategy to resolve this?
A quick idea is having a new OsgiResolverUtil class that ResolverUtil could
resort to if it should load in bundle?
Since Camel detects if it should try bundle without having hard dependecy this
is doable:
{code}
Method mth = loader.getClass().getMethod("getBundle", new Class[]
{});
if (mth != null) {
// it's osgi bundle class loader, so we need to load
implementation in bundles
if (LOG.isDebugEnabled()) {
LOG.debug("Loading from osgi buindle using classloader: " +
loader);
}
loadImplementationsInBundle(test, packageName, loader, mth);
return;
}
{code}
The loadImplementationsInBundle could be in the new OsgiResolverUtil so its
only loaded if using OSGi bundles. And thus the class loading issue should not
happend.
And we could catch the NoClassDefFoundError and output a user firendly message
that org.osgi.core should be an dependency.
And how do we configure it to be optional in the camel-core pom.xml? Currently
it is:
{code}
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<version>${felix-osgi-version}</version>
</dependency>
{code}
Could we add
<optional>true</optional>
BTW: The activation stuff is now also a hard dependency - i haven't seen this
in pom.xml
> ResolverUtil can't resolve class under osgi enviroment
> ------------------------------------------------------
>
> Key: CAMEL-577
> URL: https://issues.apache.org/activemq/browse/CAMEL-577
> Project: Apache Camel
> Issue Type: Improvement
> Components: camel-core
> Affects Versions: 1.3.0
> Reporter: Freeman Fang
> Fix For: 1.4.0
>
> Attachments: CAMEL-577.patch
>
>
> in method of
> protected void find(Test test, String packageName, ClassLoader loader)
> it try to load class from directory or jar, it works for standalone mode.
> But if the classloader of the method is osgi bundle class loader, it will
> fail since the getResource(packgename) return neither directory nor jar
> for example, package name is org/apache/camel/convert, then what returned is
> /org/apache/camel/convert, so both loadImplementationsInDirectory and
> loadImplementationsInJar doesn't work in this case
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.