Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 07:33 Go to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
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 10:38 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
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 12:54 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
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 13:23 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
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 13:47 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
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 18:12 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
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] Mon, 29 October 2007 02:59 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
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 12:44 Go to previous message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
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: Tue Oct 23 21:15:35 GMT 2018

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

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

Back to the top