Note that there are some explanatory texts on larger screens.

plurals
  1. POFelix doesn't like javax.script
    primarykey
    data
    text
    <p>I'm writing an OSGI bundle using the javax.script package and am having some issues getting Felix to load the package correctly. When attempting to start the bundle, I'm getting:</p> <p>Failed bundle start for org.plugin.script.plugin-scripter [2]: org.osgi.framework.BundleException: Unresolved constraint in bundle 2: package; (package=javax.script)</p> <p>which I think happens when we try to reference a package which isn't correctly loaded into the bundle. I'm fairly certain this is down to the fact that javax.script is only bundled into the JDK starting 1.6 and for some reason Maven is building using something else. So far I've:</p> <p>a. Set the necessary import in my Maven POM for Felix by:</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.apache.felix&lt;/groupId&gt; &lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt; &lt;extensions&gt;true&lt;/extensions&gt; &lt;configuration&gt; &lt;instructions&gt; &lt;Export-Package&gt;org.plugin.script&lt;/Export-Package&gt; &lt;Private-Package&gt;org.plugin.script.*&lt;/Private-Package&gt; &lt;Bundle-Activator&gt;org.plugin.script.ScripterPlugin&lt;/Bundle-Activator&gt; &lt;Import-Package&gt;!*,javax.script,org.osgi.framework;version="1.3.0",javax.naming,javax.naming.spi&lt;/Import-Package&gt; &lt;Embed-Dependency&gt;!org.apache.felix*;scope=compile|runtime;inline=false&lt;/Embed-Dependency&gt; &lt;Embed-Transitive&gt;true&lt;/Embed-Transitive&gt; &lt;Embed-Directory&gt;dependency&lt;/Embed-Directory&gt; &lt;Embed-StripGroup&gt;true&lt;/Embed-StripGroup&gt; &lt;_failok&gt;true&lt;/_failok&gt; &lt;/instructions&gt; &lt;/configuration&gt; &lt;/plugin&gt; </code></pre> <p>b. Set the Maven compiler to 1.6 since that's the earliest we get javax.script</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;2.0.2&lt;/version&gt; &lt;configuration&gt; &lt;source&gt;1.6&lt;/source&gt; &lt;target&gt;1.6&lt;/target&gt; &lt;/configuration&gt; &lt;/plugin&gt; </code></pre> <p>c. Not even sure if this makes a difference but I set Felix's framework properties (in their config.properties) to 1.6.0 and included the javax.script export. TBH I'm not sure about this one but figured I'd take a shot.</p> <pre><code>org.osgi.framework.system.packages=org.osgi.framework; version=1.3.0, \ [lots of stuff in between] javax.script; \ version="1.6.0" </code></pre> <p>Still nadda tho. What else did I miss ?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload