analytics icon indicating copy to clipboard operation
analytics copied to clipboard

Error: Class 'OCP\Server' not found

Open MarceloBastos5 opened this issue 1 year ago • 10 comments

After install the app analytics , nextcloud display this message

Exception: Class 'OCP\Server' not found

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

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

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

OC\AppFramework\App::main()

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

OC\Route\Router->match()

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

OC::handleRequest()

help me , please

MarceloBastos5 avatar Feb 28 '24 18:02 MarceloBastos5

that is a strange one. which NC version are you using? when you disable Analytics, working again?

Rello avatar Feb 28 '24 18:02 Rello

Version 22.

Yes, working.

My installation the nextcloud can't access internet. Can be it?

Very thanks for help

MarceloBastos5 avatar Feb 28 '24 18:02 MarceloBastos5

i installed manually the analytics

MarceloBastos5 avatar Feb 28 '24 18:02 MarceloBastos5

thats strange. how did you install it? just extracting the archive you got from github into the apps folder? did you use the oder 4.11 version? current is not nc20. I think there is some dependency that I might be missing. being airgapped in general is not the issue

Rello avatar Feb 28 '24 18:02 Rello

yes, i used the version 4.11 indicated for nextcloud 22.

i extracted the content for file in folder /var/www/nextcloud/apps then i granted permission for user www-data with chown www-data.www-data ./analytics -R

On nextcloud habilited the plugin

MarceloBastos5 avatar Feb 28 '24 18:02 MarceloBastos5

I am facing the same issue on nextcloud 22.2.10. I installed the analytics 4.11.1 manually and when I visit the app it gives me internal server error. I have checked the logs and this is what I got.

{
   "reqId":"7SaFiP2ovJzPksnfvpHn",
   "level":3,
   "time":"2024-03-04T06:13:51+00:00",
   "remoteAddr":"",
   "user":"nextcloud_admin",
   "app":"index",
   "method":"GET",
   "url":"/index.php/apps/analytics/",
   "message":"Class 'OCP\\Server' not found",
   "userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0",
   "version":"22.2.10.2",
   "exception":{
      "Exception":"Exception",
      "Message":"Class 'OCP\\Server' not found",
      "Code":0,
      "Trace":[
         {
            "file":"/var/www/ec_nextcloud/lib/private/AppFramework/App.php",
            "line":156,
            "function":"dispatch",
            "class":"OC\\AppFramework\\Http\\Dispatcher",
            "type":"->"
         },
         {
            "file":"/var/www/ec_nextcloud/lib/private/Route/Router.php",
            "line":302,
            "function":"main",
            "class":"OC\\AppFramework\\App",
            "type":"::"
         },
         {
            "file":"/var/www/ec_nextcloud/lib/base.php",
            "line":1008,
            "function":"match",
            "class":"OC\\Route\\Router",
            "type":"->"
         },
         {
            "file":"/var/www/ec_nextcloud/index.php",
            "line":50,
            "function":"handleRequest",
            "class":"OC",
            "type":"::"
         }
      ],
      "File":"/var/www/ec_nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
      "Line":158,
      "Previous":{
         "Exception":"Error",
         "Message":"Class 'OCP\\Server' not found",
         "Code":0,
         "Trace":[
            {
               "file":"/var/www/ec_nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
               "line":217,
               "function":"index",
               "class":"OCA\\Analytics\\Controller\\PageController",
               "type":"->"
            },
            {
               "file":"/var/www/ec_nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
               "line":126,
               "function":"executeController",
               "class":"OC\\AppFramework\\Http\\Dispatcher",
               "type":"->"
            },
            {
               "file":"/var/www/ec_nextcloud/lib/private/AppFramework/App.php",
               "line":156,
               "function":"dispatch",
               "class":"OC\\AppFramework\\Http\\Dispatcher",
               "type":"->"
            },
            {
               "file":"/var/www/ec_nextcloud/lib/private/Route/Router.php",
               "line":302,
               "function":"main",
               "class":"OC\\AppFramework\\App",
               "type":"::"
            },
            {
               "file":"/var/www/ec_nextcloud/lib/base.php",
               "line":1008,
               "function":"match",
               "class":"OC\\Route\\Router",
               "type":"->"
            },
            {
               "file":"/var/www/ec_nextcloud/index.php",
               "line":50,
               "function":"handleRequest",
               "class":"OC",
               "type":"::"
            }
         ],
         "File":"/var/www/ec_nextcloud/apps/analytics/lib/Controller/PageController.php",
         "Line":90
      },
      "CustomMessage":"--"
   }
}

This is how I installed the app

tar -zxvf analytics-4.11.1.tar.gz
chown -R www-data:www-data analytics
sudo -u www-data php occ app:enable analytics

mudassir1996 avatar Mar 04 '24 06:03 mudassir1996

that is strange. this is a feature that was added to NC later. But for that reasons I added the try-part around it. I will start a NC22 on my side an let you know..

Rello avatar Mar 04 '24 21:03 Rello

Ok, Rello. Thank for your attention.

MarceloBastos5 avatar Mar 05 '24 13:03 MarceloBastos5