You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/08/21 11:31:04 UTC

[GitHub] [rocketmq-clients] buzzxu opened a new issue, #159: java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()'

buzzxu opened a new issue, #159:
URL: https://github.com/apache/rocketmq-clients/issues/159

   ```
   Caused by: java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()'
   	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.<init>(CommonAnnotationBeanPostProcessor.java:664)
   	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.lambda$buildResourceMetadata$0(CommonAnnotationBeanPostProcessor.java:395)
   	at org.springframework.util.ReflectionUtils.doWithLocalFields(ReflectionUtils.java:677)
   	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.buildResourceMetadata(CommonAnnotationBeanPostProcessor.java:377)
   	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.findResourceMetadata(CommonAnnotationBeanPostProcessor.java:358)
   	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:306)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1116)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
   ```
   RocketMQ(Java) Version: 5.0.0
   Spring Version: 5.3.22
   Spring Boot Version: 2.7.3
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-clients] buzzxu commented on issue #159: java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()'

Posted by GitBox <gi...@apache.org>.
buzzxu commented on issue #159:
URL: https://github.com/apache/rocketmq-clients/issues/159#issuecomment-1221888905

   ```
   java version "17.0.4" 2022-07-19 LTS
   Java(TM) SE Runtime Environment (build 17.0.4+11-LTS-179)
   Java HotSpot(TM) 64-Bit Server VM (build 17.0.4+11-LTS-179, mixed mode)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-clients] aaron-ai commented on issue #159: java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()'

Posted by GitBox <gi...@apache.org>.
aaron-ai commented on issue #159:
URL: https://github.com/apache/rocketmq-clients/issues/159#issuecomment-1221958913

   em... I got it.
   
   Actually the javax.annotation was depecated in Java9+, and it is introduced by gRPC and the latest Spring framework. gRPC used `javax.annotation-apis` in some initial versions, but it was replaced with tomcat's annotation-api to avoid the license issue(https://github.com/grpc/grpc-java/pull/6990). Unfortunately, `Resource#lookup` was removed in tomcat's annotation-api and it was used by Spring. 😅
   
   I am not sure that whether we should go back to `javax.annotation-apis` or shade `javax.annotation`? or there may be other solution? Maybe discuss is needed here.
   
   cc @lizhanhui @zhouxinyu @xdkxlk @drpmma @lollipopjin @guyinyou @duhenglucky 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-clients] aaron-ai commented on issue #159: java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()'

Posted by GitBox <gi...@apache.org>.
aaron-ai commented on issue #159:
URL: https://github.com/apache/rocketmq-clients/issues/159#issuecomment-1221553603

   Could you give us more information about your JRE?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()' [rocketmq-clients]

Posted by "lizhanhui (via GitHub)" <gi...@apache.org>.
lizhanhui commented on issue #159:
URL: https://github.com/apache/rocketmq-clients/issues/159#issuecomment-1985132464

   Ahh, it's not a regression, it is the rocketmq-client that is suffering the issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-clients] zhouxinyu commented on issue #159: java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()'

Posted by GitBox <gi...@apache.org>.
zhouxinyu commented on issue #159:
URL: https://github.com/apache/rocketmq-clients/issues/159#issuecomment-1221974886

   Do we have any workaround solution to resolve this issue?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-clients] aaron-ai commented on issue #159: java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()'

Posted by GitBox <gi...@apache.org>.
aaron-ai commented on issue #159:
URL: https://github.com/apache/rocketmq-clients/issues/159#issuecomment-1222230607

   > Do we have any workaround solution to resolve this issue?
   
   IMHO, apart from the solutions I mentioned above. Maybe we could exclude `javax.annotation` from the shaded jar and treat it as an independent in our pom.xml, then users could choose the library that contains `javax.annotation` according to their needs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-clients] zhouxinyu commented on issue #159: java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()'

Posted by GitBox <gi...@apache.org>.
zhouxinyu commented on issue #159:
URL: https://github.com/apache/rocketmq-clients/issues/159#issuecomment-1225108376

   > > Do we have any workaround solution to resolve this issue?
   > 
   > @zhouxinyu IMHO, apart from the solutions I mentioned above. Maybe we could exclude `javax.annotation` from the shaded jar and treat it as an independent in our pom.xml, then users could choose the library that contains `javax.annotation` according to their needs.
   > 
   > example: ![image](https://user-images.githubusercontent.com/19537356/185911990-840e07db-ad40-495c-a0af-88575a964ede.png)
   
   Sounds great, there is no need to shade an annotation lib indeed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-clients] aaron-ai closed issue #159: java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()'

Posted by GitBox <gi...@apache.org>.
aaron-ai closed issue #159: java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()'
URL: https://github.com/apache/rocketmq-clients/issues/159


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-clients] aaron-ai commented on issue #159: java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()'

Posted by GitBox <gi...@apache.org>.
aaron-ai commented on issue #159:
URL: https://github.com/apache/rocketmq-clients/issues/159#issuecomment-1225272208

   @buzzxu Hi, we forgive to shade annotation-api in rocketmq-client-java.jar by #177, so you could exclude tomcat's annotation-api and import `javax.annotation-apis` to solve this issue in next version.
   
   ```
   <dependencies>
       <dependency>
           <groupId>org.apache.rocketmq</groupId>
           <artifactId>rocketmq-client-java</artifactId>
           <version>5.0.1-SNAPSHOT</version>
           <exclusions>
               <exclusion>
                   <groupId>org.apache.tomcat</groupId>
                   <artifactId>annotations-api</artifactId>
               </exclusion>
           </exclusions>
       </dependency>
       <dependency>
           <groupId>javax.annotation</groupId>
           <artifactId>javax.annotation-api</artifactId>
           <version>1.3.2</version>
       </dependency>
   <dependencies>
   ```
   or you could try to build `5.0.1-SNAPSHOT` for testing. Thx for feedback!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] java.lang.NoSuchMethodError: 'java.lang.String javax.annotation.Resource.lookup()' [rocketmq-clients]

Posted by "lizhanhui (via GitHub)" <gi...@apache.org>.
lizhanhui commented on issue #159:
URL: https://github.com/apache/rocketmq-clients/issues/159#issuecomment-1985120920

   @aaron-ai I observed an regression on this issue. Checkout rocketmq-common 5.1.4 still having tomcat annotations-api
   
   https://mvnrepository.com/artifact/org.apache.rocketmq/rocketmq-common/5.1.4
   
   rocketmq-client, as a result, will still having this transitive dependency.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org