Javascript Object not found

I think this is a vaadin related issue. If not please tell me so.

I’m using Vaadin to talk to a javascript file that I have written. The javascript file starts by calling a javascript function in a browser plugin.

The first command I issue in javascript is

aw = AW.connect();

Now 80% of the time, I get an exception saying

AW is not defined

But if I run the method again (in the same session) it works as expected. I tried calling this AW.connect method twice in a row if the first time failed, but that didn’t seem to solve the issue.

It seems like Vaadin can’t find the javascript for the browser plugin right away, but then it can later on. I don’t have any include methods or anything to reference the browser plugin.

Can anyone point me in the right direction here? This is driving me nuts.