문제 설명
OSGI의 AspectJ LoadTimeWeaving (AspectJ LoadTimeWeaving on OSGI)
저는 OSGI에서 춘분 jar(org.aspectj.runtime, org.aspectj.weaver, org.eclipse.equinox.weaving.aspectj의 번들 폴더 및 https://wiki.eclipse.org/Equinox_Weaving_QuickStart
번들의 로드 순서는 다음과 같습니다.
[org.eclipse.equinox.weaving.hook::1 ‑> INSTALLED]
[org.aspectj.runtime::11 ‑> INSTALLED]
[org.aspectj.weaver::12 ‑> INSTALLED]
[org.eclipse.equinox.weaving.aspectj::13 ‑> INSTALLED]
[com.common‑calculations_2.11::19 ‑> INSTALLED] //here I used aspects
[com.instrumentation_2.11::48 ‑> INSTALLED] //here I defined the aspects
Done installing bundles
Starting bundles...
[org.eclipse.equinox.weaving.aspectj::13 ‑> ACTIVE]
[org.aspectj.runtime::11 ‑> ACTIVE]
[org.eclipse.osgi::0 ‑> ACTIVE]
FRAGMENT Bundle ‑ skip starting: org.eclipse.equinox.weaving.hook
FRAGMENT Bundle ‑ skip starting: org.aspectj.runtime
[org.aspectj.weaver::12 ‑> ACTIVE]
FRAGMENT Bundle ‑ skip starting: org.eclipse.equinox.weaving.aspectj
Bundle started: [com.common‑calculations_2.11::19 ‑> ACTIVE]
Bundle started: [com.instrumentation_2.11::48 ‑> ACTIVE]
후크 항아리를 어떻게 시작해야 하는지 알고 싶습니다. 도움을 주시면 감사하겠습니다... ps 누군가 "org.eclipse.osgi" 번들과 "org.eclipse.equinox.weaving.hook" 조각을 "
참조 솔루션
방법 1:
Once I wrote a bigger article on this topic on my blog when I faced the issue at my job for a railroad traffic control application. It still runs with aspects at its core functionality ‑ not just for call tracing, but for automatic resource and transaction handling for JPA and thread safety aspects and so on (so I know the solution still work in real life at my former project):
Self‑contained example code is provided at my github:
https://github.com/prenex/equinox_osgi_skeleton
I also add our email's content here if it might help others:
" Hi!
It was a bit time ago when I worked on the topic but surely it was working well for us and still is part of a plugin‑based railroad traffic control application.
For your problem:
1.) Did you put the equinox.weaving.hook bundle near the core org.eclipse.osgi bundle? There were some not‑so‑clear stuff like this requirement the last time I worked on it that is why I wrote it down in a blog post. 2.) Did you try my example code from the following link?
https://github.com/prenex/equinox_osgi_skeleton
I would first try to run this example project of mine which already contains AspectJ in it and then compare your solution line‑by‑line at relevant places until it start to work.
Look at the following commit to see what I changed in a generic equinox+osgi skeleton project to add simple AspectJ support: https://github.com/prenex/equinox_osgi_skeleton/commit/882d7765f31a3fc8ee136e88b689fce116a73d1c
Best regards, Richard Thier
PS.: How did you stumble upon my blog? I am happy someone actually read it and find it helpful even if it does not completely solve all their problems. :‑) "