Speakers: Mark Hapner (SPK-hapner) and Vlada Matena (SPK-vlada)
Moderator: Edward Ort (MDR-edort)
This is a moderated forum.
MDR-edort: Welcome to JavaTM Live. Our guests today are
Mark Hapner and Vlada Matena, the authors of the Enterprise Java BeansTM
(EJB) spec 1.1 public draft. So let's begin. Who has the first question?
IgorL: According to EJB standard (V1.1 draft,
section 18.1.2), Enterprise Java Beans are not allowed to manage threads.
Can you recommend an alternative for implementing asynchronous tasks:
For instance, archive middle tier data, produce data for reports, and so on?
SPK-vlada: For asynchronous messages, you can use
JMS. For archiving, the EJB server should provide a mechanism to archive the
data.
satishrudra: What is the basic difference
between the data object in an object data base and an entity bean?
SPK-vlada: An entity bean defines the business
methods that operate on data, it is not the data itself.
dlj: I want to use XML to track jobs
involving histology and cytology samples. How do XML and EJB fit together?
SPK-vlada: You can use XML with EJB. You can use
the ProjectX parser with JSP and servlets and EJB.
rickardoberg: If a servlet engine and an EJB
container should live in same server, there is a need for both to access
JNDI component environment settings. How will this interface be defined?
SPK-vlada: Both enterprise beans and servlets can use the
Java Naming and Directory InterfaceTM (JNDI) to access the environment
entries. The entries are always in the java:comp/encontext
implemented by the Container.
dgeary: How does a single user at home get
started with EJB? Can you recommend any free EJB implementations and
databases? When will Sun have a reference implementation?
SPK-hapner: The reference impl will
be available for download soon after JavaOne. I believe there are other
evaluation versions of EJB products available as well.
bengber: Do you envision people using EJB to
support Internet Web applications or more for Intranet thin client apps?
SPK-vlada: EJB handles the reuseable business
component part of a web application and JSP and servlets handle the
presentation. This architecture is useful for both intranet and internet
apps.
jtremlett: To follow on the question on
entity beans, how do you see developing entity beans that interact with
non-transactional applications. For example, how do we achieve transaction
awareness?
SPK-vlada: You would use the NotSupported
transaction attribute for the entity bean methods. You would have empty
EJBLoad and EJBStore methods. Each business
method would be a transaction to the back-end system. This works with
systems like R/3.
dnelsen: Moderator, I've noticed, as have
some of the others here, that the chat applet doesn't work unless we click
Show Unformatted. Otherwise the chat screen just looks frozen
on the 1st question. I am now showing unformatted and can see all the
questions.
MDR-edort: This is a known bug in the applet. Sorry
for the inconvenience. The good news is that a new tool for managing the
chats is on its way, and we should be using it soon.
sramp: Remote Interface is the means by which
clients call the methods on EJB, but EJB itself is not implementing the
remote interface? Can you tell me how is that done?
SPK-vlada: The tools provided by the container generate
a remote object that implements the RemoteInterface. This
remote object delegates to the enterprise bean class instances.
IgorL: Question about container-managed
entity beans. How can we manage Java attributes, that are not part of the
entity object. Usually we would use these attributes to keep calculated
values, once the entity object is loaded. It is our responsibility to
calculate them again when the entity object is changed.
SPK-vlada: With CMP, you use the EJBLoad and
EJBStore methods to calculate the values of the derived attributes.
For example, you can use this for compression.
satishrudra: Are there any standards for
developing EJB Container? If not, How is interoperability between
different containers achieved?
SPK-vlada: In a later release of the EJB spec, we
will define the interoperabilty between servers using CORBA protocols. So
far, we have defined the application formats (this is RMI/IIOP) and
transactions (his is OTS). We have to still define interoperable security
and naming. We rely on the CORBA protocols for interoperability. We only
specify which protocols to use.
sramp: I read in some article that CMP should
be preferred over BMP. What is your comment on it, CMP vs. BMP?
SPK-vlada: We don't prefer one over the other. BMP gives
the developer maximum flexibility in designing data access. CMP allows the
deployer to develop the data access code at deployment time. Ideally, in the
future we will be able to combine the advantages of both approaches.
rickardoberg: But the servlet engines and EJB
container needs to access the JNDI namespace in order to setup the env. for
EJB and servlet components. For this to work the JNDI namespace must have some
interface for doing this initialization. When, how, will this be defined?
SPK-hapner: In many cases, the container implements
its own part of the JNDI name space which is federated with the enterprise
name space via JNDI.
jtremlett: To follow on entity beans wrapping
non-transactional applications, how do we achieve rollback of transactions?
SPK-vlada: It does not seem to make sense that a
business method of an entity bean demarcate transaction. However, the
entity protocol is designed to allow the bean to take advantage of the
EJBLoad and EJBStore method to cache data in a
transaction.
jwg1: A comment/question regarding methods
that may be called during afterCompletion(): We have a
situation where we have a MSSQLServer stored-procedure interface to a
third party server that we access via a session-bean/entity bean pair.
We have no control over how these procedures are written. As a result
we may not pass them a transaction context. We also have another entity
bean that accesses an Oracle database over which we do have control. Both
beans need to participate in the same transaction. The best we can do
on the SQL server side is catch the afterCompletion() call
and either commit or undo manually. However, EJB 1.1 says you can't
call enterprise-bean methods in the afterCompletion()
method. This puts us in a real bindwe now have no way of doing
a compensating action should a rollback occur on the oracle entity bean.
The best alternative would be if entity beans could implement something
akin to SessionSynchronization and catch the
afterCompletion() call themselves. Comments?
SPK-hapner: Dealing with non-transactional
resources is difficult. EJB does not provide the ability to write a full
compensation strategy for such resources. The only way to do this is to
extend the container transaction manager to handle this special case. We
are investigating other alternatives for EJB 2.0.
pperrone: Why use BMP at all? What does it
provide you with other than what you can code yourself?
SPK-vlada: CMP has some limitations that makes it less
suitable for some cases where BMP works. Also BMP does not mean that you
have to code the data access. BMP includes the cases where the bean developer
uses design-time data access components that ship with the entity bean.
mnf999: Comments on the portability of
context propagation?? How does that REALLY work? No RMI/IIOP answer please ;-)
SPK-vlada: The current EJB spec does NOT define
interoperability. When it does, it will be RMI/IIOP and the OMG Transaction
Service. The OTS spec (its Java rendering is the JTS spec) defines how the
multiple servers propagate the transaction context and how they perform the
two phase commit. OTS works well with RMI/IIOP.
kchaganti: Is there any way a bean can call the
client in an asynchronous manner.
SPK-hapner: The general answer is to use JMS
messages when JMS is integrated as part of EJB 2.0. Some vendors will
support asynch EJB calls for non-transactional EJBs that do not have a
return value.
rickardoberg: Answer to jtremlett: as
vlada hinted, it is possible for EJB containers to use
caching to do "semi-transactions" in the case the backing store
does not support true transactions. This will be able to handle rollbacks
that are not connected to software or hardware failure (i.e. most of them).
SPK-vlada: Right.
Duffy: I am part of a development group that
is just beginning to get our feet wet with EJB. We have begun with the
online EJB tutorial using BEA's server. However we believe that BEA is too
much for what we want to do. Are there any bare bones EJB servers out there?
Also what is the status of Sun's reference implementation and what will it's
licensing and pricing policy be?
SPK-hapner: The RI licensing details are still
being resolved. An early access version will be available soon after
JavaOne.
jthelin: Will the forthcoming "reference
implementation" of EJB from Sun include a "reference
implementation" of the JTS/JTA parts? If so, can you give some
indication of how "full-featured" it will be; that is, will
it support distributed transactions across multiple data sources?
SPK-vlada: The reference implementation of Java
2, Enterprise Edition will include support for distributed transactions.
You can update multiple databases in a transaction.
sateeshr: What is Reference implemention of EJB??
SPK-vlada: There is no reference implementation of EJB
per se. The reference implementation of the Java 2, EE will
include the reference implementation of the EJB container. The compliance
test suite for J2EE will test thoroughly for EJB compliance.
kchaganti: Is there any way the A bean can
call back the Client?
SPK-hapner: Callbacks typically imply asynch
invocation. This is best handled with JMS.
sramp: In the EJBhome interface we
define the create method to return the Bean object. But its
corresponding EJBCreate in the actual bean returns void. I am
confused here. Can you comment on this?
SPK-vlada: IN EJB 1.1, the EJBCreate
returns the primary key. With BMP, EJBCreate returns
the primary key and the container creates an object reference that
embeds the primary key. With CMP, the EJBCreate returns
null. The container creates the primary key for the entity object. The
return value of the EJBCreate method is defined to return
the primary key to match the signature of the BMP style. This allows a
CMP bean to be turned into a BMP bean by subclassing.
rickardoberg: Mark, but won't both servlets
and EJB's access the env. through the "java:/comp/env" name?
Because in that case there is no other way than to make the JNDI part
separate of both EJB and servlet engine and have a well defined interface to
it.
SPK-hapner: For J2EE, java:/comp/env is used
by all components to access the environment set up for it at deployment. EJB
1.1 is one example of this. Each container will likely provide its own
implementation of the 'java:' namespace.
flippant: Hi, I'm joining late so forgive me if
this is either inappropriate or has already been covered. With regards to
the 1.1 spec and JTA. I'm currently working on a container and I've been
trying to figure out how my container is supposed to "know" about
an existing transaction which is potentially in another VM. I suppose more
to the point is "What is the recommended way to locate an *instance* of
a JTA?"
SPK-vlada: The EJB spec does not prescribe how
vendors should build containers. You can use any strategy that you wish.
MDR-edort: We're scheduled to end the chat at noon
PDT. However the number of participants is high and the questions very
good. So let's go until 10 after noon.
IgorL: Another question about container-managed
entity beans. When we write code using the EJBActivate()
method, how do we know when an entity object is already loaded (when an
entity bean is assigned to an entity object from the cache, and call to
EJBLoad() is not performed by the container).
SPK-vlada: The developer of an entity bean does
not have to know this. It is the job of the container to manage the
cache of the active instances and call the EJBActivate /
EJBLoad / EJBStore / EJBPassivate
methods at the right times.
ronenb1: According to a question about
asynchronous tasks, how can we run asynchronous tasks without using
additional APIs (without using JMS)? We would like to return to the
client before we begin long-term processing on the server.
SPK-hapner: It is not possible to do asynch
processing in an EJB with the facilities currently available. JMS is the
mechanism we feel is best suited to this problem. We realize that this is
an important facility.
rickardoberg: Duffy: See
http://www.mgm-edv.de/ejbsig/ejbservers.html
for a comprehensive list of available servers
rickardoberg: Let me try again ;-* servlets
access java.// namespac* EJB's access java:// namespac* if EJB container
implement java:// namespace the servlet engine can't access it in order to
init and perform context switching* and the same if servlet engine implements
java:/Conclusion: JNDI must be separate from both EJB container and servlet
engine. Problem: How should the JNDI implementation be accessed by the EJB
and servlet engines? How will this interface be defined? Is this clear enough?
SPK-vlada: The servlet runtime and the EJB runtime
(runtime == container) is implemented by a J2EE platform vendor. The
java:comp/env context is implemented as part of the platform.
Since each component needs potentially a different set of values in the
java:comp/env, the implementation of the context must be able
to tell which component invokes the lookup call. Most platforms would use
thread context to know which component is calling. I hope that I understood
your question.
Misovec: Where can I load the latest Java
Development Kit (JDKTM) package. Is the package free?
MDR-edort: Your question isn't an EJB question, but
I'll answer it. Go to the java.sun.com page and then select the APIs page.
You can download from there. The JDK is free subject to licensing agreement.
flippant: With regards to JTA instances - but we
need to play nice with other containers. I'm asking how *you* would do it.
SPK-vlada: I'd use RMI/IIOP and OTS. This is
what many major vendors do. You will be able to interoperate with them.
In a later release of the spec, we may *require* RMI/IIOP for compliance.
IgorL: Are there OLAP tools that works with
EJB servers?
SPK-hapner: I'm not aware of specific tools for
creating OLAP beans; however, EJB would be a good way to implement access
to OLAP content or make OLAP requests.
MDR-edort: Well it's approaching 10 after noon. Our
time is up. Thanks for an excellent session!
Signing off.
Last moderator (me) signing off. The forum is now unmoderated
Reader Feedback
Tell us what you think of this transcript.