Automation using WatiN is being carried out. Using couple of simultaneous threads to test the application. Few threads are failed and log report/stack trace says the following.
System.InvalidCastException: Specified cast is not valid.
at SHDocVw.IWebBrowser2.get_HWND()
at WatiN.Core.Native.InternetExplorer.IEBrowser.get_hWnd()
at WatiN.Core.Browser.get_hWnd()
at WatiN.Core.DomContainer.StartDialogWatcher()
at WatiN.Core.IE.CreateNewIEAndGoToUri(Uri uri, IDialogHandler logonDialogHandler, Boolean createInNewProcess)
at WatiN.Core.IE..ctor(Boolean createInNewProcess)
at Core.BaseWatinTestWrapper.Run()
Following this exception there is another exception being raised i.e.
System.Runtime.InteropServices.COMException Retrieving the COM class factory for component with CLSID {0002DF01-0000-0000-C000-000000000046} failed due to the following error: 80080005.
Please provide some help. Thanks in advance.
I was also using couple of threads and was getting the same error. Make your main method [MTAThread]. This fixed the problem for me.
If I'm not mistaken, WatiN explicitly is single-threaded [STApartment]
- http://watin.org/documentation/sta-apartmentstate/
If you wish to have such test, I believe you need separate processes in OS-level.
I can't tell for sure does you approach collide with this requirement, yet I'd suggest single instance for single browser (and it's descendent windows / processess).
Also, there might be another hickup - WatiN connects to IE using browser's internals, but if there's any Windows / User Session related activity along the way, this might bring additional confusion.
Related
I'm having this weard mistake "The object you are trying to update was changed by another user. Please try your change again." I would like to know what is the reason of this without context. There are no logs about it, no exception stacktrace, no information about this mistake in documentation. I believe this is something about Bundles but I want to now the exact reason
GW throws several exceptions related, by example ConcurrentDataChangeException, DBVersionConflictException depending of entity type. It occurs when a bean is modified concurrent by two or more transactions (bundle).
This error usually happens because on one bundle two transaction changes are trying to commit where prior bundle is still not committed.
Let us understand with one example- There is user which does a policy change to add any contact or any other business operation. And at the same time another user open same transaction in his GW PC UI and tries to do some business operation at this GW system throws this error on UI because the pervious bundle is still not committed.
The error trace leads you to some OOTB java classed and I think you can get it from PCLogs from PC UI Server logs.
Hopes this clarifies you.
Actually this happens because your object was updated by someone else on the DB during your db read from the DB and your attempt to write it back into the DB.
GW does this by leveraging the version check from your database object.
The exception message actually tells you who and when did the conflicting update. There're no stack traces that will point you to the cause of the other update.
Root causes might be several - from distributed cache in clustered env going out of sync to actually having some other party doing work on the same entities as you do. So the fix is per case really.
I'm adding several custom properties to my AppInsights events using Initialize method of ITelemetryInitializer. Some of them are retrieved from the database or other sources which might fail. The question is, are there any official recommendations from the developers on whether or not a try-catch clause should be included inside of Initialize method?
From what I've observed, throwing an exception inside the method doesn't prevent telemetry from appearing, though the custom properties cannot be seen, as expected. Can I rely on this behaviour? Does it somehow affect performance that I don't handle exceptions manually and let AppInsights' code handle them instead?
It depends, doesn't it. If the telemetry initializer adds multiple custom properties and the first one in line fails with an exception, do you want to try to add the others. If so, put a try/catch around each custom property.
If it is just a single property, or all should not be added as soon as the first one fails then you could choose not to handle the exception. In my opinion however, I would want to have control over the exception propagation and choose for handling them myself. (and maybe ignore them with an empty catch, depending on the situation)
Ignoring them completely may give troubles in the future when the SDK for example is altered to not send the telemetry to App Insights when a telemetry initializer fails with an unhandled exception. At least if you decide to go this route try take a peek in the source code of the SDK to see what happens with the unhandled exception.
I think this topic a lot of ppl post it already. I also look for lot of thread in stack overflow and some ibm page. They do give some comment of how to solve this problem. But i still facing the same problem, it still give this error.
Case start :
Actually one of my customer, they have facing this error during running on webpages and also notes ~
error 500 http web server: command not handled exception
Action taken but not solve:
The user id signing/creating the XPages allowed to run XPages in the
server document?
Do project clean, build automatically on designer
Do testing on creating new xpages page with simple lable " hello world" , this one can run successfully only.
Try to reload the http server by
tell http quit
load http
After do this the problem still same give the same error. May i know got any other way to solve it?
"Unresolved compilation errors: java.lang.String" points to a failed install as here. A class in java.lang or java.util should always be resolved. Ensure all services and any processes for Notes / Domino are stopped before the relevant install, jar files can get locked once used. Xpages can't load, Error 500; java.util cannot be resolved
Switch on "Display XPage runtime error page" in application's XSP Properties then you'll see a detailed error message which probably will lead you to the issue:
I frequently get this error when there is a mismatch/problem with access rights or the user login has expired and the app/database doesn't redirect to the login page. I suggest you double check the security basics first. (Might also explain why the app works locally, but not on the server).
I have implemented a functional Liferay service using service builder and I want to call a method on the -LocalServiceUtil class just as soon as I possibly can. This is a task I wish to perform when the service starts and also when the service is redeployed.
Even though all the methods on the -LocalServiceUtil class are static, they will throw a BeanLocatorException if they are called too soon.
com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set for servlet context portal-navigation-impl
Is there any way to call a method on the -LocalServiceImpl instance or otherwise so that I can do this?
Thank you
As you speak about the initialization order: I'm not 100% sure about this, but I'd write a startup action. This gets run everytime a hook (or plugin) starts up - including a redeploy. Sounds like what you want - and if the initialization order works, this is your solution.
Otherwise: Create a separate hook that's dependent on the one that you're currently using. That will be restarted as well, but only run once the hook providing the *-LocalService did already start up. (dependency is declared in liferay-plugin-package.properties, with the key required-deployment-context - this is from memory - somebody correct me if I'm wrong.)
I have an indexing function named "Execute()" using IndexWriter to index my site's content. It works great if I simply called it from a web page, but failed when I have it as a delegate parameter into System.Threading.Thread. Strangely though, it always work on my local dev machine, it only fails when I uploads to a shared host.
This is the error message I got
"Lock obtain timed out: SimpleFSLock error...."
Below is the failed code (but only fails on a shared host)
Scheduler scheduler = new Scheduler();
System.Threading.Thread schedulerThread = new System.Threading.Thread(scheduler.Execute);
Below is the code that works (work both on my local machine and on shared host)
Scheduler scheduler = new Scheduler();
schedulre.Execute();
Now, some ppl said, it could be a bad left over from the previous debugging session, so before I instantiated the IndexWriter, I did
if (IndexReader.IsLocked(indexingFolder))
{
log.Debug("it is locked");
IndexReader.Unlock(FSDirectory.GetDirectory(indexingFolder));
}
else
{
log.Debug("it is not locked");
}
and guess what? my log says, it is not locked.
So now I'm pretty sure it's caused by the System.Thread.Threading, but I just have no clue as to how to fix it.
Thanks
Check that on the shared host, the thread has the same permissions to the index folder as you do on the development machine/shared host.
Update: You can find what Principal the thread is running under by interrogating the thread's CurrentPrincipal property. Though this is a read-write property, you may not have the permissions to set this property in your shared-host environment.
You might find this post helpful.
Thanks everyone and especially to Vinay for pointing me in the right direction. After much tracing, i finally decided to take a look at the source and see what's there.
In "IndexWriter", you have
Lock #lock = this.directory.MakeLock("write.lock");
if (!#lock.Obtain(this.writeLockTimeout))
which is pointed to the SimpleFSLock implementation. The culprit was
new FileStream(this.lockFile.FullName, FileMode.CreateNew).Close();
by creating a new thread, internally, it throws a system.unauthorizedaccessexception, according to msdn here
When starting a new thread, System.Security.Principal.WindowsIdentity.GetCurrent() returns the identity of the process, not necessarily the identity of the code that called Thread.Start(). This is important to remember when starting asynchronous delegates or threads in an impersonated ASP.NET thread.
If you are in ASP.NET and want the new thread to start with the impersonated WindowsIdentity, pass the WindowsIdentity to the ThreadStart method. Once in the ThreadStart method, call WindowsIdentity.Impersonate().
Such, I solved my issue by impersonate the IIS account running my application in "Execute()" function and all problems are resolved.
Thanks again to all.
Probably the worst one to try and answer this since I haven't used lucene / shared hosting, but SimpleFSLock sounds like it's locking the lucene index file by using an explicit lock file on the file system (not quite the same as locking in threading). I'd say check to make sure you have configured the proper file paths and that file permissions are set correctly.
Otherwise, hopefully someone more familiar with Lucene.net can answer.
I believe the problem is with a write lock file in the Lucene index directory.
Go and list the directory's files.
In Java Lucene, you would have seen a file named write.lock in the index directory,
meaning that the index was not properly closed last time (maybe a process was abruptly stopped). In Lucene.net, look for a similarly named empty file.
I believe the same mechanism will be used in Lucene.net.
Try finding that file, erasing it and restarting Lucene.net.