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

Error - class com.sun.xml.ws.spi.ProviderImpl cannot be cast to class jakarta.xml.ws.spi.Provider #117

Closed
hariraogotit opened this issue Aug 8, 2024 · 2 comments
Labels
for: stackoverflow A question that is better suited to stackoverflow.com

Comments

@hariraogotit
Copy link

Team,
A favour please!

I am moving from io.mateo.cxf-codegen - 1.0.3 to io.mateo.cxf-codegen 2.4.0

I am using Java 21 and Spring boot 3.3

When I run the application I get

class com.sun.xml.ws.spi.ProviderImpl cannot be cast to class jakarta.xml.ws.spi.Provider

I played around the dependencies

If I replace 'com.sun.xml.ws:jaxws-rt' from 2.3.1 to 2.3.7 I get ValidationEventLocator not found exception. It belongs to javax.xml.bind:jaxb-api:2.3.1 jar.

I have cxfCodegen 'javax.xml.bind:jaxb-api:2.3.1' declared already. Again if I add implementaion 'javax.xml.bind:jaxb-api:2.3.1' I get duplicate boot jar exception.

Very similar to https://stackoverflow.com/questions/77332934/unable-to-create-provider-class-com-sun-xml-ws-spi-providerimpl-cannot-be-cast

but mine is Jakarta

Any help is much appreciated. I don't see anything related in https://ciscoo.github.io/cxf-codegen-gradle/docs/current/user-guide/

Apologies if I overlooked anything.

@github-actions github-actions bot added the status: new An issue that has not been reviewed yet label Aug 8, 2024
@hariraogotit
Copy link
Author

hariraogotit commented Aug 9, 2024

java.lang.ClassCastException: class com.sun.xml.ws.spi.ProviderImpl cannot be cast to class jakarta.xml.ws.spi.Provider

I have been with the above error for couple of days now.

image image

@ciscoo ciscoo removed the status: new An issue that has not been reviewed yet label Aug 10, 2024
@ciscoo
Copy link
Owner

ciscoo commented Aug 10, 2024

This isn't an issue with the io.mateo.cxf-codegen plugin specifically, but rather dependency management on the application side. You need to ensure you are using the correct set of dependencies to generate code that aligns with your requirements. As called out in the documentation:

You will need to ensure the version of CXF you specify is compatible with the options used and your application’s version of Jakarta EE (Java EE).

Additionally, depending on the version of you CXF you specify, you will also need to ensure you have the appropriate dependencies for the cxfCodegen classpath and/or your application’s classpath.

Failure to do so can result in an error during code generation and/or compilation errors.

Version 1.0.x of the plugin were based on Apache CXF 3.5.x which in turn was based on the older Java EE specifications. Versions 2.1.x are based on Apache CXF 4.0.x which is based on Jakarta EE 9.1. You can get a full list of dependencies on the build classpath using ./gradlew buildEnvironment, as mentioned in the documentation, several dependencies are added already.

The issues you are facing are better suited to Stack Overflow. This issue tracker is primarily for bugs and enhancements for the io.mateo.cxf-codegen plugin, not application issues. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug with the code generation from io.mateo.cxf-codegen plugin specifically.

@ciscoo ciscoo closed this as completed Aug 10, 2024
@ciscoo ciscoo added the for: stackoverflow A question that is better suited to stackoverflow.com label Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: stackoverflow A question that is better suited to stackoverflow.com
Projects
None yet
Development

No branches or pull requests

2 participants