eclipse-ee4j / eclipse-ee4j/jersey

jersey 2.40 + JAXB based XML -> HTTP Status 500 – Internal Server Error with no stacktrace

Open
#5,361 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

When an existing application is upgraded[1] to jersey v2.40, and an attempt is made to hit a previously-working endpoint using an Accept header of application/json, we get a correct response back.

If we change the Accept header to application/xml, tomcat throws a 500 internal server error as follows:

```
HTTP Status 500 – Internal Server Errorbody {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}

HTTP Status 500 – Internal Server Error


Type Status Report

Message Internal Server Error

Description The server encountered an unexpected condition that prevented it from fulfilling the request.


Apache Tomcat/9.0.65


```

The exception that triggered the 500 is not logged anywhere, and without the exception we're stuck.

The dependency tree looks like this:

```
[snip non jersey jars]
[INFO] | +- org.glassfish.jersey.core:jersey-client:jar:2.40:compile
[INFO] | +- org.glassfish.jersey.connectors:jersey-jetty-connector:jar:2.40:compile
[INFO] | +- org.eclipse.jetty:jetty-client:jar:10.0.15:compile
[INFO] | | +- org.eclipse.jetty:jetty-http:jar:10.0.15:compile
[INFO] | | | \- org.eclipse.jetty:jetty-util:jar:10.0.15:compile
[INFO] | | +- org.eclipse.jetty:jetty-io:jar:10.0.15:compile
[INFO] | | +- org.eclipse.jetty:jetty-alpn-client:jar:10.0.15:compile
[INFO] | | \- org.slf4j:slf4j-api:jar:2.0.5:compile
[INFO] | +- com.kohlschutter.junixsocket:junixsocket-jetty:jar:2.6.2:compile
[INFO] | | \- com.kohlschutter.junixsocket:junixsocket-core:pom:2.6.2:compile
[INFO] | | +- com.kohlschutter.junixsocket:junixsocket-native-common:jar:2.6.2:compile
[INFO] | | \- com.kohlschutter.junixsocket:junixsocket-common:jar:2.6.2:compile
[INFO] | +- org.bouncycastle:bcprov-jdk15on:jar:1.61:compile
[INFO] | +- org.bouncycastle:bcmail-jdk15on:jar:1.61:compile
[INFO] | | \- org.bouncycastle:bcpkix-jdk15on:jar:1.61:compile
[INFO] | +- javax.mail:mail:jar:1.4.7:compile
[INFO] | | \- javax.activation:activation:jar:1.1:compile
[INFO] | \- javax.transaction:jta:jar:1.1:compile
[snip]
[INFO] | +- javax.ws.rs:javax.ws.rs-api:jar:2.1.1:compile
[INFO] | \- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] | \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] +- org.glassfish.jersey.containers:jersey-container-servlet:jar:2.40:compile
[INFO] | +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.40:compile
[INFO] | +- org.glassfish.jersey.core:jersey-common:jar:2.40:compile
[INFO] | | \- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] | +- org.glassfish.jersey.core:jersey-server:jar:2.40:compile
[INFO] | | \- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] | \- jakarta.ws.rs:jakarta.ws.rs-api:jar:2.1.6:compile
[INFO] +- org.glassfish.jersey.media:jersey-media-moxy:jar:2.40:compile
[INFO] | +- org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.40:compile
[INFO] | +- jakarta.json:jakarta.json-api:jar:1.1.6:compile
[INFO] | +- org.glassfish:jakarta.json:jar:1.1.6:compile
[INFO] | +- org.eclipse.persistence:org.eclipse.persistence.moxy:jar:2.7.12:compile
[INFO] | | \- org.eclipse.persistence:org.eclipse.persistence.core:jar:2.7.12:compile
[INFO] | | \- org.eclipse.persistence:org.eclipse.persistence.asm:jar:9.4.0:compile
[INFO] | \- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] | \- jakarta.activation:jakarta.activation-api:jar:1.2.2:compile
[INFO] +- org.glassfish.jersey.media:jersey-media-multipart:jar:2.40:compile
[INFO] | \- org.jvnet.mimepull:mimepull:jar:1.9.15:compile
[INFO] +- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.40:compile
[INFO] | +- org.glassfish.hk2.external:jakarta.inject:jar:2.6.1:compile
[INFO] | \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.3:compile
[INFO] +- org.glassfish.jersey.inject:jersey-hk2:jar:2.40:compile
[INFO] | +- org.glassfish.hk2:hk2-locator:jar:2.6.1:compile
[INFO] | | +- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.6.1:compile
[INFO] | | +- org.glassfish.hk2:hk2-api:jar:2.6.1:compile
[INFO] | | \- org.glassfish.hk2:hk2-utils:jar:2.6.1:compile
[INFO] | \- org.javassist:javassist:jar:3.29.2-GA:compile
[INFO] +- commons-configuration:commons-configuration:jar:1.10:compile
[INFO] | +- commons-lang:commons-lang:jar:2.6:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:4.0.1:provided
[INFO] +- commons-codec:commons-codec:jar:1.16.0:compile
[INFO] \- junit:junit:jar:4.13.2:test
[INFO] \- org.hamcrest:hamcrest-core:jar:1.3:test
```

I suspect we're providing the wrong jaxb implementation.

There seem to be two different jaxb interfaces, and it's not clear which is correct:

[INFO] | \- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] | \- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile

If we had the exception, we could probably fix this.

[1] We're in dependency hell.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.