jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.55k stars 4.02k forks source link

Atmosphere can't scan its annotations when packaged into an executable WAR file #471

Closed wollodev closed 10 years ago

wollodev commented 10 years ago

I get following error when I build a jar from a new jhipster project with atmosphere 2.1.0 and postgresql: "URI is not hierarchical"

After updated Atmosphere to 2.2.0 I get following error: "java.lang.AssertionError: Not a File:"

I tested this setting in https://github.com/AndreasKl/springboot-angular-atmosphere-quickstart and it worked fine.

Full error Log here:

Atmosphere 2.1.0

[ERROR] org.atmosphere.cpr.AtmosphereFramework - java.lang.IllegalArgumentException: URI is not hierarchical at java.io.File.(File.java:418) ~[na:1.7.0_60-ea] at org.atmosphere.util.annotation.AnnotationDetector.toFile(AnnotationDetector.java:420) ~[atmosphere-runtime-2.1.0.jar!/:2.1.0] at org.atmosphere.util.annotation.AnnotationDetector.detect(AnnotationDetector.java:330) ~[atmosphere-runtime-2.1.0.jar!/:2.1.0] at org.atmosphere.cpr.DefaultAnnotationProcessor.scanForAnnotation(DefaultAnnotationProcessor.java:147) ~[atmosphere-runtime-2.1.0.jar!/:2.1.0] at org.atmosphere.cpr.DefaultAnnotationProcessor.configure(DefaultAnnotationProcessor.java:133) ~[atmosphere-runtime-2.1.0.jar!/:2.1.0] at org.atmosphere.cpr.AtmosphereFramework.autoConfigureService(AtmosphereFramework.java:2260) [atmosphere-runtime-2.1.0.jar!/:2.1.0] at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:707) [atmosphere-runtime-2.1.0.jar!/:2.1.0] at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:614) [atmosphere-runtime-2.1.0.jar!/:2.1.0] at org.atmosphere.cpr.AtmosphereServlet.configureFramework(AtmosphereServlet.java:91) [atmosphere-runtime-2.1.0.jar!/:2.1.0] at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:80) [atmosphere-runtime-2.1.0.jar!/:2.1.0] at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) [tomcat-embed-core-7.0.54.jar!/:7.0.54] at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1090) [tomcat-embed-core-7.0.54.jar!/:7.0.54] at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210) [tomcat-embed-core-7.0.54.jar!/:7.0.54] at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedContext.deferredLoadOnStartup(TomcatEmbeddedContext.java:52) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.startConnector(TomcatEmbeddedServletContainer.java:185) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:152) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:376) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:143) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485) [spring-context-4.0.6.RELEASE.jar!/:4.0.6.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at com.mycompany.myapp.Application.main(Application.java:59) [classes!/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_60-ea] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_60-ea] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_60-ea] at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_60-ea] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53) [jhipster-0.1-SNAPSHOT.war!/:na] at java.lang.Thread.run(Thread.java:744) [na:1.7.0_60-ea]


With Atmosphere 2.2.0

[ERROR] org.atmosphere.cpr.AtmosphereFramework - java.lang.AssertionError: Not a File: file:/Users/swam/Desktop/jhipster-test1/target/jhipster-0.1-SNAPSHOT.war!/WEB-INF/lib/atmosphere-runtime-2.2.0.jar at org.atmosphere.util.annotation.AnnotationDetector.detect(AnnotationDetector.java:363) ~[atmosphere-runtime-2.2.0.jar!/:2.2.0] at org.atmosphere.cpr.DefaultAnnotationProcessor.scanForAnnotation(DefaultAnnotationProcessor.java:153) ~[atmosphere-runtime-2.2.0.jar!/:2.2.0] at org.atmosphere.cpr.DefaultAnnotationProcessor.configure(DefaultAnnotationProcessor.java:139) ~[atmosphere-runtime-2.2.0.jar!/:2.2.0] at org.atmosphere.cpr.AtmosphereFramework.autoConfigureService(AtmosphereFramework.java:2534) [atmosphere-runtime-2.2.0.jar!/:2.2.0] at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:861) [atmosphere-runtime-2.2.0.jar!/:2.2.0] at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:765) [atmosphere-runtime-2.2.0.jar!/:2.2.0] at org.atmosphere.cpr.AtmosphereServlet.configureFramework(AtmosphereServlet.java:101) [atmosphere-runtime-2.2.0.jar!/:2.2.0] at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:80) [atmosphere-runtime-2.2.0.jar!/:2.2.0] at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) [tomcat-embed-core-7.0.54.jar!/:7.0.54] at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1090) [tomcat-embed-core-7.0.54.jar!/:7.0.54] at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210) [tomcat-embed-core-7.0.54.jar!/:7.0.54] at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedContext.deferredLoadOnStartup(TomcatEmbeddedContext.java:52) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.startConnector(TomcatEmbeddedServletContainer.java:185) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:152) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:376) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:143) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485) [spring-context-4.0.6.RELEASE.jar!/:4.0.6.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) [spring-boot-1.1.4.RELEASE.jar!/:1.1.4.RELEASE] at com.mycompany.myapp.Application.main(Application.java:59) [classes!/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_60-ea] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_60-ea] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_60-ea] at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_60-ea] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53) [jhipster-0.1-SNAPSHOT.war!/:na] at java.lang.Thread.run(Thread.java:744) [na:1.7.0_60-ea]

jmirc commented 10 years ago

Sorry for our late answer. We will check the project and fix it.

jdubois commented 10 years ago

I've got some other Atmosphere 2.2.0 issues: the message length tracking seems broken (I get a "not a number" error). As we don't do anything modifying or configuring this part, this looks like an Atmosphere issue -> at the moment, let's stick to 2.1.0

Concerning the executable WAR file, that's not the first time I see this, there's this stackoverflow question on this subject: http://stackoverflow.com/questions/24117886/jhipster-executable-war-not-executable-in-combination-with-atmosphere

-> this solution used to work, but obviously it doesn't work anymore (I just tested it). The way Atmosphere scans packages makes it fail when inside a JAR file, it makes me wonder how they do it (and why the hell didn't they use what is provided by Spring, it works perfectly well)

jfarcand commented 10 years ago

@jdubois (1) Atmosphere cannoy use Spring to scan classes and I don't want to have a dependency on Spring :-) But when Tomcat 8 is used, the annotated classes comes from the Servlet 3.0 Specification. This is where I need to see what's happening. Note that all Atmosphere's sample works without any issue in Tomcat 8. (2) Have you updated atmosphere.js when upgrading to Atmosphere 2.2.0? You must use atmosphere-javascript 2.2.3+

jdubois commented 10 years ago

@jfarcand I'd love to use atmosphere-javascript 2.2.3+ but it's not available on Bower, latest version is 2.2.2...

jfarcand commented 10 years ago

@flowersinthesand, can you release 2.2.3/4 on bower once you have a chance. Thanks!

flowersinthesand commented 10 years ago

@jdubois, @jfarcand done. atmosphere 2.2.3, 2.2.4, jquery-atmosphere 2.2.3, 2.2.4 are released.

jfarcand commented 10 years ago

Thanks @flowersinthesand !!!

jdubois commented 10 years ago

Thanks @flowersinthesand

@jfarcand I still get the same "not a number" error, so I'm not upgrading, I've got already enough issues at the moment...

Here is the detail:

Uncaught Error: message length "b6d7278c-1498-467e-b7fd-90bb92fae4c9" is not a number atmosphere.js:1595_trackMessageSize atmosphere.js:1595_executeWebSocket._websocket.onmessage

jfarcand commented 10 years ago

@jdubois You have a misconfiguration somewhere as it seems trackMessageLength is enabled client side, but not server side. Previous version worked the same way, so not sure where is your issue.

jfarcand commented 10 years ago

@jdubois BTW the Spring Boot/Tomcat issue will need to be reported to them as I just added a workaround, but this is a serious issue IMO.

jdubois commented 10 years ago

@jfarcand done upgrading to Atmosphere 2.2.0: https://github.com/jhipster/generator-jhipster/commit/f849a805913ea697cba32de77fc51987704966b3

jfarcand commented 10 years ago

@jdubois FYI I'm holding the Atmosphere 2.2.2 release until we are sure the migration work fine with jhipster. It could be a good idea to create a project / unit test and run it using a CI. I can take care of updating Atmosphere there and track regression.

jdubois commented 10 years ago

@jfarcand I agree it would be great, but it's hard to test: we need to generate the WAR file, run it, and have a look at the logs...

jfarcand commented 10 years ago

@jdubois OK then everytime I do a 2.x release I will try to remember to test jhipster. 2.x.x should be less dangerous

jdubois commented 10 years ago

@jfarcand yes I confirm this is resolved. Can you also atmosphere-spring to the same version as atmosphere-runtime?

jfarcand commented 10 years ago

@jdubois Both project are independent, hence their release cycle is not the same. Thanks