You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "pjfanning (via GitHub)" <gi...@apache.org> on 2026/10/23 11:23:07 UTC
[PR] fix: fail fast when both Jackson serializer modules are on the classpath [pekko]
pjfanning opened a new pull request, #3673:
URL: https://github.com/apache/pekko/pull/3673
### Motivation
`pekko-serialization-jackson` and `pekko-serialization-jackson3` register serializers with the same names (`jackson-json`, `jackson-cbor`, `jackson-cbor-264`) and identifiers (31/33/32). If both jars are on the classpath, whichever `reference.conf` is merged last silently takes over the bindings of both modules, including the other module's `JsonSerializable` / `CborSerializable` markers.
This is an alternative to renaming the Jackson 3 serializers and giving them new identifiers. It keeps identifier 31/33 wire compatibility when swapping the Jackson 2 module for the Jackson 3 one. The trade-off is that the two modules cannot be used in the same runtime, so a gradual Jackson 2 → 3 migration, or combining libraries that depend on different modules, is not supported.
### Modification
- Both `JacksonSerializer` implementations check in their constructor whether the other module's `JacksonSerializer` class is on the classpath, and throw an `IllegalStateException` that names both modules if it is. Serializers are created eagerly by `Serialization`, so this fails ActorSystem startup.
- The Jackson serialization docs mention the startup failure.
### Result
Having both modules on the classpath fails fast with a clear error. Before, bindings were silently misrouted.
### Tests
- `sbt "serialization-jackson/testOnly *JacksonModuleClasspathCheckSpec *JacksonJsonSerializerSpec" "serialization-jackson3/testOnly *JacksonModuleClasspathCheckSpec *JacksonJsonSerializerSpec"`: passed (98 and 96 tests)
- `scalafmt` and `headerCreateAll` run for the changed files
- MiMa not run: only an addition to a `private[pekko]` `@InternalApi` object
### References
Refs #3671
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] fix: fail fast when both Jackson serializer modules are on the classpath [pekko]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning merged PR #3673:
URL: https://github.com/apache/pekko/pull/3673
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org