LMAppletserver in Glassfish - invoking EJB3 session bean methods from your applet

The previous blog entry showed how to use LMAppletserver in a web archive (WAR) without any enterprise beans or enterprise app. It could also have been deployed to e.g. Tomcat where you don't have EJB3 session beans.

In this example I'm showing how to call EJB3 session beans from your java applet using LMAppletserver.

Download and start netbeans 6.0 (http://netbeans.org)

Versioning -> Subversion -> Checkout

Checkout the following URL:


(no username or password)

Right click on the newly opened LMAppletServerEJB3 project and select "Undeploy and Deploy" to deploy the project.

When the server has started and everything is deployed then open this URL in your browser:


The applet shows a message that is obtained by calling an EJB3 session bean method method on the server, using the RPC features of LMAppletserver. This is what happens in the applet:

HelloWorldRemote helloObj = (HelloWorldRemote)AppletServiceClientProxy.newInstance(HelloWorldRemote.class);
add(new JLabel(helloObj.helloWorld()));

And on the server, a Stateless EJB3 session bean:

public class HelloWorldBean implements HelloWorldRemote {
public String helloWorld() {
return "Hello world from EJB3 session bean";

See? Calling EJB3 session bean methods using LMAppletServer clients is really simple too .. :)


Kianosh said…
I get a ClassNotFoundException when running the example under glassfish. And I get a java.lang.ClassCastException: sun.net.www.protocol.file.FileURLConnection when running it under eclipse EE.

Popular posts from this blog

My VNC based development environment with Visual Studio Code running on Ubuntu

Intercepting and adjusting SQL generated by Eclipselink JPA

Exporting Kendo UI GRID to Excel with Java