Skip to main content



      Home
Home » Eclipse Projects » Equinox » Question on starting Equinox from Java Application
Question on starting Equinox from Java Application [message #100312] Thu, 25 October 2007 03:33 Go to next message
Eclipse UserFriend
Hi all,

I've followed tutorial
http://www.eclipsezone.com/eclipse/forums/t93976.rhtml to enable me to
start Equinox programmatically (Thanks Alex). I have the following
questions :

1. One of my bundles (Jetty) needs a parameter that tells it to open at
the specified port. When I launch Equinox from Eclipse I only have to put
"-Dorg.osgi.service.http.port=8080" at the VM arguments section. How do I
pass the parameter through code ?
2. One of my bundles actually points to an Eclipse plugin project that's
not jarred yet. Since installBundle method apparently expects url that
points to jar files, how do I tell Equinox to install this bundle ?
3. Since starting this Equinox takes place on startup method of a TestCase
class, do I have to call each bundle's stop method on teardown method or
is just calling EclipseStarter.shutdown enough ?

Any help would be greatly appreciated.

Best Regards,

Setya
Re: Question on starting Equinox from Java Application [message #100327 is a reply to message #100312] Thu, 25 October 2007 06:38 Go to previous messageGo to next message
Eclipse UserFriend
Hi all,

> 2. One of my bundles actually points to an Eclipse plugin project that's
> not jarred yet. Since installBundle method apparently expects url that
> points to jar files, how do I tell Equinox to install this bundle ?

For question #2 I've tried the following code:

bundle = context.installBundle("reference:file:<path to my project>")

but then it throws ClassNotFoundException exception stating that it can
not find my activator class.

Any ideas ?

Regards,

Setya
Re: Question on starting Equinox from Java Application [message #100375 is a reply to message #100327] Fri, 26 October 2007 08:54 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

> bundle = context.installBundle("reference:file:<path to my project>")

> but then it throws ClassNotFoundException exception stating that it can
> not find my activator class.

Well, anybody ?

Regards,

Setya
Re: Question on starting Equinox from Java Application [message #100385 is a reply to message #100375] Fri, 26 October 2007 09:23 Go to previous messageGo to next message
Eclipse UserFriend
That would indicate that it installed correctly and found the Manifest fine
but it couldn't find your Activator's class.
I'd check your bundle classpath and double check the location of your class
files.
The other possibility is that you're getting a misleading CNF exception
because a dependency of your Activator is not being found. In that case I
would attach a debugger.

HTH
-Simon

"Setya" <jsetya@gmail.com> wrote in message
news:2211f170fe62382ea2aafdeb596a1916$1@www.eclipse.org...
> Hi,
>
>> bundle = context.installBundle("reference:file:<path to my project>")
>
>> but then it throws ClassNotFoundException exception stating that it can
>> not find my activator class.
>
> Well, anybody ?
>
> Regards,
>
> Setya
>
Re: Question on starting Equinox from Java Application [message #100411 is a reply to message #100385] Fri, 26 October 2007 09:47 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Thanks for your response.

> That would indicate that it installed correctly and found the Manifest fine
> but it couldn't find your Activator's class.
> I'd check your bundle classpath and double check the location of your class
> files.

This is weird, I have no problem running it from PDE and all dependencies
are satisfied.

> The other possibility is that you're getting a misleading CNF exception
> because a dependency of your Activator is not being found. In that case I
> would attach a debugger.

From the stacktrace it's clearly trying to load my bundle activator and
failed.

org.osgi.framework.BundleException: The activator
com.farbeyond.core.rap.CorePlugin for bundle com.farbeyond.core is invalid
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.load BundleActivator(AbstractBundle.java:141)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:962)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:317)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:256)
at com.farbeyond.core.test.TestCore.startTest(TestCore.java:83)
Caused by: java.lang.ClassNotFoundException:
com.farbeyond.core.rap.CorePlugin
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:402)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:347)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.loadCl ass(BundleLoader.java:278)
at
org.eclipse.osgi.framework.internal.core.BundleHost.loadClas s(BundleHost.java:227)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.load BundleActivator(AbstractBundle.java:134)
... 26 more
... Removed 22 stack frames


Any ideas ?

Regards,

Setya
Re: Question on starting Equinox from Java Application [message #100424 is a reply to message #100411] Fri, 26 October 2007 14:12 Go to previous messageGo to next message
Eclipse UserFriend
Hmm... if I had to guess.
Did you export your bundle?
When you run under PDE /bin is automagically added to your bundle-classpath.

HTH
-Simon


"Setya" <jsetya@gmail.com> wrote in message
news:19c3542aef947b127da8e07fc295d1ed$1@www.eclipse.org...
> Hi,
>
> Thanks for your response.
>
>> That would indicate that it installed correctly and found the Manifest
>> fine but it couldn't find your Activator's class.
>> I'd check your bundle classpath and double check the location of your
>> class files.
>
> This is weird, I have no problem running it from PDE and all dependencies
> are satisfied.
>
>> The other possibility is that you're getting a misleading CNF exception
>> because a dependency of your Activator is not being found. In that case I
>> would attach a debugger.
>
> From the stacktrace it's clearly trying to load my bundle activator and
> failed.
>
> org.osgi.framework.BundleException: The activator
> com.farbeyond.core.rap.CorePlugin for bundle com.farbeyond.core is invalid
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.load BundleActivator(AbstractBundle.java:141)
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:962)
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:317)
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:256)
> at com.farbeyond.core.test.TestCore.startTest(TestCore.java:83)
> Caused by: java.lang.ClassNotFoundException:
> com.farbeyond.core.rap.CorePlugin
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:402)
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:347)
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.loadCl ass(BundleLoader.java:278)
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.loadClas s(BundleHost.java:227)
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.load BundleActivator(AbstractBundle.java:134)
> ... 26 more
> .. Removed 22 stack frames
>
>
> Any ideas ?
>
> Regards,
>
> Setya
>
Re: Question on starting Equinox from Java Application [message #100484 is a reply to message #100424] Sun, 28 October 2007 22:59 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

> Hmm... if I had to guess.
> Did you export your bundle?
> When you run under PDE /bin is automagically added to your bundle-classpath.

Yes, you guess right.
After I add 'Bundle-ClassPath: bin/' in the MANIFEST.MF through PDE it
works as expected.

Thank you very much for your help.

Regards,

Setya
Re: Question on starting Equinox from Java Application [message #100622 is a reply to message #100484] Tue, 30 October 2007 08:44 Go to previous message
Eclipse UserFriend
Hi,

> After I add 'Bundle-ClassPath: bin/' in the MANIFEST.MF through PDE it
> works as expected.

I want to go deeper here. How to do above programmatically ?

Regards,

Setya
Previous Topic:OSGI-server/JSP integration : missing org.eclipse.equinox.http.helper bundle
Next Topic:basic jetty configuration question
Goto Forum:
  


Current Time: Thu Jul 17 01:44:40 EDT 2025

Powered by FUDForum. Page generated in 0.10609 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top