bamboo: my custom action in xWork not decorated, the page shows without tabs - bamboo

I am new to Atlasian Bamboo development and have a problem, if you could help me.
I develop a bamboo plugin and I have this xwork:
<xwork key="viewNFTResults" name="View NFT Results">
<package name="nftResults" extends="buildResultView">
<action name="viewNFTLogs" class="com.atlassian.sap.nftresults.impl.NFTLogsView">
<result name="success" type="freemarker">/fragments/view-nft-results-log.ftl</result>
<result name="error" type="freemarker">/fragments/error.ftl</result>
</action>
</package>
</xwork>
<web-item key="NFT:\${planKey}-\${buildNumber}" name="chainNFTResults" section="chainResults.subMenu/chainResults"
weight="80">
<label key="NFT logs"/>
<link linkId="NFT:\${planKey}-\${buildNumber}">/build/result/viewNFTLogs.action?buildKey=${planKey}&buildNumber=${buildNumber}</link>
</web-item>
In my ftl file I put in head:
<head>
<meta name="decorator" content="result"/>
<meta name="tab" content="chainNFTResults"/>
</head>
and the NFTLogsView class extends BuildResultsAction.
Now when I click the NFt logs tab when the build is running, the content of this tab is appears and the action performed and the page decorator is ok also, like that:
But when I refresh the page or when the build is finished, and I am showing the tab (I mean inside the tab), I get this page:
The other tabs disappeared and I git many exceptions in logs, like:
BambooActionSupport.getWebSectionsForLocation(String) threw an exception.
and...
`[INFO] [talledLocalContainer] ==> fn.hasPlanPermissionForKey("BUILD",
stage.planKey) [in template "lib/chains.ftl" at line 369, column 49]`
and...
BambooActionSupport.hasPlanPermission(String, String) threw an exception.
And many other exceptions. Although the action URL is the same when I click the tab and when refresh the page.
Any suggestions please.

Finally, after a week of effort and help from the Atlassian Development team, we have found the cause and a workaround till this gets fixed in Bamboo.
JIRA:
[https://jira.atlassian.com/browse/BAM-19884]
Cause: Following dependencies are not injected for Xwork action.
BambooPermissionManager, BambooAuthenticationContext, JiraApplinksService,
WebInterfaceManager, VcsRepositoryConfigurationService, PlanExecutionManager, TriggerManager, PlanManager
Workaround
Add the following in the class that extends ViewBuildResult, spring scanner will find these dependencies and make them visible for plugin class loader when xwork action gets instantiated.
#ComponentImport
private BambooPermissionManager bambooPermissionManager;
#ComponentImport
private BambooAuthenticationContext bambooAuthenticationContext;
#ComponentImport
private JiraApplinksService jiraApplinksService;
#ComponentImport
private WebInterfaceManager webInterfaceManager;
#ComponentImport
private VcsRepositoryConfigurationService vcsRepositoryConfigurationService;
#ComponentImport
private PlanExecutionManager planExecutionManager;
#ComponentImport
private TriggerManager triggerManager;
#ComponentImport
private PlanManager planManager;
In pom.xml add the following (this might not be needed for the most recent version of spring scanner)
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
com.atlassian.bamboo.applinks.*;resolution:="optional",
com.atlassian.bamboo.build.*;resolution:="optional",
com.atlassian.bamboo.plan.*;resolution:="optional",
com.atlassian.bamboo.plan.trigger.*;resolution:="optional",
com.atlassian.bamboo.security.*;resolution:="optional",
com.atlassian.bamboo.user.*;resolution:="optional",
com.atlassian.bamboo.vcs.configuration.service.*:="optional",
com.atlassian.plugin.web.*;resolution:="optional",
*
</Import-Package>
Link: Atlassian Forum
https://community.developer.atlassian.com/t/problem-with-decorator-in-xwork-the-page-is-displayed-without-tabs-and-lot-of-exceptions-in-the-log/18516/26

Related

GWT Bootstrap3 Openlayers offline

I am using GWT with Bootstrap3 and Openlayers Map. I have implemented my own OSM Map server.
My application does not start without internet connection. I need guidance.
I followed the instructions in boostrap3 V1.0.2 for offline applications.
However I only got a blank screen.
Starting with the Firefox debugger I got the following message in the console:
Uncaught ReferenceError: OpenLayers is not defined
<anonymous> http://www.openstreetmap.org/openlayers/OpenStreetMap.js:7
Starting with Google Chrome I get the following warning
[Deprecation] Application Cache API manifest selection is deprecated and will be removed in M85, around August 2020. See https://www.chromestatus.com/features/6192449487634432 for more details.
followed by
GET http://www.openlayers.org/api/OpenLayers.js net::ERR_INTERNET_DISCONNECTED
and
localhost/:1 Application Cache Error event: Invalid or missing manifest origin trial token: http://localhost:8090/simaso/simasoweb/appcache.manifest
Here is my basic setup
SiMaSoWeb.gwt.xml:
...
<inherits name='com.google.gwt.json.JSON'/>
<inherits name="com.google.web.bindery.autobean.AutoBean"/>
<inherits name="org.gwtbootstrap3.extras.cachemanifest.Offline"/>
...
<add-linker name="offline" />
SiMaSoWeb.html:
<!doctype html>
<html manifest="simasoweb/appcache.manifest">
<head>
<title>Sirene</title>
<script type="text/javascript" language="javascript" src="simasoweb/simasoweb.nocache.js"></script>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>
<link type="text/css" rel="stylesheet" href="SiMaSoWeb.css">
....
</html>
In ...\simasoweb\appcache.manifest I find:
CACHE MANIFEST
# Version: 1599380329409.0.6297069797290025
CACHE:
AF4477772D0DB53A10ABCF74A5AE0C4D.cache.js
fonts/fontawesome-webfont.woff
clear.cache.gif
fonts/FontAwesome.otf
css/bootstrap-notify-custom.min.cache.css
7192594CA2F468C2F793523022719FA0.cache.js
...
css/font-awesome-4.7.0.min.cache.css
NETWORK:
*
Finally
I compile all this . Resources seem to be included in the war file ..
Needless to say that with internet connection, only in the first 1-2 seconds of starting, all is running fine ..
As per the Google Chrome warning you included, App Cache is a deprecated standard and is being removed. It has already been removed from non-secure contexts.
You should be using Service Workers instead to cache resources for offline use. You may have to write your own linker or maybe you can use gwt-serviceworker-linker.
Thanks to ELEVATE I managed to move from AppCache to ServiceWorker. However the Openlayers couldnt be fixed this way. So here is what solved the issues:
ServiceWorker
I am still using Java 8
I upgraded to GWT 2.9
I added to .gwt.xml
<inherits name="org.realityforge.gwt.serviceworker.Linker"/>
<inherits name="elemental2.dom.Dom"/>
<inherits name="elemental2.promise.Promise"/>
<inherits name="jsinterop.base.Base"/>
...
and
<add-linker name="serviceworker"/>
<extend-configuration-property name="serviceworker_static_files" value="./"/>
<extend-configuration-property name="serviceworker_static_files" value="../SiMaSoWeb.html"/>
In my entry JAVA-routine right at the start of my onModuleLod I added
import static elemental2.dom.DomGlobal.*;
import elemental2.dom.DomGlobal;
public void onModuleLoad() {
...
initStatic();
...
and later in that module
public void initStatic() {
if ( null != navigator.serviceWorker )
{
navigator.serviceWorker.register("simasoweb/"+ GWT.getModuleName() + "-sw.js" ).then( registration -> {
console.log( "ServiceWorker registration successful with scope: " + registration.getScope() );
// Every minute attempt to update the serviceWorker. If it does update
// then the "controllerchange" event will fire.
DomGlobal.setInterval( v -> registration.update(), 60000 );
return null;
}, error -> {
console.log( "ServiceWorker registration failed: ", error );
return null;
} );
navigator.serviceWorker.addEventListener( "controllerchange", e -> {
// This fires when the service worker controlling this page
// changes, eg a new worker has skipped waiting and become
// the new active worker.
console.log( "ServiceWorker updated ", e );
} );
}
}
}
I had issues with accesing the right files in my gwt - war directory. Therefore I updated the navigator.serviceWorker.register... command.
Very useful was the google inherent debugger with CTRL+SHIFT+I. In the 'console'-tab you find the messages - red means bad - solve it!
As external jar libraries I had to include
elemental2-core
elemental2-dom
elemental2-promise
base
Now the openlayers issues... Needless to say that there might be a much more elegant way and further more, you need an offline-map, which I have rendered myself and available (150GB for Germany!).
In the HTML file
Note that I opened the openlayers and openstreetmap .js files in a browser copied them in a file and copied them into my war directory in the subdirectory src. Again the browser debugger can help find directory issues.
<script type="text/javascript" language="javascript" src="simasoweb/simasoweb.nocache.js"></script>
<script src="src/OpenLayers.js"></script>
<script src="src/OpenStreetMap.js"></script>
Copy hard
I downloaded the gwt-openlayers demo project GWT-OpenLayers-master.zip
and copied all files in GWT-OpenLayers-master\gwt-openlayers-showcase\src\main\resources\org\gwtopenmaps\demo\openlayers\public\openlayers into my ...war\src\ directory where my openlayers.js files lie.
Finally I am not sure if the service-worker point 1-3 really helped.

JSF 2.2(Mojarra 2.2.0) Primefaces Issue - While clicking on download button, application is throwing out to sessionExpired page

Here is a snippet of SupportingDocs.xhtml code
<p:commandButton value="Download" ajax="false" icon="ui-icon-arrowthick-1-s" styleClass="blue-button" actionListener="#{entityType.downloadDFile}">
<f:attribute name="selectedFile" value="#{supportingDoc[column['supportingDocument.downloadlink.column']]}" />
</p:commandButton>
When clicking on Download button, it is downloading file perfectly but in the same time it is logging out as well.
Here is some pointers which I have got while debugging the application.
Click "Download" button
It calls loginFilter ->doFilter()
then it calls loginController -> destroySession()
then it calls sessionListener -> sessionDestroyed()
then it creates new session by calling sessionListener ->sessionCreated()
then loginFilter -> doFilter()

NavigationError on NavigateTo

I'm trying out Blazor ServerSide and created a Component to Redirect To the Login Page when a user is not logged in.
#inject Microsoft.AspNetCore.Components.NavigationManager NavigationManager;
#code {
/// <inheritdoc />
protected override Task OnInitializedAsync()
{
NavigationManager.NavigateTo("Login");
return Task.CompletedTask;
}
}
But always when "NavigateTo" is called the following exception is thrown:
"Microsoft.AspNetCore.Components.NavigationException: Exception of type 'Microsoft.AspNetCore.Components.NavigationException' was thrown.
at Microsoft.AspNetCore.Components.Server.Circuits.RemoteNavigationManager.NavigateToCore(String uri, Boolean forceLoad)
at Microsoft.AspNetCore.Components.NavigationManager.NavigateTo(String uri, Boolean forceLoad)
at ApplySupportTool.Blazor.Pages.RedirectToLogin.OnInitializedAsync() in C:\\Users\\padruttn\\Documents\\git\\ApplySupportTool\\src\\ApplySupportTool.Blazor\\Pages\\RedirectToLogin.razor:line 8"
Interesstingly the navigation is made despite the exception.
I also tried to call it with the path "/login" but the same behaviour here.
There is an open issue on github for this problem. See also the preceeding issue where a possible workaround is mentioned: putting the NavigateTo method into OnAfterRender instead of OnInitialized.
I needed to put this into OnInitialized rather than OnAfterRender, so had to go with the render-mode="Server" method, though apparently this isn't recommended.
It also states in the GitHub issue that this only happens in debug, not release, so a middle ground option is to change _Host.cshtml to contain:
<environment include="Staging,Production">
<component render-mode="ServerPrerendered" type="typeof(App)" />
</environment>
<environment include="Development">
<component render-mode="Server" type="typeof(App)" />
</environment>
Note that the following may be considered a workaround:
You may also change your method to the following including the "async" keyword to its signature, there is going to be a complaint about not using await, but in exchange you are not going to need a return value. Since it doesn't have an 'await' the effect is kinda the same as the synchronous version, but without the exception being thrown.
protected override async Task OnInitializedAsync()
{
NavigationManager.NavigateTo("Login");
}
Here is an example where i am using a RedirectToLogin.razor component in my routing
#inject NavigationManager NavigationManager
#code{
protected override async Task OnInitializedAsync()
{
var returnUrl = "~/" + NavigationManager.ToBaseRelativePath(NavigationManager.Uri);
NavigationManager.NavigateTo($"Identity/Account/Login?returnUrl={returnUrl}", forceLoad:false);
}
}
And in my App.razor
<Found Context="routeData">
<AuthorizeRouteView RouteData="#routeData" DefaultLayout="#typeof(MainLayout)">
<NotAuthorized>
<RedirectToLogin />
</NotAuthorized>
</AuthorizeRouteView>
</Found>
Old post, but - if you are running a Blazor Server app, this behavior only happens if render-mode is "ServerPrerendered". Disabling Pre-rendering by changing the mode to "Server" makes the exception not be thrown in the first place:
<app>
<component type="typeof(App)" render-mode="Server" />
</app>
I've searched current Blazor Documentation and change notes, and haven't found any mention of this, so just in case it helps somebody else...
I ran into the same problem and filed issue #28355. The official answer is, that it is save to ignore the exception when NaviagteTo is placed in OnInitialized. Here is the answer from javiercn:
Yes, it is completely safe to ignore it. The debugger stops because it is configured to do so, but in this case the exception is always handled. You can turn-off breaking on this exception if it's caught on the debugger settings.
Issue #13582 deals with how to prevent the debugger from stopping at this exception.
use OnInitializedAsync replace OnInitialized
protected override async Task OnInitializedAsync()
{
nav.NavigateTo("/login", true);
await base.OnInitializedAsync();
}
I had this when I tried to call the navigateto from another thread. render-mode = "Server" - solved the problem
In .NET 5.0, in the _host.cshtml file. Past the following #(await Html.RenderComponentAsync(RenderMode.Server)) in the line after the "blazor_error_ui" section.

Asp.net core and IE 11 rendering page issue

This is the weirdest error i have seen so far, and im not sure what i am doing wrong here.
I have asp.net core application. I wanted to wire-up different layout page to Error view instead of default _layout.cshtml. So here are the steps i followed:
1> Created a new asp.net core web application using VS 2015 community using default project template.
2> I added a new _ErrorLayout.cshtml layout page into Views\Shared Folder.
_ErrorLayout.cshtml
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>My Application</title>
</head>
<body>
<div>
#RenderBody()
</div>
</body>
</html>
3> Then i wired up Error.cshtml to new _ErrorLayout.cshtml layout.
Error.cshtml
#{
Layout = "~/Views/Shared/_ErrorLayout.cshtml";
}
<h1>Error.</h1>
<h2>An error occurred while processing your request.</h2>
<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
</p>
4> Just for local testing purpose, in startup's configure method, i wire-up /Home/Error view for development environment.
Startup.cs
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
if (env.IsDevelopment())
{
//app.UseDeveloperExceptionPage();
app.UseExceptionHandler("/Home/Error");
app.UseBrowserLink();
}
}
5> For testing pupose throw exception in Home's Index method.
Home.cs
public class HomeController : Controller
{
public IActionResult Index()
{
throw new Exception();
}
}
Now whenever application starts it goes to error page as expected.
Issue
Error view has unwanted text. I just want header and a message. So i deleted everything below <h2>.
Modified Error.cshtml
#{
Layout = "~/Views/Shared/_ErrorLayout.cshtml";
}
<h1>Error.</h1>
<h2>An error occurred while processing your request.</h2>
Now if i run application i get Http 500 error
I press F12 in IE 11 and check the response. It looks correct but i dont know why page does not render. Below is the captured response in IE11
Notes
This is only happening in IE 11. Google chrome shows error page on application startup.
If put the deleted text back in error view then IE 11 works.

Migrating code from OpenLaszlo 3.3 to 5.0: TypeError #1007 Instantiation attempted on a non-constructor.

I ported some parts of the code from OL 3.3 to OL 5.0 recently. I thought that everything will work but when i try to run it using the ant script i have I am getting this error.
[echo] C:\Program Files\OpenLaszlo Server 5.0.x\Server\lps-5.0.x/WEB-INF/lps/server/bin/lzc.bat
[exec] Compiling: C:\Workspace\application\client\src\TestClient.lzx to TestClient.swf10.swf
[exec] compiler output is Loading configuration file C:\Program Files\OpenLaszlo Server 5.0.x\Server\lps-5.0.x\WEB-INF\frameworks\flex-config.xml
[exec] C:\Documents and Settings\310773\Local Settings\Temp\lzswf9\Workspace\application\client\src\build\TestClient\app.swf (289808 bytes)
So, I took the folder and i compiled it directly in Laszlo. It's not showing any error but when the swf is about to load the main page I am getting this error. Any idea why?
TypeError: Error #1007: Instantiation attempted on a non-constructor.
at $lzc$class__mvz/$mvx()
at LzNode/__LZresolveReferences()
at LzNode/__LZcallInit()
at LzCanvas/__LZcallInit()
at LzCanvas/__LZinstantiationDone()
at LzInstantiatorService/makeSomeViews()
at LzInstantiatorService/checkQ()
at Function/http://adobe.com/AS3/2006/builtin::call()
at LzEvent/sendEvent()
at LzIdleKernel$/__update()
That's the error message you get when you try to instantiate a class which is not defined. Here is an example:
<canvas>
<class name="myclass">
<handler name="oninit">
// Instantiate a class which is not defined
var x = new lz.missingclass();
</handler>
</class>
<myclass />
</canvas>
Check for missing <includes> of classes which are being instantiated through scripts. You can always check the list of Adoboe Flash Run-Time Errors as well, sometimes there is useful information contained here.
Edit: Solution to problem added
This commment pointed to the problem:
I found that this line is causing the problem. <attribute name="dp"
value="$once{new lz.Datapointer()}" />. Any idea why?
If you check the OpenLaszlo reference for 5.0, you will see that the class names (on the left side in the class browser) use different case; some classes use camel case (lz.Browser, lz.DataElement), others use all lowercase (lz.view, lz.datapointer). In your case, you should have used lz.datapointer instead of lz.Datapointer.
Therefore this code will compile and run without any problems:
<canvas>
<class name="my_class" extends="node">
<attribute name="dp" value="$once{new lz.datapointer()}" />
</class>
<my_class oninit="Debug.inspect(this.dp)" />
</canvas>
A good way to test for the correct name of a class is to use the JavaScript in console in DHTML runtime, where you have auto-completion for lz.??? classnames:
Debugging SWF #1007 errors in OpenLaszlo
If you run into a #1007 error in the SWF runtime, I would compile the application for DHTML with the debugger disabled and the JavaScript error console open. Try this:
Change the line of with the $once{} constraint to
<attribute name="dp" value="$once{new lz.Datapointer()}" />
Compile the app in Chrome using DHTML runtime and debug=false. You should see the following error in the JavaScript console:
Click on the right side on error-1007.lzx:3, and you'll see the generated JavaScript code with the line causing the error
This line fails:
this.setAttribute("dp",new (lz.Datapointer)())
and you can even reproduce the error by typing new (lz.Datapointer) into the console.
Just as a point of info: The case of class names was "regularized" in 4.0 so that the case of a class that implements a tag is the same as that tag. See Mapping Class and Tag Names.
Here is an example of the problem and a workaround:
1) PROBLEM:
Here is the code of a short OpenLaszlo application demonstrating the problem:
<canvas width="1000" height="584">
<view name="myContainer" width="500" height="500">
<handler name="oninit">
var objCB = new lz.combobox(this);
</handler>
</view>
</canvas>
In this example there is no <combobox> tag in the application so the compiler does not think it needs to include the OpenLaszlo <combobox> class code in the application. Hence, when we try to instantiate a combobox with the line "var objCB = new lz.combobox(this);" the compiler throws the following error:
ERROR #test1007error.lzx≈5: TypeError: Error #1007: Instantiation
attempted on a non-constructor.
2) WORKAROUND:
The solution for the problem is to add an include in your application for <combobox>:
<canvas width="1000" height="584">
<include href="lz/combobox.lzx" />
<view name="myContainer" width="500" height="500">
<handler name="oninit">
var objCB = new lz.combobox(this);
</handler>
</view>
</canvas>
This time the error is not thrown and we see the combobox appear at the top left of the application when we run it.