AtlasOfLivingAustralia / spatial-hub

New spatial portal front end using AngularJS
https://spatial.ala.org.au/
7 stars 16 forks source link

Boot exception in 2.1.0 #474

Open vjrj opened 3 months ago

vjrj commented 3 months ago

I have a critical exception running spatial-hub 2.1.0 in a u20 with java 11 installed via ala-install:

[2024-05-23 09:15:27] [crit]     ... 77 more 
[2024-05-23 09:15:27] [crit] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'assetProcessorService': Post-processing of merged bean definition failed; nested exception is java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()' 
[2024-05-23 09:15:27] [crit]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:597) 
[2024-05-23 09:15:27] [crit]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) 
[2024-05-23 09:15:27] [crit]     at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) 
[2024-05-23 09:15:27] [crit]     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) 
[2024-05-23 09:15:27] [crit]     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) 
[2024-05-23 09:15:27] [crit]     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) 
[2024-05-23 09:15:27] [crit]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByName(AbstractAutowireCapableBeanFactory.java:1471) 
[2024-05-23 09:15:27] [crit]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1413) 
[2024-05-23 09:15:27] [crit]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) 
[2024-05-23 09:15:27] [crit]     ... 86 more 
[2024-05-23 09:15:27] [crit] Caused by: java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()' 
[2024-05-23 09:15:27] [crit]     at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.<init>(CommonAnnotationBeanPostProcessor.java:664) 
[2024-05-23 09:15:27] [crit]     at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.lambda$buildResourceMetadata$0(CommonAnnotationBeanPostProcessor.java:395) 
[2024-05-23 09:15:27] [crit]     at org.springframework.util.ReflectionUtils.doWithLocalFields(ReflectionUtils.java:677) 
[2024-05-23 09:15:27] [crit]     at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.buildResourceMetadata(CommonAnnotationBeanPostProcessor.java:377) 
[2024-05-23 09:15:27] [crit]     at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.findResourceMetadata(CommonAnnotationBeanPostProcessor.java:358) 
[2024-05-23 09:15:27] [crit]     at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:306) 
[2024-05-23 09:15:27] [crit]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1116) 
[2024-05-23 09:15:27] [crit]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) 
[2024-05-23 09:15:27] [crit]     ... 94 more 
[2024-05-23 09:15:27] [info] Deployment of web application archive [/var/lib/tomcat9/webapps-espacial.gbif.es/ROOT.war] has finished in [8,095] ms 
[2024-05-23 09:15:27] [info] Starting ProtocolHandler ["http-nio-0.0.0.0-8080"] 

It sounds like a build dependency issue.

vjrj commented 3 months ago

Same issue with 2.0.0. Tested with java 13 and 17 with the same results. But ALA is using 2.0.0 in production so I'm missing something.

vjrj commented 2 months ago

Same issue with 2.1.1.

adam-collins commented 2 months ago

From the exception message and project dependencies I assumed that the presence of two javax.annotation.Resource, one missing javax.annotation.Resource.lookup(), and variations in class loading order is the issue.

Can you please test with 2.1.2-SNAPSHOT. I cannot reproduce so the commit may not fix the issue.

vjrj commented 2 months ago

Yes, it fix the boot issue. Thanks.

The question is why was failing with a normal ala-install deploy.

adam-collins commented 2 weeks ago

I didn't comment on why it was failing with your specific environment because

  1. It is deployed and running in various environments.
  2. There are insufficient details of the environment specifics where it fails.

I was too ambitious, I will revert the 2 commits and leave the fix for this issue for anyone who can reproduce it.