nextcloud / richdocuments

📑 Collabora Online for Nextcloud
https://nextcloud.com/collaboraonline
349 stars 115 forks source link

Error: simplexml_load_string() + Exception: Call to a member function xpath() on bool #1599

Open Night-Train-666 opened 3 years ago

Night-Train-666 commented 3 years ago

I have updated, after a few months, my server for NextCloud and, with the 4.1.1 version of richdocuments, I get the following errors:

Error: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found at /var/www/nextcloud/apps/richdocuments/lib/WOPI/Parser.php#47

Error: simplexml_load_string(): Permissions-Policy: interest-cohort=() at /var/www/nextcloud/apps/richdocuments/lib/WOPI/Parser.php#47

Error: simplexml_load_string(): ^ at /var/www/nextcloud/apps/richdocuments/lib/WOPI/Parser.php#47

for all three the description is as follows:

    <<closure>>

    OC\Log\ErrorHandler::onError()

    /var/www/nextcloud/apps/richdocuments/lib/WOPI/Parser.php - line 47:

    simplexml_load_string()

    /var/www/nextcloud/apps/richdocuments/lib/Controller/SettingsController.php - line 175:

    OCA\Richdocuments\WOPI\Parser->getUrlSrc()

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 218:

    OCA\Richdocuments\Controller\SettingsController->setSettings()

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 127:

    OC\AppFramework\Http\Dispatcher->executeController()

    /var/www/nextcloud/lib/private/AppFramework/App.php - line 157:

    OC\AppFramework\Http\Dispatcher->dispatch()

    /var/www/nextcloud/lib/private/Route/Router.php - line 302:

    OC\AppFramework\App::main()

    /var/www/nextcloud/lib/base.php - line 993:

    OC\Route\Router->match()

    /var/www/nextcloud/index.php - line 37:

    OC::handleRequest()

and then again:

Exception: Call to a member function xpath() on bool

    /var/www/nextcloud/lib/private/AppFramework/App.php - line 157:

    OC\AppFramework\Http\Dispatcher->dispatch()

    /var/www/nextcloud/lib/private/Route/Router.php - line 302:

    OC\AppFramework\App::main()

    /var/www/nextcloud/lib/base.php - line 993:

    OC\Route\Router->match()

    /var/www/nextcloud/index.php - line 37:

    OC::handleRequest()

Generato daError: Call to a member function xpath() on bool

    /var/www/nextcloud/apps/richdocuments/lib/Controller/SettingsController.php - line 175:

    OCA\Richdocuments\WOPI\Parser->getUrlSrc()

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 218:

    OCA\Richdocuments\Controller\SettingsController->setSettings()

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 127:

    OC\AppFramework\Http\Dispatcher->executeController()

    /var/www/nextcloud/lib/private/AppFramework/App.php - line 157:

    OC\AppFramework\Http\Dispatcher->dispatch()

    /var/www/nextcloud/lib/private/Route/Router.php - line 302:

    OC\AppFramework\App::main()

    /var/www/nextcloud/lib/base.php - line 993:

    OC\Route\Router->match()

    /var/www/nextcloud/index.php - line 37:

    OC::handleRequest()

The consequence is that, while everything else works, Collabora Online is no longer reachable.

The link https://my-site/loleaflet/dist/admin/admin.html displays the empty dashboard with the writing: Server has been shut down; please reload the page.

In NextCloud, on the page https://my-site/settings/admin/richdocuments, the message appears: Could not establish connection to the Collabora Online server

The configurations are the same as when the site was working.

Server details

Operating system: Ubuntu 20.04.2

Web server: Nginx 1.21.0

Database: MariaDB 10.5.10

PHP version: 8.0.7

Nextcloud version: 21.0.2

Version of the richdocuments app Collabora Online 4.1.1

collabora/code:latest

DockerVersion 19.03.11

curl -k https://localhost:9980 OK

xymox18 commented 2 years ago

Hello i have the same problem in Nextcloud 21.0.4, Collabora working perfectly before i dont know what is the problem. Some can help with this bug please.

juliushaertl commented 2 years ago

Could you chek the output of curl -k localhost:9980/hosting/discovery when executing that on the nextcloud server?

danir-de commented 2 years ago

We're getting a curl: (7) Failed to connect to localhost port 9980: Connection refused. I'm not really sure what to expect, the web server only runs on port 443 and 80.

turion commented 2 years ago

I have the same issue. Nextcloud 21.0.5, Collabora Online 4.2.3, Collabora Online - Built-in CODE Server 6.4.1303.

When checking settings/admin/richdocuments, it says that it cannot connect to the Collabora server (I'm using CODE), and points me to https://www.collaboraoffice.com/online/connecting-collabora-online-built-in-code-server-with-nginx/. Maybe this is important?

turion commented 2 years ago

Either way, for me this location is set (since I'm using NixOS) as far as I understand, and still it doesn't work. In particular, the relevant line is location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) { include /nix/store/syg3lx68fls35wwzqnfg7s8snsl3b4a3-nginx-1.20.1/conf/fastcgi.conf;, containing the string /richdocumentscode\/proxy which I believe is necessary.

juliushaertl commented 2 years ago

CODE and the built-in CODE server are two separate things. CODE in general just specifies that you are using the Collabora Online Development Edition.

You can either run it using a native package that can be installed through your distributions package manager or via Docker. Or you can use the built-in CODE server is a Nextcloud app that proxies the requests to a Collabora process that is started in the background https://github.com/CollaboraOnline/richdocumentscode.

If you are using the built-in code server, please check the output of the following urls:

https://nextcloud.example.com/apps/richdocumentscode/proxy.php?status https://nextcloud.example.com/apps/richdocumentscode/proxy.php?req=/hosting/discovery

daCaPo commented 1 year ago

Seems I face a related issue (NC 25.0.5.1, standalone CODE 22.05.12.4). simplexml_load_string($discovery) in line 47 of lib/WOPI/Parser.php returns false, obviously because $discovery contains JSON data (returned from the CODE server, so network connection is not an issue), not XML.

daCaPo commented 1 year ago

Well, I found my mistake: There was the path /hosting/capabilities given in the server address field on /settings/admin/richdocuments - copy-paste error, not so obviuos as not visible in the narrow text box - sorry for this false alarm.