hybris CMS Cockpit: preview doesn't work - sap-commerce-cloud

I've just set up a new and clean hybris instance, created a b2c accelerator storefront using ant modulegen and the receipe b2c_acc - and of course I initialized my system after those steps. Everything works fine, but the CMS Cockpit preview.
Every time I try to open the preview of a page within the CMS Cockpit, I receive a HTTP 500 error which is being caused by a NullPointerException within this method of the DefaultUrlEncoderService class:
#Override
public Collection<String> getEncodingAttributesForSite()
{
return getCmsSiteService().getCurrentSite().getUrlEncodingAttributes();
}
The reason is that getCurrentSite() does not return any website, though the page I try to open (e.g. the Homepage) has been assigned to the "apparel-de" website.
Does anybody have a clue what might be the issue?
Did I miss anything?

change the location protocol from http to https:
https://localhost:9002/cmscockpit/index.zul

Related

Broadleaf - running locally - problem getting started the API project

I'm trying to run Heat Clinic 6.0.1 locally following getting started tutorial: https://www.broadleafcommerce.com/docs/core/current/getting-started/running-locally
I managed to run admin and site but not the API project. The application starts without problems but when I go to http://localhost:8082/api/v1/swagger-ui.html I get a 404. In the log I see this exception:
javax.servlet.ServletException: Circular view path [error]: would dispatch back to the current handler URL [/error] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
Also trying to log in directly in the API with user broadleafapi and password gives 404.
My environment: Windows 10, jdk 8, maven 3.6
What's wrong? Can you help me? Thank you
Thanks for the report. I reproduced this and it looks like that with the update to Spring Boot 2.0, we did not appropriately override the updated property that specifies the servlet location to embedded Tomcat. Thus, when you went to /api/v1/swagger-ui.html, the application treats it exactly like that URL which is what gave the 404.
Setting the server.servlet.contextPath=/api/v1 property appropriately stripped off this path as part of the servlet context and resolved the 404.
I tested around a bit and was able to 'Authorize' the app (button at the top right of the Swagger page) with the credentials information that get spit out in the logs:
Basic auth configured with user broadleafapi and password: <<generated>>
then I was able to hit the API endpoints.
The changes you will need to make locally in your project to consume the fix are at https://github.com/BroadleafCommerce/DemoSite/commit/422d1cdc37f847afd8bec0be477ab784cbad2e9d#diff-991c59b6dbb0f619b8570d8f8779eaddR11. You will notice that I moved the original definition in default.properties over to common.properties and I recommend that you do the same. To be clear, follow these steps:
Delete the server.servlet.contextPath entry in `api/src/main/resources/runtime-properties/default.properties
Change server.servletPath in api/src/main/resources/runtime-properties/common.properties to server.servlet.contextPath
Thanks for trying out Broadleaf and the report, sorry for the rough early start!

Ajax.BeginForm displaying partial view correctly in Chrome/FF but on new page in IE

I've previously had a similar question answered which was resolved by downloading Ajax unobtrusive but a similar thing is now happening again after I've now published my website to IIS. Please see below code for an Ajax form:
#using (Ajax.BeginForm("SearchResults","Export", new AjaxOptions { UpdateTargetId = "result", HttpMethod="POST"}))
And the controller code:
[HttpPost]
public ActionResult SearchResults(string searchString, string docType)
{
return PartialView(db.ExportKofaxes.Where(x => x.DocumentNumber)
}
In IE the partial view returned will open in new page but in both Chrome and FF it displays within the current view as intended. This is part of an MVC project, I copied across the project including the bin folder and scripts, the only thing making me think it's not an issue with any missing dll or script is the fact it works fine for both Chrome and FF but I'm seeing no Ajax dll's in my bin folder. When I copy across the project to IIS do I need to copy across the nuget packages folder also?
Any help appreciated.
Ok I'm extremely dumb, I have spent close on half a day working on why the hell it wouldn't work in IE and missed something stupid, all local sites were set to run in compatibility mode which I must have ticked at some point while testing something else. This was causing the partial view to open up in a new page.

This controller won't show up in Web Api on Azure

namespace StorageRoleMVC4.Controllers
{
public class SearchController : ApiController
{
public Dictionary<string, string> Get([FromUri] string searchString, [FromUri] string searchObject)
{
var searchHelper = new SearchStorageHelper();
var objectList = searchHelper.Retrieve(searchString, searchObject);
return objectList;
}
}
}
Is there anything about this controller that makes it unreachable once it's deployed (to an Azure web role)? I just get a 404 error when I try to reach it. It works great on the local emulator.
The last 2 times I've deployed my project, all the controllers in my web service have returned 404 errors for several hours, until the project seems to fix itself. I'm not sure why, but it might be related.
UPDATE
There is a WARNING in the event log on the web role VM after I publish:
The application '/' belonging to site '1273337584' has an invalid AppPoolId 'ea7a2e15-9390-49e1-a16b-67ff1cdb7dcb' set. Therefore, the application will be ignored.
This is the id of my site, but the AppPoolId is not correct. Changing the app pool turns the 404 into a 502.
Also, after publishing, the World Wide Web Publishing Service is turned off. When I turn it on and do an IIS reset, after the reset it's turned off again.
When I reboot the web role VM, most of the controllers work again, and the World Wide Web Publishing Service is turned on. But still, this SearchController doesn't work. Or any other new controllers I've created since this problem started happening.
Well, after a ridiculous amount of unsuccessful troubleshooting, I just rolled back to an earlier version of the code and found that it didn't read the web service when I deployed it. So I started over with that version and re-built the delta.
This involved removing a few web.config entries and removing some libraries, creating a few classes and referencing them in the global.asax (I think that's where it was) in order to override te Authorize attribute...
If anyone has a better answer, I will switch the answer to what you post.

grails 2.1.1 does not reload static resources

I have a fresh grails 2.1.1 installation, windows 7.
Problem: Static resources (CSS) don't reload in development mode.
According to http://grails.1312388.n4.nabble.com/Re-Grails-2-0-CSS-Changes-not-Picked-Up-td3680479.html I've tried in Config.groovy:
environments {
development {
grails.resources.processing.enabled = false;
}
}
Result: no CSS is loaded at all. Chrome needs 30 seconds to load a page, and does not load any CSS.
I reverted that change.
Then, according to http://grails.1312388.n4.nabble.com/disabling-static-resource-stuff-td3827384.html
I've tried to uncomment the plugins runtime ":resources:1.1.6"
Now I'm back to how it was initially, CSS files are served but not reloaded.
What works temporarily is the hack mentioned here:
http://grails.1312388.n4.nabble.com/The-resources-plugin-is-not-reloading-my-CSS-and-JS-of-a-bundle-td3857137.html
Top append to the url: ?_debugResources=y
How do I make static resources being reloaded in development mode? Shouldn't that be the default anyway? It doesn't make any sense in my opinion to reload gsp's (which it does) but not the static resources.
I set the grails.resources.debug flag in Config.groovy on debug to get the URL to be appended like this
css/main.css?_debugResources=y&n=1386063248351
environments {
development {
grails.resources.debug = true
}
production {
}
}
Any URL in your application can have the query parameter _debugResources=y added to it, and the request will perform no processing. So for example if you are browsing http://localhost:8080/myapp/admin and need to bypass resources, just change the URL in your browser to http://localhost:8080/myapp/admin?_debugResources=y
Reference Link : https://grails-plugins.github.io/grails-resources/guide/8.%20Debugging.html

How to hide a SharePoint tab on 100 sites? (SP2010)

I have 100 team sites in SharePoint 2010. At the last minute, I have been asked to hide a tab on each of these sites. Through the GUI, I could do this by using the Navigation option under Site Settings, but I would have to do it for all 100 sites. Is there a way to do this programmatically? Or globally through the GUI (I doubt this is an option)? I have tried using JQuery, but due to the lag, it is not a viable option. I figured there may also be the possibility to write a powershell script to do this - I am just still new to powershell.
Thoughts? Thanks.
You should use something like this in your Console application:
SPSite site = new Site("http://yoursite");
foreach (SPWeb web in site.AllWebs)
{
foreach(SPNavigationNode node in web.Navigation.TopNavigationBar)
{
if (node.Title == "Test")
{
node.IsVisible = false;
node.Update();
}
}
web.Dispose();
}
site.Dispose();
This script will hide all nodes with title "Test". You can also use Url property to determine if the node needs to be hidden.
Here I expect, that you need to change navigation of 100 child webs in site collection "http://yoursite".
P.S. Please, make sure, that you target .Net Framework 3.5 in your Console App, and AnyCPU platform is specified in Visual Studio project properties. Or you can get errors saying that your site not found.

Resources