You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2022/10/09 16:08:22 UTC
[Bug 66299] New: Cannot find annotation method 'value()' in type 'aQute.bnd.annotation.spi.ServiceConsumer' with Tomcat
https://bz.apache.org/bugzilla/show_bug.cgi?id=66299
Bug ID: 66299
Summary: Cannot find annotation method 'value()' in type
'aQute.bnd.annotation.spi.ServiceConsumer' with Tomcat
Product: Tomcat 9
Version: 9.0.50
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
Assignee: dev@tomcat.apache.org
Reporter: garret@globalmentor.com
Target Milestone: -----
I have a Java 11 project embedding Tomcat:
```xml
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>9.0.50</version>
</dependency>
```
The Tomcat-specific code is in a subproject with only two classes. When I
compile using Maven 3.8.6 and Java 17 using `-Xlint:all`, I see the following
warning for that subproject:
> [WARNING] Cannot find annotation method 'value()' in type
> 'aQute.bnd.annotation.spi.ServiceConsumer':
> class file for aQute.bnd.annotation.spi.ServiceConsumer not found
Doing a bit of searching brings up similar (but not exact) things, such as
[Lombok Issue #2145](https://github.com/projectlombok/lombok/issues/2145),
which hints that I may need to add some sort of extra dependency such as
`biz.aQute.bnd:bndlib` or `org.osgi:osgi.annotation`.
But I've tried this and and I still get the warning:
```xml
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bndlib</artifactId>
<version>2.4.0</version>
</dependency>
```
I also tried this; no difference:
```xml
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.annotation</artifactId>
<version>7.0.0</version>
</dependency>
```
Where is this error coming from, and what does it mean? I don't have any
`@ServiceConsumer` annotation in my source code, and I couldn't find any in the
Tomcat classes I'm extending, either. Shouldn't the
`org.apache.tomcat.embed:tomcat-embed-core` dependency contain everything I
need (either in the artifact or via a transitive dependency) just to build a
project that references the Tomcat classes? What is missing here?
I also [asked on Stack Overflow](https://stackoverflow.com/q/74000505). No
answers so far.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 66299] Cannot find annotation method 'value()' in type 'aQute.bnd.annotation.spi.ServiceConsumer' with Tomcat
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66299
--- Comment #2 from Garret Wilson <ga...@globalmentor.com> ---
Well I think the bug will wind up being that Tomcat is not including some
needed library in its published artifacts. But we shall see. I'll ask on the
mailing list and reopen this ticket if that turns out to be the case.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 66299] Cannot find annotation method 'value()' in type 'aQute.bnd.annotation.spi.ServiceConsumer' with Tomcat
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66299
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |INVALID
OS| |All
--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Bugzilla is not a support forum. This question belongs on the users mailing
list.
https://tomcat.apache.org/lists.html
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 66299] Cannot find annotation method 'value()' in type 'aQute.bnd.annotation.spi.ServiceConsumer' with Tomcat
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66299
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |WONTFIX
Status|REOPENED |RESOLVED
--- Comment #4 from Mark Thomas <ma...@apache.org> ---
The additional dependency is only required to silence a warning if compiling
with -Xlint:all
Making the proposed change to the pom would require every user compiling
against this library to download the additional JAR(s). Give that the
tomcat-embed-core JAR is downloaded millions of times per month and we only
have a single bug report about the warning, it is not appropriate to require
every user to download the additional JAR(s) to silence the warning for one
user.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 66299] Cannot find annotation method 'value()' in type 'aQute.bnd.annotation.spi.ServiceConsumer' with Tomcat
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66299
Garret Wilson <ga...@globalmentor.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|----- |------
Status|RESOLVED |REOPENED
Component|Catalina |Catalina
Resolution|INVALID |---
Version|9.0.50 |10.1.0
Product|Tomcat 9 |Tomcat 10
--- Comment #3 from Garret Wilson <ga...@globalmentor.com> ---
I'm reopening this ticket now that the cause is better understood and a simple
fix is available. You may still decide not to address this, and that's OK
because I have a workaround, but in my opinion the appropriate resolution would
not be `INVALID` but rather `WONTFIX`.
In any case I wanted to at least provide a further explanation for completeness
and to help anyone else who is looking for the answer in the future.
Summarizing our discussion on the list, Tomcat has a primary Ant-based build
workflow which uses the bnd annotation
`aQute.bnd.annotation.spi.ServiceConsumer` (which in turn uses the OSGi class
`org.osgi.annotation.bundle.Requirement`) to generate JPMS and OSGi metadata.
These classes aren't needed in any secondary builds (i.e. using Maven with the
embedded Tomcat dependency), but `javac` with linting doesn't like it if these
annotation classes are missing.
This can be solved easily enough if Tomcat were to include the following in its
POM(s) (versions relevant for Tomcat 10.1.0 shown here):
```xml
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>biz.aQute.bnd.annotation</artifactId>
<version>6.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.annotation</artifactId>
<version>8.1.0</version>
<scope>provided</scope>
</dependency>
```
Developers can prevent the warning by including those same dependency
declarations in their own POMs. The `provided` scope informs Maven that these
dependencies should not be included in any resulting JARs in the secondary
build.
Even if you decide to close this ticket again, thanks for the discussion on the
list and explaining what was causing this. That helped me find a workaround.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org