Hi,
A little, perhaps useful, contribution to the documentation.
I have been experimenting with Orion. In the end I want to connect to the Orion server
from a
browser. As a first step I have added a remote client to the Orion-Primer from Ernst
de Haan.
Maybe it is usefull from some other people new to Orion.
Frank
Hi,
I've got a simple remote client running. As it took me quite some time, maybe
other people might find this example useful to get started.
All this is based on the Orion-Primer of Ernst de Haan. Have a look on his site
www.znerd.demon.nl for a more detailed explanation of the JSP example before
running the remote client.
In the attached archive files you find:
- the unchanged sources from Ernst,
- an addapted application.xml file (did I do that right?),
- two extra files: HelloClient.Java and application-client.xml and
- an addapted build file.
If you have successfully compiled the example as described by Ernst using my
sources, you will find the necessary 'orion-primer-client.jar' in the rel/
directory.
B.T.W. It is fun to see the autodeploy working. Check the log of the server while
running 'ant clean' and 'ant'. You'll see the autodeploy picking the file up.
You run the remote client as follows:
1. Make sure you have a proper java setup on your remote machine.
2. Copy a jndi.properties file from a orion demo (e.g. the cart demo) to
directory X. You'll find it in the directory orion/demo/ejb/cart. Make
sure it refers to the server and not localhost.
3. Copy the following jars from the orion installation dir to directory X:
- orion.jar
- ejb.jar
- jndi.jar
- jaxp.jar
- parser.jar
- jdbc.jar
- mail.jar
4. Copy the orion-primer-client.jar to directory X on your remote machine.
5. Run the following command:
"java -classpath .:orion.jar:ejb.jar:jndi.jar:orion-primer-client.jar
hello.client.HelloClient"
If all runs fine you will get some messages on your screen ending with:
"Exit cleanly".
== HelloClient.java ==
The code is straightforward, but as it is an example and things can go
wrong.
Amongst others:
- First thing is to get a context. You'll run into trouble here if your
jndi.properties are not right.
- Next step is the get the Home Interface. If the application-client.xml
is not right or server does not run (or you point to the wrong server)
things will break here.
I guess there are more ways of having fun ...
== application-client.xml ==
The example file is pretty straightforward. It describes under which
name you can find the Home Interface, in our case 'ejb/HelloHome'.
You have to use that same name in your source file 'HelloClient.java'.
The type of the Bean is of course the same as in the ejb-jar.xml: Session.
The other entries in the application-client point to the right Home and
Remote interfaces.
== classpath / jndi.properties / jars ==
The '.' in the classpath is necessary to pick up your jndi.properties file.
The first three jars mentioned (orion, ejb, and jndi) in the classpath are
necessary for the execution environment. The Orion runtime environment will
look for the other jars you have copied (mail, jdbc, parser and jaxp) in the
directory where the orion.jar file resides (directory X in our example).
The reason why you need mail.jar and jdbc.jar is unclear to me. You get error
messages if don't include them. I understood from Karl Avedal that Orion is
working on a smaller 'client.jar' that also contains a subset of orion.jar.
That would be great for connecting to Orion from a browser. That would take
less downloading.
Next step for me is to get it running using an applet and a browser. All that
work and who will notice the difference with the JSP example 8-).
Frank
orion-primer.zip
orion-primer.tar.gz