Icefaces: server push issue - jsf-2

I have been working with icefaces since its version 1.8 and now I am getting into the latest version (3.0). I think my problem is not version related, but the solution could be.
I am programming an application which uses ICEpush. The model is like this:
Several devices are connected to the server via java.net.socket and running in an independent thread and every message could trigger an ajax push event.
When I use PushRenderer.Render("group") I get this:
java.lang.RuntimeException: FacesContext is not present for thread Thread[172.17.1.49,5,main].
When I use SessionRenderer.Render("group") it works as expected when I go the main page of the devices and I can see how the information changes on real time for everyone. The problem I find is that when I try to navigate to another view in my application I see that it is done in a very slow way and the buttons after I click on them do not work.
When I refresh the page they start working again until I navigate to the page of the devices where I get the problem again.
I have tried with the PortableRenderer but if I use PushRenderer.getPortableRenderer() I get a nullPointerException; and, if try to use PushRenderer.getPortableRenderer(FacesContext.getCurrentInstance()) I find that this method has changed its parameter to ServletContext that I do not know where I can find it.
I hope you can help me with this.
thanks in advance.

You can get the ServletContext from your FacesContext, like this:
ServletContext servletContext = (ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext();

Call PushRenderer.getPortableRenderer() from within the faces context. For example in the constructor of a managed bean. The portable renderer can than be passed to another thread and called later outside the faces context.

Related

How to deploy client-side service WSDLs

I have code using the SysOperationFrameworkService, and after a model-deploy or some other set of circumstances, many users get Function SysOperationDataContractInfo::newParameterInfo has been incorrectly called..
It's unable to be resolved with full-compile, sync, full CIL, deleting XPPIL files, deleting AUC/KTI, usage data, security (they're admin), refreshing caches (server &client), etc. and I have a ticket open with Microsoft and they're struggling.
I've narrowed the issue down to when the service group AxClient located in the AOT at \Service Groups\AxClient WSDL files get deployed to C:\Users\[User]\AppData\Local. Either those files existing there, or something happening when those files get deployed is needed.
Any idea how/what causes these files (AxClient.wsdl, etc) to be created? With a user who happens to be "working", I can close the client, delete all the files, open the client, and no files will exist...then I perform a SysOp process and those files get created during that process. With the non-working user, with same security on the same machine does it, the files don't get created.
I have found that the
"Function SysOperationDataContractInfo::newParameterInfo has been incorrectly called" has been throwed because of a possible bug in the kernel when calling the "dictMethod = new DictMethod(UtilElementType::ClassInstanceMethod, dictClass.id(), methodName);" in the SysOperationServiceController.getServiceOperation() method. In my case the new DictMethod was sometimes unable to get the method parameter from a superclass, causing the _parentMethodParameterName check fail in the SysOperationDataContractInfo.newParameterInfo.
So, I solved the issue just by doing an override of the super method where the parameter could not be retrieved and then just calling super(_parameter), then everything went well.
Have you tried axclicfg.exe -> connections -> refresh

JSFUnit inconsistently getting JSFServerSession

We are trying to run JSFUnit with Arquillian on a WebLogic 12c container and are running into a few problems.
First, when we try to use the #InitialPage annotation to inject in the JSFServerSession and JSFClientSession, the JSFServerSession is always returned as null.
Second, we have tried working around the problem by going the legacy route of creating a new JSFSession and then getting the JSFServerSession and JSFClientSession from it. Once we run a second test we get "java.lang.IllegalStateException: Can not find HttpSession. Make sure JSFUnitFilter has run and your test extends org.apache.cactus.ServletTestCase."
It seems very arbitrary because there are times where we will run a test and it passes. Sometimes the very next time it fails. Or adding a line that doesn't seem like it should be related, will thrown the "Can not find HttpSession" error.
It seems like it can't handle creating the JSFSession multiple times or there is some timeout on the server that even though the test war is getting undeployed something needs to timeout. Any thoughts?
I am not sure if this applies to your problem as well, but I had similar issue with JBoss 7. Usually the issues can be solved by:
Using Servlet 3.0 protocol which should include relevant filters to web.xml
If that doesn't help (like in my case), use this solution: https://stackoverflow.com/a/17036005/1667977
In any case, try to avoid creating the session yourself

monodroid activity - wrong activity at start up

I have developed a monodroid application with several activities.
Occasionally, the wrong activity is shown first, as opposed to the one with "MainLauncher=true" set.
Also, occasionally I get a dialog stating "Could not determine activity to run because the generated manifest could not be found?
I occasionally see the wrong activity on startup.
I think this generally seems to be when I haven't changed any code and try to restart my application for a second debugging session.
I think what happens in this case, it that Android tries to restart my application on the page/Activity where I last left it. This situation also happens when the app is in general use - so it's good practice to write your code so that the app works in this situation (e.g. using the saved instance state bundle)

Selenium Web Driver Error

I'm getting a weird error while trying to click on a Capybara Element
I'm using find(:xpath,"//a[contains(text(),'Connect')]").click
(find(:xpath,"//a[contains(text(),'Connect')]").present? return true)
the error I get is:
Selenium::WebDriver::Error::MoveTargetOutOfBoundsError Exception: Element cannot be scrolled into view:javascript:void(0);
i did some research and the only solution i found is that setting the selenium version to 2.16 may fix this issue (i'm using 2.25).
anybody got an idea?
It may happen when the page being tested is not fit into the current window size. If you know such pages where usually these error happening, you may explicitly scroll down before doing the operation on such hidden elements(like click, clear etc). Here the code to explicitly scroll down the page.
In java,
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("javascript:window.scrollBy(250,350)");
From the times I used selenium webdriver to test .NET apps, I would get that error when the issue was exactly what it sounds like: It's looking for an object on the page that it cant scroll to for some reason. In my case it was because some dialogue boxes would appear without scrollbars and the driver had no way to "scroll the object into view"
Can you watch the execution of your test and see if that's the case? I had some luck rolling back to a previous version of firefox because 15+ was (as of about 2 months ago when I had the issue) unsupported by web driver and had this problem periodically. Rolling back selenium versions may help too.
First step though is definitely to watch the execution of the test and see whats happening though. And a good debugging idea may be to try to work through your steps manually yourself to make sure the test works by hand.
Its also worth noting that for the webdriver to be able to execute click the object actually has to be visible. IsPresent doesnt require that, it just searches the page files. Also an issue I ran into. IsPresent will still return true for objects that are not and cannot be made visible on the page (i.e. something at the bottom of the page that you cant see at the time)
Couple of tips here:
Webdriver should ideally be on the most recent update, it's what most use (Unless you're doing Ruby Automation)
Use css selectors, xpath (Whilst rendered), is almost always heavier on both resources and code.
Try defensive coding, first of all ascertain it exists. There are many ways to do that dependent on what package you are using. In ruby you would do page.has_css?('css_string')

Why am I getting the message "The specified request cannot be executed from current Application Pool"?

Quite not sure why I see this error.
I navigate to my Login View like so http://test.staging.com/mywebsite/Login
My Login view was just redone using MVC but I have seen this same error message going to an aspx page as well...
If I use http I get the error message The specified request cannot be executed from current Application Pool.
If I use https://test.staging.com/mywebsite/Login, I'm good.
If I don't specify a protocol, test.staging.com/mywebsite/Login, I get the error as well
Is there an error happening under the covers and my custom error page can't be shown like discussed here?
What are some other causes of this error?
That usually means your custom errors are configured to run as a different AppPool.
You can read more at MSDN. (See section "Using Custom Errors from Another Application Pool").
There are two ways to correct this behavior. The first is possibly not one that you are interested in because it would require you to change your current architecture and run both sites in the same application pool (such as share the same worker process memory space). To do this, simply move the /errors virtual directory to run in the same application pool as the site for which it serves the custom error.
The second way is to make use of a registry key provided by IIS 6.0. This registry key makes sure IIS 6.0 does not check the metadata during the execution of the custom error and therefore allowing this to work.
See the article for information on the registry key fix.
It may also mean that you are using something along the lines of Server.Transfer to a page that is in a different AppPool.
It could be because you're using different versions of ASP.NET for one or many apps in the pool.
Make sure all apps in the pool use the same version of ASP (e.g. ASP 2.0.50727)
If you just added a new app, try changing the app momentarily to a different version of ASP, then back to same version. I experienced an issue where the displayed version was correct, but under the hood, a different version was used!
Check your event log, under Application, to get more details about the error.
The message would be caused by your page server-side redirecting to a page served by another application pool. Such as for example, in your link, the error page.
I know this is an old thread, but I stumbled upon it and found a different solution. Here's what worked for me: Make sure your application handles .asmx files correctly
From IIS:
Right Click on your project > Properties > Configuration
If necessary, add the .asmx file extension that maps to the aspnet_isapi.dll
Limit to: "GET,HEAD,POST,DEBUG" and restart.
Because I can't comment on vcsjones's answer, I'll add it down here. The DWORD value IgnoreAppPoolForCustomErrors needs to be set under HKLM\SYSTEM\CurrentControlSet\Services\W3SVC\ Parameters vs HKLM\SYSTEM\CurrentControlSet\Services\W3SVC referenced in that technet article. Set it to 1 and do an iisreset and you're good to go.
Source Blog Post
In my particular case, I received this error while trying to serve a content (non ASP.NET) website while it was an Application. Right-Clicking the virtual folder and removing the application fixed it for me.
In my case the application used the application pool that didn't exist. I have no idea how it's happened.

Resources