[MGNLSTK-1481] Cannot open page on EE travel demo with STK added afterwards Created: 20/May/15  Updated: 15/Apr/16  Resolved: 29/Sep/15

Status: Closed
Project: Magnolia Standard Templating Kit (closed)
Component/s: None
Affects Version/s: 2.9
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Christopher Zimmermann Assignee: Evzen Fochr
Resolution: Obsolete Votes: 2
Labels: 5.4migration, support
Remaining Estimate: 0d
Time Spent: 1h
Original Estimate: Not Specified

Issue Links:
relation
is related to MGNLSTK-1480 Bad Multisite prototype site after in... Closed
Template:
Acceptance criteria:
Empty
Date of First Response:
Sprint: Kromeriz 12
Story Points: 1

 Description   

If an EE bundle with travel demo is already installed - and then STK is installed: one gets the following error on opening a page:

Caused by: java.lang.ClassCastException: info.magnolia.module.site.ConfiguredSite cannot be cast to info.magnolia.module.templatingkit.sites.Site
	at info.magnolia.module.templatingkit.functions.STKTemplatingFunctions.site(STKTemplatingFunctions.java:232)


 Comments   
Comment by Daniel Kasmeroglu [ 13/Jul/15 ]

This is clearly an implementation error in STKTemplatingFunctions caused by recent refactorings. The methods in STKTemplatingFunctions simply assumes that they got an instance of the old type info.magnolia.module.templatingkit.sites.Site whereas they're only getting the new interface info.magnolia.module.site.Site .
I suggest to either change the API of STKTemplatingFunctions so it will use the new Site interface (which might cause compatibility issues; nevertheless it's my preferred choice) or the methods in question should provide a wrapper which delegates the methods to the current Site if it cannot be casted.

A temporary solution would be to override the current type ConfiguredSite while adding the following type mapping to your magnolia module declarator:

    <components>

        <id>main</id>

        <type-mapping>
            <type>info.magnolia.module.site.Site</type>
            <!-- NEW BUT NOT WORKING TYPE
            <implementation>info.magnolia.module.site.ConfiguredSite</implementation>
            -->
            <implementation>info.magnolia.module.templatingkit.sites.Site</implementation>
        </type-mapping>

    </components>
Comment by Edgar Vonk [ 14/Jul/15 ]

We also run into this issue with Magnolia 5.4 EE with multisite and the STK installed.

PS: it is not that we want to install the STK but various (Magnolia) modules still come with the STK currently. See e.g. MGNLEESOLR-66

Generated at Mon Feb 12 07:36:58 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.