Omeka S 3.0.1 module Omeka 2 Importer error

I was able to import data from an Omeka S v2.1.2 site, from an Omeka Classic V2.6.1 site.

I am currently evaluating Omeka S 3.0.1 and I have installed the latest version (1.4.0) of this module.

And I’m trying to import from the same Omeka Classic v2.6.1 site (the same Omeka 2 API Endpoint) and I encounter the following error:

Laminas\Http\Client\Exception\InvalidArgumentException
Unable to locate adapter class “Laminas\Http\Proxy”

Détails :
Laminas\Http\Client\Exception\InvalidArgumentException: Unable to locate adapter class “Laminas\Http\Proxy” in /applis/omekas/home/www/omeka-s/vendor/laminas/laminas-http/src/Client.php:195

Stack trace:

#0 /applis/omekas/home/www/omeka-s/vendor/laminas/laminas-http/src/Client.php(221): Laminas\Http\Client->setAdapter(‘Laminas\Http\Pr…’)

#1 /applis/omekas/home/www/omeka-s/vendor/laminas/laminas-http/src/Client.php(882): Laminas\Http\Client->getAdapter()

#2 /applis/omekas/home/www/omeka-s/modules/Omeka2Importer/src/Service/Omeka2Client.php(172): Laminas\Http\Client->send()

#3 [internal function]: Omeka2Importer\Service\Omeka2Client->get()

#4 /applis/omekas/home/www/omeka-s/modules/Omeka2Importer/src/Service/Omeka2Client.php(85): call_user_func_array(Array, Array)

#5 /applis/omekas/home/www/omeka-s/modules/Omeka2Importer/src/Controller/IndexController.php(96): Omeka2Importer\Service\Omeka2Client->__call(‘get’, Array)

#6 /applis/omekas/home/www/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(77): Omeka2Importer\Controller\IndexController->mapElementsAction()

#7 /applis/omekas/home/www/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\Controller\AbstractActionController->onDispatch(Object(Laminas\Mvc\MvcEvent))

#8 /applis/omekas/home/www/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))

#9 /applis/omekas/home/www/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(105): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))

#10 /applis/omekas/home/www/omeka-s/vendor/laminas/laminas-mvc/src/DispatchListener.php(139): Laminas\Mvc\Controller\AbstractController->dispatch(Object(Laminas\Http\PhpEnvironment\Request), Object(Laminas\Http\PhpEnvironment\Response))

#11 /applis/omekas/home/www/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\DispatchListener->onDispatch(Object(Laminas\Mvc\MvcEvent))

#12 /applis/omekas/home/www/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))

#13 /applis/omekas/home/www/omeka-s/vendor/laminas/laminas-mvc/src/Application.php(331): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))

#14 /applis/omekas/home/www/omeka-s/index.php(21): Laminas\Mvc\Application->run()

#15 {main}

I declared in the config/local.config.php file, the Proxy adapter.

‘http_client’ => [
‘adapter’ => \Zend\Http\Client\Adapter\Proxy::class,
‘sslcapath’ => null,
‘sslcafile’ => null,
],

But, more curiously, by choosing the Curl adapter, I get the same error.

Does anyone have any ideas ?

I’m not certain this is your problem, but try this:

First, have you tried just not specifying the adapter here at all? Most users don’t need to set that line of configuration.

Second, the “Zend” names have all changed in Omeka S 3.0.0 and up to be “Laminas” instead, so if you are going to specify an adapter, try \Laminas\Http\Client\Adapter\Proxy::class instead.

One further bit of confusion though: there’s actually an issue with the Omeka2Importer module where it doesn’t respect those basic HTTP client settings from the Omeka configuration file. Have you possibly modified the Omeka2Importer module code at all to try to work around this issue? The instruction to use “Laminas\Http\Proxy” must be coming from somewhere (it’s not the default).

Sorry, I indicated the configuration of the Omeka S 2.1.2 site from which I managed to import data from an Omeka Classic 2.6.1 site.

In reality, the configuration of the Omeka S 3.0.1 site was actually this one :
‘http_client’ => [
‘adapter’ => \Laminas\Http\Client\Adapter\Proxy::class,
‘sslcapath’ => null,
‘sslcafile’ => null,
],

I tried with the Curl adapter and just not specifying the adapter in the files config/local.config.php and application/config/module.config.php and I have the same error.

Maybe the module does not use the local.config.php and module.config.php files, but rather laminas-http/src/Client.php in which I indicated Proxy as adapter.

I tried with the Curl adapter in Client.php and I no longer have the error

So, the module does not exploit local.config.php and module.config.php files and there seems to be a problem with the Proxy adapter.

OK, this jogs my memory now, we’ve discussed this before, including the issue with the Omeka 2 Importer not respecting the config settings here.

What’s the change you made to the Client.php file? Could you paste it here? I think you might have just made a simple mistake in naming the class when using it there (for example, by calling the class just Proxy but not including a use statement to map that to the correct class name).

I had just changed Socket::class by Proxy::class as for the OMEKA S 2.1.2 configuration.

protected $config = [
‘maxredirects’ => 5,
‘strictredirects’ => false,
‘useragent’ => Client::class,
‘timeout’ => 10,
‘connecttimeout’ => null,
‘adapter’ => Proxy::class,
‘httpversion’ => Request::VERSION_11,
‘storeresponse’ => true,
‘keepalive’ => false,
‘outputstream’ => false,
‘encodecookies’ => true,
‘argseparator’ => null,
‘rfc3986strict’ => false,
‘sslcafile’ => null,
‘sslcapath’ => null,
];

But by indicating the complete path, I no longer have the problem :
protected $config = [
‘maxredirects’ => 5,
‘strictredirects’ => false,
‘useragent’ => Client::class,
‘timeout’ => 10,
‘connecttimeout’ => null,
‘adapter’ => \Laminas\Http\Client\Adapter\Proxy::class,
‘httpversion’ => Request::VERSION_11,
‘storeresponse’ => true,
‘keepalive’ => false,
‘outputstream’ => false,
‘encodecookies’ => true,
‘argseparator’ => null,
‘rfc3986strict’ => false,
‘sslcafile’ => null,
‘sslcapath’ => null,
];

Thank you very much