inception-project / inception

INCEpTION provides a semantic annotation platform offering intelligent annotation assistance and knowledge management.
https://inception-project.github.io
Apache License 2.0
588 stars 149 forks source link

Documentmetadata not available in sidebar #2971

Closed RubberDog closed 2 years ago

RubberDog commented 2 years ago

Describe the bug "Document Metadata" doesn't show up in the sidebar

To Reproduce Steps to reproduce the behavior:

  1. Add "documentmetadata.enabled=true" to settings.properties
  2. Restart INCEpTION ( 23.1, .jar )
  3. Create a Document Metadata-layer as described in the User Guide
  4. Notice the "Document Metadata" button is missing in the sidebar after clicking "Annotation" and selecting the document with the previously added layer

Expected behavior Should be able to see the icon

Please complete the following information:

reckart commented 2 years ago

I have just tried this:

Screenshot 2022-04-12 at 09 25 58

Do you do anything different than that?

RubberDog commented 2 years ago

Hi,

I initially followed the steps as described in the User Guide for 23.1.

For testing, I just created a new project following your steps. The metadata icon doesn't show up.

reckart commented 2 years ago

The only condition for the document metadata sidebar to show up is whether there is any enabled document-metadata layer in the project (and of course that the document metadata support is generally enabled via the property in settings.properties).

Can you provide a screenshot of the layer configuration from the project settings?

Do you see any suspicious messages being logged when you open the document for annotation?

RubberDog commented 2 years ago

settings.properties does contain the line "documentmetadata.enabled=true"

There's no errors on screen when opening the document, nor anything popping up in /srv/inception/logs/application.log

Layer config;

layers

reckart commented 2 years ago

I cannot reproduce it. I have downloaded a fresh 23.1 JAR, started with a fresh data folder, enabled the document metadata in the settings.properties, created a fresh project (this time a standard project as you have), imported a document, added the meta layer and saved the layer, went to the annotation page and there is the button. I tried as admin as well as using another account with only the "project creator" role.

Are you using the embedded database or MySQL/MariaDB?

RubberDog commented 2 years ago

I'm using MariaDB.

INCEpTION is running behind an nginx as reverse proxy, if that matters.

reckart commented 2 years ago

If you repeat your steps with a fresh 23.1 JAR starting the JAR directly (i.e. using the embedded database), does it work or not?

$ java -Ddocumentmetadata.enabled=true -jar inception-app-webapp-23.1-standalone.jar
RubberDog commented 2 years ago

I had to use my settings.properties for testing that, so INCEpTION can run behind the nginx reverse-proxy due to other sites running on the same server.

I commented out the DB-related settings, leaving nothing but reverse-proxy settings and documentmetadata.enabled=true. Same outcome using the embedded, clean DB. Metadata doesn't show up.

EDIT: It's also running on a subdomain instead of an subdirectory on the webserver. Might that be some kind of related? Everything but Metadata works without any issues, still.

reckart commented 2 years ago

I have tried on a server running behind a reverse proxy as well - works nicely.

Could you check the Javascript console in your browser to see if you get any errors there?

Can you please try locally on your PC/laptop?

RubberDog commented 2 years ago

In the console, I see an error:

VM288:44 WebSocket connection to 'wss://mydomainnamehere/ws' failed: connect @ VM288:44 mounted @ VM288:77 vt @ vue.global.prod-ver-E22888EA1E6B63091B1D0497CD5750FA.js:1 yt @ vue.global.prod-ver-E22888EA1E6B63091B1D0497CD5750FA.js:1 t.weh.t.weh @ vue.global.prod-ver-E22888EA1E6B63091B1D0497CD5750FA.js:1 Lt @ vue.global.prod-ver-E22888EA1E6B63091B1D0497CD5750FA.js:1 Ut @ vue.global.prod-ver-E22888EA1E6B63091B1D0497CD5750FA.js:1 webstomp.min-ver-2B0B110FE1C4F8C4F048C05A5F5FEB8A.js:1 Whoops! Lost connection to wss://mydomainnamehere/ws: {event: CloseEvent}


        location /ws {
            proxy_pass http://127.0.0.1:8080/;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
            proxy_set_header Host $host;
        }

Works fine in a VM.

reckart commented 2 years ago

Please double-check that the CSRF settings as well as the reverse proxy settings are configured according to the admin guide.

That said, I believe that a failed WebSocket connection should not cause the metadata sidebar to disappear.

When you said "works fine in a VM", does it mean that the document metadata sidebar appears when you run without the reverse proxy in a VM?

RubberDog commented 2 years ago

I had CSRF disabled via settings.properties. Now enabled it according to the admin guide, the same error persists.

"works fine in a VM" means, I can see and access the documentmetadata in a freshly set up VM, using the same reverse proxy settings as in my live-server. Plus MariaDB instead of the embedded DB.

settings.properties and the config-file for inception in nginx are identical, except the domain name.

reckart commented 2 years ago

Ok, so if its not the reverse proxy/CSRF settings (same in fresh VM as well as in original VM), does it mean it should be related to the database?

Mind that these lines here are important not only for CSRF but also for WebSocket to work behind the reverse proxy - and it is important to have them both, once with and once without the protocol - matching your (sub)domain of course and matching with the reverse proxy config as well:

wicket.core.csrf.accepted-origins[0]=your.public.domain.name.com
wicket.core.csrf.accepted-origins[1]=https://your.public.domain.name.com
reckart commented 2 years ago

Btw. another way to check if websocket is working is to go to the project settings, there to the export page and try exporting a project - since 22.0, the export page uses WebSocket (unless you manually switched back to the the legacy export page).

RubberDog commented 2 years ago

I have both these lines and they match the reverse proxy config.

Exporting a project does work.

I wonder if it could be related to the database - at least the icon should show up anyway as long as the option is set in the settings.properties?

Also, everything else works fine - I added an external editor as of 23.0, and there are several people working with documents with no issues at all, except the missing metadata.

reckart commented 2 years ago

The document metadata sidebar shows up if the project contains an enabled document metadata layer:

DocumentMetadataSidebarFactory

    @Override
    public boolean available(Project aProject)
    {
        return schemaService.existsEnabledLayerOfType(aProject, DocumentMetadataLayerSupport.TYPE);
    }

AnnotationSchemaServiceImpl

    @Override
    @Transactional
    public boolean existsEnabledLayerOfType(Project aProject, String aType)
    {
        String query = String.join("\n", //
                "FROM AnnotationLayer", //
                "WHERE project = :project ", //
                "AND type = :type", //
                "AND enabled = true");

        List<AnnotationLayer> layers = entityManager.createQuery(query, AnnotationLayer.class) //
                .setParameter("project", aProject) //
                .setParameter("type", aType) //
                .getResultList();

        return layers.stream().anyMatch(layer -> {
            try {
                layerSupportRegistry.getLayerSupport(layer);
                return true;
            }
            catch (IllegalArgumentException e) {
                return false;
            }
        });
    }

So something in here must be going wrong (note the query is a JPA query which is translated to the actual DB names by Hibernate).

RubberDog commented 2 years ago

What table can I query to check if there's an enabled metadata-layer present?

reckart commented 2 years ago

If you see it in the project settings it should be there. The table name should be 'annotation_layer' I think.

RubberDog commented 2 years ago

Okay, thank you.

It's visible in the project settings in any project we tried to use that layer, so that's probably not the issue.

RubberDog commented 2 years ago

Hi,

I just wanted to let you know: I just tried INCEpTION 23.2, and the Documentmetadata Icon finally shows up for me.

Best regards

reckart commented 2 years ago

Interesting - I am not aware of any change in 23.2 that would affect the metadata sidebar. But ok, then let's close the issue. If you run into it again, please let us know.

reckart commented 2 years ago

There was an update in the MariaDB driver and in Hibernate for 23.2 - maybe these had some effect on you: