-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hystrix javanica aspectj compile time weaving #907
Comments
Have you tried upgrading to maven-aspectj-plugin 1.8 and aspectj 1.8.7? |
yes, we got the same error |
I'll take a look as soon as can |
we tried to extract HystrixCommandAspect and use it at compile time . The final error is: I hope this helps. |
Thanks for help. Will see
|
Could you please provide the client code ? Or it's pretty simple, just one method annotated with the annotation ? |
Hi, a simple test method, annotated with @HystrixCommand, which is called repeatedly: public class TestService {
} |
I found the root cause of problem and started working on it. The problem is evident, ajc transforms byte code of instrument method, thus we can't get method in original state anymore. But there is one trick in ajc that I've used to fix the problem. There is one disadvantage with it 'cause javanica becomes very dependent on certain aspectj version, it means that in a case of any compatibility issues we can't easily increase aspectj version we need to change javanica code also. But this approach looks simple and doesn't require any changes in client api or adding new features to support it. But you need to run java process with the property: |
@tol I've finished working on support for compile time weaving, but haven't created PL yet, because suddenly I recognized that you cannot you use CTW if an aspect is located in jar and this aspect wasn't compiled using ajc, otherwise you'll get MethodNotFoundException: aspectOf(). If you want to use CTW then you need to copy HystrixCacheAspect and HystrixCommandAspect from javanica source code into your project and compile javanica aspects+your source code files using ajc. If you are ok with it then I'll create PL. BTW, why you don't use LTW, it has same performance I guess. LTW helps to solve this problem but requires javaagent. |
@tol Or I can add task to release sep jar with aspects compiled using ajc. @mattrjacobs is it possible to upload/release two jars: hystrix-javanica-x.y.z.jar and hystrix-javanica-ctw.x.y.z.jar ? |
@dmgcodevil Nice work finding the issue. All of the build/deploy pieces are governed by the Gradle script. If you write a PR for a Gradle script change, then I could test that out. I really don't want to add a manual process if it can be avoided. |
@mattrjacobs thanks, I didn't mean do it manually, of cource I'm going to change gradle script. Let me try and I'll encourage you if have some problems with it |
@dmgcodevil Would it not be possible to resolve this issue without requiring another system property, -DweavingMode=compile ? Now, CTW mode is the only intended usage mode hystrix-javanica-ctw-X.Y.Z artifact, right? Then, the implementation may safely assume CTW usage in the *-ctw artifact, without requiring extra system properties. So javanica user chooses weaving mode at build time by introducing dependency on CTW or non-CTW artifact. |
... also asked spring-cloud-netflix (the downstream project) if they can provide an input on the issue and solution implications. |
@pagrus7 I hear you man but javanica,jar and javanica-ctw.jar share the same code base and I don't want to support two versions of code. I mean, to make ctw jar works without property we need to redesign project structure: create javanica-core module and etc. Actually issue has been solved and PL merged. We can eliminate this property but I don't have a bandwidth for that right now. |
@dmgcodevil Hey, for the sake of discussion completeness, what do you think is the ideal, elegant way of dealing with CTW? I mean if you had a bandwidth - or someone else would be interested in contributing? |
@pagrus7 Actually it was not easy to implement that. One inconvenience is extra property but I don't think that is a big problem for now. In the future we can remove but now I'm busy with other hystrix issues. Looks like I'm only one contributor in javanica. |
@mattrjacobs, hi, close it please |
I just released 1.4.20 and the publishing process did not push out the new jar you were working on. I'll investigate. |
Ok, let me know if you will need any help
|
I'm not a Gradle expert, but I think the best way to solve this would be to give I can start doing this, but wanted to check with you @dmgcodevil, to make sure it sounds reasonable to you. |
@mattrjacobs The vibe now is that in this case hystrix-javanica-ctw will have exactly the same code, to avoid that I need to create three modules: hystrix-javanica-core, hystrix-javanica and hystrix-javanica-ctw. It will be ideal. Now I'm working in onservable feature, once I finish it I'll jump on that |
OK, will defer to you. Thanks! |
I'm having the same issue with 1.4.22. |
Hi @raffaelespazzoli, as @mattrjacobs mentioned, there is an issue with gradle release plugin or something that blocks us to release javanica-ctw jar without having separate module, it's my undestanding. I didn't investigate the issue from gradle perspective so I can't tell you ETA. It would be great if can fix the issue by just tweaking release procedure, if not then I'd estimate it up to 5d. @mattrjacobs did you have a chance to investigate the issue with artifact deployment ? |
@dmgcodevil I haven't had any time to make progress on this, so AFAIK it's still in the same state as before. |
Hi, How can I get the hystrix-javanica-ctw?
Can you help me please? |
I never figured out a way to get Gradle to generate and publish this artifact. Any help would be appreciated. |
So, is there any solution to this? The docs for hystrix-javanica still reference using hystrix-javanica-ctw-x.y.z.jar for compile time weaving. Or is there another way to achieve it using the standard jar? |
I am having the similar issue. I am getting below error:
Even though, there should not be any concurrency issue, as i am submitting only one request. So, ideally only one task should be submitted to the threadpool. But somehow, hystrix seems to be spanning out threads for the same task, until the pool gets exhausted, and the last thread just goes to fallback method, due to the above error. Could someone help here ? |
Mine is simple Java application(No Spring) and I am using the configuration as mentioned @https://stackoverflow.com/questions/50994164/hystrixcommandaspect-resulting-into-nosuchmethoderror-in-plain-java-application I am also facing the same issue, appreciate any help. |
I tried with Load Time Weaving, but end up into the same issue. |
could you please create a github repo with a small project that illustrates the issue? |
Where can I find hystrix-javanica-ctw-x.y.z.jar? I cannot see it in https://mvnrepository.com. |
download javanica src and build it, the ctw artifact should be in the target folder, it's generated as a part of regular build process but it's not published |
Hi,
We try to use javanica with compile time weaving.
Our maven configuration is :
At run time we get the following error:
Exception in thread "main" java.lang.NoSuchMethodError: com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect.aspectOf()Lcom/netflix/hystrix/contrib/javanica/aop/aspectj/HystrixCommandAspect;
Is there a way to have javanica aspects applied at compile time?
Thank You
The text was updated successfully, but these errors were encountered: