1

I had this working with a previous, snapshot version of structr - I wish to use an existing Neo4j installation via Structr and NOT Structr's embedded graph db.

Set-up is :

  • Windows 10
  • Neo4j 3.2.5
  • Structr 2.1.3

After structr starts, it creates a structr.conf file with only entry as superuser.password = somehash

I added the following entry, as I did previously :

superuser.password = somehash

#############################################################################
# Neo4j server settings
#############################################################################

# With driver 'org.structr.bolt.BoltDatabaseService'
# and driver mode 'remote' Structr won't start a Neo4j database
database.driver = org.structr.bolt.BoltDatabaseService
database.driver.mode = remote

database.connection.url = bolt://localhost:7687
database.connection.username = neo4j
database.connection.password = password

Now when I start structr, the admin credentials don't work, the console says :

INFO  org.structr.rest.auth.AuthHelper - No principal found for eMail admin
21:35:08.273 [qtp180489140-23] INFO  o.s.websocket.command.LoginCommand - Unable to login admin, probably wrong password

*********Edit-1*********

I can log-in the db browser with admin credentials

enter image description here

The console output when the structr is started :

java -cp lib/*;structr-ui-2.1.3-201706220925.909fa.jar org.structr.Server
21:04:32,158 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
21:04:32,160 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
21:04:32,161 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/P:/Software/IDE/DB/structr-2.1.3/lib/structr-ui-2.1.3.jar!/logback.xml]
21:04:32,171 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
21:04:32,172 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/P:/Software/IDE/DB/structr-2.1.3/lib/structr-ui-2.1.3.jar!/logback.xml]
21:04:32,172 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/P:/Software/IDE/DB/structr-2.1.3/structr-ui-2.1.3-201706220925.909fa.jar!/logback.xml]
21:04:32,272 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@46238e3f - URL [jar:file:/P:/Software/IDE/DB/structr-2.1.3/lib/structr-ui-2.1.3.jar!/logback.xml] is not of type file
21:04:32,683 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
21:04:32,712 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
21:04:32,721 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
21:04:32,727 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
21:04:32,779 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.structr] to INFO
21:04:32,779 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
21:04:32,779 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
21:04:32,779 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
21:04:32,789 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@6e2c9341 - Registering current configuration as safe fallback point

21:04:32.804 [main] INFO  org.structr.Server - Starting server instance
21:04:32.892 [main] INFO  org.structr.core.app.StructrApp - Reading structr.conf..
log4j:WARN No appenders could be found for logger (org.apache.commons.configuration.PropertiesConfiguration).
log4j:WARN Please initialize the log4j system properly.
21:04:33.586 [main] INFO  o.structr.api.service.LicenseManager - Host ID is bbb22b8bc5944fc3ffd95f070c5789fd
21:04:33.586 [main] INFO  o.structr.api.service.LicenseManager - Checking Structr license..
21:04:33.589 [main] INFO  o.structr.api.service.LicenseManager - Running Community Edition with modules [core, rest, ui].
21:04:33.589 [main] INFO  o.structr.api.service.LicenseManager - Evaluation License
21:04:34.897 [main] INFO  o.s.module.JarConfigurationProvider - Activating module core
21:04:36.130 [main] INFO  o.s.module.JarConfigurationProvider - Activating module rest
21:04:37.271 [main] INFO  o.s.module.JarConfigurationProvider - Activating module ui
21:04:37.507 [main] INFO  o.s.module.JarConfigurationProvider - 24 JARs scanned
21:04:37.508 [main] INFO  org.structr.core.app.StructrApp - Starting services..
21:04:37.508 [main] INFO  org.structr.core.app.StructrApp - Creating NodeService..
21:04:38.411 [main] INFO  org.structr.bolt.BoltDatabaseService - Node cache size set to 100000
21:04:38.412 [main] INFO  org.structr.bolt.BoltDatabaseService - Relationship cache size set to 100000
21:04:38.413 [main] INFO  org.structr.core.graph.NodeService - Database driver loaded.
21:04:39.039 [main] INFO  org.structr.core.app.StructrApp - Creating AgentService..
21:04:39.040 [main] ERROR org.structr.core.app.StructrApp - Configured service AgentService is not part of the currently licensed Structr Edition.
21:04:39.041 [main] INFO  org.structr.core.app.StructrApp - Creating CronService..
21:04:39.045 [main] ERROR org.structr.core.app.StructrApp - Configured service CronService is not part of the currently licensed Structr Edition.
21:04:39.045 [main] INFO  org.structr.core.app.StructrApp - Creating SchemaService..
21:04:39.047 [main] INFO  org.structr.core.app.StructrApp - Creating HttpService..
21:04:39.048 [main] INFO  org.structr.rest.service.HttpService - Running in asynchronous mode
21:04:39.136 [main] INFO  org.eclipse.jetty.util.log - Logging initialized @18425ms
21:04:39.454 [main] INFO  org.structr.rest.service.HttpService - Adding servlet org.structr.rest.servlet.JsonRestServlet-3b4d50b@7547473c==org.structr.rest.servlet.JsonRestServlet,1,true for /structr/rest/*
21:04:39.456 [main] INFO  org.structr.rest.service.HttpService - Adding servlet org.structr.web.servlet.HtmlServlet-476ee5b3@2123a164==org.structr.web.servlet.HtmlServlet,2,true for /structr/html/*
21:04:39.459 [main] INFO  org.structr.rest.service.HttpService - Adding servlet org.structr.websocket.servlet.WebSocketServlet-7cd4a4d7@5154ec46==org.structr.websocket.servlet.WebSocketServlet,3,true for /structr/ws/*
21:04:39.460 [main] INFO  org.structr.rest.service.HttpService - Adding servlet org.structr.web.servlet.UploadServlet-18da4dd@beda4369==org.structr.web.servlet.UploadServlet,4,true for /structr/upload/*
21:04:39.461 [main] INFO  org.structr.rest.service.HttpService - Starting Structr 2.1 (host=0.0.0.0:8082, maxIdleTime=30000, requestHeaderSize=8192)
21:04:39.462 [main] INFO  org.structr.rest.service.HttpService - Base path ./
21:04:39.463 [main] INFO  org.structr.rest.service.HttpService - Structr 2.1 started at http://0.0.0.0:8082
21:04:39.474 [main] INFO  org.eclipse.jetty.server.Server - jetty-9.2.9.v20150224
21:04:39.750 [main] INFO  / - org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: loaded (conf ok)
21:04:40.399 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@7915bca3{/,[file:/P:/Software/IDE/DB/structr-2.1.3/, jar:file:/P:/Software/IDE/DB/structr-2.1.3/lib/structr-rest-2.1.3.jar!/],AVAILABLE}
21:04:40.399 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.s.h.ContextHandler@68d651f2{/structr,null,AVAILABLE}
21:04:40.437 [main] INFO  o.e.jetty.server.ServerConnector - Started ServerConnector@3d96fa9e{HTTP/1.1}{0.0.0.0:8082}
21:04:40.439 [main] INFO  org.eclipse.jetty.server.Server - Started @19728ms
21:04:40.445 [main] INFO  org.structr.core.app.StructrApp - 3 service(s) processed
21:04:40.446 [main] INFO  org.structr.core.app.StructrApp - Registering shutdown hook.
21:04:45.817 [pool-3-thread-1] INFO  o.s.schema.compiler.NodeExtender - Successfully compiled 10 dynamic entities: File.java, _FileHelper.java, Folder.java, Group.java, Image.java, _ImageHelper.java, MailTemplate.java, Page.java, User.java, Widget.java
2017-10-02 21:04:45.445  ---------------- Initialization complete ----------------

Neither a log is created nor could I find any conf directory to have a look at the log or other config. The seed and seed/files folder is empty. The structr.conf file(as shown in the original post) is just 1KB, wondering if anything is missed there !

Kaliyug Antagonist
  • 3,512
  • 9
  • 51
  • 103

2 Answers2

2

The remote database is probably not configured with an admin user. Please have a look at logs/structr.log to fiund out whether an admin user is created. There should be something like

11:35:24.856 [main] INFO  org.structr.core.graph.NodeService - Checking if seed file should be imported..
11:35:26.179 [main] INFO  org.structr.core.graph.NodeService - Found initial seed file and no application nodes, applying initial seed..
11:35:26.921 [main] INFO  org.structr.core.graph.SyncCommand - Imported 1 nodes and 0 rels, committing transaction..

You should be able to create a user with the following curl statement:

curl -HX-User:superadmin -HX-Password:yourpassword http://localhost:8082/structr/rest/User -d '{ name: admin, password: admin, isAdmin: true }'

You might need to adjust the quotes in the above command for shells other that unix bash.

  • Can you check the 'Edit-1' in the original post ? – Kaliyug Antagonist Oct 02 '17 at 19:18
  • 2
    The Structr login credentials are different from the ones used in Neo4j. You will not be able to log into Structr with the credentials you set in Neo4j, you will need to create a User object in Structr (or use the admin/admin entity that is imported from the initial seed.) – Christian Morgner Oct 04 '17 at 08:57
  • admin/admin is what I am using but it doesn't work. Surprisingly, it worked earlier but the conf file was much larger. – Kaliyug Antagonist Oct 04 '17 at 08:58
  • 2
    As of Structr 2.1, the structr.conf only contains those entries that differ from the default configuration, that's why the file is so small. You will not be able to log into Structr without a User object in the Neo4j database, so we have to find a way to create one. Can you use curl or any other command-line HTTP client? Or maybe some other HTTP client that can create an HTTP POST request to the Structr REST interface? – Christian Morgner Oct 04 '17 at 13:45
  • Ok but then what could be the root cause ? – Kaliyug Antagonist Oct 04 '17 at 13:46
  • 2
    I think the root cause is that there is no user in the database to log in with. You should be able to create one with the following curl statement: curl -HX-User:superadmin -HX-Password:yourpassword http://localhost:8082/structr/rest/User -d '{ name: admin, password: admin, isAdmin: true }' – Christian Morgner Oct 04 '17 at 13:48
  • Can you edit your answer to include the complete, formatted command ? I am getting an error : At line:1 char:19 + Invoke-WebRequest -HX-User:superadmin -HX-Password:mypassword localho ... + ~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand – Kaliyug Antagonist Oct 06 '17 at 17:40
2

I think the root cause is that there is no user in the database to log in with. You should be able to create one with the following curl statement:

curl -HX-User:superadmin -HX-Password:yourpassword http://localhost:8082/structr/rest/User -d '{ name: admin, password: admin, isAdmin: true }'