Stopped working on IntelliJ 2019.2
Hey, just like for the original otj-pg-embedded project this fork stopped working on my system since upgrading to Mac OS 10.14.6 (latest version). The error I get is java.lang.IllegalStateException: Process [/var/folders/l_/c1b_7t2n39j48k7sbpp54zy00000gn/T/embedded-pg/PG-8eddc1e460ca1c5597350c162933683c/bin/initdb, -A, trust, -U, postgres, -D, /var/folders/l_/c1b_7t2n39j48k7sbpp54zy00000gn/T/epg3835758492450081687, -E, UTF-8] failed.
Deleting the temporary embedded-pg folder does not solve the problem. Do you have any ideas?
Hi, thanks for the report. I will try to upgrade my system and let you know.
I am still using macOS 10.14.5, but experience the same issue. I did update IntelliJ to 2019.2 though. Everything else is still the same setup compared to the last successful run.
I tried embedded-database-spring-test version 1.4.1 and 1.5.0 ... without success so far.
I also updated to IntelliJ 2019.2 so that may be related to this as well. However, my tests fail with the same error during maven install.
I ran ./gradlew clean test from IntelliJ's integrated Terminal command line view -> fail. Afterwards I ran the same command from the Apple Terminal -> scuccess.
@renedewaele Can you confirm the behaviour with maven install?
Hi, I saw the same: maven install works from the terminal but not within IntelliJ 2019.2. Really weird, but I'm glad that settles it.
Hey guys, thanks for the investigation. I did upgrade to IntelliJ 2019.2 (build IU-192.5728.98) and I'm trying to simulate the problem, but everything works fine. So, are you still experiencing the problem? Maybe some update fixed it?
@tomix26 In my case the problem is still exists. But I have two colleagues with almost the same setup (macOS 10.14.x and IntelliJ 2019.2) who don't experience the described behaviour. So it's very likely that it is some rare combination of installed programs and IntelliJ 2019.2
Edit
I just downgraded to IntelliJ 2019.1.4 and it works like a charm. So i guess it's more an IntelliJ 2019.2 issue and less an embedded-postgres issue.
I had exact problem with otj-pg-embedded and spent too many hours on the issue (downgrading IntelliJ didn't help). ./gradlew build from mac terminal worked fine but same operation from intellij terminal failed with exactly same message as in the 1st post. Problem was with locales (don't ask why). Setting these properties in ~/.bash_profile helped:
export LC_CTYPE="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
Hope this saves someone from struggles.
and if you using zsh, put these 2 exports into .zshrc file and restart Intellij
Just my 2 cents: you can also put the locale environment variables in your gradle build file like this:
test {
useJUnitPlatform()
environment "LC_CTYPE", "en_US.UTF-8"
environment "LC_ALL", "en_US.UTF-8"
}
Full answer here: https://github.com/opentable/otj-pg-embedded/issues/65#issuecomment-567860383
I am having this problem too, on all of
- MacOS terminal
- iTerm
- IntelliJ Terminal
- IntelliJ runner
with versions
- 12.0
- 12.1
- 12.5
Exporting the environment variables provided by @wiktord did not fix it for IntelliJ (2020.3), or on the MacOS terminals.
Caused by: java.lang.IllegalStateException: Process [/var/folders/pv/c91ppn_s3n36kff_5jqqkh580000gn/T/embedded-pg/PG-abc4d7798f0045b30e0a18facc5799d0/bin/initdb, -A, trust, -U, postgres, -D, /var/folders/pv/c91ppn_s3n36kff_5jqqkh580000gn/T/epg5612952893588405656, -E, UTF-8] failed
Turns out in the end that it was the missing libpq.5.dylib that was the problem for me. I have Postgres.app installed on my machine, so I just symlinked that based on this issue in the postgresql-libpq project https://github.com/lpsmith/postgresql-libpq/issues/9 and it now works. For 12.1. 12.5 still doesn't work because of
dyld: Library not loaded: @loader_path/../lib/libz.1.dylib Referenced from: /private/var/folders/pv/c91ppn_s3n36kff_5jqqkh580000gn/T/embedded-pg/PG-21706f841db941a04058ca5131a27776/lib/libxml2.2.dylib Reason: no suitable image found. Did find: file system relative paths not allowed in hardened programs no data was returned by command ""/private/var/folders/pv/c91ppn_s3n36kff_5jqqkh580000gn/T/embedded-pg/PG-21706f841db941a04058ca5131a27776/bin/postgres" -V" initdb: error: The program "postgres" is needed by initdb but was not found in the same directory as "/private/var/folders/pv/c91ppn_s3n36kff_5jqqkh580000gn/T/embedded-pg/PG-21706f841db941a04058ca5131a27776/bin/initdb". Check your installation.
@mark-anzcro This is another problem that was reported here: https://github.com/zonkyio/embedded-postgres-binaries/issues/21
This used to work for me but it has stopped working after the BigSur upgrade.
I had exact problem with otj-pg-embedded and spent too many hours on the issue (downgrading IntelliJ didn't help).
./gradlew buildfrommac terminalworked fine but same operation fromintellij terminalfailed with exactly same message as in the 1st post. Problem was with locales (don't ask why). Setting these properties in ~/.bash_profile helped: export LC_CTYPE="en_US.UTF-8" export LC_ALL="en_US.UTF-8" Hope this saves someone from struggles.
and if you using zsh, put these 2 exports into .zshrc file and restart Intellij
it works, thanks bro, you saved my day.
For those running into this on MacOS and using Maven Surefire, you can set the LC_* environment variables like so:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<reuseForks>true</reuseForks>
<environmentVariables>
<!-- required for running embedded PostgreSQL on MacOS -->
<!-- see: https://github.com/zonkyio/embedded-postgres/issues/11#issuecomment-533468269 -->
<LC_CTYPE>en_US.UTF-8</LC_CTYPE>
<LC_ALL>en_US.UTF-8</LC_ALL>
</environmentVariables>
</configuration>
</plugin>
Using the builder with the localconfig works too if you want the programmatic way.
EmbeddedPostgres pg = EmbeddedPostgres.builder()
.setLocaleConfig("locale","en_US.UTF-8")
.start()