Skip to content
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

Boot exception in 2.1.0 #474

Open
vjrj opened this issue May 23, 2024 · 5 comments
Open

Boot exception in 2.1.0 #474

vjrj opened this issue May 23, 2024 · 5 comments
Assignees

Comments

@vjrj
Copy link
Contributor

vjrj commented May 23, 2024

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
Copy link
Contributor Author

vjrj commented May 23, 2024

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
Copy link
Contributor Author

vjrj commented Jun 7, 2024

Same issue with 2.1.1.

adam-collins pushed a commit that referenced this issue Jun 21, 2024
@adam-collins
Copy link
Collaborator

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.

@adam-collins adam-collins self-assigned this Jun 21, 2024
@vjrj
Copy link
Contributor Author

vjrj commented Jun 21, 2024

Yes, it fix the boot issue. Thanks.

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

@adam-collins
Copy link
Collaborator

adam-collins commented Aug 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants