Page 1 of 1

Fatal error: Uncaught exception 'Exception' with message 'Th

Posted: Fri Nov 02, 2012 6:22 am
by yita33
Hello,
the WURFL API works fine in my local server (xampp), but on my web it appears:

Fatal error: Uncaught exception 'Exception' with message 'There is no device with ID [generic] in the loaded WURFL Data' in /hosting/www/rewindthecity.es/public/wurfl/WURFL/CustomDeviceRepository.php:104 Stack trace: #0 /hosting/www/rewindthecity.es/public/wurfl/WURFL/CustomDeviceRepository.php(70): WURFL_CustomDeviceRepository->getDevice('generic') #1 /hosting/www/rewindthecity.es/public/wurfl/WURFL/CustomDeviceRepository.php(63): WURFL_CustomDeviceRepository->init() #2 /hosting/www/rewindthecity.es/public/wurfl/WURFL/DeviceRepositoryBuilder.php(91): WURFL_CustomDeviceRepository->__construct(Object(WURFL_Storage_File), Array) #3 /hosting/www/rewindthecity.es/public/wurfl/WURFL/WURFLManagerFactory.php(150): WURFL_DeviceRepositoryBuilder->build('/hosting/www/re...', NULL) #4 /hosting/www/rewindthecity.es/public/wurfl/WURFL/WURFLManagerFactory.php(134): WURFL_WURFLManagerFactory->deviceRepository(Object(WURFL_Storage_File), Object(WURFL_UserAgentHandlerChain)) #5 /hosting/www/rewindthecity.es/public/wurfl/WURFL/WURFLManager in /hosting/www/rewindthecity.es/public/wurfl/WURFL/CustomDeviceRepository.php on line 104

After reading another post below, I changed the chmod and made the folder writable, but the error message hasn't gone.
What can the problem be?
Thanks a lot and sorry about my english

Re: Fatal error: Uncaught exception 'Exception' with message

Posted: Fri Nov 02, 2012 9:24 pm
by kamermans
Hi,

Can you post your WURFL configuration please? Also, you should delete your cache and persistence directories from the server so they can be recreated.

Re: Fatal error: Uncaught exception 'Exception' with message

Posted: Mon Nov 05, 2012 5:49 am
by yita33
Hello, thanks for your help.
I've tried deleting cache and persistence. I've refresh the page and WURFL creates the directories again, but still doesn't work.
Here is my wurfl_config.php, is the same as in the demo, just changed the path to de directories.
I have two directories, WURFL with de API, and data with the wurfl.zip file, wurfl_config.php and storage directory.
I've also tried changing the paths from '../../WURFL' to '/../WURFL' (relative) but is the same, it works in my local server but not on the web.

Code: Select all

<?php
// Enable all error logging while in development
ini_set('display_errors', 'on');
error_reporting(E_ALL);

$wurflDir = dirname(__FILE__) . '../../WURFL';
$resourcesDir = dirname(__FILE__) . '../../data';

require_once $wurflDir.'/Application.php';

$persistenceDir = $resourcesDir.'/storage/persistence';
$cacheDir = $resourcesDir.'/storage/cache';

// Create WURFL Configuration
$wurflConfig = new WURFL_Configuration_InMemoryConfig();

// Set location of the WURFL File
$wurflConfig->wurflFile($resourcesDir.'../wurfl.zip');

// Set the match mode for the API ('performance' or 'accuracy')
$wurflConfig->matchMode('performance');

// Automatically reload the WURFL data if it changes
$wurflConfig->allowReload(true);

// Setup WURFL Persistence
$wurflConfig->persistence('file', array('dir' => $persistenceDir));

// Setup Caching
$wurflConfig->cache('file', array('dir' => $cacheDir, 'expiration' => 36000));

// Create a WURFL Manager Factory from the WURFL Configuration
$wurflManagerFactory = new WURFL_WURFLManagerFactory($wurflConfig);

// Create a WURFL Manager
/* @var $wurflManager WURFL_WURFLManager */
$wurflManager = $wurflManagerFactory->create();
?>

Re: Fatal error: Uncaught exception 'Exception' with message

Posted: Mon Nov 05, 2012 5:13 pm
by kamermans
I'm looking over the config now, but one immediate thing I spotted was this:

Code: Select all

// Set location of the WURFL File
$wurflConfig->wurflFile($resourcesDir.'../wurfl.zip');
I think you need a "/" in the beginning of the path, like this:

Code: Select all

// Set location of the WURFL File
$wurflConfig->wurflFile($resourcesDir.'/../wurfl.zip');