Reputation: 39
I'm getting an in-IDE error regarding the conf.register() call.
Cannot access jakarta.ws.rs.core.Configurable
I can't figure out how to fix it. I looked all over the internet and I think I have the right dependencies, so I'm not sure what might be causing the error. Here's the class where I'm making the call:
package server.api;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.media.multipart.MultiPartFeature;
import org.glassfish.jersey.test.JerseyTest;
public class FileControllerTest extends JerseyTest {
@Override
protected void configureClient(ClientConfig conf) {
conf.register(MultiPartFeature.class);
}
}
Here are the dependencies I'm using, although I'm not sure how helpful providing them is:
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-websocket'
implementation 'org.springframework:spring-test:5.3.9'
implementation 'org.glassfish.jersey.core:jersey-client:3.0.3'
implementation 'org.glassfish.jersey.media:jersey-media-multipart:3.0.3'
testImplementation 'org.glassfish.jersey.test-framework:jersey-test-framework-core:2.34'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
Upvotes: 2
Views: 5504
Reputation: 3286
This project using incompatible versions of JavaEE / JakartaEE specifications.
Jersey is Jakarta EE compatible since 3.0.0. (used version is 3.0.3). That means this version of Jersey is on jakarta.*
namespace.
But used Spring version (5.3.9) is still on JavaEE (javax.*
) namespace.
Finally, Jersey's test framework with that version (2.34) is still on JavaEE (javax.*
) namespace.
JakartaEE 9 has a lot of breaking changes to JavaEE 8.
So pick only one version of these specifications and use compatible dependencies.
Personally, I prefer JakartaEE 9. But this case it takes a great effort, because all production code has to be migrated. So, if it is possible, try to upgrade to SpringFramework 6 / Sping Boot 3 and Jersey 3, otherwise just downgrade Jersey's dependency to 2.x
Upvotes: 4