You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Mike Spoonauer <ms...@tradecard.com> on 2011/12/02 04:41:37 UTC

How can I use XPath in my OSGi bundle?

I am working on a bundle in which I want to use XPath.  I'm using Java 1.6, so I don't need Xalan or Xerces or anything like that.  The JDK 1.6 comes with default implementations for all of the major XML APIs.

When I attempt, though, to call XPathFactory.newInstance() within my OSGi bundle, it fails with the following exception stack trace:

java.lang.ClassNotFoundException: com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl
[INFO] [talledLocalContainer]   at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:772)
[INFO] [talledLocalContainer]   at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
[INFO] [talledLocalContainer]   at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1690)
[INFO] [talledLocalContainer]   at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[INFO] [talledLocalContainer]   at org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:634)
[INFO] [talledLocalContainer]   at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1594)
[INFO] [talledLocalContainer]   at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:887)
[INFO] [talledLocalContainer]   at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)

What is the appropriate means by which to tell the BundleDelegatingClassloader to find com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl in rt.jar?

Thanks,
Mike

Michael Spoonauer
Enterprise Systems Management Engineer
TradeCard, Inc.
M: (617) 233-7959 | E: mspoonauer@tradecard.com<ma...@tradecard.com>

Connect. Transact. Profit.(r)
Find out more at www.tradecard.com<http://www.tradecard.com/>

[cid:image001.jpg@01CCB077.115917B0]<http://twitter.com/TradeCard>  [cid:image002.jpg@01CCB077.115917B0] <http://www.linkedin.com/company/tradecard>   [cid:image003.jpg@01CCB077.115917B0] <https://www.facebook.com/TradeCard>


Re: How can I use XPath in my OSGi bundle?

Posted by Rob Walker <ro...@ascert.com>.
We handcraft our manifests (actually use mangen, but we wrote it, so 
it's sort of handcrafted). Also we use Ant not maven. But haven't ever 
had a case where a classloader picked a wrong version in our usage model.

- Rob

On 02/12/2011 7:05 PM, Mike Spoonauer wrote:
> Have you ever run into anything like that before, where the classloader seems to ignore that you said to use version Y of a dependency instead of version X?
>

-- 


Ascert - Taking systems to the Edge
robw@ascert.com
+27 87 550 1701
www.ascert.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


RE: How can I use XPath in my OSGi bundle?

Posted by Mike Spoonauer <ms...@tradecard.com>.
Rob,

Thanks for the response.  I found that, for JIRA, if you set the following property, you can access Sun's internal implementations of JAXP classes:

<plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>3.4</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${jira.version}</productVersion>
                    <productDataVersion>${jira.data.version}</productDataVersion>
                    <log4jProperties>src/main/resources/log4j.properties</log4jProperties> <!-- configure our own logging -->
                     <systemProperties>
                        <property>
                            <name>atlassian.org.osgi.framework.bootdelegation</name>
                            <value>sun.*,com.sun.*</value>
                        </property>
                    </systemProperties>
                </configuration>
            </plugin>

I tested in code that the above system property was not set until I set it in my plugin's pom.xml file.

The alternative that I tried was to download and install the Xalan 2.7.1 OSGi bundle and all of its dependencies into the Felix Web Management console, and to update my plugin's pom.xml to set Xalan 2.7.1 as a dependency, but it didn't seem to matter.  JAXP always went for the Xalan 2.7.0 JAR that's within the JIRA Web application's lib folder, even if I explicitly excluded it from the "atlassian-jira" dependency, and Eclipse's Dependency Hierarchy view showed that it was excluded.

Have you ever run into anything like that before, where the classloader seems to ignore that you said to use version Y of a dependency instead of version X?

Thanks,
Mike

-----Original Message-----
From: Rob Walker [mailto:robw@ascert.com] 
Sent: Friday, December 02, 2011 8:51 AM
To: users@felix.apache.org
Subject: Re: How can I use XPath in my OSGi bundle?

Mike

Not sure I can help there much I'm afraid - we use Felix in an entirely embedded environment, so I haven't used Web Console much, nor Atlassian.

In theory, I think most properties set in Felix config should end up accessible to Bundles via BundleContext.getProperty(), but of course you'll need some code to call that to dump out the values.

-- Rob

On 02/12/2011 3:22 PM, Mike Spoonauer wrote:
> Rob,
>
> Thanks for the response.  How can I tell what that property has been set to within the container and is there any way that I can control it?  I am actually attempting to deploy a plugin I'm developing to a local installation of Atlassian's JIRA product.  If it helps at all, I do have access to the Felix Web Console.
>
> Thanks again for your time.
>
> -Mike
>
> -----Original Message-----
> From: Rob Walker [mailto:robw@ascert.com]
> Sent: Friday, December 02, 2011 12:48 AM
> To: users@felix.apache.org
> Subject: Re: How can I use XPath in my OSGi bundle?
>
> Not sure if it's the exact same scenario, but all our configs have:
>
> org.osgi.framework.bootdelegation = sun.*,com.sun.*
>
> Xpath works fine
>
> -- Rob
>
> On 02/12/2011 5:41 AM, Mike Spoonauer wrote:
>> I am working on a bundle in which I want to use XPath.  I'm using 
>> Java 1.6, so I don't need Xalan or Xerces or anything like that.  The 
>> JDK
>> 1.6 comes with default implementations for all of the major XML APIs.
>>
>> When I attempt, though, to call XPathFactory.newInstance() within my 
>> OSGi bundle, it fails with the following exception stack trace:
>>
>> java.lang.ClassNotFoundException:
>> com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl
>>
>> [INFO] [talledLocalContainer]   at
>> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation
>> (
>> ModuleImpl.java:772)
>>
>> [INFO] [talledLocalContainer]   at
>> org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
>>
>> [INFO] [talledLocalContainer]   at
>> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(Mod
>> u
>> leImpl.java:1690)
>>
>> [INFO] [talledLocalContainer]   at
>> java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>
>> [INFO] [talledLocalContainer]   at
>> org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.
>> java:634)
>>
>> [INFO] [talledLocalContainer]   at
>> org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1594)
>>
>> [INFO] [talledLocalContainer]   at
>> org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:887)
>>
>> [INFO] [talledLocalContainer]   at
>> org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(B
>> u
>> ndleDelegatingClassLoader.java:99)
>>
>> What is the appropriate means by which to tell the 
>> BundleDelegatingClassloader to find 
>> com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl in rt.jar?
>>
>> Thanks,
>>
>> Mike
>>
>> Michael Spoonauer
>> Enterprise Systems Management Engineer TradeCard, Inc.
>>
>> M: (617) 233-7959 | E: mspoonauer@tradecard.com 
>> <ma...@tradecard.com>
>>
>> Connect. Transact. Profit.(r)
>>
>> Find out more at www.tradecard.com<http://www.tradecard.com/>
>>
>> Description: Description: Description:
>> cid:image001.jpg@01CC47B3.295F20C0
>> <http://twitter.com/TradeCard>Description: Description: Description:
>> cid:image002.jpg@01CC47B3.295F20C0
>> <http://www.linkedin.com/company/tradecard>Description: Description:
>> Description: cid:image003.jpg@01CC47B3.295F20C0
>> <https://www.facebook.com/TradeCard>
>>

-- 


Ascert - Taking systems to the Edge
robw@ascert.com
+27 87 550 1701
www.ascert.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org



Re: How can I use XPath in my OSGi bundle?

Posted by Rob Walker <ro...@ascert.com>.
Mike

Not sure I can help there much I'm afraid - we use Felix in an entirely 
embedded environment, so I haven't used Web Console much, nor Atlassian.

In theory, I think most properties set in Felix config should end up 
accessible to Bundles via BundleContext.getProperty(), but of course 
you'll need some code to call that to dump out the values.

-- Rob

On 02/12/2011 3:22 PM, Mike Spoonauer wrote:
> Rob,
>
> Thanks for the response.  How can I tell what that property has been set to within the container and is there any way that I can control it?  I am actually attempting to deploy a plugin I'm developing to a local installation of Atlassian's JIRA product.  If it helps at all, I do have access to the Felix Web Console.
>
> Thanks again for your time.
>
> -Mike
>
> -----Original Message-----
> From: Rob Walker [mailto:robw@ascert.com]
> Sent: Friday, December 02, 2011 12:48 AM
> To: users@felix.apache.org
> Subject: Re: How can I use XPath in my OSGi bundle?
>
> Not sure if it's the exact same scenario, but all our configs have:
>
> org.osgi.framework.bootdelegation = sun.*,com.sun.*
>
> Xpath works fine
>
> -- Rob
>
> On 02/12/2011 5:41 AM, Mike Spoonauer wrote:
>> I am working on a bundle in which I want to use XPath.  I'm using Java
>> 1.6, so I don't need Xalan or Xerces or anything like that.  The JDK
>> 1.6 comes with default implementations for all of the major XML APIs.
>>
>> When I attempt, though, to call XPathFactory.newInstance() within my
>> OSGi bundle, it fails with the following exception stack trace:
>>
>> java.lang.ClassNotFoundException:
>> com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl
>>
>> [INFO] [talledLocalContainer]   at
>> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(
>> ModuleImpl.java:772)
>>
>> [INFO] [talledLocalContainer]   at
>> org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
>>
>> [INFO] [talledLocalContainer]   at
>> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(Modu
>> leImpl.java:1690)
>>
>> [INFO] [talledLocalContainer]   at
>> java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>
>> [INFO] [talledLocalContainer]   at
>> org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.
>> java:634)
>>
>> [INFO] [talledLocalContainer]   at
>> org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1594)
>>
>> [INFO] [talledLocalContainer]   at
>> org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:887)
>>
>> [INFO] [talledLocalContainer]   at
>> org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(Bu
>> ndleDelegatingClassLoader.java:99)
>>
>> What is the appropriate means by which to tell the
>> BundleDelegatingClassloader to find
>> com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl in rt.jar?
>>
>> Thanks,
>>
>> Mike
>>
>> Michael Spoonauer
>> Enterprise Systems Management Engineer TradeCard, Inc.
>>
>> M: (617) 233-7959 | E: mspoonauer@tradecard.com
>> <ma...@tradecard.com>
>>
>> Connect. Transact. Profit.(r)
>>
>> Find out more at www.tradecard.com<http://www.tradecard.com/>
>>
>> Description: Description: Description:
>> cid:image001.jpg@01CC47B3.295F20C0
>> <http://twitter.com/TradeCard>Description: Description: Description:
>> cid:image002.jpg@01CC47B3.295F20C0
>> <http://www.linkedin.com/company/tradecard>Description: Description:
>> Description: cid:image003.jpg@01CC47B3.295F20C0
>> <https://www.facebook.com/TradeCard>
>>

-- 


Ascert - Taking systems to the Edge
robw@ascert.com
+27 87 550 1701
www.ascert.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


RE: How can I use XPath in my OSGi bundle?

Posted by Mike Spoonauer <ms...@tradecard.com>.
Rob,

Thanks for the response.  How can I tell what that property has been set to within the container and is there any way that I can control it?  I am actually attempting to deploy a plugin I'm developing to a local installation of Atlassian's JIRA product.  If it helps at all, I do have access to the Felix Web Console.

Thanks again for your time.

-Mike

-----Original Message-----
From: Rob Walker [mailto:robw@ascert.com] 
Sent: Friday, December 02, 2011 12:48 AM
To: users@felix.apache.org
Subject: Re: How can I use XPath in my OSGi bundle?

Not sure if it's the exact same scenario, but all our configs have:

org.osgi.framework.bootdelegation = sun.*,com.sun.*

Xpath works fine

-- Rob

On 02/12/2011 5:41 AM, Mike Spoonauer wrote:
>
> I am working on a bundle in which I want to use XPath.  I'm using Java 
> 1.6, so I don't need Xalan or Xerces or anything like that.  The JDK
> 1.6 comes with default implementations for all of the major XML APIs.
>
> When I attempt, though, to call XPathFactory.newInstance() within my 
> OSGi bundle, it fails with the following exception stack trace:
>
> java.lang.ClassNotFoundException: 
> com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl
>
> [INFO] [talledLocalContainer]   at 
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(
> ModuleImpl.java:772)
>
> [INFO] [talledLocalContainer]   at 
> org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
>
> [INFO] [talledLocalContainer]   at 
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(Modu
> leImpl.java:1690)
>
> [INFO] [talledLocalContainer]   at 
> java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>
> [INFO] [talledLocalContainer]   at 
> org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.
> java:634)
>
> [INFO] [talledLocalContainer]   at 
> org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1594)
>
> [INFO] [talledLocalContainer]   at 
> org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:887)
>
> [INFO] [talledLocalContainer]   at 
> org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(Bu
> ndleDelegatingClassLoader.java:99)
>
> What is the appropriate means by which to tell the 
> BundleDelegatingClassloader to find 
> com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl in rt.jar?
>
> Thanks,
>
> Mike
>
> Michael Spoonauer
> Enterprise Systems Management Engineer TradeCard, Inc.
>
> M: (617) 233-7959 | E: mspoonauer@tradecard.com 
> <ma...@tradecard.com>
>
> Connect. Transact. Profit.(r)
>
> Find out more at www.tradecard.com <http://www.tradecard.com/>
>
> Description: Description: Description: 
> cid:image001.jpg@01CC47B3.295F20C0
> <http://twitter.com/TradeCard>Description: Description: Description: 
> cid:image002.jpg@01CC47B3.295F20C0
> <http://www.linkedin.com/company/tradecard>Description: Description: 
> Description: cid:image003.jpg@01CC47B3.295F20C0
> <https://www.facebook.com/TradeCard>
>

-- 


Ascert - Taking systems to the Edge
robw@ascert.com
+27 87 550 1701
www.ascert.com


Re: How can I use XPath in my OSGi bundle?

Posted by Rob Walker <ro...@ascert.com>.
Not sure if it's the exact same scenario, but all our configs have:

org.osgi.framework.bootdelegation = sun.*,com.sun.*

Xpath works fine

-- Rob

On 02/12/2011 5:41 AM, Mike Spoonauer wrote:
>
> I am working on a bundle in which I want to use XPath.  I'm using Java 
> 1.6, so I don't need Xalan or Xerces or anything like that.  The JDK 
> 1.6 comes with default implementations for all of the major XML APIs.
>
> When I attempt, though, to call XPathFactory.newInstance() within my 
> OSGi bundle, it fails with the following exception stack trace:
>
> java.lang.ClassNotFoundException: 
> com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl
>
> [INFO] [talledLocalContainer]   at 
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:772)
>
> [INFO] [talledLocalContainer]   at 
> org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
>
> [INFO] [talledLocalContainer]   at 
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1690)
>
> [INFO] [talledLocalContainer]   at 
> java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>
> [INFO] [talledLocalContainer]   at 
> org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:634)
>
> [INFO] [talledLocalContainer]   at 
> org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1594)
>
> [INFO] [talledLocalContainer]   at 
> org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:887)
>
> [INFO] [talledLocalContainer]   at 
> org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)
>
> What is the appropriate means by which to tell the 
> BundleDelegatingClassloader to find 
> com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl in rt.jar?
>
> Thanks,
>
> Mike
>
> Michael Spoonauer
> Enterprise Systems Management Engineer
> TradeCard, Inc.
>
> M: (617) 233-7959 | E: mspoonauer@tradecard.com 
> <ma...@tradecard.com>
>
> Connect. Transact. Profit.®
>
> Find out more at www.tradecard.com <http://www.tradecard.com/>
>
> Description: Description: Description: 
> cid:image001.jpg@01CC47B3.295F20C0 
> <http://twitter.com/TradeCard>Description: Description: Description: 
> cid:image002.jpg@01CC47B3.295F20C0 
> <http://www.linkedin.com/company/tradecard>Description: Description: 
> Description: cid:image003.jpg@01CC47B3.295F20C0 
> <https://www.facebook.com/TradeCard>
>

-- 


Ascert - Taking systems to the Edge
robw@ascert.com
+27 87 550 1701
www.ascert.com