Re: EJB and J2C Connector Problem
John Pickler <[email protected]> Wed, 27 Aug 2003 14:52:15 -0600
| Newsgroups | gmane.comp.java.sun.connector |
|---|---|
| Message-ID | <[email protected]> |
My bean does not implement the SessionSynchronization interface. I am
rather new to EJB development, so I was not even aware of this interface.
However, when I look at the online Javadoc for
javax.ejb.SessionSynchronization, it appears that that is used by the
container to notify of transaction boundaries. The Interactions that are
linked together in my application are a series of autocommit
operations...there are no LocalTransaction operations involved. Would I
still need to use this interface? In case it helps, here's a clip from the
code of my EJB:
public class ABBean implements javax.ejb.SessionBean {
private SessionContext mySessionCtx;
private InitialContext ctx;
private Connection con;
private ConnectionFactory conFact;
private ConnectionSpecImpl conSpec;
/**
* Creates the EJB given the proper ERP credentials.
*/
public void ejbCreate(String username,String password,String
environment,String role)
throws CreateException {
System.err.println("ejbCreate called.");
try {
// get JNDI context
ctx = new javax.naming.InitialContext();
// lookup the connection factory
conFact = (javax.resource.cci.ConnectionFactory)
ctx.lookup("myAdapter");
// create a ConnectionSpec
conSpec = new ConnectionSpecImpl(username, password, environment,
role);
// get the Connection to ERP
con = conFact.getConnection(conSpec);
} catch (NamingException e) {
throw new CreateException(e.getMessage());
} catch (ResourceException e) {
throw new CreateException(e.getMessage());
}
}
...
Thanks,
DW
----- Original Message -----
From: "Johan Eltes" <[email protected]>
To: <[email protected]>
Sent: Wednesday, August 27, 2003 2:38 PM
Subject: Re: EJB and J2C Connector Problem
> Does your SSB implement the SessionSynchronization interface?
>
> /Johan
> Den 03-08-27 21.30, skrev "John Pickler" <[email protected]>:
>
> > I have a written a J2EE Connector Architecture 1.0 Resource Adapter for
> > my company along with some sample customer applications. I have several
> > applications in which I need a stateful session bean to create a
> > connection through my resource adapter, and then have the client be able
to
> > call the methods on that EJB instance with that same connection. The
reason
> > they need to be the same connection is so that the work done on my ERP
> > server (which is what my resource adapter talks to) will be recognized
as
> > one single, related user session on the ERP side. However, I've done
> > significant debugging in WebSphere 5.0.2 (my company's platform of
choice),
> > and I am finding that although the connection is being created
> > (by me) in the ejbCreate() method, the container is calling my
> > ManagedConnection.cleanup() method after the ejbCreate() method is
finished,
> > which of course terminates the connection. I need this connection to
stay
> > live across multiple Interaction.execute() calls on my resource adapter.
> > Any ideas on how I accomplish this? Am I doing something wrong?
> >
> > Thanks,
> > DW
> >
> >
===========================================================================
> > To unsubscribe, send email to [email protected] and include in the
body
> > of the message "signoff CONNECTOR-INTEREST". For general help, send
email to
> > [email protected] and include in the body of the message "help".
>
>
===========================================================================
> To unsubscribe, send email to [email protected] and include in the
body
> of the message "signoff CONNECTOR-INTEREST". For general help, send email
to
> [email protected] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff CONNECTOR-INTEREST". For general help, send email to
[email protected] and include in the body of the message "help".