Ticket #213 (closed defect: fixed)

Opened 2 years ago

Last modified 16 months ago

Aspectj isn't started in Netbinox

Reported by: dumoulin Owned by: dumoulin
Priority: high Milestone: 0.3
Component: ui.graphical Version: 0.3
Severity: blocker Keywords:
Cc: nicolas.dumoulin@…

Description

Recently, aspect have been introduced in the management of jobs queueing, and we have discovered that aspects are not well managed in netbinox environment, so from the IDE.

The problem is that the bundle org.eclipse.equinox.weaving.aspectj has to be started at the begin. So we should find a way to configure that for netbinox.

The property osgi.framework.extensions=org.eclipse.equinox.weaving.hook was missing too (fixed in r2795)

Attachments

messages.log (49.0 kB) - added by dumoulin 21 months ago.
execution log when execution never ends after some assertion errors

Change History

Changed 2 years ago by DefaultCC Plugin

  • cc nicolas.dumoulin@… added

Changed 2 years ago by dumoulin

  • status changed from new to assigned

It seems that this blocking issue will be fixed in Netbinox.

Changed 2 years ago by dumoulin

Jaroslav has sent a fix for the issue in Netbinox about framework extensions.

But an error remains. I've commited a reduced sample, and get this error:

org.osgi.framework.BundleException: A fragment bundle cannot be started: org.eclipse.equinox.weaving.hook_1.0.0.200905261348 [3]
        at org.eclipse.osgi.framework.internal.core.BundleFragment.startWorker(BundleFragment.java:228)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:272)
        at org.netbeans.core.netigso.Netigso.createLoader(Netigso.java:180)
Caused: java.io.IOException: Cannot start /home/dumoulin/Documents/SimExplorer/dev/Netbeans-Equinox/aspectj-test/target/dependency/hook-1.0.0.jar
        at org.netbeans.core.netigso.Netigso.createLoader(Netigso.java:183)
        at org.netbeans.NetigsoModule.start(NetigsoModule.java:107)
        at org.netbeans.NetigsoFramework.delayedInit(NetigsoFramework.java:152)
        at org.netbeans.NetigsoFramework.turnOn(NetigsoFramework.java:135)
        at org.netbeans.ModuleManager.enable(ModuleManager.java:928)
        at org.netbeans.core.startup.ModuleList.installNew(ModuleList.java:315)
        at org.netbeans.core.startup.ModuleList.trigger(ModuleList.java:251)
        at org.netbeans.core.startup.ModuleSystem.restore(ModuleSystem.java:283)
        at org.netbeans.core.startup.Main.getModuleSystem(Main.java:169)
        at org.netbeans.core.startup.Main.start(Main.java:299)
        at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:111)
[catch] at java.lang.Thread.run(Thread.java:619)
INFO [org.simexplorer.netbinox.Installer]: Module started
INFO [org.netbeans.core.startup.NbEvents]: Turning on modules:
        org.openide.util.lookup [8.1 nbms-and-javadoc-4810-on-100206]
        org.openide.util [8.1 nbms-and-javadoc-4810-on-100206]
        org.openide.modules [7.15 nbms-and-javadoc-4810-on-100206]
        org.openide.filesystems [7.35 nbms-and-javadoc-4810-on-100206]
        org.netbeans.bootstrap/1 [2.27 100208-f04952b487d4]
        org.netbeans.core.startup/1 [1.23 nbms-and-javadoc-4810-on-100206]
        org.netbeans.libs.osgi [1.0 nbms-and-javadoc-4810-on-100206]
        org.netbeans.core.netigso [1.2 nbms-and-javadoc-4810-on-100206]
        org.apidesign.netbinox [1.1 100208]
        org.eclipse.equinox.weaving.hook [1.0.0 1.0.0.200905261348]
        org.simexplorer.netbinox [1.0 100209]

But it seems that starting org.eclipse.equinox.weaving.hook from an osgi console gives the same error

java -Dosgi.bundles=file:///home/dumoulin/tmp/osgi/org.eclipse.equinox.weaving.hook_1.0.0.jar,file:///home/dumoulin/tmp/osgi/org.eclipse.equinox.weaving.aspectj_1.0.0.jar,file:///home/dumoulin/tmp/osgi/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar,file:///home/dumoulin/tmp/osgi/com.springsource.org.aspectj.weaver-1.6.6.RELEASE.jar -Dosgi.framework.extensions=org.eclipse.equinox.weaving.hook -jar org.eclipse.osgi_3.5.1.jar -console

osgi> ss

Framework is launched.

id      State       Bundle
0       ACTIVE      org.eclipse.osgi_3.5.1.R35x_v20090827
                    Fragments=1
1       RESOLVED    org.eclipse.equinox.weaving.hook_1.0.0.200905261348
                    Master=0
3       RESOLVED    org.eclipse.equinox.weaving.aspectj_1.0.0.200906171200
4       ACTIVE      com.springsource.org.aspectj.runtime_1.6.6.RELEASE
5       ACTIVE      com.springsource.org.aspectj.weaver_1.6.6.RELEASE

osgi> start 1
org.osgi.framework.BundleException: A fragment bundle cannot be started: org.eclipse.equinox.weaving.hook_1.0.0.200905261348 [1]
        at org.eclipse.osgi.framework.internal.core.BundleFragment.startWorker(BundleFragment.java:228)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:272)
        at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:253)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:155)
        at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:303)
        at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:288)
        at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:224)
        at java.lang.Thread.run(Thread.java:619)

So I should first better understand how it works…

Changed 2 years ago by dumoulin

Well, I've compared with the launch of org.simexplorer.ui.console, and found that this bundles should be started:

  • org.eclipse.equinox.weaving.aspectj
  • org.eclipse.equinox.weaving.caching

They are well defined for autostart in the run.sh script, but are not:

16      RESOLVED    org.eclipse.equinox.weaving.aspectj_1.0.0.200906171200
17      RESOLVED    org.eclipse.equinox.weaving.caching_1.0.0.200807082136

If I start to start them in the console, it fails:

osgi> start 17
[org.aspectj.osgi.service.caching] info starting standard caching service ...
org.osgi.framework.BundleException: Exception in 
org.eclipse.equinox.weaving.internal.caching.Activator.start() of bundle 
org.eclipse.equinox.weaving.caching.
        at 
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806)                                              
[…]
Caused by: java.lang.NoClassDefFoundError: 
org/eclipse/equinox/weaving/internal/caching/SingletonCachingService
[…]
Nested Exception:
java.lang.NoClassDefFoundError: 
org/eclipse/equinox/weaving/internal/caching/SingletonCachingService
[…]
Nested Exception:
java.lang.NoClassDefFoundError: 
org/eclipse/equinox/weaving/internal/caching/SingletonCachingService
[…]

osgi> start 16
[org.eclipse.equinox.weaving.aspectj] info Starting AspectJ weaving service 
...
org.osgi.framework.BundleException: Exception in 
org.eclipse.equinox.weaving.aspectj.AspectJWeavingActivator.start() of bundle 
org.eclipse.equinox.weaving.aspectj.                                                                                                                                                               
        at 
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806)                                                 
[…]
Nested Exception:
java.lang.NoClassDefFoundError: 
org/eclipse/equinox/service/weaving/IWeavingServiceFactory
[…]
Nested Exception:
java.lang.NoClassDefFoundError: 
org/eclipse/equinox/service/weaving/IWeavingServiceFactory
[…]

Changed 2 years ago by dumoulin

org/eclipse/equinox/service/weaving/IWeavingServiceFactory is provided by org.eclipse.equinox.weaving.hook, so it should be a problem with this bundle.

Changed 2 years ago by dumoulin

The both bundles are well started if I remove the property:

     -Dosgi.framework.extensions=org.eclipse.equinox.weaving.hook \

Then I get:

$./run.sh 

osgi> [org.eclipse.equinox.weaving.aspectj] info Starting AspectJ weaving service ...
[org.aspectj.osgi.service.caching] info starting standard caching service ...        
[org.aspectj.osgi.service.caching] Created and registered SingletonCachingService.   
[org.aspectj.osgi.service.caching.j9] warning cannot start J9 caching service        


osgi> ss

Framework is launched.

id      State       Bundle
0       ACTIVE      org.eclipse.osgi_3.5.1.R35x_v20090827
                    Fragments=18
1       <<LAZY>>    org.simexplorer.netbinox.aspect_0.3.0
2       <<LAZY>>    org.simexplorer.netbinox.example_0.3.0
3       RESOLVED    com.springsource.org.aspectj.runtime_1.6.6.RELEASE
4       RESOLVED    com.springsource.org.aspectj.weaver_1.6.6.RELEASE
5       <<LAZY>>    org.eclipse.core.contenttype_3.4.0.v20090429-1800
6       ACTIVE      org.eclipse.core.jobs_3.4.100.v20090429-1800
7       ACTIVE      org.eclipse.core.runtime_3.5.0.v20090525
8       <<LAZY>>    org.eclipse.emf.common_2.5.0.v200906151043
9       <<LAZY>>    org.eclipse.emf.ecore_2.5.0.v200906151043
10      ACTIVE      org.eclipse.equinox.app_1.2.0.v20090520-1800
11      ACTIVE      org.eclipse.equinox.common_3.5.1.R35x_v20090807-1100
12      RESOLVED    org.eclipse.equinox.launcher_1.0.200.v20090520
13      ACTIVE      org.eclipse.equinox.preferences_3.2.300.v20090520-1800
14      ACTIVE      org.eclipse.equinox.registry_3.4.100.v20090520-1800
15      ACTIVE      org.eclipse.equinox.weaving.aspectj_1.0.0.200906171200
16      ACTIVE      org.eclipse.equinox.weaving.caching_1.0.0.200807082136
17      ACTIVE      org.eclipse.equinox.weaving.caching.j9_1.0.0.200807082136
18      RESOLVED    org.eclipse.equinox.weaving.hook_1.0.0.200905261348
                    Master=0

osgi> start 1

osgi> start 2
10 févr. 2010 11:00:00 org.simexplorer.netbinox.example.Activator start
INFO: Module started
10 févr. 2010 11:00:00 org.simexplorer.netbinox.example.MyObject <init>
INFO: Object creation

All looks fine, but the aspect isn't triggered.

Changed 2 years ago by dumoulin

Aspect are well started if I start equinox launcher instead of raw osgi console.

See misc/aspectj-test/clusters/run.sh@2965, it will produce:

 ******** Run with equinox launcher ********
[org.eclipse.equinox.weaving.hook] info adding AspectJ hooks ...
[org.eclipse.equinox.weaving.aspectj] info Starting AspectJ weaving service ...
[org.aspectj.osgi.service.caching] info starting standard caching service ...
[org.aspectj.osgi.service.caching] Created and registered SingletonCachingService.
[org.aspectj.osgi.service.caching.j9] warning cannot start J9 caching service
[org.simexplorer.netbinox.example] info AspectJ Weaver Version 1.6.6 built on Wednesday Sep 30, 2009 at 18:55:14 GMT
[org.simexplorer.netbinox.example] info register aspect org.simexplorer.netbinox.aspect.ObjectConstructedAspect
[org.eclipse.equinox.weaving.aspectj] info weaving bundle 'org.simexplorer.netbinox.example'
10 févr. 2010 11:30:27 org.simexplorer.netbinox.example.Activator start
INFO: Module started
[org.simexplorer.netbinox.example] weaveinfo Join point 'constructor-execution(void org.simexplorer.netbinox.example.MyObject.<init>())' in Type 'org.simexplorer.netbinox.example.MyObject' (MyObject.java:9) advised by after advice from 'org.simexplorer.netbinox.aspect.ObjectConstructedAspect' (ObjectConstructedAspect.aj:7)
10 févr. 2010 11:30:27 org.simexplorer.netbinox.example.MyObject <init>
INFO: Object creation
10 févr. 2010 11:30:27 org.simexplorer.netbinox.aspect.ObjectConstructedAspect ajc$after$org_simexplorer_netbinox_aspect_ObjectConstructedAspect$1$70ce0fd
INFO: Aspect triggered at object created
[org.aspectj.osgi.service.caching] Shut down and unregistered SingletonCachingService.

 ******** Run with equinox osgi console ********

osgi> [org.eclipse.equinox.weaving.aspectj] info Starting AspectJ weaving service ...
[org.aspectj.osgi.service.caching] info starting standard caching service ...
[org.aspectj.osgi.service.caching.j9] warning cannot start J9 caching service

Changed 2 years ago by dumoulin

Bug report submitted at eclipse: https://bugs.eclipse.org/bugs/show_bug.cgi?id=302429

Changed 2 years ago by dumoulin

Ok, solution given on eclipse bugtracker for launching with osgi console. Commited in r2979

Changed 23 months ago by dumoulin

Changed 23 months ago by dumoulin

Aspectj is working on our sample application! Now, we need to integrate the solution in trunk …

Changed 21 months ago by dumoulin

  • priority changed from normal to high

Hmm, I've tried the solution proposed by Jaroslav and patched equinox, and I thought to have solved the problem, but it doesn't! Indeed, I'm not sure where remains the problem:

  • is the aspectj weaving hook loaded in the good ClassLoader?
  • is the apsectj weaving hook module rightly configured in my netbinox modules suite?

Another solution to get a temporary fix would be to try to weave at the compilation time needed modules. See this articles:

Changed 21 months ago by dumoulin

I've made some tests with last solution, and it seems better! I have modified modules org.openmole.core.workflow.implementation and org.openmole.core.batchservicecontrol in order to weave artifact with org.openmole.misc.eventdispatcher aspects, and ui-console is now working without equinox weaving hook. So I've tried in netbinox, and I can successfully run a mole, but some other bugs still remain …

SEVERE [org.openmole.core.workflow.implementation.execution.local.LocalExecuter]
java.lang.AssertionError
        at org.openmole.core.workflow.implementation.mole.SubMoleExecution.checkAllJobsWaitingInGroup(SubMoleExecution.java:72)
        at org.openmole.core.workflow.implementation.mole.SubMoleExecution.decNbJobInProgress(SubMoleExecution.java:84)
        at org.openmole.core.workflow.implementation.mole.MoleExecution.jobOutputTransitionsPerformed(MoleExecution.java:288)
        at org.openmole.core.workflow.implementation.mole.MoleExecution$MoleExecutionAdapterForMoleJob.objectChanged(MoleExecution.java:74)
        at org.openmole.core.workflow.implementation.mole.MoleExecution$MoleExecutionAdapterForMoleJob.objectChanged(MoleExecution.java:1)
        at org.openmole.misc.eventdispatcher.internal.EventDispatcher.objectChanged(EventDispatcher.java:110)
        at org.openmole.misc.eventdispatcher.EventAspect.ajc$after$org_openmole_misc_eventdispatcher_EventAspect$1$78fd885d(EventAspect.aj:22)
        at org.openmole.core.workflow.implementation.job.MoleJob.setState(MoleJob.java:96)
        at org.openmole.core.workflow.implementation.capsule.GenericTaskCapsule.jobFinished(GenericTaskCapsule.java:181)
        at org.openmole.core.workflow.implementation.capsule.GenericTaskCapsule$GenericTaskCapsuleAdapter.objectChanged(GenericTaskCapsule.java:58)
        at org.openmole.core.workflow.implementation.capsule.GenericTaskCapsule$GenericTaskCapsuleAdapter.objectChanged(GenericTaskCapsule.java:1)
        at org.openmole.misc.eventdispatcher.internal.EventDispatcher.objectChanged(EventDispatcher.java:110)
        at org.openmole.misc.eventdispatcher.EventAspect.ajc$after$org_openmole_misc_eventdispatcher_EventAspect$1$78fd885d(EventAspect.aj:22)
        at org.openmole.core.workflow.implementation.job.MoleJob.setState(MoleJob.java:96)
        at org.openmole.core.workflow.implementation.job.MoleJob.finished(MoleJob.java:137)
        at org.openmole.core.workflow.implementation.execution.local.LocalExecuter.run(LocalExecuter.java:73)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

If it is OK, I will integrate modification in trunk…

Changed 21 months ago by dumoulin

Actually, It doesn't work. In the openmole ui console, if I start equinox without the property osgi.framework.extensions=org.eclipse.equinox.weaving.hook, the execution doesn't end correctly for the hello world workflow, and displays nothing for a basic exploration as given in the tutorial.

So, it means that in the current configuration, modules are not correctly woven.

Changed 21 months ago by dumoulin

execution log when execution never ends after some assertion errors

Changed 21 months ago by dumoulin

Well, I've restored (but not commited) the weaveDependencies options removed in r3592, and it seems that without this option, modules are not woven.

So I've made a new test with a reduced sample and I confirm that a workflow can be ran with netbinox, but get still the AssertionErrors and the execution never ends, see log file.

You can checkout this test here, then run mvn package in the openmole-cluster/ directory. Im other words:

svn co http://svn.simexplorer.org/SimExplorer/misc/openmole-netbinox
cd openmole-netbinox/openmole-cluster/
mvn package
cd ..
ant clean run

Changed 19 months ago by dumoulin

  • status changed from assigned to closed
  • resolution set to fixed

Ok, the assertion was wrong. The mole is well executed by disabling assertions run.args.extra=-J-da in platform.properties.

Changed 16 months ago by anonymous

Note: See TracTickets for help on using tickets.

logo cemagref

logo iscpif

logo lifegrid

logo region auvergne

logo patres project