Search code examples
springspring-mvcgradlebuild.gradlegretty

Why Gretty is slow?


i have no idea why my gretty takes a very long time to run appStart tasks. Anyone have idea why it stop at the step "appStart", and i need to wait for about 30 minutes before it continue to the next step...

Is it working on something in the background, or it is just waiting for something ?

:copyPropertiesFile UP-TO-DATE
:processResources
:classes
:prepareInplaceWebAppClasses
:prepareInplaceWebApp
:appStart
16:29:16 INFO  No Spring WebApplicationInitializer types detected on classpath
16:29:17 INFO  Initializing Spring root WebApplicationContext
INFO  ContextLoader - Root WebApplicationContext: initialization started
INFO  AnnotationConfigWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Mon Oct 07 16:29:18 SGT 2019]; root of context hierarchy
INFO  AnnotationConfigWebApplicationContext - Successfully resolved class for [com.sample.api.web.config.WebApplicationConfig]
INFO  AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
INFO  PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'asyncConfig' of type [class com.sample.api.web.config.async.AsyncConfig$$EnhancerBySpringCGLIB$$e08b8abf] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
INFO  ThreadPoolTaskExecutor - Initializing ExecutorService

It always run till the :appStart step, and just stop there before continuing to the next line. Is it caused by no spring webapplicationinitializer ?

Anyone can guide me on how to identify the root cause or a solution to solve the issue ?

I am using gretty 1.4.0

Thanks

Update: I added these to my eclipse jvm arguments before running the application and it shows me that it is indeed working on something.

-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog 
-Dorg.eclipse.jetty.LEVEL=DEBUG

From my latest observation, it is trying to scan

2019-10-07 17:44:41.521:DBUG:oejuc.AbstractLifeCycle:starting org.eclipse.jetty.util.Scanner@1d2ca98
2019-10-07 17:44:42.157:DBUG:oejuc.AbstractLifeCycle:STARTED org.eclipse.jetty.util.Scanner@1d2ca98
2019-10-07 17:44:43.957:DBUG:oeju.Scanner:scanned [C:\Users...

The strange thing is, this last line of of scanned files are generated about once every second, and the list of files shown are exactly the same...

All the scanned lines are showed in red ( i think that means it cannot scan ? ) and thus, it will continue to spam the red line for 30 minutes before continuing..

Any idea ?


Solution

  • Just to help others who might have similar issue, you can try to add

    scanInterval = 0
    debugSuspend = false
    

    into the gretty block within build.gradle. It could reduce the build time.