-
-
Notifications
You must be signed in to change notification settings - Fork 749
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
[Spring Boot] Atmosphere can't scan its annotations when packaged into an executable WAR file #1706
Comments
Salut Julien, I reproduced the issue. I deploy under tomcat 8 so atmosphere relies on Servlet 3 support to detect annotation. But when atmosphere selects the implementation at this step and then calls configure, the underlying implementation does nothing. @jfarcand do you know why? Maybe I'm checking in the wrong place. |
@gdrouet I need to debug but I suspect the classes aren't at the normal location, e.g not under WEB-INF/classes or WEB-INF/lib. |
Changed the title as all Atmosphere's sample works fine, without any issue with Tomcat 8.0.x |
Hum no. The classes are located under WEB-INF/classes Actually the WAR seems well packaged. What really differs from samples is that no web.xm exists. |
Then the issue is |
@gdrouet no, the error (as seen in jhipster/generator-jhipster#471 ) is a " java.lang.IllegalArgumentException: URI is not hierarchical" @jfarcand no, this is configured in Java, in the "WebConfigurer" class we do: You can find below a sample generated project. The whole code is there (it's a Maven project, easy to open!), and in the target/ directory you have the executable WAR file (run it with java -jar *.war): |
@jdubois Is this a regression or that new code? I'm curious to isolate it that's a regression. My blindly guess is the classloading is different. Anyway will take a look as soon as I can next week. Merci! |
It seems the |
As I updated to the latest version of Spring Boot, and that Spring Boot provides Tomcat, it is highly possible that this new version of Tomcat causes the bug. |
@jdubois Atmosphere works with the latest Tomcat version. I do vote on every Tomcat release (like the new 8.0.12) :-)...the issue is when the embedded API is used. I'm investigating solution right now, but first I try with Atmosphere 2.1.8 and your code. More to come... |
So to recap, Atmosphere fallback to use it's own Annotation scanner but fail with the exception above. The scanner normally assume it runs on an exploded war (most server does that or properly configure the classloader based on that fact), hence fails miserably. I'm trying to see if I can fix that but keep in mind the real issue is Tomcat/Spring Boot. Not sure yet which one is causing issue, but I suspect Spring Boot :-) |
OK found a workaround, will be available in 2.1.9, 2.2.1 + . @jdubois Can you test with 2.1.9-SNAPSHOT to make sure all functionalities are working? Now annotations are scanned, but I suspect other issue may arise because of the failure to process the META/services. |
Great, thanks @jfarcand ! |
@jdubois have you had the time to test it out yet? Planning to release 2.1.9 as soon as possible. |
@slovdahl no... I'm currently trying to, but found a bunch of other issues... Hopefully I will do it tomorrow. Don't wait for me! |
@jdubois If you can share the workspace/sample you are working on, I can take a look ASAP. You shoudn't have so many issues. |
@jfarcand I won't be able to do it until tomorrow... If you have time, just generate a JHipster project with the "atmosphere" option |
@jdubois Any progress on this yet? Aiming for a release on monday the 22th of September. |
@jfarcand here is my sample project: https://www.dropbox.com/s/widhpbtogf5f7rl/jhipster-sample-app-atmosphere.tar.gz?dl=0 You can run it with "mvn spring-boot:run" or package it with "mvn package". And run the generated WAR file with "java -jar file.war". |
@slovdahl yes, see my above comment. I've also commited my code if you want to test and have a look: jhipster/generator-jhipster@f849a80 |
This comes from this ticket in JHipster:
jhipster/generator-jhipster#471
Atmosphere runs fine when we do a "mvn spring-boot:run", but if we package it into an executable WAR file with Spring Boot, even if we use the "requireUnpack" trick (see http://stackoverflow.com/questions/24117886/jhipster-executable-war-not-executable-in-combination-with-atmosphere ), it cannot scan its annotations, and hence fails at startup.
It's easy to reproduce: create a project with JHipster, selecting the Atmosphere option (of course!), and then do a "mvn package". Then try to execute the generated executable WAR file.
The text was updated successfully, but these errors were encountered: