arcadedb icon indicating copy to clipboard operation
arcadedb copied to clipboard

Postgres plugin not activating on windows start file

Open Jurgen-Aquilina opened this issue 3 years ago • 23 comments

ArcadeDB Version: 21.10

JDK Version: Oracle 8

OS: Windows 10

Expected behavior

Postgres Protocol plugin started displayed.

Actual behavior

Starting ArcadeDB Server with plugins []... displayed

Steps to reproduce

server.bat -Darcadedb.server.plugins=Postgres

Jurgen-Aquilina avatar Oct 05 '21 21:10 Jurgen-Aquilina

Fond the issue, the commands are passed after the class but they should be before the Java class.

java ... %CMD_LINE_ARGS% com.arcadedb.server.ArcadeDBServer

lvca avatar Oct 05 '21 21:10 lvca

Ok, tested the unix/macosx/linux version and works. I don't have a Windows quickly to try.

Could you please get the latest distribution from git, build it (mvn clean install -DskipTests) and then:

server.bat -Darcadedb.server.plugins=Postgres:com.arcadedb.postgres.PostgresProtocolPlugin

lvca avatar Oct 05 '21 21:10 lvca

Ok, tested the unix/macosx/linux version and works. I don't have a Windows quickly to try.

Could you please get the latest distribution from git, build it (mvn clean install -DskipTests) and then:

server.bat -Darcadedb.server.plugins=Postgres:com.arcadedb.postgres.PostgresProtocolPlugin

It gives the following error now:

Error: Could not find or load main class Postgres:com.arcadedb.postgres.PostgresProtocolPlugin
Caused by: java.lang.ClassNotFoundException: Postgres:com.arcadedb.postgres.PostgresProtocolPlugin

Jurgen-Aquilina avatar Oct 05 '21 21:10 Jurgen-Aquilina

I guess : cause troubles under Windows. Could you please try this:

server.bat -Darcadedb.server.plugins="Postgres:com.arcadedb.postgres.PostgresProtocolPlugin"

lvca avatar Oct 06 '21 04:10 lvca

I guess : cause troubles under Windows. Could you please try this:

server.bat -Darcadedb.server.plugins="Postgres:com.arcadedb.postgres.PostgresProtocolPlugin"

This displays "Starting ArcadeDB Server with plugins []... displayed"

Jurgen-Aquilina avatar Oct 06 '21 08:10 Jurgen-Aquilina

I pushed a fix for that, please let me know if you can retry it after pulling from the latest version..

lvca avatar Oct 06 '21 17:10 lvca

@lvca apologies I accidentally ran it on the release distribution. On the latest commit in the main branch it results in the same error again as below:

Error: Could not find or load main class Postgres:com.arcadedb.postgres.PostgresProtocolPlugin
Caused by: java.lang.ClassNotFoundException: Postgres:com.arcadedb.postgres.PostgresProtocolPlugin

Jurgen-Aquilina avatar Oct 07 '21 10:10 Jurgen-Aquilina

The weird thing is that is trying to load the class Postgres:com.arcadedb.postgres.PostgresProtocolPlugin but it should look for com.arcadedb.postgres.PostgresProtocolPlugin. it's seems the parsing of parameters doesn't work under windows. I'm looking for a windows machine where to run our tests.

lvca avatar Oct 07 '21 16:10 lvca

Could it be that the command says Postgres:com.arcadedb.postgres.PostgresProtocolPlugin rather than com.arcadedb.postgres.PostgresProtocolPlugin? I ran the latter now but got the following error:

Error: Main method not found in class com.arcadedb.postgres.PostgresProtocolPlugin, please define the main method as:
   public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application

If you need anymore testing for windows in the short-term let me know

Jurgen-Aquilina avatar Oct 07 '21 16:10 Jurgen-Aquilina

The syntax is <plugin-name>:<class>, so it's correct Postgres:com.arcadedb.postgres.PostgresProtocolPlugin. But for some reason, it's not splitting the string.

lvca avatar Oct 07 '21 18:10 lvca

@Jurgen-Aquilina could you please retry with the latest release? Thanks in advance.

lvca avatar Oct 13 '21 18:10 lvca

@lvca I tried all the command iterations both on latest in main and latest in windows-issues, but they all return the same errors

Jurgen-Aquilina avatar Oct 14 '21 14:10 Jurgen-Aquilina

If you do this in a command prompt:

set ARCADEDB_SETTINGS=-Darcadedb.server.plugins="Postgres:com.arcadedb.postgres.PostgresProtocolPlugin"
server.bat 

Works? This sets the environment variable and let the script using that instead of receiving as an argument.

lvca avatar Oct 14 '21 16:10 lvca

Yes that loads the plugin and starts on the latest in the main branch. I will try to actually test if it works properly in the upcoming days as it's crashing due to my 5432 port being occupied by a postgres service which I cannot turn off at the moment.

Jurgen-Aquilina avatar Oct 14 '21 16:10 Jurgen-Aquilina

Thanks for the report. I've changed server.bat and now should work as for documentation.

server.bat -Darcadedb.server.plugins="Postgres:com.arcadedb.postgres.PostgresProtocolPlugin"

Please, if you can, confirm with the latest version if server.bat now manages correctly settings. Thanks.

lvca avatar Oct 16 '21 04:10 lvca

Apologies was occupied with other things. On the latest in main branch the provided command returns the ClassNotFoundException again unfortunately.

Jurgen-Aquilina avatar Oct 18 '21 18:10 Jurgen-Aquilina

Class not found with both?

  1. server.bat -Darcadedb.server.plugins="Postgres:com.arcadedb.postgres.PostgresProtocolPlugin"
  2. set ARCADEDB_SETTINGS=-Darcadedb.server.plugins="Postgres:com.arcadedb.postgres.PostgresProtocolPlugin";server.bat

lvca avatar Oct 18 '21 19:10 lvca

Class not found with 1. 2 works

Jurgen-Aquilina avatar Oct 18 '21 19:10 Jurgen-Aquilina

The latest change to server.bat was to the last line:

call %JAVA% -server %JAVA_OPTS% %ARCADEDB_OPTS_MEMORY% %JAVA_OPTS_SCRIPT% %ARCADEDB_JMX% %ARCADEDB_SETTINGS% %CMD_LINE_ARGS% -cp "%ARCADEDB_HOME%\lib\*" com.arcadedb.server.ArcadeDBServer

As you can see both %ARCADEDB_SETTINGS% and %CMD_LINE_ARGS% are before the classpath, so they should both work. Could you please check server.bat in your system the last line is like the one above? Thanks in advance.

lvca avatar Oct 18 '21 19:10 lvca

Yes my server.bat has the same line

Jurgen-Aquilina avatar Oct 18 '21 19:10 Jurgen-Aquilina

Hi @Jurgen-Aquilina any chance to retry this with the latest snapshot? Thanks in advance.

lvca avatar Nov 11 '21 17:11 lvca

Problem persists with latest from main branch (SNAPSHOT 21.11.1)

Jurgen-Aquilina avatar Nov 11 '21 18:11 Jurgen-Aquilina

Does anybody have a Windows machine that can help with this? Waiting for the final solution, this works for now: setting the plugin in ARCADEDB_SETTING environment variable and then run the server:

set ARCADEDB_SETTINGS=-Darcadedb.server.plugins="Postgres:com.arcadedb.postgres.PostgresProtocolPlugin"
bin\server.bat 

lvca avatar Jan 04 '22 23:01 lvca

For anyone trying this on Windows, note: the workaround does not work in the new Terminal, but does work in the old Command Prompt.

shasaur avatar Jan 29 '23 13:01 shasaur

There are bugs with the server.bat, for example, if I want to use a non-default databases location, it would throw errors like

.\arcadedb-23.10.1\bin\server.bat -Dserver.databaseDirectory=Z:\arcadedb\databases
...

ARCADEDB server script path = ...
ARCADEDB home directory     = ...
Error: Could not find or load main class Z:\arcadedb\databases
Caused by: java.lang.ClassNotFoundException: Z:\arcadedb\databases

Edit and add the options in the server.bat including postgres plugin settings will be fine, but such would fail with the command line.

LLuke avatar Nov 17 '23 16:11 LLuke

I'm using server.sh and it correctly instances the Postgres plugin. By the way, how can we fix the server.bat? Adding quotes for paths?

lvca avatar Nov 17 '23 17:11 lvca

I just created a PR for you https://github.com/ArcadeData/arcadedb/pull/1333 and this also fixed https://github.com/ArcadeData/arcadedb/issues/173 under windows.

LLuke avatar Nov 19 '23 08:11 LLuke