Issues with custom URLRewrite rules in 7.9











up vote
3
down vote

favorite












Currently I'm having some issues with custom URL rewrite rules within ISH 7.9.



For some of our environments it works fine (like local and test), but on ACC and PROD it only seems to work from time to time after multiple deploys/restarts of the system.



We have created a custom cartridge that has a deploy.gradle file to exclude the files urlrewriterules.xml, domainsplittings.xml and syndication-targets.properties from the original cartridges. They get replaced by our custom files in the share/system/config/cluster folder. The static rules applied in the urlrewriterules.xml always work fine. However the rules that are coming from custom Java classes sometimes don't get well loaded by the RewriteRuleFactoryImpl returning back the below error:



[2018-11-07 08:20:37.906 +0100] WARN localhost ES1 appserver0 [ShipSupport-ebusiness-Site] [-] com.intershop.component.urlrewrite.internal.factory.RewriteRuleFactoryImpl [Storefront] [wJ5DCcg2CM5DCZPUUqdNu2D2fj8NZHaXjvP9qIZb] [yFAAAFvikjkOsqjA-0-00] "yFAAAFvikjkOsqjA-0-00" An implementation of rewrite rule type 'CustomCategory' does not exist.



The part of code in the urlrewriterules.xml that will call this java class is the following:



<!-- Custom Category Rule /c/<NAME_OF_LOWEST_CATEGORY> -->
<rule type="CustomCategory" priority="1000" name="custom category rule">
<configurations>
<configuration id="pathPrefix">/catalog</configuration>
<configuration id="partsCatalogID">4393</configuration>
</configurations>
</rule>


We also have the classes well created in our own cartridge such as CustomCategoryRewriteRule that extends BaseRewriteRule. URL Rewrite is enabled for those channels and we always Invalidate the cache in the channels that have it enabled.



The extension for the CustomCategory (defined in the same cartridge) is defined as below:






<?xml version="1.0" encoding="UTF-8"?>
<extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomCategoryRewriteRule">
<extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule" priority="1"/>
</extensionpoint:ExtensionPointModel>





Also the app-extension.component is defined in the same cartridge as below:






<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010" scope="global">
<fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.SLDSystem.Cartridges"/>
<fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.EnterpriseBackoffice.Cartridges"/>
</components>





We followed this article to confirm on how to do it: https://support.intershop.com/kb/index.php/Display/B28069 We also have it working fine in another project, but using Intershop 7.8.



Do you have any idea on what might be the cause?



Thank you!










share|improve this question




























    up vote
    3
    down vote

    favorite












    Currently I'm having some issues with custom URL rewrite rules within ISH 7.9.



    For some of our environments it works fine (like local and test), but on ACC and PROD it only seems to work from time to time after multiple deploys/restarts of the system.



    We have created a custom cartridge that has a deploy.gradle file to exclude the files urlrewriterules.xml, domainsplittings.xml and syndication-targets.properties from the original cartridges. They get replaced by our custom files in the share/system/config/cluster folder. The static rules applied in the urlrewriterules.xml always work fine. However the rules that are coming from custom Java classes sometimes don't get well loaded by the RewriteRuleFactoryImpl returning back the below error:



    [2018-11-07 08:20:37.906 +0100] WARN localhost ES1 appserver0 [ShipSupport-ebusiness-Site] [-] com.intershop.component.urlrewrite.internal.factory.RewriteRuleFactoryImpl [Storefront] [wJ5DCcg2CM5DCZPUUqdNu2D2fj8NZHaXjvP9qIZb] [yFAAAFvikjkOsqjA-0-00] "yFAAAFvikjkOsqjA-0-00" An implementation of rewrite rule type 'CustomCategory' does not exist.



    The part of code in the urlrewriterules.xml that will call this java class is the following:



    <!-- Custom Category Rule /c/<NAME_OF_LOWEST_CATEGORY> -->
    <rule type="CustomCategory" priority="1000" name="custom category rule">
    <configurations>
    <configuration id="pathPrefix">/catalog</configuration>
    <configuration id="partsCatalogID">4393</configuration>
    </configurations>
    </rule>


    We also have the classes well created in our own cartridge such as CustomCategoryRewriteRule that extends BaseRewriteRule. URL Rewrite is enabled for those channels and we always Invalidate the cache in the channels that have it enabled.



    The extension for the CustomCategory (defined in the same cartridge) is defined as below:






    <?xml version="1.0" encoding="UTF-8"?>
    <extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomCategoryRewriteRule">
    <extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule" priority="1"/>
    </extensionpoint:ExtensionPointModel>





    Also the app-extension.component is defined in the same cartridge as below:






    <?xml version="1.0" encoding="UTF-8"?>
    <components xmlns="http://www.intershop.de/component/2010" scope="global">
    <fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.SLDSystem.Cartridges"/>
    <fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.EnterpriseBackoffice.Cartridges"/>
    </components>





    We followed this article to confirm on how to do it: https://support.intershop.com/kb/index.php/Display/B28069 We also have it working fine in another project, but using Intershop 7.8.



    Do you have any idea on what might be the cause?



    Thank you!










    share|improve this question


























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      Currently I'm having some issues with custom URL rewrite rules within ISH 7.9.



      For some of our environments it works fine (like local and test), but on ACC and PROD it only seems to work from time to time after multiple deploys/restarts of the system.



      We have created a custom cartridge that has a deploy.gradle file to exclude the files urlrewriterules.xml, domainsplittings.xml and syndication-targets.properties from the original cartridges. They get replaced by our custom files in the share/system/config/cluster folder. The static rules applied in the urlrewriterules.xml always work fine. However the rules that are coming from custom Java classes sometimes don't get well loaded by the RewriteRuleFactoryImpl returning back the below error:



      [2018-11-07 08:20:37.906 +0100] WARN localhost ES1 appserver0 [ShipSupport-ebusiness-Site] [-] com.intershop.component.urlrewrite.internal.factory.RewriteRuleFactoryImpl [Storefront] [wJ5DCcg2CM5DCZPUUqdNu2D2fj8NZHaXjvP9qIZb] [yFAAAFvikjkOsqjA-0-00] "yFAAAFvikjkOsqjA-0-00" An implementation of rewrite rule type 'CustomCategory' does not exist.



      The part of code in the urlrewriterules.xml that will call this java class is the following:



      <!-- Custom Category Rule /c/<NAME_OF_LOWEST_CATEGORY> -->
      <rule type="CustomCategory" priority="1000" name="custom category rule">
      <configurations>
      <configuration id="pathPrefix">/catalog</configuration>
      <configuration id="partsCatalogID">4393</configuration>
      </configurations>
      </rule>


      We also have the classes well created in our own cartridge such as CustomCategoryRewriteRule that extends BaseRewriteRule. URL Rewrite is enabled for those channels and we always Invalidate the cache in the channels that have it enabled.



      The extension for the CustomCategory (defined in the same cartridge) is defined as below:






      <?xml version="1.0" encoding="UTF-8"?>
      <extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomCategoryRewriteRule">
      <extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule" priority="1"/>
      </extensionpoint:ExtensionPointModel>





      Also the app-extension.component is defined in the same cartridge as below:






      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://www.intershop.de/component/2010" scope="global">
      <fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.SLDSystem.Cartridges"/>
      <fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.EnterpriseBackoffice.Cartridges"/>
      </components>





      We followed this article to confirm on how to do it: https://support.intershop.com/kb/index.php/Display/B28069 We also have it working fine in another project, but using Intershop 7.8.



      Do you have any idea on what might be the cause?



      Thank you!










      share|improve this question















      Currently I'm having some issues with custom URL rewrite rules within ISH 7.9.



      For some of our environments it works fine (like local and test), but on ACC and PROD it only seems to work from time to time after multiple deploys/restarts of the system.



      We have created a custom cartridge that has a deploy.gradle file to exclude the files urlrewriterules.xml, domainsplittings.xml and syndication-targets.properties from the original cartridges. They get replaced by our custom files in the share/system/config/cluster folder. The static rules applied in the urlrewriterules.xml always work fine. However the rules that are coming from custom Java classes sometimes don't get well loaded by the RewriteRuleFactoryImpl returning back the below error:



      [2018-11-07 08:20:37.906 +0100] WARN localhost ES1 appserver0 [ShipSupport-ebusiness-Site] [-] com.intershop.component.urlrewrite.internal.factory.RewriteRuleFactoryImpl [Storefront] [wJ5DCcg2CM5DCZPUUqdNu2D2fj8NZHaXjvP9qIZb] [yFAAAFvikjkOsqjA-0-00] "yFAAAFvikjkOsqjA-0-00" An implementation of rewrite rule type 'CustomCategory' does not exist.



      The part of code in the urlrewriterules.xml that will call this java class is the following:



      <!-- Custom Category Rule /c/<NAME_OF_LOWEST_CATEGORY> -->
      <rule type="CustomCategory" priority="1000" name="custom category rule">
      <configurations>
      <configuration id="pathPrefix">/catalog</configuration>
      <configuration id="partsCatalogID">4393</configuration>
      </configurations>
      </rule>


      We also have the classes well created in our own cartridge such as CustomCategoryRewriteRule that extends BaseRewriteRule. URL Rewrite is enabled for those channels and we always Invalidate the cache in the channels that have it enabled.



      The extension for the CustomCategory (defined in the same cartridge) is defined as below:






      <?xml version="1.0" encoding="UTF-8"?>
      <extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomCategoryRewriteRule">
      <extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule" priority="1"/>
      </extensionpoint:ExtensionPointModel>





      Also the app-extension.component is defined in the same cartridge as below:






      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://www.intershop.de/component/2010" scope="global">
      <fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.SLDSystem.Cartridges"/>
      <fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.EnterpriseBackoffice.Cartridges"/>
      </components>





      We followed this article to confirm on how to do it: https://support.intershop.com/kb/index.php/Display/B28069 We also have it working fine in another project, but using Intershop 7.8.



      Do you have any idea on what might be the cause?



      Thank you!






      <?xml version="1.0" encoding="UTF-8"?>
      <extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomCategoryRewriteRule">
      <extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule" priority="1"/>
      </extensionpoint:ExtensionPointModel>





      <?xml version="1.0" encoding="UTF-8"?>
      <extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomCategoryRewriteRule">
      <extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule" priority="1"/>
      </extensionpoint:ExtensionPointModel>





      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://www.intershop.de/component/2010" scope="global">
      <fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.SLDSystem.Cartridges"/>
      <fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.EnterpriseBackoffice.Cartridges"/>
      </components>





      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://www.intershop.de/component/2010" scope="global">
      <fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.SLDSystem.Cartridges"/>
      <fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.EnterpriseBackoffice.Cartridges"/>
      </components>






      intershop






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 7 at 9:50

























      asked Nov 7 at 7:46









      Duarte Pimenta

      486




      486
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          Besides the implementation, you also need to create an extension file in <cartridge>/staticfiles/cartridge/extensions. This is the actual registration of the rewrite rule for the lookup mechanism. See the following example:



          <?xml version="1.0" encoding="UTF-8"?>
          <extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomRewriteRule.extension">
          <extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule " priority="1"/>
          </extensionpoint:ExtensionPointModel>


          Also the cartridge that contains these extensions needs to be registered at the application types via a component file in <cartridge>/staticfiles/cartridge/components. This is needed so that the extension is loaded correctly in the correct application context. See this example:



          <?xml version="1.0" encoding="UTF-8" ?>
          <components xmlns="http://www.intershop.de/component/2010">
          <fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.SLDSystem.Cartridges" />
          <fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CBackoffice.Cartridges" />
          <fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CResponsive.Cartridges" />
          </components>


          I'm not quite sure if you need to register it for all of these applications, but these are the ones we used in our last project. If you use different application types or have custom ones, make sure to add those accordingly.






          share|improve this answer








          New contributor




          Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.














          • 1




            Updated my original post with extra information
            – Duarte Pimenta
            Nov 7 at 9:42












          • We do have all these configurations in place, otherwise it would not work in any environment. The problem we have is that, for certain environments, it only works from 'time to time' after a certain amount of rebuilds/deploys.
            – Bas de Groot
            Nov 7 at 9:51






          • 1




            It seems this is an issue with the implementation of the RewriteRuleFactoryImpl: This factory is registered as singleton and the rules are loaded lazily only once and then cached. However, for loading the rules only the current application at the time of the lookup is considered. If this is an application which does not contain the cartridge, then it may be missing and will never get loaded. /edit: As a workaround, you may try to register the cartridge for more application types (especially the storefront ones) and see if the issue still persists.
            – Andreas Paschwitz
            Nov 7 at 13:16








          • 1




            I just managed to reproduce the issue locally by registering a cartridge (with some custom rewrite rules) for the applications SLDSystem and EnterpriseBackoffice only (just like in your example). After starting the application server, I first opened a storefront page (application type B2CResponsive). The rewrite rules don't get loaded in this case and the URLs will never be re-written. However, if I open the backoffice first after server start, then the rules will get loaded and everything is working fine.
            – Andreas Paschwitz
            Nov 7 at 13:16






          • 1




            Adding the storefront application types seems to have fixed our issue indeed. Thanks!
            – Bas de Groot
            Nov 7 at 13:54


















          up vote
          3
          down vote













          We ended up solving it out by apply the SMBResponsive cartridge as well.






          <?xml version="1.0" encoding="UTF-8"?>
          <components xmlns="http://www.intershop.de/component/2010" scope="global">
          <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SLDSystem.Cartridges"/>
          <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.EnterpriseBackoffice.Cartridges"/>
          <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SMBResponsive.Cartridges" />
          </components>





          Thanks Andreas for all the help.






          share|improve this answer








          New contributor




          Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53185307%2fissues-with-custom-urlrewrite-rules-in-7-9%23new-answer', 'question_page');
            }
            );

            Post as a guest
































            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote



            accepted










            Besides the implementation, you also need to create an extension file in <cartridge>/staticfiles/cartridge/extensions. This is the actual registration of the rewrite rule for the lookup mechanism. See the following example:



            <?xml version="1.0" encoding="UTF-8"?>
            <extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomRewriteRule.extension">
            <extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule " priority="1"/>
            </extensionpoint:ExtensionPointModel>


            Also the cartridge that contains these extensions needs to be registered at the application types via a component file in <cartridge>/staticfiles/cartridge/components. This is needed so that the extension is loaded correctly in the correct application context. See this example:



            <?xml version="1.0" encoding="UTF-8" ?>
            <components xmlns="http://www.intershop.de/component/2010">
            <fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.SLDSystem.Cartridges" />
            <fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CBackoffice.Cartridges" />
            <fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CResponsive.Cartridges" />
            </components>


            I'm not quite sure if you need to register it for all of these applications, but these are the ones we used in our last project. If you use different application types or have custom ones, make sure to add those accordingly.






            share|improve this answer








            New contributor




            Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.














            • 1




              Updated my original post with extra information
              – Duarte Pimenta
              Nov 7 at 9:42












            • We do have all these configurations in place, otherwise it would not work in any environment. The problem we have is that, for certain environments, it only works from 'time to time' after a certain amount of rebuilds/deploys.
              – Bas de Groot
              Nov 7 at 9:51






            • 1




              It seems this is an issue with the implementation of the RewriteRuleFactoryImpl: This factory is registered as singleton and the rules are loaded lazily only once and then cached. However, for loading the rules only the current application at the time of the lookup is considered. If this is an application which does not contain the cartridge, then it may be missing and will never get loaded. /edit: As a workaround, you may try to register the cartridge for more application types (especially the storefront ones) and see if the issue still persists.
              – Andreas Paschwitz
              Nov 7 at 13:16








            • 1




              I just managed to reproduce the issue locally by registering a cartridge (with some custom rewrite rules) for the applications SLDSystem and EnterpriseBackoffice only (just like in your example). After starting the application server, I first opened a storefront page (application type B2CResponsive). The rewrite rules don't get loaded in this case and the URLs will never be re-written. However, if I open the backoffice first after server start, then the rules will get loaded and everything is working fine.
              – Andreas Paschwitz
              Nov 7 at 13:16






            • 1




              Adding the storefront application types seems to have fixed our issue indeed. Thanks!
              – Bas de Groot
              Nov 7 at 13:54















            up vote
            2
            down vote



            accepted










            Besides the implementation, you also need to create an extension file in <cartridge>/staticfiles/cartridge/extensions. This is the actual registration of the rewrite rule for the lookup mechanism. See the following example:



            <?xml version="1.0" encoding="UTF-8"?>
            <extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomRewriteRule.extension">
            <extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule " priority="1"/>
            </extensionpoint:ExtensionPointModel>


            Also the cartridge that contains these extensions needs to be registered at the application types via a component file in <cartridge>/staticfiles/cartridge/components. This is needed so that the extension is loaded correctly in the correct application context. See this example:



            <?xml version="1.0" encoding="UTF-8" ?>
            <components xmlns="http://www.intershop.de/component/2010">
            <fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.SLDSystem.Cartridges" />
            <fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CBackoffice.Cartridges" />
            <fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CResponsive.Cartridges" />
            </components>


            I'm not quite sure if you need to register it for all of these applications, but these are the ones we used in our last project. If you use different application types or have custom ones, make sure to add those accordingly.






            share|improve this answer








            New contributor




            Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.














            • 1




              Updated my original post with extra information
              – Duarte Pimenta
              Nov 7 at 9:42












            • We do have all these configurations in place, otherwise it would not work in any environment. The problem we have is that, for certain environments, it only works from 'time to time' after a certain amount of rebuilds/deploys.
              – Bas de Groot
              Nov 7 at 9:51






            • 1




              It seems this is an issue with the implementation of the RewriteRuleFactoryImpl: This factory is registered as singleton and the rules are loaded lazily only once and then cached. However, for loading the rules only the current application at the time of the lookup is considered. If this is an application which does not contain the cartridge, then it may be missing and will never get loaded. /edit: As a workaround, you may try to register the cartridge for more application types (especially the storefront ones) and see if the issue still persists.
              – Andreas Paschwitz
              Nov 7 at 13:16








            • 1




              I just managed to reproduce the issue locally by registering a cartridge (with some custom rewrite rules) for the applications SLDSystem and EnterpriseBackoffice only (just like in your example). After starting the application server, I first opened a storefront page (application type B2CResponsive). The rewrite rules don't get loaded in this case and the URLs will never be re-written. However, if I open the backoffice first after server start, then the rules will get loaded and everything is working fine.
              – Andreas Paschwitz
              Nov 7 at 13:16






            • 1




              Adding the storefront application types seems to have fixed our issue indeed. Thanks!
              – Bas de Groot
              Nov 7 at 13:54













            up vote
            2
            down vote



            accepted







            up vote
            2
            down vote



            accepted






            Besides the implementation, you also need to create an extension file in <cartridge>/staticfiles/cartridge/extensions. This is the actual registration of the rewrite rule for the lookup mechanism. See the following example:



            <?xml version="1.0" encoding="UTF-8"?>
            <extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomRewriteRule.extension">
            <extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule " priority="1"/>
            </extensionpoint:ExtensionPointModel>


            Also the cartridge that contains these extensions needs to be registered at the application types via a component file in <cartridge>/staticfiles/cartridge/components. This is needed so that the extension is loaded correctly in the correct application context. See this example:



            <?xml version="1.0" encoding="UTF-8" ?>
            <components xmlns="http://www.intershop.de/component/2010">
            <fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.SLDSystem.Cartridges" />
            <fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CBackoffice.Cartridges" />
            <fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CResponsive.Cartridges" />
            </components>


            I'm not quite sure if you need to register it for all of these applications, but these are the ones we used in our last project. If you use different application types or have custom ones, make sure to add those accordingly.






            share|improve this answer








            New contributor




            Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            Besides the implementation, you also need to create an extension file in <cartridge>/staticfiles/cartridge/extensions. This is the actual registration of the rewrite rule for the lookup mechanism. See the following example:



            <?xml version="1.0" encoding="UTF-8"?>
            <extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomRewriteRule.extension">
            <extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule " priority="1"/>
            </extensionpoint:ExtensionPointModel>


            Also the cartridge that contains these extensions needs to be registered at the application types via a component file in <cartridge>/staticfiles/cartridge/components. This is needed so that the extension is loaded correctly in the correct application context. See this example:



            <?xml version="1.0" encoding="UTF-8" ?>
            <components xmlns="http://www.intershop.de/component/2010">
            <fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.SLDSystem.Cartridges" />
            <fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CBackoffice.Cartridges" />
            <fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CResponsive.Cartridges" />
            </components>


            I'm not quite sure if you need to register it for all of these applications, but these are the ones we used in our last project. If you use different application types or have custom ones, make sure to add those accordingly.







            share|improve this answer








            New contributor




            Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            share|improve this answer



            share|improve this answer






            New contributor




            Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            answered Nov 7 at 9:26









            Andreas Paschwitz

            693




            693




            New contributor




            Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.





            New contributor





            Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.






            Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.








            • 1




              Updated my original post with extra information
              – Duarte Pimenta
              Nov 7 at 9:42












            • We do have all these configurations in place, otherwise it would not work in any environment. The problem we have is that, for certain environments, it only works from 'time to time' after a certain amount of rebuilds/deploys.
              – Bas de Groot
              Nov 7 at 9:51






            • 1




              It seems this is an issue with the implementation of the RewriteRuleFactoryImpl: This factory is registered as singleton and the rules are loaded lazily only once and then cached. However, for loading the rules only the current application at the time of the lookup is considered. If this is an application which does not contain the cartridge, then it may be missing and will never get loaded. /edit: As a workaround, you may try to register the cartridge for more application types (especially the storefront ones) and see if the issue still persists.
              – Andreas Paschwitz
              Nov 7 at 13:16








            • 1




              I just managed to reproduce the issue locally by registering a cartridge (with some custom rewrite rules) for the applications SLDSystem and EnterpriseBackoffice only (just like in your example). After starting the application server, I first opened a storefront page (application type B2CResponsive). The rewrite rules don't get loaded in this case and the URLs will never be re-written. However, if I open the backoffice first after server start, then the rules will get loaded and everything is working fine.
              – Andreas Paschwitz
              Nov 7 at 13:16






            • 1




              Adding the storefront application types seems to have fixed our issue indeed. Thanks!
              – Bas de Groot
              Nov 7 at 13:54














            • 1




              Updated my original post with extra information
              – Duarte Pimenta
              Nov 7 at 9:42












            • We do have all these configurations in place, otherwise it would not work in any environment. The problem we have is that, for certain environments, it only works from 'time to time' after a certain amount of rebuilds/deploys.
              – Bas de Groot
              Nov 7 at 9:51






            • 1




              It seems this is an issue with the implementation of the RewriteRuleFactoryImpl: This factory is registered as singleton and the rules are loaded lazily only once and then cached. However, for loading the rules only the current application at the time of the lookup is considered. If this is an application which does not contain the cartridge, then it may be missing and will never get loaded. /edit: As a workaround, you may try to register the cartridge for more application types (especially the storefront ones) and see if the issue still persists.
              – Andreas Paschwitz
              Nov 7 at 13:16








            • 1




              I just managed to reproduce the issue locally by registering a cartridge (with some custom rewrite rules) for the applications SLDSystem and EnterpriseBackoffice only (just like in your example). After starting the application server, I first opened a storefront page (application type B2CResponsive). The rewrite rules don't get loaded in this case and the URLs will never be re-written. However, if I open the backoffice first after server start, then the rules will get loaded and everything is working fine.
              – Andreas Paschwitz
              Nov 7 at 13:16






            • 1




              Adding the storefront application types seems to have fixed our issue indeed. Thanks!
              – Bas de Groot
              Nov 7 at 13:54








            1




            1




            Updated my original post with extra information
            – Duarte Pimenta
            Nov 7 at 9:42






            Updated my original post with extra information
            – Duarte Pimenta
            Nov 7 at 9:42














            We do have all these configurations in place, otherwise it would not work in any environment. The problem we have is that, for certain environments, it only works from 'time to time' after a certain amount of rebuilds/deploys.
            – Bas de Groot
            Nov 7 at 9:51




            We do have all these configurations in place, otherwise it would not work in any environment. The problem we have is that, for certain environments, it only works from 'time to time' after a certain amount of rebuilds/deploys.
            – Bas de Groot
            Nov 7 at 9:51




            1




            1




            It seems this is an issue with the implementation of the RewriteRuleFactoryImpl: This factory is registered as singleton and the rules are loaded lazily only once and then cached. However, for loading the rules only the current application at the time of the lookup is considered. If this is an application which does not contain the cartridge, then it may be missing and will never get loaded. /edit: As a workaround, you may try to register the cartridge for more application types (especially the storefront ones) and see if the issue still persists.
            – Andreas Paschwitz
            Nov 7 at 13:16






            It seems this is an issue with the implementation of the RewriteRuleFactoryImpl: This factory is registered as singleton and the rules are loaded lazily only once and then cached. However, for loading the rules only the current application at the time of the lookup is considered. If this is an application which does not contain the cartridge, then it may be missing and will never get loaded. /edit: As a workaround, you may try to register the cartridge for more application types (especially the storefront ones) and see if the issue still persists.
            – Andreas Paschwitz
            Nov 7 at 13:16






            1




            1




            I just managed to reproduce the issue locally by registering a cartridge (with some custom rewrite rules) for the applications SLDSystem and EnterpriseBackoffice only (just like in your example). After starting the application server, I first opened a storefront page (application type B2CResponsive). The rewrite rules don't get loaded in this case and the URLs will never be re-written. However, if I open the backoffice first after server start, then the rules will get loaded and everything is working fine.
            – Andreas Paschwitz
            Nov 7 at 13:16




            I just managed to reproduce the issue locally by registering a cartridge (with some custom rewrite rules) for the applications SLDSystem and EnterpriseBackoffice only (just like in your example). After starting the application server, I first opened a storefront page (application type B2CResponsive). The rewrite rules don't get loaded in this case and the URLs will never be re-written. However, if I open the backoffice first after server start, then the rules will get loaded and everything is working fine.
            – Andreas Paschwitz
            Nov 7 at 13:16




            1




            1




            Adding the storefront application types seems to have fixed our issue indeed. Thanks!
            – Bas de Groot
            Nov 7 at 13:54




            Adding the storefront application types seems to have fixed our issue indeed. Thanks!
            – Bas de Groot
            Nov 7 at 13:54












            up vote
            3
            down vote













            We ended up solving it out by apply the SMBResponsive cartridge as well.






            <?xml version="1.0" encoding="UTF-8"?>
            <components xmlns="http://www.intershop.de/component/2010" scope="global">
            <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SLDSystem.Cartridges"/>
            <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.EnterpriseBackoffice.Cartridges"/>
            <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SMBResponsive.Cartridges" />
            </components>





            Thanks Andreas for all the help.






            share|improve this answer








            New contributor




            Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.






















              up vote
              3
              down vote













              We ended up solving it out by apply the SMBResponsive cartridge as well.






              <?xml version="1.0" encoding="UTF-8"?>
              <components xmlns="http://www.intershop.de/component/2010" scope="global">
              <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SLDSystem.Cartridges"/>
              <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.EnterpriseBackoffice.Cartridges"/>
              <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SMBResponsive.Cartridges" />
              </components>





              Thanks Andreas for all the help.






              share|improve this answer








              New contributor




              Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.




















                up vote
                3
                down vote










                up vote
                3
                down vote









                We ended up solving it out by apply the SMBResponsive cartridge as well.






                <?xml version="1.0" encoding="UTF-8"?>
                <components xmlns="http://www.intershop.de/component/2010" scope="global">
                <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SLDSystem.Cartridges"/>
                <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.EnterpriseBackoffice.Cartridges"/>
                <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SMBResponsive.Cartridges" />
                </components>





                Thanks Andreas for all the help.






                share|improve this answer








                New contributor




                Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                We ended up solving it out by apply the SMBResponsive cartridge as well.






                <?xml version="1.0" encoding="UTF-8"?>
                <components xmlns="http://www.intershop.de/component/2010" scope="global">
                <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SLDSystem.Cartridges"/>
                <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.EnterpriseBackoffice.Cartridges"/>
                <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SMBResponsive.Cartridges" />
                </components>





                Thanks Andreas for all the help.






                <?xml version="1.0" encoding="UTF-8"?>
                <components xmlns="http://www.intershop.de/component/2010" scope="global">
                <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SLDSystem.Cartridges"/>
                <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.EnterpriseBackoffice.Cartridges"/>
                <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SMBResponsive.Cartridges" />
                </components>





                <?xml version="1.0" encoding="UTF-8"?>
                <components xmlns="http://www.intershop.de/component/2010" scope="global">
                <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SLDSystem.Cartridges"/>
                <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.EnterpriseBackoffice.Cartridges"/>
                <fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SMBResponsive.Cartridges" />
                </components>






                share|improve this answer








                New contributor




                Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                share|improve this answer



                share|improve this answer






                New contributor




                Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered Nov 7 at 14:07









                Duarte Pimenta

                486




                486




                New contributor




                Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53185307%2fissues-with-custom-urlrewrite-rules-in-7-9%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest




















































































                    這個網誌中的熱門文章

                    Academy of Television Arts & Sciences

                    L'Équipe

                    1995 France bombings