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.27k stars 4k forks source link

[FEATURE] Consider using Undertow again #2948

Closed jdubois closed 8 years ago

jdubois commented 8 years ago

Very interesting discussion here on StackOverflow, the comments are worth reading.

Concerning our microservices approach, there is more to add:

wdroste commented 8 years ago

My group has been using JHipster for the last year and created 3 applications on it, using Undertow w/o WebSockets. The Gzip support is not important to us since we always place Nginx in front of the application.

In all the applications we removed all profiles except for dev and prod. It would be nice if part of the generation you could optionally choose the other spring profiles.

deepu105 commented 8 years ago

@wdroste may be you can help @rksanket here https://github.com/jhipster/generator-jhipster/issues/2939

wdroste commented 8 years ago

@deepu105 it looks like the stackoverflow has a checkmark on the solution, are you referring to helping the JH 3.0 release?

deepu105 commented 8 years ago

You are welcome for that as well On 24 Feb 2016 01:19, "Will Droste" notifications@github.com wrote:

@deepu105 https://github.com/deepu105 it looks like the stackoverflow has a checkmark on the solution, are you referring to helping the JH 3.0 release?

— Reply to this email directly or view it on GitHub https://github.com/jhipster/generator-jhipster/issues/2948#issuecomment-187798243 .

jdubois commented 8 years ago

I confirm GZip and Websockets work with Undertow! This is looking very good!

jdubois commented 8 years ago

And my performance tests are excellent, let's do this :-)

deepu105 commented 8 years ago

@jhipster/developers when using gradle build with new undertow change Imseeing below error in console

@jdubois here is my yo-rc

{
  "generator-jhipster": {
    "jhipsterVersion": "2.27.0",
    "baseName": "testApp",
    "packageName": "com.mycompany.myapp",
    "packageFolder": "com/mycompany/myapp",
    "authenticationType": "session",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": "no",
    "websocket": "spring-websocket",
    "databaseType": "sql",
    "devDatabaseType": "h2Memory",
    "prodDatabaseType": "mysql",
    "searchEngine": "elasticsearch",
    "buildTool": "gradle",
    "enableSocialSignIn": false,
    "rememberMeKey": "516b241406f1d15f6f1aa15b67dae78012e804fa",
    "useSass": true,
    "applicationType": "monolith",
    "testFrameworks": [
      "gatling",
      "protractor"
    ],
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en",
      "zh-cn",
      "fr"
    ]
  }
}
2016-03-02 14:54:44.059 ERROR 9156 --- [ XNIO-2 task-23] io.undertow.request                      : UT005023: Exception handling request to /websocket/tracker/675/5sxmjvaq/websocket

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.web.socket.sockjs.SockJsException: Uncaught failure in SockJS request, uri=http://localhost:8080/websocket/tracker/675/5sxmjvaq/websocket; nested exception is org.springframework.web.socket.sockjs.SockJsTransportFailureException: WebSocket handshake failure; nested exception is java.lang.ClassCastException: io.undertow.websockets.jsr.ServerWebSocketContainer cannot be cast to org.apache.tomcat.websocket.server.WsServerContainer
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:980)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:859)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
        at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:104)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:237)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:92)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:112)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:157)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at com.mycompany.myapp.web.filter.CsrfCookieGeneratorFilter.doFilterInternal(CsrfCookieGeneratorFilter.java:34)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:96)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.webt.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
        at org.springframework.web.filter.OncePerRequestFilteter(OncePerRequestFilter.java:107)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
        at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
        at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
        at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
        at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
        at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
        at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
        at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
        at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.server.handldicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:119)
        at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
        at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
        at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
        at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
        at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.web.socket.sockjs.SockJsException: Uncaught failure in SockJS request, uri=http://localhost:8080/websocket/tracker/675/5sxmjvaq/websocket; nested exception is org.springframework.web.socket.sockjs.SockJsTransportFailureException: WebSocket handshake failure; nested exception is java.lang.ClassCastException: io.undertow.websockets.jsr.ServerWebSocketContainer cannot be cast to org.apache.tomcat.websocket.server.WsServerContainer
        at org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler.handleRequest(SockJsHttpRequestHandler.java:135)
        at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:51)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968)
        ... 100 common frames omitted
Caused by: org.springframework.web.socket.sockjs.SockJsTransportFailureException: WebSocket handshake failure; nested exception is java.lang.ClassCastException: io.undertow.websockets.jsr.ServerWebSocketContainer cannot be cast to org.apache.tomcat.websocket.server.WsServerContainer
        at org.springframework.web.socket.sockjs.transport.handler.WebSocketTransportHandler.handleRequest(WebSocketTransportHandler.java:122)
        at org.springframework.web.socket.sockjs.transport.TransportHandlingSockJsService.handleTransportRequest(TransportHandlingSockJsService.java:306)
        at org.springframework.web.socket.sockjs.support.AbstractSockJsService.handleRequest(AbstractSockJsService.java:433)
        at org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler.handleRequest(SockJsHttpRequestHandler.java:132)
        ... 104 common frames omitted
Caused by: java.lang.ClassCastException: io.undertow.websockets.jsr.ServerWebSocketContainer cannot be cast to org.apache.tomcat.websocket.server.WsServerContainer
        at org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy.getContainer(TomcatRequestUpgradeStrategy.java:85)
        at org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy.getContainer(TomcatRequestUpgradeStrategy.java:48)
        at org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy.getSupportedExtensions(AbstractStandardUpgradeStrategy.java:88)
        at org.springframework.web.socket.server.support.AbstractHandshakeHandler.doHandshake(AbstractHandshakeHandler.java:274)
        at org.springframework.web.socket.sockjs.transport.handler.WebSocketTransportHandler.handleRequest(WebSocketTransportHandler.java:118)
        ... 107 common frames omitted

2016-03-02 14:54:44.984 DEBUG 9156 --- [nboundChannel-4] c.m.myapp.web.websocket.ActivityService  : Sending user tracking data ActivityDTO{sessionId='3tl5aiex', userLogin='admin', ipAddress='/0:0:0:0:0:0:0:1:7553', page='home', time='2016-03-02 14:54:44'}
2016-03-02 14:54:47.938 DEBUG 9156 --- [nboundChannel-7] c.m.myapp.web.websocket.ActivityService  : Sending user tracking data ActivityDTO{sessionId='3tl5aiex', userLogin='admin', ipAddress='/0:0:0:0:0:0:0:1:7553', page='settings', time='2016-03-02 14:54:47'}
2016-03-02 14:54:50.416 DEBUG 9156 --- [nboundChannel-3] c.m.myapp.web.websocket.ActivityService  : Sending user tracking data ActivityDTO{sessionId='3tl5aiex', userLogin='admin', ipAddress='/0:0:0:0:0:0:0:1:7553', page='user-management', time='2016-03-02 14:54:50'}
2016-03-02 14:54:50.479 DEBUG 9156 --- [  XNIO-2 task-9] c.m.myapp.aop.logging.LoggingAspect      : Enter: com.mycompany.myapp.web.rest.UserResource.getAllUsers() with argument[s] = [Page request [number: 0, size 20, sort: null]]
atomfrede commented 8 years ago

I've not tried it with websockets yet, without I didn't see any errors. Have you tried maven? Does it work correctly?

deepu105 commented 8 years ago

also when I do java -jar after gradlew bootRepackage im unable to access the app from localhost:8080 as well

I have to try the prod profile and see if that works

deepu105 commented 8 years ago

No havent tried maven

atomfrede commented 8 years ago

I can try this evening with your config.

deepu105 commented 8 years ago

its gives same in prod profile as well

Im on windows BTW

image

deepu105 commented 8 years ago

Tried the same config with maven and I have same issue when doing java -jar however there is no websocket error here so thats only with gradle I guess.

  1. java -jar doesnt work in both dev and prod profile. Did anyone try this after undertow change?
rksanket commented 8 years ago

What deepu has mentioned above is the exact issue I am facing on jH2.27 on win7. Strangely, all the profiles work when we launch from eclipse (through java main method and runtime args) and works when we move the war to a Linux machine. Other Spring boot undertow samples from springsource work too in fat jar mode, but for this one.

deepu105 commented 8 years ago

Not sure if this is an OS related issue?

Thanks & Regards, Deepu

On Wed, Mar 2, 2016 at 4:27 PM, rksanket notifications@github.com wrote:

What deepu has mentioned above is the exact issue I am facing on jH2.27 on win7. Strangely, all the profiles work when we launch from eclipse (through java main method and runtime args) and works when we move the war to a Linux machine. Other Spring boot undertow samples from springsource work too in fat jar mode, but for this one.

— Reply to this email directly or view it on GitHub https://github.com/jhipster/generator-jhipster/issues/2948#issuecomment-191125977 .

wdroste commented 8 years ago

Please reference my pull request. In order for this to work in Gradle, tomcat must be excluded globally.. in the "configurations" block above and not in the "spring-boot-starter-web"..

Referenced in the documentation: Use Jetty instead of Tomcat

atomfrede commented 8 years ago

@wdroste Oh yes you're right, thanks! Will provide a fix.

deepu105 commented 8 years ago

java -jar still doesn't work on both dev and prod profile for maven and gradle @atomfrede can you please check on linux if it works?

the websocket error seems to fixed with #3061

deepu105 commented 8 years ago

@jdubois we might need your wisdom here

deepu105 commented 8 years ago

here is my logs and screenshot from maven config

{
  "generator-jhipster": {
    "jhipsterVersion": "2.27.0",
    "baseName": "jhipster",
    "packageName": "org.powertac.visualizer",
    "packageFolder": "org/powertac/visualizer",
    "authenticationType": "session",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": "no",
    "websocket": "spring-websocket",
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": "no",
    "buildTool": "maven",
    "enableSocialSignIn": false,
    "rememberMeKey": "a23f3263a88c09f414fa809da77acc7f23f62d05",
    "useSass": true,
    "applicationType": "monolith",
    "testFrameworks": [
      "gatling",
      "protractor"
    ],
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en",
      "zh-cn"
    ]
  }
}
PS D:\Projects\test\testApp> java -jar .\target\jhipster-0.0.1-SNAPSHOT.war

        ██  ██    ██  ████████  ███████    ██████  ████████  ████████  ███████
        ██  ██    ██     ██     ██    ██  ██          ██     ██        ██    ██
        ██  ████████     ██     ███████    █████      ██     ██████    ███████
  ██    ██  ██    ██     ██     ██             ██     ██     ██        ██   ██
   ██████   ██    ██  ████████  ██        ██████      ██     ████████  ██    ██

:: JHipster ?  :: Running Spring Boot 1.3.3.RELEASE ::
:: http://jhipster.github.io ::

2016-03-03 20:35:35.577  INFO 13440 --- [           main] org.powertac.visualizer.JhipsterApp      : Starting JhipsterApp on DESKTOP-3NUQHBI with PID 13440 (started by Deepu in D:\Projects\test\testApp)
2016-03-03 20:35:35.577 DEBUG 13440 --- [           main] org.powertac.visualizer.JhipsterApp      : Running with Spring Boot v1.3.3.RELEASE, Spring v4.2.5.RELEASE
2016-03-03 20:35:35.577  INFO 13440 --- [           main] org.powertac.visualizer.JhipsterApp      : The following profiles are active: dev
2016-03-03 20:35:39.890 DEBUG 13440 --- [           main] o.p.v.config.AsyncConfiguration          : Creating Async Task Executor
2016-03-03 20:35:40.544 DEBUG 13440 --- [           main] o.p.v.config.MetricsConfiguration        : Registering JVM gauges
2016-03-03 20:35:40.763 DEBUG 13440 --- [           main] o.p.v.config.MetricsConfiguration        : Initializing Metrics JMX reporting
2016-03-03 20:35:41.420  WARN 13440 --- [           main] io.undertow.websockets.jsr               : UT026009: XNIO worker was not set on WebSocketDeploymentInfo, the default worker will be used
2016-03-03 20:35:41.775  WARN 13440 --- [           main] io.undertow.websockets.jsr               : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2016-03-03 20:35:42.630  INFO 13440 --- [           main] o.p.visualizer.config.WebConfigurer      : Web application configuration, using profiles: [dev]
2016-03-03 20:35:42.631 DEBUG 13440 --- [           main] o.p.visualizer.config.WebConfigurer      : Initializing Metrics registries
2016-03-03 20:35:42.642 DEBUG 13440 --- [           main] o.p.visualizer.config.WebConfigurer      : Registering Metrics Filter
2016-03-03 20:35:42.643 DEBUG 13440 --- [           main] o.p.visualizer.config.WebConfigurer      : Registering Metrics Servlet
2016-03-03 20:35:42.652 DEBUG 13440 --- [           main] o.p.visualizer.config.WebConfigurer      : Initialize H2 console
2016-03-03 20:35:42.655  INFO 13440 --- [           main] o.p.visualizer.config.WebConfigurer      : Web application fully configured
2016-03-03 20:35:42.792 DEBUG 13440 --- [           main] o.p.v.config.DatabaseConfiguration       : Configuring Datasource
2016-03-03 20:35:43.389 DEBUG 13440 --- [           main] o.p.v.config.DatabaseConfiguration       : Configuring Liquibase
2016-03-03 20:35:43.462  WARN 13440 --- [ster-Executor-1] o.p.v.c.liquibase.AsyncSpringLiquibase   : Starting Liquibase asynchronously, your database might not be ready at startup!
2016-03-03 20:35:46.639 DEBUG 13440 --- [ster-Executor-1] o.p.v.c.liquibase.AsyncSpringLiquibase   : Started Liquibase in 3173 ms
2016-03-03 20:35:48.029  INFO 13440 --- [           main] org.powertac.visualizer.JhipsterApp      : Running with Spring profile(s) : [dev]
2016-03-03 20:35:51.268 DEBUG 13440 --- [           main] o.p.v.config.CacheConfiguration          : Starting Ehcache
2016-03-03 20:35:51.349 DEBUG 13440 --- [           main] o.p.v.config.CacheConfiguration          : Registering Ehcache Metrics gauges
2016-03-03 20:35:52.081 DEBUG 13440 --- [           main] o.p.v.c.apidoc.SwaggerConfiguration      : Starting Swagger
2016-03-03 20:35:52.101 DEBUG 13440 --- [           main] o.p.v.c.apidoc.SwaggerConfiguration      : Started Swagger in 16 ms
2016-03-03 20:35:54.345  INFO 13440 --- [           main] org.powertac.visualizer.JhipsterApp      : Started JhipsterApp in 20.215 seconds (JVM running
for 21.388)
2016-03-03 20:35:54.350  INFO 13440 --- [           main] org.powertac.visualizer.JhipsterApp      :
----------------------------------------------------------
        Application 'jhipster' is running! Access URLs:
        Local:          http://127.0.0.1:8080
        External:       http://192.168.0.11:8080
----------------------------------------------------------
2016-03-03 20:36:27.027 DEBUG 13440 --- [  XNIO-2 task-1] p.v.s.CustomPersistentRememberMeServices : Remember-me cookie detected
Hibernate: select persistent0_.series as series1_3_0_, persistent0_.ip_address as ip_addre2_3_0_, persistent0_.token_date as token_da3_3_0_, persistent0_.token_value as token_va4_3_0_, persistent0_.user_id as user_id6_3_0_, persistent0_.user_agent as user_age5_3_0_, user1_.id as id1_4_1_, user1_.created_by as created_2_4_1_, user1_.created_date as created_3_4_1_, user1_.last_modified_by as last_mod4_4_1_, user1_.last_modified_date as last_mod5_4_1_, user1_.activated as activate6_4_1_, user1_.activation_key as activati7_4_1_, user1_.email as email8_4_1_, user1_.first_name as first_na9_4_1_, user1_.lang_key as lang_ke10_4_1_, user1_.last_name as last_na11_4_1_, user1_.login as login12_4_1_, user1_.password_hash as passwor13_4_1_, user1_.reset_date as reset_d14_4_1_, user1_.reset_key as reset_k15_4_1_ from jhi_persistent_token persistent0_ left outer join jhi_user user1_ on persistent0_.user_id=user1_.id where persistent0_.series=?
2016-03-03 20:36:27.099 DEBUG 13440 --- [  XNIO-2 task-1] p.v.s.CustomPersistentRememberMeServices : No persistent token found for series id: YaEF2y/0Bq2W0vHTFreSZw==
2016-03-03 20:36:27.103 DEBUG 13440 --- [  XNIO-2 task-1] p.v.s.CustomPersistentRememberMeServices : Cancelling cookie
2016-03-03 20:36:47.845 DEBUG 13440 --- [  XNIO-2 task-3] o.p.v.aop.logging.LoggingAspect          : Enter: org.springframework.boot.actuate.audit.AuditEventRepository.add() with argument[s] = [AuditEvent [timestamp=Thu Mar 03 20:36:47 SGT 2016, principal=anonymousUser, type=AUTHORIZATION_FAILURE, data={type=org.springframework.security.access.AccessDeniedException, message=Access is denied}]]
2016-03-03 20:36:47.853 DEBUG 13440 --- [  XNIO-2 task-3] o.p.v.aop.logging.LoggingAspect          : Exit: org.springframework.boot.actuate.audit.AuditEventRepository.add() with result = null
2016-03-03 20:36:47.865 DEBUG 13440 --- [  XNIO-2 task-3] o.p.v.s.Http401UnauthorizedEntryPoint    : Pre-authenticated entry point called. Rejecting access
deepu105 commented 8 years ago

untitled

deepu105 commented 8 years ago

whats weird is the console shows some logs for authentication but webapp doesnt seem to load

erikkemperman commented 8 years ago

Just to add to the confusion: this same config works for me on Linux, running in IDE or using java -jar on the war file.

wdroste commented 8 years ago

Linux works for me gradle/maven, dev/prod, jar/ide

deepu105 commented 8 years ago

seems some voodoo on windows

atomfrede commented 8 years ago

@deepu105 Same for me. Setting up a fresh app with your config, booting up the docker production image doing java -jar and everything works fine.

pascalgrimaud commented 8 years ago

@deepu105 : I find a Windows machine to make tests (only with Maven) ! Some information that can help.

Linux -> it works fine Windows -> same error like you, when I run java -jar target\jhmysql-0.0.1-SNAPSHOT.war, I got Your request cannot be processed

I move the jhmysql-0.0.1-SNAPSHOT.war from Windows to Linux : it works I move the jhlinux-0.0.1-SNAPSHOT.war from Linux to Windows : it doesn't work

I change the pom.xml to use Tomcat instead of Undertow and it works on Windows

erikkemperman commented 8 years ago

Maybe try with undertow log level debug or even trace, might provide a clue? I read about undertow issues with websockets, is that the critical aspect in this config, i.e. does it work without those?

pascalgrimaud commented 8 years ago

Initialy, I used Windows for maybe another issue (with protractor tests) and I used all default options except protractor :

{
  "generator-jhipster": {
    "jhipsterVersion": "2.27.0",
    "baseName": "jhmysql",
    "packageName": "com.mycompany.myapp",
    "packageFolder": "com/mycompany/myapp",
    "authenticationType": "session",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": "no",
    "websocket": "no",
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": "no",
    "buildTool": "maven",
    "enableSocialSignIn": false,
    "rememberMeKey": "cec4dca50f944bd72bce74832b053a3007735891",
    "useSass": false,
    "applicationType": "monolith",
    "testFrameworks": [
      "gatling",
      "protractor"
    ],
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en",
      "fr"
    ]
  }
}

And I don't see anything in log...

gmarziou commented 8 years ago

I don't know if this is the same issue but I got same behaviour when running the main method from IntelliJ and to make it work I had to set working dir: https://groups.google.com/forum/#!topic/jhipster-dev/DI5DlxFA1bg

Maybe something related to classpath or current dir

erikkemperman commented 8 years ago

No errors? Or nothing at all? If the former, might be websockets... Deepu's log complained about WebsocketDeploymentInfo...

Unfortunately I don't have a Windows machine to help out... But I'm interested because this seems to be blocking my (otherwise unrelated, I guess) PR :-)

pascalgrimaud commented 8 years ago

I mean, no error in log

deepu105 commented 8 years ago

The websocket issue was resolved after excluding tomcat properly could this be an undertow bug with windows? On 4 Mar 2016 07:44, "Pascal Grimaud" notifications@github.com wrote:

I mean, no error in log

— Reply to this email directly or view it on GitHub https://github.com/jhipster/generator-jhipster/issues/2948#issuecomment-192023382 .

deepu105 commented 8 years ago

Even when running the app directly using bootrun im having a strange error saying the ports are already in use quite often with maven and gradle it works when i try again. I never had such issues with tomcat.

I have started to think if the few reduced seconds in startup is worth all this trouble :( tomcat was rock solid stable On 4 Mar 2016 09:17, "Deepu K Sasidharan" d4udts@gmail.com wrote:

The websocket issue was resolved after excluding tomcat properly could this be an undertow bug with windows? On 4 Mar 2016 07:44, "Pascal Grimaud" notifications@github.com wrote:

I mean, no error in log

— Reply to this email directly or view it on GitHub https://github.com/jhipster/generator-jhipster/issues/2948#issuecomment-192023382 .

wdroste commented 8 years ago

Has anyone tried the spring-boot sample on Windows?

Sample Websocket Undertow

I've google'd for issues related to Undertow on Windows w/ websocket and nothing..

deepu105 commented 8 years ago

i will try

Thanks & Regards, Deepu

On Fri, Mar 4, 2016 at 12:31 PM, Will Droste notifications@github.com wrote:

Has anyone tried the spring-boot sample on Windows?

Sample Websocket Undertow https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-websocket-undertow

I've google'd for issues related to Undertow on Windows w/ websocket and nothing..

— Reply to this email directly or view it on GitHub https://github.com/jhipster/generator-jhipster/issues/2948#issuecomment-192096250 .

deepu105 commented 8 years ago

I dont think it has anything to do with websockets

Thanks & Regards, Deepu

On Fri, Mar 4, 2016 at 12:53 PM, Deepu K Sasidharan d4udts@gmail.com wrote:

i will try

Thanks & Regards, Deepu

On Fri, Mar 4, 2016 at 12:31 PM, Will Droste notifications@github.com wrote:

Has anyone tried the spring-boot sample on Windows?

Sample Websocket Undertow https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-websocket-undertow

I've google'd for issues related to Undertow on Windows w/ websocket and nothing..

— Reply to this email directly or view it on GitHub https://github.com/jhipster/generator-jhipster/issues/2948#issuecomment-192096250 .

deepu105 commented 8 years ago

The spring boot sample works and our generated war file with or without websocket doesn't work. So this is definitely a bug from our end

Thanks & Regards, Deepu

On Fri, Mar 4, 2016 at 12:53 PM, Deepu K Sasidharan d4udts@gmail.com wrote:

I dont think it has anything to do with websockets

Thanks & Regards, Deepu

On Fri, Mar 4, 2016 at 12:53 PM, Deepu K Sasidharan d4udts@gmail.com wrote:

i will try

Thanks & Regards, Deepu

On Fri, Mar 4, 2016 at 12:31 PM, Will Droste notifications@github.com wrote:

Has anyone tried the spring-boot sample on Windows?

Sample Websocket Undertow https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-websocket-undertow

I've google'd for issues related to Undertow on Windows w/ websocket and nothing..

— Reply to this email directly or view it on GitHub https://github.com/jhipster/generator-jhipster/issues/2948#issuecomment-192096250 .

erikkemperman commented 8 years ago

But the default setup worked on Windows for @pascalgrimaud , right? So the salient difference must be in the config? But other than websockets I see only sass is different, which I can't imagine to be related to which servlet container is used. Or the language, @deepu105 's config has Chinese -- maybe an encoding / charset issue?

pascalgrimaud commented 8 years ago

No, default setup on windows only works if I run mvn or ./gradlew If I use java -jar, it doesn't work

erikkemperman commented 8 years ago

Ah, sorry, I misunderstood. Disregard that last comment!

rksanket commented 8 years ago

Finally, a workaround/probable-root-cause for the nemesis is in place. Here is an update from me - hopefully this may lead to something - may be, jHipster needs to revisit static resources location.

Today, to see what's happening on this issue, I started to debug spring boot and undertow code and realized that spring boot is looking for resources in the below locations :

    private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
            "classpath:/META-INF/resources/", "classpath:/resources/",
            "classpath:/static/", "classpath:/public/" };

After that, I created a folder called resources inside the META-INF directory and copied all the resources inside it using 7zip. And lo & behold., it works! :-). . Putting them in any one of the above folders should also work.

Although spring boot is supposed to also load resources from
private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" };

for some reason, it is not doing so. (which is where jHipster is putting all of the resource files)

I thought this to be a bug with spring boot version that jHipster uses and I upgraded my app spring boot version to 1.3.3.RELEASE, but that does not help either. (on a side note, it would be good if jHipster is upgraded to latest release version of spring/spring-boot).

jhipster

jdubois commented 8 years ago

Hi guys,

I'm sorry I didn't have time to look at this earlier. I will study this over the week-end. But if it's too buggy to use Undertow, let's not make the whole JHipster 3.0 release at risk for it. Tomcat still works very well, so in case of doubt we will stick to Tomcat.

Julien Le 4 mars 2016 3:44 PM, "rksanket" notifications@github.com a écrit :

Finally, a solution for the nemesis is in place. Here is an update from me

  • hopefully this may lead to something - may be, jHipster needs to revisit static resources location. Today, I started to debug spring boot and undertow code and realized that spring boot is looking for resources in the below locations :

    private static final String[] CLASSPATH_RESOURCE_LOCATIONS = { "classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/" };

After that, I created a folder called resources inside the META-INF directory and copied all the resources inside it using 7zip. And lo behold., it works! :-).

Although spring boot is supposed to also load resources from

private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" };

for some reason, it is not doing so. (which is where jHipster is putting all of the resource files)

I thought this to be a bug with spring boot version that jHipster uses and I upgraded my app spring boot version to 1.3.3.RELEASE, but that does not help either.

[image: jhipster] https://cloud.githubusercontent.com/assets/14866614/13529753/bdfd8a8e-e243-11e5-87c9-9173d9ad0193.png

— Reply to this email directly or view it on GitHub https://github.com/jhipster/generator-jhipster/issues/2948#issuecomment-192306617 .

notflorian commented 8 years ago

I found this in the spring boot documentation : http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-developing-web-applications.html#boot-features-spring-mvc-static-content

By default Spring Boot will serve static content from a directory called /static (or /public or /resources or /META-INF/resources) in the classpath or from the root of the ServletContext.

Maybe there is a bug with the root of the ServletContext on Windows with Undertow, can we put the static ressources in a directory static at the root of the war? Or we can customize the location with the spring.resources.staticLocations property to look for the resources in the dist directory.

pascalgrimaud commented 8 years ago

thanks @rksanket and @notflorian So finally, this command works for Windows users: java -jar jhmysql-0.0.1-SNAPSHOT.war --spring.resources.static-locations=classpath:/

So Undertow on Windows has clearly a problem with classpath

notflorian commented 8 years ago

Yes, but by doing so we can access with a simple HTTP GET unprotected ressources like : http://localhost:8080/org/springframework/boot/loader/Launcher.class.

For me, it would be more secure to have all static files in a single directory.

pascalgrimaud commented 8 years ago

Of course, using my command above is not the solution !! I just wanted to confirm the classpath issue ;)

erikkemperman commented 8 years ago

Progress, yay!

I'll rebase my PR, which was blocked by this issue but perhaps, reading the above, it might end up helping in some small way to resolve it.

Give me an hour or so, I'm not at a decent computer right now and there are some conflicts, looks like they're due to the gulpfile having been shuffled in recent commits to master.

Unfortunately I don't have a Windows box so I would need some help to verify if it actually improves the situation.

erikkemperman commented 8 years ago

All right, I've rebased that PR.

If you change following line in the generated gulpfile:

dist: 'target/www/',

into

dist: 'target/www/static/',

then mvn -Pprod package will leave the static assets in [war-root]/static/, and hopefully it works without the commandline classpath argument.

But in my opinion this would be an ugly workaround for what is basically an upstream bug. It also doesn't address the issue for -Pdev builds, and I don't see a nice way to remedy that just now.

Maybe the transition to Undertow was premature?

deepu105 commented 8 years ago

That seems good, i wont have time today so ill check this first thing in the morning

If it works we can merge and close this finally On 5 Mar 2016 05:29, "Erik Kemperman" notifications@github.com wrote:

All right, I've rebased that PR.

If you change following line in the generated gulpfile:

dist: 'target/www/',

into

dist: 'target/www/static/',

then mvn -Pprod package will leave the static assets in [war-root]/static/, and hopefully it works without the commandline classpath argument.

But in my opinion this would be an ugly workaround for what is basically an upstream bug. It also doesn't address the issue for -Pdev builds, and I don't see a nice way to remedy that just now.

Maybe the transition to Undertow was premature?

— Reply to this email directly or view it on GitHub https://github.com/jhipster/generator-jhipster/issues/2948#issuecomment-192475684 .