All Examples All Jolt Examples This Package
This example is a package that demonstrates an Enterprise JavaBean. Please run this example before attempting to create your own Enterprise JavaBeans, as it will show you the different steps involved. The example is a stateful session EJBean called TellerBean that contacts a TUXEDO Server using Jolt for WebLogic and conducts transactions.
The example demonstrates:
Note that in Transaction 1, a single call is made, and is automatically committed. In Transaction 2, a begin() and commit() bracket two seperate requests (a deposit and a withdrawl).
The bean provides an example of a simple interface for accessing the TUXEDO Server.
To get the most out of this example, first read through the source code files to see what is happening. Start with the XML deployment files to find the general structure of the EJBean, which classes are used for the different objects and interfaces, then look at Client.java to see how the application works.
In general, you will need to adjust certain properties to match your setup. you will need to edit the entry for the property that begins with "weblogic.ejb.deploy" in the weblogic.properties file to deploy the EJBean. The property is commented out in the default properties file; make sure that you uncomment out all the lines of the property.
These three sections cover what to do:
Set up your development environment as described in Setting your development environment.
We provide separate build scripts (in the directory above this one: /examples/jolt/ejb) for Windows NT and UNIX:
The "build" scripts build individual examples, such as this entry for Windows:
$ buildThese scripts will build the example and place the files in the correct locations:
We provide a commented-out version in the property that begins with "weblogic.ejb.deploy" that you can use. you will need to adjust the property depending on which EJBeans you are building and are deploying, or if the location of the files differs from the installed location.
Note: If you are running under the Microsoft SDK for Java add the path to the .jar to the CLASSPATH for your WebLogic Server.
Add a Jolt connection pool that connects to your TUXEDO server. See Implementing Jolt for WebLogic for information on how to set up your server.
Here is a sample weblogic.properties file:
# Demo Jolt pool weblogic.system.startupClass.demojoltpoolStart=\ bea.jolt.pool.servlet.weblogic.PoolManagerStartUp weblogic.system.startupArgs.demojoltpoolStart=\ poolname=demojoltpool,\ appaddrlist=//<your_tuxedo.your.domain>,\ failoverlist=//<your_tuxedo.your.domain>,\ minpoolsize=1,\ maxpoolsize=3 weblogic.system.shutdownClass.demojoltpoolStop=\ bea.jolt.pool.servlet.weblogic.PoolManagerShutDown weblogic.system.shutdownArgs.demojoltpoolStop=\ poolname=demojoltpool
$ java examples.jolt.ejb.bankapp.Client
If you are not running the WebLogic Server with its default settings, you will have to run the client using:
$ java examples.jolt.ejb.bankapp.Client "t3://WebLogicURL:Port"
Parameters are optional, but if any are supplied, they are interpreted in this order:
Beginning jolt.bankapp.Client... Created teller Terry Getting current balance of Account 10000 for Erin Balance: 27924.02 Start Transaction 1 for Erin Depositing 100.0 for Erin Balance: 28024.02 End Transaction 1 for Erin Start Transaction 2 for Erin Depositing 200.0 for Erin Balance: 28224.02 Withdrawing 28324.02 for Erin Transaction error: examples.jolt.ejb.bankapp.TransactionErrorException: Teller error: application exception: Account Overdraft Rolling back transaction for Erin End Transaction 2 for Erin Getting final balance of Account 10000 for Erin Balance: 28024.02 Removing teller Terry End jolt.bankapp.Client...Note how the final balance shows that Transaction 2 was rolled back to the balance at the end of Transaction 1.
Read more about Jolt in the Jolt for WebLogic Server User's Guide.
Copyright © 1998-2000 BEA Systems, Inc. All rights reserved.
Last updated 03/20/2000