| HTML Tutorials |
|
|
| XML Tutorials |
|
|
| Browser Scripting |
|
|
| Server Scripting |
|
|
| .NET (dotnet) |
|
|
| Multimedia |
|
|
| Web Building |
|
|
| Java Tutorials |
|
|
| Programming Langauges |
|
|
| Soft Skills |
|
|
|
|
Compile the Source Code
|
|
Now we have all of our files in the correct directories. The next step is to
compile the source code into class files. The following commands should be
executed from the top of the directory structure created earlier (c:\ejb_example
on my computer). Also, you'll need to ensure your javac command is working and
that you have the proper development kits installed. (These commands are for
Microsoft Windows. If running this example on another operating system, just
edit these commands as required.) The LIBDIR variable should point to the
directory that contains jboss-j2ee.jar.
(The line breaks are for formatting only. Execute these on one line.)
|
|
javac -classpath %LIBDIR%\jboss-j2ee.jar -d
target\client src\client\com\examples\*.java
src\shared\com\examples\*.java
javac -classpath %LIBDIR%\jboss-j2ee.jar -d
target\server src\server\com\examples\*.java
src\shared\com\examples\*.java
|
Create the Jar Files
|
|
Remember that EJBs execute in an EJB container on the server. In our case
this will be the jboss application server. We need to package the server code
into a jar file named helloserver.jar. This jar will be copied into the proper
jboss deployment directory in the next step. Likewise, we need to package the
client code, the code that will call and use the EJB, into a jar file named
helloclient.jar. The client code can be run from any computer on the network,
but in our case we'll just run jboss in one DOS window and the client in another
DOS window on the same computer.
|
|
Execute the following command from your c:\ejb_example\target\client
directory. (Don't forget the trailing "." at the end.)
|
|
jar cvf ..\..\assemble\helloclient.jar .
|
|
Execute the next command from your c:\ejb_example\target\server directory.
(Again, there is a trailing ".".)
|
|
jar cvf ..\..\assemble\helloserver.jar .
|
|
After executing these jar commands you should have a helloclient.jar and a helloserver.jar in the assemble directory.
|
|
Deploy to jboss
|
- Create a JBOSS_HOME environment variable and set it to the
jboss installation directory (for instance, c:\jboss-3.2.5).
- Create a LIBDIR environment variable and set it to the
client directory under JBOSS_HOME (for instance, %JBOSS_HOME%\client).
- Place the helloserver.jar in the %JBOSS_HOME%\server\default\deploy
directory.
- From the command prompt:
|
|
When jboss starts up, you should see logging statements indicating that the Hello EJB has been deployed. Here is what I have in my command window:
|
08:56:07,656 INFO [EjbModule] Deploying Hello
08:56:08,424 INFO [EJBDeployer] Deployed: file:c:\jboss-4.0.1sp1\server\default\deploy\helloserver.jar
|
|
Run The Client
|
To run the client, open a new DOS window (you should have jboss already running in a separate window).
- Create a JBOSS_HOME environment variable and set it to the
jboss installation directory (for instance, c:\jboss-3.2.5)
- Create a LIBDIR environment variable and set it to the
client directory under JBOSS_HOME (for instance, %JBOSS_HOME%\client)
- Change directory to the assemble directory that contains
helloclient.jar
- From the command prompt (all as one line)
|
java -classpath helloclient.jar;%LIBDIR%\jnp-client.jar;%LIBDIR%\jboss-common-client.jar;
%LIBDIR%\jboss-j2ee.jar;%LIBDIR%\jboss-net-client.jar;%LIBDIR%\jbossall-client.jar;;%LIBDIR%\jnet.jar
com.examples.HelloClient
|
|
In your client DOS window, you should see "Hello! World" print out. In the server DOS window, you should see "Someone called sayHello()" print out. The client just executed our sayHello business method from within the jboss application server.
|
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
Keywords:
EJB Deploy,ejb deployment,jboss deploy,weblogic deploy,weblogic 8.1 deploy,jboss deployment,ejb deployment descriptor,weblogic deployment,j2ee deployment,weblogic 8.1 ejb,j2ee deploy,jboss hot deploy,ejb web services,deploy ejb,j2ee deployment descriptor,weblogic deployment descriptor,weblogic hot deploy,org jboss deployment deploymentexception,web application deploy
|
|
| HTML Quizes |
|
|
| XML Quizes |
|
|
| Browser Scripting Quizes |
|
|
| Server Scripting Quizes |
|
|
| .NET (dotnet) Quizes |
|
|
| Multimedia Quizes |
|
|
| Web Building Quizes |
|
|
| Java Quizes |
|
|
| Programming Langauges Quizes |
|
|
| Soft Skills Quizes |
|
|
|