Source Code has been edited by Gareth Evans (Sep 24, 2007).

(View changes)

Content:

Browsing

You can browse the source via the web interface to Subversion.

Downloading

You may want to download the sources to play with. You can download (aka checkout) the source with Subversion client using the following URL http://svn.apache.org/repos/asf/openejb/trunk/openejb3.

Performing the checkout from the command line using the subversion client is as easy as:

$ svn co http://svn.apache.org/repos/asf/openejb/trunk/openejb3

If you are experiencing problems with errors like "400 Bad Request (http://svn.apache.org)", try using:

$ svn co https://svn.apache.org/repos/asf/openejb/trunk/openejb3

or alternatively with Apache Maven 2 (that's going to be necessary to built them):

mvn scm:checkout -DconnectionUrl=scm:svn:http://svn.apache.org/repos/asf/openejb/trunk/openejb3 -DcheckoutDirectory=openejb3

It's not yet known how to follow the progress of the checkout as mvn scm:checkout checks out the sources non-interactively. It's worth to know about the command, though, as it doesn't require the subversion client.

Building

To build the code, you'll need to grab a copy of Apache Maven version 2.0.4 or higher. The standard build command is as follows:

$ cd openejb3
$ mvn clean install -Dassemble

or alternatively when on Unix-like systems

$cd openejb3
$ mvn -o -Dmaven.{test,itest}.skip -Dassemble clean install

Running with the assemble option on enables a profile that builds OpenEJB assemblies (distributions). They live in assembly directory. You can remove it from the command line when you're not interested in them - just remove -Dassemble from the command line and you're ready to go.

NOTE: When importing a project into your preferred IDE (Eclipse, NetBeans, IDEA, vim) you should run with the assemble profile on. It's because the assembly modules are only included in the M2 run when the property is set.

The output of that command should end with "BUILD SUCCESSFUL"

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] OpenEJB ............................................... SUCCESS [0.594s]
[INFO] OpenEJB :: iTests ..................................... SUCCESS [0.015s]
[INFO] OpenEJB :: iTests Beans ............................... SUCCESS [0.375s]
[INFO] OpenEJB :: iTests Client .............................. SUCCESS [0.219s]
[INFO] OpenEJB :: iTests App ................................. SUCCESS [0.125s]
[INFO] OpenEJB :: Container .................................. SUCCESS [0.000s]
[INFO] OpenEJB :: Container :: Loader ........................ SUCCESS [0.031s]
[INFO] OpenEJB :: Container :: Java Agent .................... SUCCESS [0.015s]
[INFO] OpenEJB :: Container :: Java EE ....................... SUCCESS [0.063s]
[INFO] OpenEJB :: Container :: Core .......................... SUCCESS [1.016s]
[INFO] OpenEJB :: Server ..................................... SUCCESS [0.015s]
[INFO] OpenEJB :: Server :: Client ........................... SUCCESS [0.016s]
[INFO] OpenEJB :: Server :: Core ............................. SUCCESS [0.422s]
[INFO] OpenEJB :: Server :: EJBd ............................. SUCCESS [0.109s]
[INFO] OpenEJB :: Server :: Admin ............................ SUCCESS [0.094s]
[INFO] OpenEJB :: Server :: Http ............................. SUCCESS [0.140s]
[INFO] OpenEJB :: Server :: Telnet ........................... SUCCESS [0.094s]
[INFO] OpenEJB :: Server :: XFire ............................ SUCCESS [0.094s]
[INFO] OpenEJB :: Server :: Axis ............................. SUCCESS [1.922s]
[INFO] OpenEJB :: Server :: ActiveMQ ......................... SUCCESS [0.078s]
[INFO] OpenEJB :: Server :: CORBA ............................ SUCCESS [0.109s]
[INFO] OpenEJB :: Server :: Derby Network Service ............ SUCCESS [0.078s]
[INFO] OpenEJB :: Server :: Hsql ............................. SUCCESS [0.079s]
[INFO] OpenEJB :: Examples :: HelloWorld Stateful POJO ....... SUCCESS [0.281s]
[INFO] OpenEJB :: Examples :: Calculator Stateless Pojo ...... SUCCESS [0.172s]
[INFO] OpenEJB :: Examples :: Counter Stateful Pojo .......... SUCCESS [0.156s]
[INFO] OpenEJB :: Examples :: EJB Injection .................. SUCCESS [0.156s]
[INFO] OpenEJB :: Examples :: Resource Injection ............. SUCCESS [0.172s]
[INFO] OpenEJB :: Examples :: Telephone Stateful Pojo ........ SUCCESS [0.172s]
[INFO] OpenEJB :: Examples ................................... SUCCESS [0.000s]
[INFO] OpenEJB :: Assembly ................................... SUCCESS [0.016s]
[INFO] OpenEJB :: Assembly :: Tomcat ......................... SUCCESS [0.234s]
[INFO] OpenEJB :: Assembly :: iTest Webapp ................... SUCCESS [0.141s]
[INFO] OpenEJB :: Assembly :: Standalone ..................... SUCCESS [0.140s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8 seconds
[INFO] Finished at: Tue Apr 24 08:53:26 CEST 2007
[INFO] Final Memory: 23M/254M
[INFO] ------------------------------------------------------------------------

Running

Provided you have successfully built OpenEJB 3 with the assemble option on, you can find assemblies in the target directories beneath the assembly directory of each custom assembly (e.g. openejb-tomcat, openejb-itests-webapp and openejb-standalone). Go to the assembly directory and have a look at its content.

[EMAIL PROTECTED] /cygdrive/c/oss/openejb3/assembly
$ ls -ltr
total 4
-rw-r--r--  1 jlaskowski None 732 Sep 28 11:53 pom.xml
drwxr-xr-x+ 6 jlaskowski None   0 Oct  6 09:09 openejb-tomcat
drwxr-xr-x+ 6 jlaskowski None   0 Oct  6 09:10 openejb-itests-webapp
drwxr-xr-x+ 6 jlaskowski None   0 Oct  6 09:10 openejb-standalone

The most common choice is to go to openejb-standalone which is exactly what the name stands for - it lets you get OpenEJB up and running from a command line with no additional configuration - in other words you can play with your EJBs right away. Looking at the openejb-standalone/target directory reveals the tar.gz'ed and zip'ed distributions. Unpack one and give it a go.

[EMAIL PROTECTED] /cygdrive/c/oss/openejb3/assembly/openejb-standalone/target
$ jar -xvf openejb-3.0-incubating-SNAPSHOT-bin.zip
 created: openejb-3.0-incubating-SNAPSHOT/
 ...

[EMAIL PROTECTED] /cygdrive/c/oss/openejb3/assembly/openejb-standalone/target
$ cd openejb-3.0-incubating-SNAPSHOT

[EMAIL PROTECTED] /cygdrive/c/oss/openejb3/assembly/openejb-standalone/target/openejb-3.0-incubating-SNAPSHOT
$ ./bin/openejb start
OPENEJB_HOME = c:\oss\openejb3\assembly\openejb-standalone\target\openejb-3.0-incubating-SNAPSHOT
Apache OpenEJB 3.0-incubating-SNAPSHOT    build: 20070421-01:19
http://incubator.apache.org/openejb
OpenEJB ready.
[init] OpenEJB Remote Server
[EMAIL PROTECTED]: [Thread[main,5,main]]: checkRunning(false) entered
[EMAIL PROTECTED]: [Thread[main,5,main]]: checkRunning(false) exited
  ** Starting Services **
  NAME                 IP              PORT
  httpejbd             0.0.0.0         4204
  telnet               0.0.0.0         4202
  ejbd                 0.0.0.0         4201
[EMAIL PROTECTED]: Initiating startup sequence...
[EMAIL PROTECTED]: Server socket opened successfully in 16 ms.
[EMAIL PROTECTED]: Database [index=0, id=0, db=file:C:\oss\openejb3\assembly\openejb-standalone\...
[EMAIL PROTECTED]: Database [index=1, id=0, db=file:C:\oss\openejb3\assembly\openejb-standalone\...
[EMAIL PROTECTED]: Startup sequence completed in 16 ms.
[EMAIL PROTECTED]: 2007-04-24 09:09:05.656 HSQLDB server 1.8.0 is online
[EMAIL PROTECTED]: To close normally, connect and execute SHUTDOWN SQL
[EMAIL PROTECTED]: From command line, use [Ctrl]+[C] to abort abruptly
  hsql                 0.0.0.0         9001
  admin thread         0.0.0.0         4200
-------
Ready!

There's another, slightly less error-prone approach using a shell script - try.sh - that's tailor-made for that particular task - running OpenEJB 3 right after it's been built locally. No need to remember these aforementioned steps, but the name of the script.

[EMAIL PROTECTED] /cygdrive/c/oss/openejb3/assembly/openejb-standalone
$ ./try.sh
openejb-3.0-incubating-SNAPSHOT/conf/
...
OPENEJB_HOME = c:\oss\openejb3\assembly\openejb-standalone\target\openejb-3.0-incubating-SNAPSHOT
Apache OpenEJB 3.0-incubating-SNAPSHOT    build: 20070421-01:19
http://incubator.apache.org/openejb
OpenEJB ready.
[init] OpenEJB Remote Server
[EMAIL PROTECTED]: [Thread[main,5,main]]: checkRunning(false) entered
[EMAIL PROTECTED]: [Thread[main,5,main]]: checkRunning(false) exited
  ** Starting Services **
  NAME                 IP              PORT
  httpejbd             0.0.0.0         4204
  telnet               0.0.0.0         4202
  ejbd                 0.0.0.0         4201
[EMAIL PROTECTED]: Initiating startup sequence...
[EMAIL PROTECTED]: Server socket opened successfully in 0 ms.
[EMAIL PROTECTED]: Database [index=0, id=0, db=file:C:\oss\openejb3\assembly\openejb-standalone\...
[EMAIL PROTECTED]: Database [index=1, id=0, db=file:C:\oss\openejb3\assembly\openejb-standalone\...
[EMAIL PROTECTED]: Startup sequence completed in 0 ms.
[EMAIL PROTECTED]: 2007-04-24 09:11:34.312 HSQLDB server 1.8.0 is online
[EMAIL PROTECTED]: To close normally, connect and execute SHUTDOWN SQL
[EMAIL PROTECTED]: From command line, use [Ctrl]+[C] to abort abruptly
  hsql                 0.0.0.0         9001
  admin thread         0.0.0.0         4200
-------
Ready!

The old 2 finger salute - Ctrl-C - stops the OpenEJB instance.

Reply via email to