Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

AddJaxwsRuntime blindly injects com.sun.xml.ws:jaxws-rt into projects using Apache CXF

Abierto
#1,314 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java
Área
backend

Línea de trabajo

Start by reading AddJaxwsRuntime.java and the AddJaxwsRuntimeMaven recipe, then inspect its tests for dependency detection. Reproduce with the provided Maven project using Apache CXF's cxf-rt-frontend-jaxws dependency. Done means the recipe avoids adding com.sun.xml.ws:jaxws-rt when an alternative JAX-WS runtime is already present, with a test covering that case.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

I checked out all relevant OpenRewrite repo's, fed the AI with existing recipe name and a very careful description. Antigravity with Vertex / Gemini was then tasked to check and test. .Also to create a ticket for it, using your default template. The result is shown beneath.

What version of OpenRewrite are you using?

  • rewrite-maven-plugin: 6.500
  • rewrite-migrate-java: 3.49.0
  • Recipe: org.openrewrite.java.migrate.javax.AddJaxwsRuntime (AddJaxwsRuntimeMaven)

How are you running OpenRewrite?

Maven plugin on a multi-module Maven project running UpgradeToJava21 (or UpgradeToJava11 / UpgradeToJava17):

What is the smallest, simplest way to reproduce the problem?

Create a project that uses Apache CXF for JAX-WS web services:

pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.sample</groupId>
    <artifactId>cxf-sample</artifactId>
    <version>1.0.0</version>
    <dependencies>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>3.5.5</version>
        </dependency>
    </dependencies>
</project>

Run:

mvn rewrite:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:LATEST -Drewrite.activeRecipes=org.openrewrite.java.migrate.javax.AddJaxwsRuntime

What did you expect to see?

pom.xml should not be modified.

Apache CXF provides its own JAX-WS implementation and runtime. It does not require or use the Sun/Metro reference implementation (com.sun.xml.ws:jaxws-rt).

What did you see instead?

OpenRewrite injects Sun's JAX-WS runtime into pom.xml:

<dependency>
  <groupId>com.sun.xml.ws</groupId>
  <artifactId>jaxws-rt</artifactId>
  <version>2.3.x</version>
  <scope>provided</scope>
</dependency>
Root Cause

In AddJaxwsRuntime.java (AddJaxwsRuntimeMaven), the recipe checks whether jakarta.xml.ws:jakarta.xml.ws-api exists in transitive dependencies. If found, it checks only whether com.sun.xml.ws:jaxws-rt is absent.

Because Apache CXF brings in jakarta.xml.ws-api transitively, AddJaxwsRuntimeMaven assumes the project lacks a JAX-WS runtime and blindly injects com.sun.xml.ws:jaxws-rt.

This causes classpath pollution and conflicting JAX-WS SPI provider entries (META-INF/services/javax.xml.ws.spi.Provider) between Apache CXF and Sun's runtime.

Proposed Fix

Before adding com.sun.xml.ws:jaxws-rt, check whether an alternative JAX-WS runtime is already present on the classpath (e.g. org.apache.cxf:cxf-rt-frontend-jaxws, org.apache.cxf:cxf-rt-transports-http, or Spring WS).

What is the full stack trace of any errors you encountered?

N/A (semantic defect resulting in conflicting dependency injection).

Lenguaje dominante
Java
Estrellas
159
Forks
130
Merge medio
7 h 49 min
PR fusionados (30 d)
60

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de openrewrite/rewrite-migrate-java

Todos los issues de openrewrite/rewrite-migrate-java

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.