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 DeploymentDescriptor.txt 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'll need to adjust certain properties to match your setup. You'll 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:
We provide separate build scripts (in the directory above this one: /examples/jolt/ejb) for Windows NT and UNIX:
The "build" scripts builds individual examples, such as this entry for Windows:
$ buildTo build under Microsoft's JDK for Java, use
$ build -msThese 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'll need to adjust the property depending on which EJBeans you're building and are deploying, or if the location of the files differs from the installed location.
Note: If you're running under the Microsoft SDK for Java, you'll also need to add the path to the .jar to the CLASSPATH for your WebLogic Server.
You'll need to add a Jolt connection pool that connects to the public TUXEDO Server at BEA by adding to your weblogic.properties file:
# Demo Jolt pool weblogic.system.startupClass.demojoltpoolStart=\ bea.jolt.pool.servlet.weblogic.PoolManagerStartUp weblogic.system.startupArgs.demojoltpoolStart=\ poolname=demojoltpool,\ appaddrlist=//beademo1.beasys.com:8000,\ failoverlist=//beademo1.beasys.com:8000,\ 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're 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"
where:
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 Developers Guide, Using Jolt for WebLogic.
Copyright © 1998-1999 BEA Systems, Inc. All rights reserved.
Last updated 09/26/1999