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

Duplicate package export: jnr.enxio.channels #58

Closed
JulianSchuette opened this issue Sep 4, 2018 · 3 comments
Closed

Duplicate package export: jnr.enxio.channels #58

JulianSchuette opened this issue Sep 4, 2018 · 3 comments
Milestone

Comments

@JulianSchuette
Copy link

In its MANIFST.MF, jnr-unixsocket exports package jnr.enxio.channels. However, the same package is exported by its dependency bundle jnr-enxio.
This results in ClassNotFoundExceptions in OSGi environments because the class loader will bind exclusively to one bundle and thus fail to load classes from the other bundle. See section 3.6.6 in the OSGi spec [1], for instance.

A clean fix would be splitting the classes in jnr-unixsocket -> jnr.enxio.channels and jnr-enxio -> jnr.enxio.channels into two different packages, e.g. jnr.enxio.channels.api and jnr.enxio.channels.impl.

A workaround without modifying package names could be to use Require-Bundle: jnr-enxio in MANIFEST.MF of jnr-unixsocket.

[1] https://osgi.org/specification/osgi.core/7.0.0/framework.module.html

JulianSchuette added a commit to Fraunhofer-AISEC/trusted-connector that referenced this issue Sep 10, 2018
jnr-unixsocket exports package "jnr.enxio.channels" from multiple
packages. See issue jnr/jnr-unixsocket#58

The workaround uses DynamicImport-Package to cowboy-resolve classes at
runtime. Slower and a bit rough but an easy fix.
@guenhter
Copy link

guenhter commented Oct 8, 2018

Also happens for Java 9:

Error:java: the unnamed module reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio

Looking forward to see this fixed.

@headius
Copy link
Member

headius commented Jan 10, 2019

This definitely needs to be fixed. I don't think there's any reason it needs to use the enxio package.

@headius
Copy link
Member

headius commented Feb 11, 2019

Ok, part of the problem is that it used this package to gain access to the package-private Native class from jnr-enxio. For simpliciy, I'm just going to make a release of enxio with that class public, since all it really does is bind some libc IO functions. Obviously the right fix (hopefully someone can assist) would be to make jnr-unixsocket just use jnr-enxio or jnr-posix to handle the actual FFI bindings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants