Skip to content

Docker build fails with postgres persistence: dnsjava error: Provider org.xbill.DNS.spi.DnsjavaInetAddressResolverProvider not found #583

@offbeatport

Description

@offbeatport

Describe the bug

Dockerfile build fails with dnsjava error

To Reproduce

  1. Create a new "persistence.xml" file with configuration form here: https://polaris.apache.org/in-dev/unreleased/metastores/#postgres

  2. Inside the Dockerfile use this:

ARG ECLIPSELINK="true"
ARG ECLIPSELINK_DEPS="org.postgresql:postgresql:42.7.4"

WORKDIR /app

RUN rm -rf build
RUN ./gradlew --no-daemon --info ${ECLIPSELINK_DEPS+"-PeclipseLinkDeps=$ECLIPSELINK_DEPS"} -PeclipseLink=$ECLIPSELINK clean prepareDockerDist

COPY ./persistence.xml /app
RUN jar cvf /app/persistence-conf.jar persistence.xml

  1. Inside polaris-server.yml use this:
metaStoreManager:
  type: eclipse-link
  conf-file: /app/persistence-conf.jar!/persistence.xml
  persistence-unit: polaris
  1. Build the image:
$ docker build .

Actual Behavior

This is the error I'm getting:

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
[EL Warning]: metadata: 2024-12-19 11:06:08.715--ServerSession(995911260)--You have specified multiple ids for the entity class [org.apache.polaris.jpa.models.ModelEntityChangeTracking] without specifying an @IdClass. By doing this you may lose the ability to find by identity, distributed cache support etc. Note: You may however use EntityManager find operations by passing a list of primary key fields. Else, you will have to use JPQL queries to read your entities. For other id options see @PrimaryKey.
[EL Warning]: metadata: 2024-12-19 11:06:08.725--ServerSession(995911260)--You have specified multiple ids for the entity class [org.apache.polaris.jpa.models.ModelGrantRecord] without specifying an @IdClass. By doing this you may lose the ability to find by identity, distributed cache support etc. Note: You may however use EntityManager find operations by passing a list of primary key fields. Else, you will have to use JPQL queries to read your entities. For other id options see @PrimaryKey.
[EL Warning]: metadata: 2024-12-19 11:06:08.726--ServerSession(995911260)--You have specified multiple ids for the entity class [org.apache.polaris.jpa.models.ModelEntity] without specifying an @IdClass. By doing this you may lose the ability to find by identity, distributed cache support etc. Note: You may however use EntityManager find operations by passing a list of primary key fields. Else, you will have to use JPQL queries to read your entities. For other id options see @PrimaryKey.
[EL Warning]: metadata: 2024-12-19 11:06:08.727--ServerSession(995911260)--You have specified multiple ids for the entity class [org.apache.polaris.jpa.models.ModelEntityActive] without specifying an @IdClass. By doing this you may lose the ability to find by identity, distributed cache support etc. Note: You may however use EntityManager find operations by passing a list of primary key fields. Else, you will have to use JPQL queries to read your entities. For other id options see @PrimaryKey.
[EL Warning]: metadata: 2024-12-19 11:06:08.728--ServerSession(995911260)--You have specified multiple ids for the entity class [org.apache.polaris.jpa.models.ModelEntityDropped] without specifying an @IdClass. By doing this you may lose the ability to find by identity, distributed cache support etc. Note: You may however use EntityManager find operations by passing a list of primary key fields. Else, you will have to use JPQL queries to read your entities. For other id options see @PrimaryKey.
[EL Info]: 2024-12-19 11:06:08.783--ServerSession(995911260)--EclipseLink, version: Eclipse Persistence Services - 4.0.4.v202407190748-059428cdd2583c46f1f3e50d235854840a6fa9a7
[EL Severe]: ejb: 2024-12-19 11:06:08.804--ServerSession(995911260)--java.util.ServiceConfigurationError: java.net.spi.InetAddressResolverProvider: Provider org.xbill.DNS.spi.DnsjavaInetAddressResolverProvider not found
jakarta.persistence.PersistenceException: java.util.ServiceConfigurationError: java.net.spi.InetAddressResolverProvider: Provider org.xbill.DNS.spi.DnsjavaInetAddressResolverProvider not found
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:855)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:226)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:203)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getDatabaseSession(EntityManagerFactoryImpl.java:534)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:153)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:191)
	at jakarta.persistence.Persistence.createEntityManagerFactory(Persistence.java:80)
	at org.apache.polaris.extension.persistence.impl.eclipselink.PolarisEclipseLinkMetaStoreSessionImpl.createEntityManagerFactory(PolarisEclipseLinkMetaStoreSessionImpl.java:185)
	at org.apache.polaris.extension.persistence.impl.eclipselink.PolarisEclipseLinkMetaStoreSessionImpl.<init>(PolarisEclipseLinkMetaStoreSessionImpl.java:122)
	at org.apache.polaris.extension.persistence.impl.eclipselink.EclipseLinkPolarisMetaStoreManagerFactory.createMetaStoreSession(EclipseLinkPolarisMetaStoreManagerFactory.java:62)
	at org.apache.polaris.extension.persistence.impl.eclipselink.EclipseLinkPolarisMetaStoreManagerFactory.createMetaStoreSession(EclipseLinkPolarisMetaStoreManagerFactory.java:37)
	at org.apache.polaris.core.persistence.LocalPolarisMetaStoreManagerFactory.lambda$initializeForRealm$0(LocalPolarisMetaStoreManagerFactory.java:78)
	at org.apache.polaris.core.persistence.LocalPolarisMetaStoreManagerFactory.checkPolarisServiceBootstrappedForRealm(LocalPolarisMetaStoreManagerFactory.java:223)
	at org.apache.polaris.core.persistence.LocalPolarisMetaStoreManagerFactory.getOrCreateMetaStoreManager(LocalPolarisMetaStoreManagerFactory.java:128)
	at org.apache.polaris.core.persistence.LocalPolarisMetaStoreManagerFactory.purgeRealms(LocalPolarisMetaStoreManagerFactory.java:110)
	at org.apache.polaris.service.dropwizard.PurgeRealmsCommand.run(PurgeRealmsCommand.java:46)
	at org.apache.polaris.service.dropwizard.PurgeRealmsCommand.run(PurgeRealmsCommand.java:30)
	at io.dropwizard.core.cli.ConfiguredCommand.run(ConfiguredCommand.java:98)
	at io.dropwizard.core.cli.Cli.run(Cli.java:78)
	at io.dropwizard.core.Application.run(Application.java:94)
	at org.apache.polaris.service.dropwizard.PolarisApplication.main(PolarisApplication.java:153)
Caused by: java.util.ServiceConfigurationError: java.net.spi.InetAddressResolverProvider: Provider org.xbill.DNS.spi.DnsjavaInetAddressResolverProvider not found
	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1219)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
	at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
	at java.base/java.util.ServiceLoader.findFirst(ServiceLoader.java:1812)
	at java.base/java.net.InetAddress.loadResolver(InetAddress.java:508)
	at java.base/java.net.InetAddress.resolver(InetAddress.java:488)
	at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1826)
	at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:1139)
	at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1818)
	at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1688)
	at java.base/java.net.InetAddress.getByName(InetAddress.java:1568)
	at java.base/java.net.InetSocketAddress.<init>(InetSocketAddress.java:230)
	at org.postgresql.core.PGStream.createSocket(PGStream.java:258)
	at org.postgresql.core.PGStream.<init>(PGStream.java:121)
	at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:140)
	at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:268)
	at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54)
	at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:273)
	at org.postgresql.Driver.makeConnection(Driver.java:446)
	at org.postgresql.Driver.connect(Driver.java:298)
	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:683)
	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:191)
	at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:102)
	at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:174)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.setOrDetectDatasource(DatabaseSessionImpl.java:226)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:809)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:259)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:770)
	... 20 more
npm ERR! Lifecycle script `purge` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: [email protected]
npm ERR!   at location: /Users/vladpalos/Development/PolarBase/apps/polaris

Expected Behavior

No response

Additional context

It works fine with the h2 persistence configuration.

System information

macos / openjdk-21 (redhat)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions