[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Equinox aspects: Several problems for Load-Time-Weaving in a eclipse product!

Hi Jens!

I am sure we can get your setting to work well with equinox aspects. Firstofall, I see that you are using an old version of equinox aspects. You should definitely download and use M3 of equinox aspects, this is much more stable, especially in the case of dynamics.

Your config.ini looks good, I would just add a start level of 4 to the o.e.e.weaving.aspectj bundle. You definitely don't need to start your system with the osgi.clean option=true. The latest versions of equinox aspects work with and without cleaning the configuration area.

If you would like to use dynamics for aspects, the best way to go is to install and uninstall aspect bundles. Every time an aspect bundle is installed and got resolved, the aspect is woven into the system, including a refresh of already running bundles. Telling you that you need to know that some Eclipse bundles do not behave well within an dynamic environment. For example refreshing swt or the workbench at runtime does not work. So if you would like to dynamically install and uninstall aspects you should take care that the effected bundles behave nicely within a dynamic environment.

HTH,
-Martin


Jens Goldhammer wrote:
Hello,

I have downloaded the equinox aspectj extension and integrated into eclipse
how it is mentioned in the user guide.
The hello world aspectj example works great for me. I can dynamically start
and stop the aspectj service and the classes seam to be reloading at
run-time.

I have zipped the folders org.aspectj.runtime_1.6.1.20080703120000 and
org.aspectj.weaver_1.6.1.20080703120000 (project
org.eclipse.equinox.weaving.demo.target) from the example to two jar files
and copied it to the eclipse plugins directory. I reloaded the target
platform, so the plugins are considered.


After playing with some examples, I tried to integrate aspects into our
eclipse product which is based on 3.4.1. I have created a config.ini
(modified the prebaked config.ini of eclipse export mechanism) which looks
like this one:

# default start level for the bundles
osgi.bundles.defaultStartLevel=4

osgi.bundles=org.eclipse.equinox.common@2\:start,
org.eclipse.update.configurator@3\:start, org.eclipse.core.runtime@start,
org.eclipse.equinox.weaving.aspectj@start,
org.eclipse.equinox.weaving.caching.j9@start,
org.eclipse.equinox.weaving.caching@2\:start, com.ibm.icu, [our bundles],
org.apache.log4j,org.aspectj.runtime,org.aspectj.weaver,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.databinding,org.eclipse.core.expressions,org.eclipse.core.jobs,org.eclipse.core.runtime.compatibility.auth,org.eclipse.equinox.app,org.eclipse.equinox.event,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.equinox.weaving.aspectj,org.eclipse.equinox.weaving.caching,org.eclipse.equinox.weaving.caching.j9,org.eclipse.equinox.weaving.hook,org.eclipse.help,org.eclipse.jface,org.eclipse.jface.databinding,org.eclipse.osgi.services,org.eclipse.swt,org.eclipse.swt.win32.win32.x86,org.eclipse.ui,org.eclipse.ui.workbench,org.junit,org.eclipse.equinox.launcher,org.eclipse.equinox.launcher.win32.win32.x86

#osgi.configuration.cascaded=false
osgi.clean=true

# AOSGi
osgi.framework.extensions=org.eclipse.equinox.weaving.hook
aj.weaving.verbose=true
org.aspectj.weaver.showWeaveInfo=true
org.aspectj.osgi.debug=true

After configuring it there are two problems:

1. If I start the product configuration via eclipse, I can see following in
the osgi console after running ss:
4 <<LAZY>>    org.eclipse.equinox.weaving.aspectj_1.0.0.200808061839
5 <<LAZY>>    org.eclipse.equinox.weaving.caching.j9_1.0.0.200808061839

The two bundles for aspectj are not active after starting the osgi platform.
I donÂt know why! Something prevents loading the aspectj bundles. My
presumption is that the required bundles
org.aspectj.runtime_1.6.1.20080703120000.jar and
org.aspectj.weaver_1.6.1.20080703120000.jar are loaded to late from the
org.eclipse.update.configurator which loads all bundles from the plugins
directory. Or anyboday think there is another problem?

After starting the two bundles manually with start [bundle-ids], my trace
aspect which traces method calls is working for this session. But how I can
deactivate it during runtime? I made a stop for the bundle 4
(org.eclipse.equinox.weaving.aspectj_1.0.0.200808061839) and the main
Activator of our application will be stopped!!! I thought I can dynamically
start and stop the aspect bundle?

Another approach was to stop the bundle with the compiled aspect inside. But
it does not work, too. The tracing still is working. I think, the aspect is
cached... Can I prevent this?

2. I made a shutdown of the ogsi plattform and there are two different
situations.

2.1 If I restart the product WITHOUT the parameter osgi.clean=true, the
needed bundles are started:

4 ACTIVE      org.eclipse.equinox.weaving.aspectj_1.0.0.200808061839
5 ACTIVE      org.eclipse.equinox.weaving.caching.j9_1.0.0.200808061839
6 ACTIVE      org.eclipse.equinox.weaving.caching_1.0.0.200808061839

My bundle with the aspect is also active. But I get severeal messages on
console which are like this one: "Info no configuration found. Disabling
weaver for bundler [...]".
I think, the aspect in one of my bundles cannot be found. At all, the trace
aspect does not work!

2.2 If I restart the product WITH the parameter osgi.clean=true, I have the
same situation as mentioned under point 1! The required bundles are not
loaded...

What does it mean to me? I have always to start the osgi platform with
osgi.clean=true, so in this case I cannot have the advantage of osgi
caching. At all, we cannot rely on the equinox aspects. Maybe somebody can
help me to fix the problem.

Thanks,
Jens Goldhammer
fme AG