You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Stephan Burkard <sb...@gmail.com> on 2013/12/12 15:48:52 UTC

Use JRE-Package com.sun.script.javascript in OSGi-Bundle

Hi Felix users

I have an embedded JAR in my bundle that has a dependency to the package
"com.sun.script.javascript" from rt.jar.

How can I "activate" and use the classes from this package in my OSGi
bundle since this package is not available in the system bundle?

Thanks for any help
stephan

Re: Use JRE-Package com.sun.script.javascript in OSGi-Bundle

Posted by Stephan Burkard <sb...@gmail.com>.
Hi Neil

We use the maven-bundle-plugin that uses bnd. The class-not-found happend
in a bundle that was running fine before my change to custom.properties
(very strange).
However, after recreating the servicemix-instance, the exposing of the
package as you suggested worked fine.

I have posted the strange Class-Not-Found case to the servicemix-users-list
- just to understand if it is normal or not :-)

Thanks a lot
Stephan


On Thu, Dec 12, 2013 at 5:37 PM, Neil Bartlett <nj...@gmail.com> wrote:

> ClassNotFoundExceptions (and/or NoClassDefFoundErrors) are usually the
> result of failing to declare a package in your bundle's Import-Package
> statement.
>
> If you use a tool like bnd, or one of the many tools based on bnd, then the
> Import-Package statement will be automatically generated by static analysis
> of all the dependencies in your code.
>
> Regards
> Neil
>
>
> On Thu, Dec 12, 2013 at 4:29 PM, Stephan Burkard <sb...@gmail.com>
> wrote:
>
> > Thanks a lot for the very fast answers!
> >
> > I am trying Neils approach, but have now a class-not-found problem in a
> > completely different bundle ... need to check that out first ...
> >
> > Regards
> > Stephan
> >
> >
> >
> > On Thu, Dec 12, 2013 at 4:32 PM, Neil Bartlett <nj...@gmail.com>
> > wrote:
> >
> > > Set the framework property "org.osgi.framework.system.packages.extra"
> to
> > > the (list of) additional package(s) that you wish to export from the
> > system
> > > bundle.
> > >
> > > --
> > > Neil Bartlett
> > > Sent from a phone
> > >
> > >
> > > On Thursday, 12 December 2013 at 14:54, Robert Munteanu wrote:
> > >
> > > > Hi Stephan,
> > > >
> > > > On Thu, 2013-12-12 at 15:48 +0100, Stephan Burkard wrote:
> > > > Hi Felix users
> > > > >
> > > > > I have an embedded JAR in my bundle that has a dependency to the
> > > package
> > > > > "com.sun.script.javascript" from rt.jar.
> > > > >
> > > > > How can I "activate" and use the classes from this package in my
> OSGi
> > > > > bundle since this package is not available in the system bundle?
> > > > >
> > > > > Thanks for any help
> > > > > stephan
> > > > >
> > > >
> > > > Most straightforward way would be to create a fragment for the system
> > > > bundle which exports the com.sun.script.javascript.
> > > >
> > > > One Maven-based example for javax.activation can be found at [1]
> > > >
> > > > Cheers,
> > > >
> > > > Robert
> > > >
> > > > [1]:
> > >
> >
> http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/framework-extension-activation/
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > > > For additional commands, e-mail: users-help@felix.apache.org
> > > >
> > > >
> > >
> > >
> > >
> >
>

Re: Use JRE-Package com.sun.script.javascript in OSGi-Bundle

Posted by Neil Bartlett <nj...@gmail.com>.
ClassNotFoundExceptions (and/or NoClassDefFoundErrors) are usually the
result of failing to declare a package in your bundle's Import-Package
statement.

If you use a tool like bnd, or one of the many tools based on bnd, then the
Import-Package statement will be automatically generated by static analysis
of all the dependencies in your code.

Regards
Neil


On Thu, Dec 12, 2013 at 4:29 PM, Stephan Burkard <sb...@gmail.com> wrote:

> Thanks a lot for the very fast answers!
>
> I am trying Neils approach, but have now a class-not-found problem in a
> completely different bundle ... need to check that out first ...
>
> Regards
> Stephan
>
>
>
> On Thu, Dec 12, 2013 at 4:32 PM, Neil Bartlett <nj...@gmail.com>
> wrote:
>
> > Set the framework property "org.osgi.framework.system.packages.extra" to
> > the (list of) additional package(s) that you wish to export from the
> system
> > bundle.
> >
> > --
> > Neil Bartlett
> > Sent from a phone
> >
> >
> > On Thursday, 12 December 2013 at 14:54, Robert Munteanu wrote:
> >
> > > Hi Stephan,
> > >
> > > On Thu, 2013-12-12 at 15:48 +0100, Stephan Burkard wrote:
> > > Hi Felix users
> > > >
> > > > I have an embedded JAR in my bundle that has a dependency to the
> > package
> > > > "com.sun.script.javascript" from rt.jar.
> > > >
> > > > How can I "activate" and use the classes from this package in my OSGi
> > > > bundle since this package is not available in the system bundle?
> > > >
> > > > Thanks for any help
> > > > stephan
> > > >
> > >
> > > Most straightforward way would be to create a fragment for the system
> > > bundle which exports the com.sun.script.javascript.
> > >
> > > One Maven-based example for javax.activation can be found at [1]
> > >
> > > Cheers,
> > >
> > > Robert
> > >
> > > [1]:
> >
> http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/framework-extension-activation/
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > > For additional commands, e-mail: users-help@felix.apache.org
> > >
> > >
> >
> >
> >
>

Re: Use JRE-Package com.sun.script.javascript in OSGi-Bundle

Posted by Stephan Burkard <sb...@gmail.com>.
Thanks a lot for the very fast answers!

I am trying Neils approach, but have now a class-not-found problem in a
completely different bundle ... need to check that out first ...

Regards
Stephan



On Thu, Dec 12, 2013 at 4:32 PM, Neil Bartlett <nj...@gmail.com> wrote:

> Set the framework property "org.osgi.framework.system.packages.extra" to
> the (list of) additional package(s) that you wish to export from the system
> bundle.
>
> --
> Neil Bartlett
> Sent from a phone
>
>
> On Thursday, 12 December 2013 at 14:54, Robert Munteanu wrote:
>
> > Hi Stephan,
> >
> > On Thu, 2013-12-12 at 15:48 +0100, Stephan Burkard wrote:
> > Hi Felix users
> > >
> > > I have an embedded JAR in my bundle that has a dependency to the
> package
> > > "com.sun.script.javascript" from rt.jar.
> > >
> > > How can I "activate" and use the classes from this package in my OSGi
> > > bundle since this package is not available in the system bundle?
> > >
> > > Thanks for any help
> > > stephan
> > >
> >
> > Most straightforward way would be to create a fragment for the system
> > bundle which exports the com.sun.script.javascript.
> >
> > One Maven-based example for javax.activation can be found at [1]
> >
> > Cheers,
> >
> > Robert
> >
> > [1]:
> http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/framework-extension-activation/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
>
>
>

Re: Use JRE-Package com.sun.script.javascript in OSGi-Bundle

Posted by Neil Bartlett <nj...@gmail.com>.
Set the framework property "org.osgi.framework.system.packages.extra" to the (list of) additional package(s) that you wish to export from the system bundle.  

-- 
Neil Bartlett
Sent from a phone


On Thursday, 12 December 2013 at 14:54, Robert Munteanu wrote:

> Hi Stephan,
> 
> On Thu, 2013-12-12 at 15:48 +0100, Stephan Burkard wrote:
> Hi Felix users
> > 
> > I have an embedded JAR in my bundle that has a dependency to the package
> > "com.sun.script.javascript" from rt.jar.
> > 
> > How can I "activate" and use the classes from this package in my OSGi
> > bundle since this package is not available in the system bundle?
> > 
> > Thanks for any help
> > stephan
> > 
> 
> Most straightforward way would be to create a fragment for the system
> bundle which exports the com.sun.script.javascript.
> 
> One Maven-based example for javax.activation can be found at [1]
> 
> Cheers,
> 
> Robert
> 
> [1]: http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/framework-extension-activation/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 



Re: Use JRE-Package com.sun.script.javascript in OSGi-Bundle

Posted by Robert Munteanu <ro...@lmn.ro>.
Hi Stephan,

On Thu, 2013-12-12 at 15:48 +0100, Stephan Burkard wrote:
Hi Felix users
>
> I have an embedded JAR in my bundle that has a dependency to the package
> "com.sun.script.javascript" from rt.jar.
>
> How can I "activate" and use the classes from this package in my OSGi
> bundle since this package is not available in the system bundle?
>
> Thanks for any help
> stephan
>
Most straightforward way would be to create a fragment for the system
bundle which exports the com.sun.script.javascript.

One Maven-based example for javax.activation can be found at [1]

Cheers,

Robert

[1]: http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/framework-extension-activation/

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