Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Problems starting Equinox Aspects on the command line

Thorsten,

see my comments below ...

Heiko

Am 28.09.2008 um 08:43 schrieb Thorsten Harbig:

Actually I have looked for a way to use AOP in OSGi. I didn't want to do
compile-time-weaving, as that would mean a dependency to AspectJ for
each bundle which is augmented by aspects. So the right solution for me
seemed to be Equinox Aspects.

The right decision ;-)

Therefore I tried the provided example and
it worked just perfect for me - but unfortunately it worked only inside
eclipse.

When I tried to run the example on the command line I didn't succeed.

In order to help you in finding the problem in my set-up, I document
each step. I hope I wrote to the correct mailing list or should I have
created a bug in bugzilla ?

This place is just fine. If we find out that it is a bug we still can create one ...



I use the following bundles:
org.aspectj.runtime_1.6.1.20080703120000
org.aspectj.weaver_1.6.1.20080703120000
org.eclipse.equinox.weaving.aspectj_1.0.0.200809192119.jar
org.eclipse.equinox.weaving.demo.hello
org.eclipse.equinox.weaving.demo.hello.aspects
org.eclipse.equinox.weaving.hook_1.0.0.200809192119.jar
org.eclipse.osgi_3.4.0.v20080605-1900.jar

my config.ini file in the configuration directory looks like the
following:
org.aspectj.weaver.showWeaveInfo=true
osgi.framework.extensions=org.eclipse.equinox.weaving.hook
osgi.bundles=org.aspectj.runtime_1.6.1.20080703120000,
org.aspectj.weaver_1.6.1.20080703120000,
org.eclipse.equinox.weaving.aspectj_1.0.0.200809192119.jar, org.
eclipse.equinox.weaving.hook_1.0.0.200809192119.jar,
org.eclipse.equinox.weaving
.demo.hello, org.eclipse.equinox.weaving.demo.hello.aspects


After starting the the osgi app:
java -jar org.eclipse.osgi_3.4.0.v20080605-1900.jar -console

Looking at this I have got one question: Are the system bundle (org.eclipse.osgi) and the framework extension fragment (org.eclipse.equinox.weaving.hook) colocated, i.e. in the same directory? That is neccessary for Equinox to recognize the framework extension (see http://wiki.eclipse.org/index.php/Adaptor_Hooks for details) => Equinox Aspects will not work if the both bundles are not colocated.



I cann see all the installed bundles:
Framework is launched.

id	State       Bundle
0	ACTIVE      org.eclipse.osgi_3.4.0.v20080605-1900
	            Fragments=1
1	RESOLVED    org.eclipse.equinox.weaving.hook_1.0.0.200809192119
	            Master=0
2	RESOLVED    org.aspectj.runtime_1.6.1.20080703120000
3	RESOLVED    org.aspectj.weaver_1.6.1.20080703120000
4	<<LAZY>>    org.eclipse.equinox.weaving.aspectj_1.0.0.200809192119
5	RESOLVED    org.eclipse.equinox.weaving.demo.hello_1.0.0
6	RESOLVED    org.eclipse.equinox.weaving.demo.hello.aspects_1.0.0


and I try to start the bundle 4 in order to get the weaving working, but
then I get the following exception: (see on the bottom)
Ok it seems like the hook bunde can not be found or at least the classes
(IWeavingService) cannot be found. But the hook is shown as bundle 1
(see above).

Maybe someone of the Equinox Aspect team has an idea what I do wrong and
can help me to run Equinox Aspects on the command line...


org.osgi.framework.BundleException: Exception in
org.eclipse.equinox.weaving.aspectj.WeavingServicePlugin.start() of
bundle org.eclipse.equinox.weaving.aspectj.
	at
org .eclipse .osgi .framework .internal .core.BundleContextImpl.startActivator(BundleContextImpl.java:1028)
	at
org .eclipse .osgi .framework .internal.core.BundleContextImpl.start(BundleContextImpl.java:984)
	at
org .eclipse .osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java: 346)
	at
org .eclipse .osgi .framework.internal.core.AbstractBundle.start(AbstractBundle.java:265)
	at
org .eclipse .osgi .framework.internal.core.AbstractBundle.start(AbstractBundle.java:257)
	at
org .eclipse .osgi .framework .internal .core.FrameworkCommandProvider._start(FrameworkCommandProvider.java: 257)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun .reflect .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at
sun .reflect .DelegatingMethodAccessorImpl .invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at
org .eclipse .osgi .framework .internal .core .FrameworkCommandInterpreter .execute(FrameworkCommandInterpreter.java:150)
	at
org .eclipse .osgi .framework .internal.core.FrameworkConsole.docommand(FrameworkConsole.java:302)
	at
org .eclipse .osgi .framework .internal.core.FrameworkConsole.console(FrameworkConsole.java:287)
	at
org .eclipse .osgi .framework.internal.core.FrameworkConsole.run(FrameworkConsole.java: 223)
	at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.NoClassDefFoundError:
org.eclipse.equinox.service.weaving.IWeavingService
	at
org .eclipse .equinox .weaving .aspectj.WeavingServicePlugin.start(WeavingServicePlugin.java:71)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl
$2.run(BundleContextImpl.java:1009)
	at java.security.AccessController.doPrivileged(Native Method)
	at
org .eclipse .osgi .framework .internal .core.BundleContextImpl.startActivator(BundleContextImpl.java:1003)
	... 14 more
Nested Exception:
java.lang.NoClassDefFoundError:
org.eclipse.equinox.service.weaving.IWeavingService
	at
org .eclipse .equinox .weaving .aspectj.WeavingServicePlugin.start(WeavingServicePlugin.java:71)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl
$2.run(BundleContextImpl.java:1009)
	at java.security.AccessController.doPrivileged(Native Method)
	at
org .eclipse .osgi .framework .internal .core.BundleContextImpl.startActivator(BundleContextImpl.java:1003)
	at
org .eclipse .osgi .framework .internal.core.BundleContextImpl.start(BundleContextImpl.java:984)
	at
org .eclipse .osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java: 346)
	at
org .eclipse .osgi .framework.internal.core.AbstractBundle.start(AbstractBundle.java:265)
	at
org .eclipse .osgi .framework.internal.core.AbstractBundle.start(AbstractBundle.java:257)
	at
org .eclipse .osgi .framework .internal .core.FrameworkCommandProvider._start(FrameworkCommandProvider.java: 257)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun .reflect .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at
sun .reflect .DelegatingMethodAccessorImpl .invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at
org .eclipse .osgi .framework .internal .core .FrameworkCommandInterpreter .execute(FrameworkCommandInterpreter.java:150)
	at
org .eclipse .osgi .framework .internal.core.FrameworkConsole.docommand(FrameworkConsole.java:302)
	at
org .eclipse .osgi .framework .internal.core.FrameworkConsole.console(FrameworkConsole.java:287)
	at
org .eclipse .osgi .framework.internal.core.FrameworkConsole.run(FrameworkConsole.java: 223)
	at java.lang.Thread.run(Thread.java:636)
Nested Exception:
java.lang.NoClassDefFoundError:
org.eclipse.equinox.service.weaving.IWeavingService
	at
org .eclipse .equinox .weaving .aspectj.WeavingServicePlugin.start(WeavingServicePlugin.java:71)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl
$2.run(BundleContextImpl.java:1009)
	at java.security.AccessController.doPrivileged(Native Method)
	at
org .eclipse .osgi .framework .internal .core.BundleContextImpl.startActivator(BundleContextImpl.java:1003)
	at
org .eclipse .osgi .framework .internal.core.BundleContextImpl.start(BundleContextImpl.java:984)
	at
org .eclipse .osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java: 346)
	at
org .eclipse .osgi .framework.internal.core.AbstractBundle.start(AbstractBundle.java:265)
	at
org .eclipse .osgi .framework.internal.core.AbstractBundle.start(AbstractBundle.java:257)
	at
org .eclipse .osgi .framework .internal .core.FrameworkCommandProvider._start(FrameworkCommandProvider.java: 257)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun .reflect .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at
sun .reflect .DelegatingMethodAccessorImpl .invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at
org .eclipse .osgi .framework .internal .core .FrameworkCommandInterpreter .execute(FrameworkCommandInterpreter.java:150)
	at
org .eclipse .osgi .framework .internal.core.FrameworkConsole.docommand(FrameworkConsole.java:302)
	at
org .eclipse .osgi .framework .internal.core.FrameworkConsole.console(FrameworkConsole.java:287)
	at
org .eclipse .osgi .framework.internal.core.FrameworkConsole.run(FrameworkConsole.java: 223)
	at java.lang.Thread.run(Thread.java:636)

osgi>



_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev



Back to the top