0

I'm using embedded PostgreSQL with Java 11 for integration testing. On Windows it runs fine, but on Mac it first downloads Mac OS binaries (which is expected):

Extract /Users/fubar/.embedpostgresql/postgresql-11.1-1-osx-binaries.zip START

But then it fails with the following stacktrace:

java.lang.NoSuchFieldException: handle
at java.base/java.lang.Class.getDeclaredField(Class.java:2411)
at de.flapdoodle.embed.process.runtime.Processes.windowsProcessId(Processes.java:109)
at de.flapdoodle.embed.process.runtime.Processes.access$200(Processes.java:51)
at de.flapdoodle.embed.process.runtime.Processes$PidHelper$2.getPid(Processes.java:209)

When I look into Processes source code I see that internally it uses PidHelper.LEGACY, that fails the first attempt to obtain pid via unixLikeProcessId().

Could anyone, please, give a hint why this is happenning or how to fix that?

xuesheng
  • 3,396
  • 2
  • 29
  • 38
  • 2
    I don't know anything about Embedded Progress. Have you checked their issue tracker to see if there is a newer version that fixes this issue? The Process::pid method is the simplest way to get the pid since JDK 9. – Alan Bateman Jun 15 '19 at 06:52

1 Answers1

0

Logs revealed the following:

Possibly failed to run initdb:
initdb: invalid locale name "en-US"

So the initdb failed, PostgeSQL instance didn't start and didn't create a postmaster.pid file, which all led to the error above.

The problem was in locale that was configured via additionalInitDbParams=[--locale=en-US, -EUTF8].

xuesheng
  • 3,396
  • 2
  • 29
  • 38