Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Installing SilverStripe

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

[User Error] Bad class to singleton() - PageKarriere


Reply

4 Posts   2727 Views

Avatar
Worp

11 August 2010 at 12:33am Community Member, 11 Posts

Hey guys,

I did a fresh install on a webserver that is not my own. Now I get the problem "[User Error] Bad class to singleton() - PageKarriere" when accessing the /admin panel (via silverstripe/index.php/admin because i do not have mod_rewrite on the server).
Note: PageKarriere is a page type i have customized for the website.

Now when i delete the custom page types and leave only the "page.ss" in /mysite/code, everything works fine. But as soon as i add one of the custom pages (which already work on another webserver and on my localhost), i get the bad class to singleton() error again.
Can anyone explain the function singleton() to me and maybe what the problem is?

On the forums i only found "not really" related topics, which all describe a different problem which cause the singleton() error.
Find the full error code below.

I know that this is probably a very easy problem, but i am just not seeing the solution ^^

Thanks in advance for all answers i get =)

Kindest Regards,
Worp

[User Error] Bad class to singleton() - PageKarriere
GET /silverstripe/index.php/admin

Line 334 in /www/test.ceceka.de/htdocs/silverstripe/sapphire/core/Core.php
Source

325 *
326 * @param string $className
327 * @return Object
328 */
329 function singleton($className) {
330    global $_SINGLETONS;
331    if(!isset($className)) user_error("singleton() Called without a class", E_USER_ERROR);
332    if(!is_string($className)) user_error("singleton() passed bad class_name: " . var_export($className,true), E_USER_ERROR);
333    if(!isset($_SINGLETONS[$className])) {
334     if(!class_exists($className)) user_error("Bad class to singleton() - $className", E_USER_ERROR);
335       $_SINGLETONS[$className] = Object::strong_create($className,null, true);
336       if(!$_SINGLETONS[$className]) user_error("singleton() Unknown class '$className'", E_USER_ERROR);
337    }
338    return $_SINGLETONS[$className];
339 }
340

Trace

* Bad class to singleton() - PageKarriere
Line 334 of Core.php
* singleton(PageKarriere)
Line 322 of SiteTree.php
* SiteTree::page_type_classes()
Line 341 of CMSMain.php
* CMSMain->PageTypes()
Line 1188 of CMSMain.php
* CMSMain->AddPageOptionsForm()
Line 369 of ViewableData.php
* ViewableData->obj(AddPageOptionsForm)
Line 45 of .cache.www.test.ceceka.de.htdocs.silverstripe.cms.templates.Includes.CMSMain_left.ss
* include(/www/test.ceceka.de/htdocs/silverstripe/silverstripe-cache/.cache.www.test.ceceka.de.htdocs.silverstripe.cms.templates.Includes.CMSMain_left.ss)
Line 420 of SSViewer.php
* SSViewer->process(CMSMain)
Line 342 of ViewableData.php
* ViewableData->renderWith(Array)
Line 481 of LeftAndMain.php
* LeftAndMain->Left()
Line 369 of ViewableData.php
* ViewableData->obj(Left,,,1)
Line 446 of ViewableData.php
* ViewableData->XML_val(Left,,1)
Line 59 of .cache.www.test.ceceka.de.htdocs.silverstripe.cms.templates.LeftAndMain.ss
* include(/www/test.ceceka.de/htdocs/silverstripe/silverstripe-cache/.cache.www.test.ceceka.de.htdocs.silverstripe.cms.templates.LeftAndMain.ss)
Line 420 of SSViewer.php
* SSViewer->process(CMSMain)
Line 202 of Controller.php
* Controller->handleAction(SS_HTTPRequest)
Line 137 of RequestHandler.php
* RequestHandler->handleRequest(SS_HTTPRequest)
Line 147 of Controller.php
* Controller->handleRequest(SS_HTTPRequest)
Line 281 of Director.php
* Director::handleRequest(SS_HTTPRequest,Session)
Line 124 of Director.php
* Director::direct(admin)
Line 127 of main.php
* require_once(/www/test.ceceka.de/htdocs/silverstripe/sapphire/main.php)
Line 63 of index.php

Avatar
Sean

11 August 2010 at 11:17am (Last edited: 11 August 2010 11:17am), Forum Moderator, 921 Posts

If you add or remove a class you need to run ?flush=all in the URL for the class manifest to be reloaded.

If you're adding or removing a class which requires database tables or columns, it's best to run dev/build?flush=all so the database is rebuilt as well as the class manifest.

Sean

Avatar
Worp

11 August 2010 at 8:50pm (Last edited: 11 August 2010 8:57pm), Community Member, 11 Posts

Ah, i am sorry. I did not mention that. I did flush the database with /dev/build?flush=1 aswell as /dev/build?flush=all.
But as I did it again just now, to be sure, i now get another problem:

Website Error
There has been an error

The website server has not been able to respond to your request.

How do i get more information about the problem? (Developer Mode?)

*edit:
When i delete the custom pages and flush the database mit /dev/build?flush=all, i do not get an error when accessing the silverstripe/index.php/admin panel. However the Panel does not load anymore. There is just the screen "Loading...Welcome to Silverstripe now Loading" (see attachement). I had this problem before the problem "bad class to singleton()" but simply because I entered "silverstripe/admin" instead of "silverstripe/index.php/admin". But now I am typing in the correct URL and i get the loading screen.

Worp

Attached Files
Avatar
Worp

24 August 2010 at 2:39am Community Member, 11 Posts

Hey...

It's me again. Any chance of getting an answer to this?
I could really need the help and i still can't get it fixed.

Kindest Regards,
Wrop