Unable to run AppletIntegration addon

Hi,

I recentely discovered AppletIntegration addon, and would like to try it.
I created maven test app, built it, however, when running browser doesn’t display anything.

Please, help - I have no clue.
Or please, provide some sample code to try the plugin.

Thanks
Regards,
Dmitry

public class TestApp2 extends Application {

private Window window;

@Override
public void init() {
    window = new Window("My Vaadin Application");
    setMainWindow(window);

    System.out.println("HELLO");

    AppletIntegration applet = new AppletIntegration() {
        private static final long serialVersionUID = 1L;

        @Override
        public void attach() {
            // Actual applet loaned from here:
            // http://www.w3.org/People/mimasa/test/object/java/Othello
            setAppletArchives(Arrays.asList(new String[]{"Othello.jar"}));
            setCodebase("http://www.w3.org/People/mimasa/test/object/java/applets/");
            setAppletClass("Othello.class");
            setWidth("800px");
            setHeight("500px");
        }
    };

    window.addComponent(applet);
}

}

Hi! The same code seems to work fine with me (Chrome, FF). Which browser are you using?
Have you compiled the widgetset and checked that other applets work?

Also, I have found a bug in AppletIntegration that you are required to have the applet archives even you applet is just a single class in a directory. As a workaround use the following:

applet.setAppletArchives(Collections.EMPTY_LIST);

Hi, Sami

Thanks for quick response, however it didn’t work either.
Browser page still comes back blank.
Using ?debug in url shows this error in console: JavaScriptException: (TypeError): c is null fileName: …

System spec:

  • Ubuntu 64bit
  • Java 1.6.0_26 64bit
  • FF 5
  • jetty 7 or tomcat 7
  • vaadin.version=6.6.3
  • gwt.version=2.3.0
  • gwt.plugin.version=2.3.0-1
  • vaadin-maven-plugin=1.0.2
  • appletintegration=1.2.8

What versions do you use/recommend/working for you?
Is it possible that this is 64bit java a problem?

Interesting facts observed:

  1. tested my app with several other vaadin plugins - works fine. widgetset compiles correctly
    2.1) Tried online demo for Screenshot plugin based on appletintegration: works FINE from my browser, applet is loaded and working
    2.2) Tried to use Screenshot demo app, built, application starts showing regular vaadin UI elements, however the applet shows BLANK!
  • based on 2.1 and 2.2 we can make a conclusion, that the issue is not in browser configuration

Your help will be greatly appreciated!
Thanks,
Regards.
Dmitry

Hi, Sami

Could, you, please help me with the issue? I am really stuck for a week now.

Regards,
Dmitry

after spending tons of time of scratching my head over this issue, I finally got a light in the end of tunnel…

Looks like latest version of AppletIntegration plugin (1.2.8) is either buggy, or missing some required settings.

I tried some other open source app based on this plugin, and it worked on my machine. I started to narrow down the configuration settings until finally got the clue. Basically, they used AppletIntegration plugin v1.1.4.
I tried this version with demo screen app and, voila, it worked too. By “worked” I mean applet has started. Screenshot functionality isn’t actually working, but I guess this is because of differencies in plugin implementation.

I am going to dig more, but at least now its more clear where the problem is.

This is good to know. I also have spent quite a bit of time over the past few days trying to get AppletIntegration to work, without success. Like you, I’ve been using the latest version. I have been trying to understand and rebuild the Screenshot add-on, as a way of learning how to use AppletIntegration with my own Vaadin application and applet. Initially I had various build errors, but I’ve now fixed these. Now Screenshot builds and runs without producing any error messages – but in my installation the applet never appears.

What would be really helpful IMHO would be to fix whatever is the problem with the latest version, of course, but also some documentation for AppletIntegration and an example of a project using AppletIntegration distributed as an Eclipse project, i.e. with the all the files necessary for importation into Eclipse. This could then be used as a template for other projects based on AppletIntegration. The Screenshot project has some value as an example, but the format in which it is currently distributed is not the most useful for the purpose. Another, simpler, example of a project using AppletIntegration would be helpful, and again distributed in a form suitable for importation into Eclipse so that it could be used as a template.

AppletIntegration uses Vaadin’s client/server communication protocols, which can otherwise be ignored, unless you need to make your own GWT widget or subclass one of the Vaadin widgets. It would be possible to have done a fair bit of Vaadin programming (as I have) and still be ignorant of these protocols. Yesterday I finally read chapter 10 in the manual, and so understand them much better. But still I don’t fully understand even the API for AppletIntegration, let alone exactly how it works. Again, a little documentation would be very much appreciated.

Dmitry, if you do figure it out please share your observations. I will continue to work on it, though I don’t have any time for it today, and will do the same.

Matthew Fleming

Hi, Matthew

Thank you for the message. I totally agree with you - this is a valuable component,
and there are several things needs to be improved to make other people lives easier in the future.

I think, it would be better if we could create a maven distribution, as well as Eclipse, since some people (as me for ex) use different ide’s for dev.

Currently I am communicating with Sami about the implementation details like jar signing, etc - whatever needs to be done in order for applet to run.

I definitely want to share the code I have and the final working solution. Let’s cooperate and stay in touch.

As minimal we need to have ability to embed any jar containing applet into vaadin app, and as maximum we need to be able to have applet and server-side part to communicate to each other.

Regards,
Dmitry

Dmitry,

Just FYI, I’m officially giving up on this. I’ve tried with the current version of AppletIntegration (1.2.8) and the version that is distributed with the screenshot add-on (1.0.2). With the earlier version, I did get to the point where the browser tried to start up the applet (the java console appeared), but the applet’s UI was never displayed and the java console indicated that the main class (the AbstractVaadinApplet subclass) could not be found. This suggests a problem with the codebase, but I’m not sure what it was. I had included the jar file containing the applet’s classes in my Eclipse project under both src/*.widgetset/public and WebContent/WEB-INF/lib. Possibly inserting a setCodebase() somewhere would have solved the problem, but I never got to find out because I began to have problems building my applet against AppletIntegration 1.0.2. I was using NetBeans to build the applet, and it started to complain about a signature/permission problem when appletintegration-.1.0.2.jar was included but not with appletintegration-1.2.8.jar. With the 1.2.8 version, I never got as far as the java console. That the applet at least began to load with 1.0.2 but not with 1.2.8 suggests you may be correct that there is something wrong with the latest version. All this is with OS X Lion, java 6, and Safari and FireFox browsers.

If you ever do get it figured out I’d really appreciate it if you would contact me at mgflem AT** gmail.com and let me know how you did it. Maybe someday AppletIntegration’s author will choose to release it in a form that it is useable by mere mortals.

Regards,

Matthew Fleming, MD
Fleming Dermatopathology, LLC
DermVision, LLC

Hi Mathew,

Based on your discussion here I tested the AppletIntegration 1.2.8, and indeed found some problems when used with newer Vaadin versions (6.6). I submitted a new version to the Directory that fixes this, if you still want to test:
http://vaadin.com/addon/appletintegration
(1.2.9)

The issues you are describing with signing are probably also real. If you are building a custom applet with elevated privileges, you need to sign the whole code-chain. Otherwise you will get an security exception.

I know these applet things are pain to debug, because there are so many layers in the application. IMO, most annoying is the browser caching. What I’ve seen is that you cannot really be sure if your latest code is in use unless you restart the browser.

Hi, Matthew

Great news!
I have been a tester for Sami on the latest bug fix of AppletIntegration plugin, and Screenshot plugin, and finally got it working.
I will prepare nice maven demo distribution, so you can see how the plugin can be used different ways.

Thanks Sami on quick responses.

I will try to send you an email to the address you posted.

Regards,
Dmitry