start() had already been called. The second call will be ignored.? - netbeans-7

The start() method was called on component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Account]] after start() had already been called. The second call will be ignored.
plz help me with these error.

This exception at shutdown happens only if examples webapp was correct when Tomcat started, but was broken afterwards. If it was already broken at startup time, nothing happens.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51610 -maybe it help.

Related

Kotlin app using recreate() function Error:"java.lang.IllegalStateException: Must be called from main thread"

I get the error"java.lang.IllegalStateException: Must be called from main thread" when using the "recreate()" function to refresh my activity in Kotlin-Android Studio.
What is causing the error?
Edit: I solved the problem by running the following instead:
"
runOnUiThread { recreate() }
", but I still do not understand why I get the error.
Apparently, you were invoking recreate() from a thread other than the UI thread.
You didn't show your code, so we can't tell how you were on this other thread.
All UI operations have to be done on the UI, or "main" thread. Therefore the error.

Selenium - watch for an error condition AND run 'happy path' test code

My app displays an error dialog whenever a JavaScript error occurs. This is always a bad sign, so I want to set up my tests so that, if the error dialog appears, it causes the test to fail there and then.
So I'd like to do something like (very much pseudocode!);
// start a new 'guard' thread;
start {
found = this.driver.wait(untilVisible(By.css('.myErrorDialog')), VERY_LONG_TIMEOUT);
if (found) {
// the error dialog appeared! That's bad!
throw();
}
}
// now run the test
login();
clickButton();
testBannerContains();
But I'm having trouble and I think it has to do with the way Selenium schedules actions.
What I've found is that for a single driver, I can only schedule one thing at a time, so the guard I set up early in the test blocks the body of the test from starting.
Is there a better way to handle conditions like 'this should never happen', or a way to create two independent threads in the same test?
So the problem with the code you have is that it immediately runs it and waits for a VERY_LONG_TIMEOUT amount of time for that error dialog to appear. Since it never does, it continues to wait. You have already discovered that is not what you want... ;)
I haven't done anything like this but I think you want a JS event handler that watches for the event that is triggered when the error dialog appears. See the link below for some guidance there.
Can my WebDriver script catch a event from the webpage?
One option would be to watch for that event to fire and then store true (or whatever) in some JS variable. Before leaving a page, check to see if the variable is set to true and if so, fail the test. You can set and get JS variables using JavascriptExecutor. Some google searches should get you all you need to use it.

Jasmine .andCallFake not triggering for function call with spineJs

I am using jasmine to test my front end, and have a spy set up to watch for the edit function to be called within a controller. The callback takes a message and either brings up the edit view or throws an error.
spyOn(edit, "edit").andCallFake (callback) ->
console.log(callback)
callback()
I also have a spy setup to watch for a function in the model that fetches an updated version of the item within the edit controller.
spyOn(ag, "fetchLatestVersion").andCallFake (callback) ->
console.log(callback)
callback()
This function returns a message that gets sent to the edit callback and then displays the view or throws an error.
My edit function is running correctly until it gets to the fetchLatestVersion() function and then it doesn't seem to want to run the callback and doesn't even seem to output what the callback is. Any help with jasmine's .andCallFake() would be much appreciated.
Thanks in advance!
EDIT:
I just removed the edit spy (ended up being unnecessary) and my error has since changed. I am receiving the correct callback function from .fetchLatestVersion(), but I end up getting an error saying:
Error: Expected a spy, but got Function.
Let me know if you need more information. Thanks again!
This turned out to be an issue with Spine (the frontend framework) and how it finds objects. It makes a clone rather than returning the actual object. By changing the records to irecords I was able to get the test to pass correctly!

Why does NSAssert break in main instead of in the code that call the assertion

I set this NSAssert
NSAssert(isStillLoadingArgument== [[self class] stillLoading],#"Hmm.... we think isStill Loading is false or true and yet stillLoading is true");;
Here is the screenshot of where I ask this question:
Then when assertion fail, the code break here:
Which is very annoying because I want to see the assertion break on the code I set up the assertion instead. So, how do I do so.
Ben answer unfortunately doesn't solve the issue:
You need to add a Breakpoint to your project for all exceptions.
1) Click on breakpoint navigator
2) Add an exception breakpoint
3) Make sure you set it to break on all exceptions
Now XCode will break to the actual assert rather than main. Hope this helps!
Configure the debugger to break on exceptions.
When an assertion fails, it raises an exception. If nothing catches the exception, it terminates the program after unwinding the stack, leaving it at main().

Async call for WCF service hosted in windows service

I have hosted a WCF service in windows service. I have console app for which I added a WCF service reference and generated Client for it.
I can make Sync call to the service,but Async call doesn't seem to work. If i attach server process it doesn't hit the service at all.
client= new ServiceClient();
client.DoSomething();//Works fine
client.DoSomethingAsync()//Doesnot work
Is this a known problem?
The asynccall will probably be started in a background workerthread. So what could be happening is that your async thread is dieing out because the foreground thread has finished it's processing.
Unless you have some logic after you make this call to wait for the reponse, or continue with some other work on your main thread, the background thread may not have the time to get created before the application exits.
This can be easily tested by adding Thread.Sleep after the async call.
client.DoSomethingAsync();
Thread.Sleep(1000);
A symptom of this happening is that your service starts / stops unexpectedly and windows throws an error.
When you generated the client, did you tick the box to specify "Generate asynchronous operations"?
From the code posted, i'm assuming you have not set up handlers to deal with the response from the async method. You'll need something like the example at the bottom of this msdn post where you use AddHanlder to handle the response.
Something like the below before you make the async call:
AddHandler client.DoSomethingCompleted, AddressOf DoSomethingCallback
With a method to deal with the outome:
Private Shared Sub DoSomethingCallback(ByVal sender As Object, ByVal e As DoSomethingCompletedEventArgs)
'Do something with e.Result
MsgBox e.Result
End Sub
If you have a call to
client.DoSomethingAsync()//Doesnot work
then did you specify a handler for the callback completed event??
public event DoSomethingCompletedEventHandler DoSomethingCompleted;
What happens is that the async call goes off, but how would it send you back any results?? You'll need to provide a handler method for that - hook it up to the DoSomethingCompleted event handler! In that method, you'll get the results of the async call and you can do with them whatever you need to do.
Marc