facto icon indicating copy to clipboard operation
facto copied to clipboard

Errors when trying to setup with given commands in Readme

Open misteu opened this issue 1 year ago • 7 comments

I uploaded everything to my webserver, created a mariaDB database + installed Java (because my debian did not have it yet) but the setup does not work for me.

Are the commands in the Readme up to date?

I tried these

# Create database tables
bin/server -DdropAndCreateNewDb

# Create admin user
bin/server -DcreateAdminUser

# Run application
bin/server

But already the first throws a lot of errors. I am not quite sure what to look for.

E.g.: One error marked red says "[error] application - Error when parsing accounting-config.yml: java.nio.charset.MalformedInputException: Input length = 1"

Really looking forward to you reply as I'm really interested in trying this tool :)

misteu avatar Apr 16 '23 19:04 misteu

Are the commands in the Readme up to date?

Yes, they should be working.

E.g.: One error marked red says "[error] application - Error when parsing accounting-config.yml: java.nio.charset.MalformedInputException: Input length = 1"

Looks like the server cannot parse accounting-config.yml. A quick search on the error seems to indicate that it is some kind of encoding issue. Can you try to change the file's encoding to utf-8? Or can you share the file here?

nymanjens avatar Apr 17 '23 06:04 nymanjens

Hi, thanks for the quick reply!

checked the encoding using file, it says:

conf/accounting-config.yml: UTF-8 Unicode text

Regarding the contents of it, I did not change anything of it. It's the same that is in the release's zip archive.

misteu avatar Apr 17 '23 19:04 misteu

I tried to reproduce this with the following steps:

  • Download and unpack the latest release
  • In application.conf: Configure the database and change play.http.secret.key
  • Run bin/server -DdropAndCreateNewDb and the subsequent commands

This all works fine.

Could you give me the steps you're doing to reproduce this?

nymanjens avatar Apr 19 '23 07:04 nymanjens

OK, I'm doing it right now:

  • downloaded archived release
  • unpacked on my machine and renamed the folder to facto
  • uploaded it to my webserver's /var/www/ via FTP
  • logged into my webserver via ssh
  • created the database, user and granted privileges to user using this guide: https://linuxhint.com/create-mariadb-user/
  • opened the config via nano conf/application.conf
  • changed db.default.url="jdbc:mysql://localhost/facto?user=mysqluser&password=mysqlpassword" to contain the username + password set in the previous step
  • did choose some random values for play.http.secret.key and app.setup.defaultPassword
  • saved everything
  • running bin/server -DdropAndCreateNewDb-> permission denied
  • running chmod -R 775 for all the three subdirectories in my facto folder -> something happens
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/var/www/facto/lib/com.google.inject.guice-4.1.0.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[info] application - Creating Pool for datasource 'default'
[info] p.a.d.DefaultDBApi - Database [default] connected at **********

after that a lot of errors are appearing, starting with: application - Error when parsing accounting-config.yml: java.nio.charset.MalformedInputException: Input length = 1

I will try now different encodings (other than UTF-8) as described here: https://stackoverflow.com/questions/26268132/all-inclusive-charset-to-avoid-java-nio-charset-malformedinputexception-input

misteu avatar Apr 19 '23 18:04 misteu

OK no idea where I should continue. I'm unwilling to just randomly try other file encoding.

Maybe anything of my VPS setup (Java, etc) is different or incompatible? Let me know if you have any other ideas.

misteu avatar Apr 19 '23 18:04 misteu

On your Unix machine, could you please run the following code:

mkdir facto
cd facto
wget https://github.com/nymanjens/facto/releases/download/v3.70/release-v3.70.tar.gz
tar -xf release-v3.70.tar.gz

echo '
  play {
    http.secret.key="abcabcabcabcabcabcabcabc"
    i18n.langs = ["en"] # Supported: "en" and "nl"
    http.session.maxAge = 60d
  }
  db.default {
    # In memory database
    slick.profile = "slick.jdbc.H2Profile$"
    driver = org.h2.Driver
    url = "jdbc:h2:mem:test1"
    connectionPool = disabled
    keepAliveConnection = true
    logStatements = true
  }
  app {
    accounting.configYamlFilePath = "conf/accounting-config.yml"
    setup.defaultPassword = "changeme"
  }
' > conf/application.conf

bin/server -Dhttp.port=9007

It starts the server with an In memory databse. It's useless for production, but it should help us narrow down what's wrong with accounting-config.yml.

nymanjens avatar Apr 20 '23 08:04 nymanjens

For me it fixed running it with LC_ALL=C.UTF-8 LANG=C.UTF-8 bin/server

Logfro avatar Jan 11 '24 21:01 Logfro