There is no device with id [generic] in wurfl

carl.olsen
Posts: 8
Joined: Tue Jul 19, 2011 7:54 am

There is no device with id [generic] in wurfl

Postby carl.olsen » Tue Jul 19, 2011 7:57 am

What am I doing wrong?

http://mtest.drake.edu/carl/examples/demo/

I'm trying to install on Solaris and I'm getting this error:

Fatal error: Uncaught exception 'Exception' with message 'There is no device with id [generic] in wurfl' in /var/apache2/htdocs/mtest/carl/WURFL/CustomDeviceRepository.php:105 Stack trace: #0 /var/apache2/htdocs/mtest/carl/WURFL/CustomDeviceRepository.php(70): WURFL_CustomDeviceRepository->getDevice('generic') #1 /var/apache2/htdocs/mtest/carl/WURFL/CustomDeviceRepository.php(63): WURFL_CustomDeviceRepository->init() #2 /var/apache2/htdocs/mtest/carl/WURFL/DeviceRepositoryBuilder.php(78): WURFL_CustomDeviceRepository->__construct(Object(WURFL_Storage_File), Array) #3 /var/apache2/htdocs/mtest/carl/WURFL/WURFLManagerFactory.php(164): WURFL_DeviceRepositoryBuilder->build('/var/apache2/ht...', Array) #4 /var/apache2/htdocs/mtest/carl/WURFL/WURFLManagerFactory.php(127): WURFL_WURFLManagerFactory->deviceRepository(Object(WURFL_Storage_File), Object(WURFL_UserAgentHandlerChain)) #5 /var/apache2/htdocs/mtest/carl/WURFL/WURFLManagerFactory.php(66): WURFL_WURFLManagerFactory->init() #6 /var/apache2/htdocs/mtest/carl/examples/demo/ in /var/apache2/htdocs/mtest/carl/WURFL/CustomDeviceRepository.php on line 105

kamermans
Posts: 393
Joined: Mon Jun 06, 2011 9:50 am

Re: There is no device with id [generic] in wurfl

Postby kamermans » Tue Jul 19, 2011 12:30 pm

This is most likely because your resources/storage directory is not currently writable by the webserver.

Please try making the directory writable by using a command like this:

chmod -R 777 /var/apache2/htdocs/mtest/carl/examples/resources/storage
Thanks,

Steve Kamerman
ScientiaMobile

Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!

carl.olsen
Posts: 8
Joined: Tue Jul 19, 2011 7:54 am

Re: There is no device with id [generic] in wurfl

Postby carl.olsen » Tue Jul 19, 2011 12:55 pm

chmod -R 777 /var/apache2/htdocs/mtest/carl/examples/resources/storage works but I'm still getting the same error. The permissions on that directory were already set to drwxrwxrwx. I set them to 777 during the set up.

kamermans
Posts: 393
Joined: Mon Jun 06, 2011 9:50 am

Re: There is no device with id [generic] in wurfl

Postby kamermans » Tue Jul 19, 2011 1:12 pm

In that case, this is a little strange because the persistence is not being built. There should be a large number of files here: http://mtest.drake.edu/carl/examples/re ... rsistence/

If you have PHP Safe Mode on then your webserver's process will need to be the owner of the storage/persistence directory, so you would have to do something like "chown -R www-data" on the directory. Do you see any errors in your Apache error log that might shed some more light on the situation?
Thanks,

Steve Kamerman
ScientiaMobile

Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!

carl.olsen
Posts: 8
Joined: Tue Jul 19, 2011 7:54 am

Re: There is no device with id [generic] in wurfl

Postby carl.olsen » Tue Jul 19, 2011 1:29 pm

I don't have root access to the server. I don't think I can view the logs. I did get a different error when that directory was set to 755. In that case, the error was that it could not write to the directory. Changing it to 777 fixed that, but it's still not writing anything to that directory. I tried setting up the UCLA Mobile Web Framework first and had the server administrator put those files in /var/mobile/wurfl and /var/mobile/cache/img, /var/mobile/cache/magpierss, and /var/mobile/cache/wurfl

Here's the file structure on that:

-bash-3.00$ cd /var/mobile
-bash-3.00$ ls -l
total 3
drwxr-xr-x 5 root root 5 2011-07-14 10:50 cache
drwxr-xr-x 2 root root 5 2011-07-14 10:50 wurfl


-bash-3.00$ cd cache
-bash-3.00$ ls -l
total 5
drwxr-xr-x 2 webservd webservd 2 2011-07-14 10:50 img
drwxr-xr-x 2 webservd webservd 2 2011-07-14 10:50 magpierss
drwxr-xr-x 2 webservd webservd 2 2011-07-14 10:50 wurfl


-bash-3.00$ cd /var/mobile/wurfl
-bash-3.00$ ls -l
total 17306
-rw-r--r-- 1 webcomm staff 1732 2011-07-18 13:29 wurfl-config.xml
-rw-r--r-- 1 webcomm staff 6632 2011-07-12 14:22 wurfl-web_browsers_patch.xml
-rw-r--r-- 1 root root 17639515 2011-07-14 10:50 wurfl.xml

kamermans
Posts: 393
Joined: Mon Jun 06, 2011 9:50 am

Re: There is no device with id [generic] in wurfl

Postby kamermans » Tue Jul 19, 2011 1:32 pm

Ok, can you try change the wurfl-config.xml that you're using with the demo page to "/var/mobile/wurfl/wurfl-config.xml" to see if that solves the problem? Perhaps there is a specific requirement in your organization that is different than most.
Thanks,

Steve Kamerman
ScientiaMobile

Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!

carl.olsen
Posts: 8
Joined: Tue Jul 19, 2011 7:54 am

Re: There is no device with id [generic] in wurfl

Postby carl.olsen » Tue Jul 19, 2011 1:41 pm

Okay, now it looks like I have a permission problem with that directory. I thought I had the server administrator set those to 777 but I see they are 755 now. The owner was root.root and I had him change that to webserverd.webserverd since we don't have apache.apache on that machine.

Fatal error: Uncaught exception 'WURFL_Storage_Exception' with message 'The file cache directory is not writeable: /var/mobile/cache/wurfl' in /var/apache2/htdocs/mtest/carl/WURFL/Storage/File.php:53 Stack trace: #0 /var/apache2/htdocs/mtest/carl/WURFL/Storage/File.php(42): WURFL_Storage_File->createCacheDirIfNotExist() #1 /var/apache2/htdocs/mtest/carl/WURFL/Storage/File.php(37): WURFL_Storage_File->initialize(Array) #2 /var/apache2/htdocs/mtest/carl/WURFL/Storage/Factory.php(43): WURFL_Storage_File->__construct(Array) #3 /var/apache2/htdocs/mtest/carl/WURFL/WURFLManagerFactory.php(142): WURFL_Storage_Factory::create(Array) #4 /var/apache2/htdocs/mtest/carl/WURFL/WURFLManagerFactory.php(57): WURFL_WURFLManagerFactory::persistenceStorage(Array) #5 /var/apache2/htdocs/mtest/carl/examples/demo/inc/header-config.inc(13): WURFL_WURFLManagerFactory->__construct(Object(WURFL_Configuration_XmlConfig)) #6 /var/apache2/htdocs/mtest/carl/examples/demo/index.php(8): include_once('/var/apache2/ht...') #7 {main} thrown in /var/apache2/htdocs/mtest/carl/WURFL/Storage/File.php on line 53

kamermans
Posts: 393
Joined: Mon Jun 06, 2011 9:50 am

Re: There is no device with id [generic] in wurfl

Postby kamermans » Tue Jul 19, 2011 1:44 pm

Ok, that's a more typical error message, like you said. I guess we can continue down the original path, with your header-config.inc.

Something that would be helpful for troubleshooting is to edit inc/header-config.inc and make sure the top of the file looks like this:

Code: Select all

<?php
ini_set("display_errors","on");
error_reporting(E_ALL);
It looks to me like there are some warnings that are not being shown.
Thanks,

Steve Kamerman
ScientiaMobile

Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!

carl.olsen
Posts: 8
Joined: Tue Jul 19, 2011 7:54 am

Re: There is no device with id [generic] in wurfl

Postby carl.olsen » Tue Jul 19, 2011 1:46 pm

I already had that display error code in that page, but I have now replaced it with the code you just provided. The page is just blank if errors are not displayed.

I've sent a request to the server administrator to set the permissions to 777 on the cache folder and the three folders inside it and to set the owner to webservd.webservd on all of them.

carl.olsen
Posts: 8
Joined: Tue Jul 19, 2011 7:54 am

Re: There is no device with id [generic] in wurfl

Postby carl.olsen » Tue Jul 19, 2011 1:52 pm

Okay, he's reset the permissions and the owner on those folders and now the error message is back to the original one I reported:

Fatal error: Uncaught exception 'Exception' with message 'There is no device with id [generic] in wurfl' in /var/apache2/htdocs/mtest/carl/WURFL/CustomDeviceRepository.php:105 Stack trace: #0 /var/apache2/htdocs/mtest/carl/WURFL/CustomDeviceRepository.php(70): WURFL_CustomDeviceRepository->getDevice('generic') #1 /var/apache2/htdocs/mtest/carl/WURFL/CustomDeviceRepository.php(63): WURFL_CustomDeviceRepository->init() #2 /var/apache2/htdocs/mtest/carl/WURFL/DeviceRepositoryBuilder.php(78): WURFL_CustomDeviceRepository->__construct(Object(WURFL_Storage_File), Array) #3 /var/apache2/htdocs/mtest/carl/WURFL/WURFLManagerFactory.php(164): WURFL_DeviceRepositoryBuilder->build('/var/mobile/wur...', Array) #4 /var/apache2/htdocs/mtest/carl/WURFL/WURFLManagerFactory.php(127): WURFL_WURFLManagerFactory->deviceRepository(Object(WURFL_Storage_File), Object(WURFL_UserAgentHandlerChain)) #5 /var/apache2/htdocs/mtest/carl/WURFL/WURFLManagerFactory.php(66): WURFL_WURFLManagerFactory->init() #6 /var/apache2/htdocs/mtest/carl/examples/demo/ in /var/apache2/htdocs/mtest/carl/WURFL/CustomDeviceRepository.php on line 105



-bash-3.00$ cd /var/mobile
-bash-3.00$ ls -l
total 3
drwxrwxrwx 5 webservd webservd 5 2011-07-14 10:50 cache
drwxr-xr-x 2 root root 5 2011-07-14 10:50 wurfl
-bash-3.00$ cd cache
-bash-3.00$ ls -l
total 5
drwxrwxrwx 2 webservd webservd 2 2011-07-14 10:50 img
drwxrwxrwx 2 webservd webservd 2 2011-07-14 10:50 magpierss
drwxrwxrwx 2 webservd webservd 2 2011-07-14 10:50 wurfl
-bash-3.00$

kamermans
Posts: 393
Joined: Mon Jun 06, 2011 9:50 am

Re: There is no device with id [generic] in wurfl

Postby kamermans » Tue Jul 19, 2011 1:57 pm

Can you put this in your header-config.inc under the two define() statements?

Code: Select all

if(!file_exists(RESOURCES_DIR.'persistence') && !mkdir(RESOURCES_DIR.'persistence', 0777, true)){
	echo "storage/persistence directory does not exist and I can't create it: ".RESOURCES_DIR.'persistence'."<br/>\n";
}
echo "<pre>\n";
echo 'WURFL File: '.WURFL_DIR.', '.( is_readable(WURFL_DIR.'wurfl.xml')? "OK": "Not Readable" )."\n";
echo 'Storage Dir: '.RESOURCES_DIR.', '.( is_writable(RESOURCES_DIR)? "OK": "Not Writable" )."\n";
echo 'Storage/Persistence Dir: '.RESOURCES_DIR.', '.( is_writable(RESOURCES_DIR.'persistence')? "OK": "Not Writable" )."\n";
echo "</pre>\n";
Thanks,

Steve Kamerman
ScientiaMobile

Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!

carl.olsen
Posts: 8
Joined: Tue Jul 19, 2011 7:54 am

Re: There is no device with id [generic] in wurfl

Postby carl.olsen » Tue Jul 19, 2011 2:05 pm

I did install tera-wurfl this morning and it works great. I'm just not sure I want to try to switch out the wurfl that UCLA mobile web framework is using with the mysql version. If all else fails, at least I can try to do that.

carl.olsen
Posts: 8
Joined: Tue Jul 19, 2011 7:54 am

Re: There is no device with id [generic] in wurfl

Postby carl.olsen » Tue Jul 19, 2011 2:07 pm

Okay,

WURFL File: /var/apache2/htdocs/mtest/carl/examples/demo/inc/../../../WURFL/, Not Readable
Storage Dir: /var/apache2/htdocs/mtest/carl/examples/demo/inc/../../resources/, OK
Storage/Persistence Dir: /var/apache2/htdocs/mtest/carl/examples/demo/inc/../../resources/, OK


Fatal error: Uncaught exception 'Exception' with message 'There is no device with id [generic] in wurfl' in /var/apache2/htdocs/mtest/carl/WURFL/CustomDeviceRepository.php:105 Stack trace: #0 /var/apache2/htdocs/mtest/carl/WURFL/CustomDeviceRepository.php(70): WURFL_CustomDeviceRepository->getDevice('generic') #1 /var/apache2/htdocs/mtest/carl/WURFL/CustomDeviceRepository.php(63): WURFL_CustomDeviceRepository->init() #2 /var/apache2/htdocs/mtest/carl/WURFL/DeviceRepositoryBuilder.php(78): WURFL_CustomDeviceRepository->__construct(Object(WURFL_Storage_File), Array) #3 /var/apache2/htdocs/mtest/carl/WURFL/WURFLManagerFactory.php(164): WURFL_DeviceRepositoryBuilder->build('/var/mobile/wur...', Array) #4 /var/apache2/htdocs/mtest/carl/WURFL/WURFLManagerFactory.php(127): WURFL_WURFLManagerFactory->deviceRepository(Object(WURFL_Storage_File), Object(WURFL_UserAgentHandlerChain)) #5 /var/apache2/htdocs/mtest/carl/WURFL/WURFLManagerFactory.php(66): WURFL_WURFLManagerFactory->init() #6 /var/apache2/htdocs/mtest/carl/examples/demo/ in /var/apache2/htdocs/mtest/carl/WURFL/CustomDeviceRepository.php on line 105

kamermans
Posts: 393
Joined: Mon Jun 06, 2011 9:50 am

Re: There is no device with id [generic] in wurfl

Postby kamermans » Tue Jul 19, 2011 2:39 pm

The problem is Solaris-specific in that PHP tries to obtain an exclusive file lock on the WURFL.XML to prevent multiple instances of the updater from updating the WURFL at the same time.

In Solaris, a read-only exclusive file lock is not possible (http://www.php.net/manual/en/function.flock.php#93400), it needs to be locked for reading and writing. As a result, the WURFL API had no choice but to assume the WURFL was either loaded already or in the process of being loaded, and it did not attempt to load the WURFL.

This a confirmed bug and will be fixed shortly in the next release.
Thanks,

Steve Kamerman
ScientiaMobile

Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!

kamermans
Posts: 393
Joined: Mon Jun 06, 2011 9:50 am

Re: There is no device with id [generic] in wurfl

Postby kamermans » Tue Jul 19, 2011 10:17 pm

We've just released a new version of the PHP API that addresses this problem directly: http://bit.ly/p9h4Dc
Thanks,

Steve Kamerman
ScientiaMobile

Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!


Who is online

Users browsing this forum: No registered users and 1 guest