slavaz / embedded-postgresql-maven-plugin

Embedded PostgreSQL Maven Plugin
13 stars 11 forks source link

Fails to bootup on Mac OS X #8

Closed DamienOReilly closed 6 years ago

DamienOReilly commented 6 years ago

Hitting a null pointer after the extraction is done:

Extract /Users/user/.embedpostgresql/postgresql-9.5.7-1-osx-binaries.zip START
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Extract /Users/user/.embedpostgresql/postgresql-9.5.7-1-osx-binaries.zip DONE
Exception in thread "postgres-embedded" java.lang.RuntimeException: Invocation of method startPostgres threw exception
    at com.github.slavaz.maven.plugin.postgresql.embedded.psql.IsolatedPgInstanceManager.invokeStaticMethod(IsolatedPgInstanceManager.java:80)
    at com.github.slavaz.maven.plugin.postgresql.embedded.psql.IsolatedPgInstanceManager.lambda$start$0(IsolatedPgInstanceManager.java:28)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.github.slavaz.maven.plugin.postgresql.embedded.psql.IsolatedPgInstanceManager.invokeStaticMethod(IsolatedPgInstanceManager.java:76)
    ... 2 more
Caused by: java.lang.NullPointerException
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1012)
    at de.flapdoodle.embed.process.runtime.ProcessControl.start(ProcessControl.java:205)
    at de.flapdoodle.embed.process.runtime.AbstractProcess.(AbstractProcess.java:98)
    at ru.yandex.qatools.embed.postgresql.AbstractPGProcess.(AbstractPGProcess.java:19)
    at ru.yandex.qatools.embed.postgresql.PostgresProcess.(PostgresProcess.java:68)
    at ru.yandex.qatools.embed.postgresql.PostgresExecutable.start(PostgresExecutable.java:25)
    at ru.yandex.qatools.embed.postgresql.PostgresExecutable.start(PostgresExecutable.java:13)
    at de.flapdoodle.embed.process.runtime.Executable.start(Executable.java:101)
    at com.github.slavaz.maven.plugin.postgresql.embedded.psql.PgInstanceManager.start(PgInstanceManager.java:30)
    at com.github.slavaz.maven.plugin.postgresql.embedded.psql.IsolatedPgInstanceManager.startPostgres(IsolatedPgInstanceManager.java:49)
    ... 7 more
slavaz commented 6 years ago

I need steps to reproduce.

Would you please share values for: pgServerVersion, pgHost, pgPort, dbName, userName, password, pgDatabaseDir, pgLocale, pgCharset?

DamienOReilly commented 6 years ago

Sure thing, I haven't specified all properties. I just worked of the README example.

 <pgServerVersion>9.5</pgServerVersion>
 <pgServerPort>5432</pgServerPort>
 <dbName>postgres</dbName>
 <userName>test</userName>
 <password>test</password>
jasonfagan commented 6 years ago

I had a look into this and the cause is a missing pgHost configuration, if this is not set then the java.lang.ProcessBuilder::startmethod will throw a NPE as one of the arguments is null.

The solution for now is to add pgHost like so

 <pgServerVersion>9.5</pgServerVersion>
 <pgServerPort>5432</pgServerPort>
 <pgHost>localhost</pgHost>
 <dbName>postgres</dbName>
 <userName>test</userName>
 <password>test</password>

Having the plugin default to localhost would be a good fix for the long run.

slavaz commented 6 years ago

I've created the branch: https://github.com/slavaz/embedded-postgresql-maven-plugin/pull/9 Are you able to check it?

jasonfagan commented 6 years ago

Tested without pgHost set and all works fine. Thanks for fixing so quickly.

slavaz commented 6 years ago

Released new version 1.2.2: [INFO] Uploaded: https://oss.sonatype.org:443/service/local/staging/deployByRepositoryId/comgithubslavaz-1008/com/github/slavaz/embedded-postgresql-maven-plugin/1.2.2/embedded-postgresql-maven-plugin-1.2.2-javadoc.jar

Just wait above a day - need to update all Maven mirrors...