Lab 5 - OpenEJB

OpenEJB

Open-source implementation of EJB, part of Apache TomEE.

Download OpenEJB Standalone at https://tomee.apache.org/download-ng.html

Download source code

https://d3s.mff.cuni.cz/files/teaching/nswi080/labs/Files/sources-5.zip.

Example

EJB application consisting of remotely accessible session beans and persistent entity beans.

The client application shows how to call methods of the remote session beans, then using another session bean, creates and queries the entities.

Explore example source

mwy/ExampleStateless.java:

mwy/ExampleStatelessBean.java:

mwy/ExampleStateful.java:

mwy/ExampleStatefulBean.java:

mwy/Director.java, mwy/Movie.java:

mwy/ExampleEntities.java:

mwy/ExampleEntityBeans.java:

classes/META-INF/persistence.xml

ExampleClient.java:

Scripts:

make.sh:

run-server.sh:

stop-server.sh:

run-deploy.sh:

run-client.sh:

Run the example

Download OpenEJB Standalone from https://archive.apache.org/dist/tomee/tomee-8.0.6/openejb-standalone-8.0.6.tar.gz, or a choose different version from https://tomee.apache.org/download-ng.html. Extract openejb-standalone-8.0.6.tar.gz.

Configure OPENEJB_HOME as the path to OpenEJB in setenv.sh.

Compile source codes (the beans and the client): bash make.sh

Run the server: bash run-server.sh

Deploy the beans to the running server: bash run-deploy.sh

Run a client: bash run-client.sh

Stop the server: bash stop-server.sh

Re-deploying the application

If you change the application, after compilation use bash run-deploy.sh -u to undeploy the old version and deploy the new version.

Lab activity task

Run the example as described above, but run the client two times. Look at and send the following by e-mail to the teaching assistant.

Read the homework assignment

https://d3s.mff.cuni.cz/files/teaching/nswi080/labs/Files/task-5-en.html.

Explore assignment source code

mwy/Node.java

mwy/Searcher.java

mwy/SearcherImpl.java

Main.java