MicroShed / MicroShed/microshed-testing

Building rest client fails with "java.lang.IllegalArgumentException: <FQCN> is not an interface."

Open
#288 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

is:bug
Dominant language
Java
Stars
68
Forks
25
Avg merge
1d 21h
Merged PRs (30d)
6

Description

**Describe the bug**
When testing OpenLiberty services in Java versions greater than 11, using `@RESTClient`-annotated classes in integration tests results in a failed test with the error message: "java.lang.IllegalArgumentException: my.package.MyService is not an interface". Re-running with Java11 results in a successful test.

**To Reproduce**
- `git clone https://github.com/OpenLiberty/guide-microshed-testing.git` (Using this as a known-working project)
- `cd guide-microshed-testing/finish`
- `mvn verify`

**Expected behavior**
PersonServiceIT and ErrorPathIT complete without errors.

**System information:**
- OS: macOS 12.1
- Java Version: 17 (tested with 15 & 18 which show this same behavior as well)
- MicroShed Testing Version: 0.9.1

**Additional context**
I'm not sure where I'd even begin debugging this since it really caught me by surprise. Any guidance or even just confirmation that this is indeed a bug would be helpful. Since it is working on Java11 I could fall back to that if nothing else.

For reference, here is the output of a failed run:

```
buzaan@buzaan ~/scratch/guide-microshed-testing/finish % git rev-parse HEAD
cda558a8cab1d2d2630b6d7463973862729a188a
buzaan@buzaan ~/scratch/guide-microshed-testing/finish % java -version
openjdk version "17.0.1" 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12-39)
OpenJDK 64-Bit Server VM (build 17.0.1+12-39, mixed mode, sharing)
buzaan@buzaan ~/scratch/guide-microshed-testing/finish % mvn verify
(...output....)
[INFO] --- maven-failsafe-plugin:2.22.0:integration-test (default) @ guide-microshed-testing ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running io.openliberty.guides.testing.PersonServiceIT
[INFO] Found application file at: /Users/buzaan/scratch/guide-microshed-testing/finish/target/guide-microshed-testing.war
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Using ServerAdapter: org.testcontainers.containers.liberty.LibertyAdapter
[INFO] Using ApplicationEnvironment class: org.microshed.testing.testcontainers.config.TestcontainersConfiguration
[INFO] Starting 1 container(s) in parallel for class io.openliberty.guides.testing.PersonServiceIT
[INFO] localhost/testcontainers/dw5vlrv2adhpyddu:latest
[ApplicationContainer]
[INFO] ApplicationContainer[localhost/testcontainers/dw5vlrv2adhpyddu:latest] has exposed ports:
[INFO] 9080 --> 35221
[ApplicationContainer] Launching defaultServer (Open Liberty 22.0.0.11/wlp-1.0.70.cl221120221010-1540) on Eclipse OpenJ9 VM, version 1.8.0_345-b01 (en_US)
[ApplicationContainer] [AUDIT ] CWWKE0001I: The server defaultServer has been launched.
[ApplicationContainer] [AUDIT ] CWWKG0093A: Processing configuration drop-ins resource: /opt/ol/wlp/usr/servers/defaultServer/configDropins/defaults/keystore.xml
[ApplicationContainer] [AUDIT ] CWWKG0093A: Processing configuration drop-ins resource: /opt/ol/wlp/usr/servers/defaultServer/configDropins/defaults/open-default-port.xml
[ApplicationContainer] [AUDIT ] CWWKZ0058I: Monitoring dropins for applications.
[ApplicationContainer] [AUDIT ] CWWKT0016I: Web application available (default_host): http://ab727dc296fb:9080/health/
[ApplicationContainer] [ERROR ] CWWKZ0002E: An exception occurred while starting the application guide-microshed-testing. The exception message was: java.lang.UnsupportedClassVersionError: JVMCFRE199E bad major version 61.0 of class=io/openliberty/guides/testing/PersonServiceApp, the maximum supported major version is 52.0; offset=6
[ApplicationContainer] [AUDIT ] CWWKF0012I: The server installed the following features: [json-1.0, mpConfig-2.0, mpHealth-3.1, mpRestClient-2.0].
[ApplicationContainer] [AUDIT ] CWWKF0013I: The server removed the following features: [appClientSupport-1.0, appSecurity-2.0, appSecurity-3.0, batch-1.0, concurrent-1.0, distributedMap-1.0, ejb-3.2, ejbHome-3.2, ejbLite-3.2, ejbPersistentTimer-3.2, ejbRemote-3.2, j2eeManagement-1.1, jacc-1.5, jaspic-1.1, javaMail-1.6, javaee-8.0, jaxb-2.2, jaxws-2.2, jca-1.7, jcaInboundSecurity-1.0, jdbc-4.2, jms-2.0, jpa-2.2, jpaContainer-2.2, jsf-2.3, jsp-2.3, managedBeans-1.0, mdb-3.2, ssl-1.0, wasJmsClient-2.0, wasJmsSecurity-1.0, wasJmsServer-1.0, webProfile-8.0, websocket-1.1].
[ApplicationContainer] [AUDIT ] CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 12.821 seconds.
[INFO] All containers started in 16955ms
[INFO] Building rest client for class io.openliberty.guides.testing.PersonService with base path: http://localhost:35221/guide-microshed-testing/ and providers: [class org.microshed.testing.jaxrs.JsonBProvider]
Nov 08, 2022 2:46:30 PM org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean createWithValues
SEVERE: java.lang.IllegalArgumentException : io.openliberty.guides.testing.PersonService is not an interface
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 18.151 s <<< FAILURE! - in io.openliberty.guides.testing.PersonServiceIT
[ERROR] io.openliberty.guides.testing.PersonServiceIT Time elapsed: 18.149 s <<< ERROR!
java.lang.IllegalArgumentException: io.openliberty.guides.testing.PersonService is not an interface

[INFO] Running io.openliberty.guides.testing.ErrorPathIT
[INFO] Using ApplicationEnvironment class: org.microshed.testing.testcontainers.config.TestcontainersConfiguration
[INFO] All containers started in 21ms
[INFO] Building rest client for class io.openliberty.guides.testing.PersonService with base path: http://localhost:35221/guide-microshed-testing/ and providers: [class org.microshed.testing.jaxrs.JsonBProvider]
Nov 08, 2022 2:46:30 PM org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean createWithValues
SEVERE: java.lang.IllegalArgumentException : io.openliberty.guides.testing.PersonService is not an interface
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.047 s <<< FAILURE! - in io.openliberty.guides.testing.ErrorPathIT
[ERROR] io.openliberty.guides.testing.ErrorPathIT Time elapsed: 0.047 s <<< ERROR!
java.lang.IllegalArgumentException: io.openliberty.guides.testing.PersonService is not an interface

[ApplicationContainer] [INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] ErrorPathIT » IllegalArgument io.openliberty.guides.testing.PersonService is n...
[ERROR] PersonServiceIT » IllegalArgument io.openliberty.guides.testing.PersonService ...
[INFO]
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with `mvn verify` from the `finish` directory of guide-microshed-testing on Java 17, focusing on PersonServiceIT and ErrorPathIT. Trace the REST client construction for the @RESTClient-annotated PersonService and compare behavior across Java 11 and newer versions. Done means both integration tests complete without the IllegalArgumentException on supported newer Java versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.