Name: sample.appclient.basiccalc
Owner: WASdev
Description: A Java EE 7 EJB application client sample that makes calls to a remote EJB implementation of a calculator. #JavaEE7
Created: 2015-06-10 12:56:45.0
Updated: 2017-11-09 07:12:55.0
Pushed: 2016-05-31 15:14:27.0
Size: 28
Language: Java
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
The Java EE application client is a Java application program that accesses Java EE services such as enterprise beans, Java Database Connectivity (JDBC) databases, and Java Message Service (JMS) message queues. The Java EE application client program runs on client machines. This program follows the same Java programming model as other Java programs. However, the Java EE application client depends on the application client runtime to configure its execution environment, and uses the Java Naming and Directory Interface (JNDI) name space to access resources.
The Basic Calculator client sample communicates directly with a stateless session bean on a Liberty server. This sample shows how to use a simple stateless session enterprise bean from a Java EE 7 application client.
This sample can be built using Apache Maven.
n install
In addition to publishing the ear to the local maven repository, the built ear file is copied into the apps directory of the server and client configurations located in the basiccalc-wlpcfg directory:
ccalc-wlpcfg
clients
+- basiccalcClient <-- specific client configuration
+- client.xml <-- client configuration
+- apps <- directory for applications
+- basiccalc.ear <- sample application
+- logs <- created by running the client locally
+- workarea <- created by running the client locally
servers
+- basiccalcServer <-- specific server configuration
+- server.xml <-- server configuration
+- apps <- directory for applications
+- basiccalc.ear <- sample application
+- logs <- created by running the server locally
+- workarea <- created by running the server locally
There are lots of ways to get your hands on WAS Liberty. Note that you will need a version of Liberty that has support for javaeeClient-7.0, ejb-3.2, and appClientSupport-1.0 for this sample (or javaee-7.0 will do as well for the server).
To download just the WAS Liberty runtime, go to the wasdev.net Downloads page, and choose between the latest version of the runtime or the latest beta. You can also download Liberty via Eclipse and WDT
There are a few options to choose from (especially for the beta drivers): choose the one that is most appropriate.
The WebSphere Development Tools (WDT) for Eclipse can be used to control the server (start/stop/dump etc.). The tools also support incremental publishing with minimal restarts and works with a debugger to allow you to step through your applications plus many more features including:
Installing WDT on Eclipse is a simple drag and drop process as explained on wasdev.net. Note that WDT support for client is not available yet but coming soon.
If the sample git repository hasn't been cloned yet, WDT has git tools integrated into the IDE:
TBD
For the purposes of this sample, we will create the Liberty server (step 3 in the wasdev.net instructions) a little differently:
runtime
in the filter box to find the view (it's under the Server heading).wlp-2015.6.0.0
if you're using the June 2015 beta.Advanced Options...
linkbasiccalc-wlpcfg
directory is not listed as a User Directory, we need to add it:basiccalc-wlpcfg
listed under the Runtime Environment in the Runtime Explorer view.Currently, application client is not supported in WDT, so We will create the Liberty client from command line. In the following steps, “wlp” is the root directory of the Liberty installation.
The following steps will run both client and server on the same computer.
For more common scenarios where the client and the server run on different hosts, the following config elements need to be added to server.xml and client.xml:
TBD
When importing the existing maven project into Eclipse, Eclipse will (by default) “helpfully” add this project to an (extraneous) ear. To turn this off, go to Preferences -> Java EE -> Project, and uncheck “Add project to an EAR” before you import the project. If you forgot to do this, just delete the ear project; no harm.
If you use bash, consider trying the command line tools, which provide tab-completion for the server and other commands.
© Copyright IBM Corporation 2015.
nsed under the Apache License, Version 2.0 (the "License");
may not use this file except in compliance with the License.
may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
ss required by applicable law or agreed to in writing, software
ributed under the License is distributed on an "AS IS" BASIS,
OUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
the License for the specific language governing permissions and
tations under the License.