RE: Has anyone run OJB on WebLogic 8.1?

2004-01-02 Thread Bates, Alex

Problem solved: 
I found a post by Armin on the archive (glad that's still online!)
recommending removing the T3ServicesDef from the startup class.  I did this,
and no longer get the NotSerializableException.

Now I'm getting a different classloader exception, but not specific to OJB
(have to figure out the WL classloader, much different from JBoss).

Recommendation: 
Change the sample startup class posted on the OJB website by removing the
T3ServicesDef member variable.


-Original Message-
From: Bates, Alex 
Sent: Wednesday, December 31, 2003 10:32 AM
To: OJB Users List
Subject: RE: Has anyone run OJB on WebLogic 8.1?



Here is some more information: in stderr (wasn't present in the log file)
there is a NotSerializableException caused by the Ojb startup class.

As you can see from the code below, the startup class does implement
Serializable.  The only interface in OJB that it's implementing that is NOT
serializable is ODMGJ2EEFactory.  But if this were a problem I'm assuming it
would have been noticed by others.


Here is the NotSerializableException stack trace from WL:

javax.naming.CommunicationException.  Root exception is
java.rmi.UnmarshalExcept
ion: failed to unmarshal cookie; nested exception is:
java.io.NotSerializableException: weblogic.t3.srvr.T3ServerServices
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
ef.java:294)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
ef.java:244)
at weblogic.jndi.internal.ServerNamingNode_811_WLStub.bind(Unknown
Sourc
e)
at weblogic.jndi.internal.WLContextImpl.bind(WLContextImpl.java:359)
at javax.naming.InitialContext.bind(InitialContext.java:355)
at
org.apache.ojb.weblogic.OjbODMGStartup.bind(OjbODMGStartup.java:89)
at
org.apache.ojb.weblogic.OjbODMGStartup.startup(OjbODMGStartup.java:58
)
at
weblogic.t3.srvr.StartupClassService.invokeStartup(StartupClassServic
e.java:177)


-Original Message-
From: Bates, Alex 
Sent: Wednesday, December 31, 2003 10:19 AM
To: OJB Users List
Subject: Has anyone run OJB on WebLogic 8.1?



I tried following the instructions in the deployment documentation for OJB,
creating a startup class for WebLogic similar to the example posted on the
website.  

I'm getting an error that WL is unable to bind the factory to JNDI.  Then,
downstream of course I get errors that ojb/defaultODMG is not bound (we're
using the ODMG API).  

Here's the error binding to JNDI, and code for startup classes.  Am I doing
something wrong?  We are trying to port to WL 8.1 for an urgent customer
request, so any help is appreciated.



Info WLS Kernel  BEA-000287 Invoking startup class:
org.apache.ojb.weblogic.OjbODMGStartup.startup(null)
 
Info WebLogicServer wusab210009-0n9 myserver main WLS Kernel
 BEA-000288 org.apache.ojb.weblogic.OjbODMGStartup reports: Startup
Class error: impossible to bind OJB ODMG factory 



Here is the code:

public interface OjbODMGFactory extends ODMGJ2EEFactory, Serializable {

}


public class OjbODMGStartup implements OjbODMGFactory, T3StartupDef,
Serializable {

private String DEFAULT_JNDI_NAME = ojb/defaultODMG;
private String defaultPropsFile =
org/apache/ojb/weblogic/OJB.properties;

private T3ServicesDef services;

public void setServices (T3ServicesDef services)
{
this.services = services;
}

public Implementation getInstance()
{
return OJBJ2EE_2.getInstance();
}

public String startup (String name, Hashtable args)
throws Exception
{

try
{
String jndiName = (String)args.get (jndiname);
if (jndiName == null || jndiName.length () == 0)
jndiName = DEFAULT_JNDI_NAME;

String propsFile = (String)args.get (propsfile);
if (propsFile == null || propsFile.length () == 0)
{
System.setProperty(OJB.properties, defaultPropsFile  );
}
else
{
System.setProperty(OJB.properties, propsFile  );
}

InitialContext ctx = new InitialContext ();
bind (ctx, jndiName, this);

// return a message for logging
return Bound OJBODMGFactory to  + jndiName;
}
catch (Exception e)
{
e.printStackTrace();
// return a message for logging
return
Startup Class error: impossible to bind OJB ODMG
factory;
}
}

private void bind(Context ctx, String name, Object val)
throws NamingException
{
Name n;
for (n = ctx.getNameParser().parse(name);
 n.size()  1; n = n.getSuffix(1))
{
String ctxName = n.get(0);
try
{
ctx = (Context) ctx.lookup(ctxName);
}
catch (NameNotFoundException

Has anyone run OJB on WebLogic 8.1?

2003-12-31 Thread Bates, Alex

I tried following the instructions in the deployment documentation for OJB,
creating a startup class for WebLogic similar to the example posted on the
website.  

I'm getting an error that WL is unable to bind the factory to JNDI.  Then,
downstream of course I get errors that ojb/defaultODMG is not bound (we're
using the ODMG API).  

Here's the error binding to JNDI, and code for startup classes.  Am I doing
something wrong?  We are trying to port to WL 8.1 for an urgent customer
request, so any help is appreciated.



Info WLS Kernel  BEA-000287 Invoking startup class:
org.apache.ojb.weblogic.OjbODMGStartup.startup(null)
 
Info WebLogicServer wusab210009-0n9 myserver main WLS Kernel
 BEA-000288 org.apache.ojb.weblogic.OjbODMGStartup reports: Startup
Class error: impossible to bind OJB ODMG factory 



Here is the code:

public interface OjbODMGFactory extends ODMGJ2EEFactory, Serializable {

}


public class OjbODMGStartup implements OjbODMGFactory, T3StartupDef,
Serializable {

private String DEFAULT_JNDI_NAME = ojb/defaultODMG;
private String defaultPropsFile =
org/apache/ojb/weblogic/OJB.properties;

private T3ServicesDef services;

public void setServices (T3ServicesDef services)
{
this.services = services;
}

public Implementation getInstance()
{
return OJBJ2EE_2.getInstance();
}

public String startup (String name, Hashtable args)
throws Exception
{

try
{
String jndiName = (String)args.get (jndiname);
if (jndiName == null || jndiName.length () == 0)
jndiName = DEFAULT_JNDI_NAME;

String propsFile = (String)args.get (propsfile);
if (propsFile == null || propsFile.length () == 0)
{
System.setProperty(OJB.properties, defaultPropsFile  );
}
else
{
System.setProperty(OJB.properties, propsFile  );
}

InitialContext ctx = new InitialContext ();
bind (ctx, jndiName, this);

// return a message for logging
return Bound OJBODMGFactory to  + jndiName;
}
catch (Exception e)
{
e.printStackTrace();
// return a message for logging
return
Startup Class error: impossible to bind OJB ODMG
factory;
}
}

private void bind(Context ctx, String name, Object val)
throws NamingException
{
Name n;
for (n = ctx.getNameParser().parse(name);
 n.size()  1; n = n.getSuffix(1))
{
String ctxName = n.get(0);
try
{
ctx = (Context) ctx.lookup(ctxName);
}
catch (NameNotFoundException namenotfoundexception)
{
ctx = ctx.createSubcontext(ctxName);
}
}
ctx.bind(n.get(0), val);
}
}




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Has anyone run OJB on WebLogic 8.1?

2003-12-31 Thread Bates, Alex

Here is some more information: in stderr (wasn't present in the log file)
there is a NotSerializableException caused by the Ojb startup class.

As you can see from the code below, the startup class does implement
Serializable.  The only interface in OJB that it's implementing that is NOT
serializable is ODMGJ2EEFactory.  But if this were a problem I'm assuming it
would have been noticed by others.


Here is the NotSerializableException stack trace from WL:

javax.naming.CommunicationException.  Root exception is
java.rmi.UnmarshalExcept
ion: failed to unmarshal cookie; nested exception is:
java.io.NotSerializableException: weblogic.t3.srvr.T3ServerServices
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
ef.java:294)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
ef.java:244)
at weblogic.jndi.internal.ServerNamingNode_811_WLStub.bind(Unknown
Sourc
e)
at weblogic.jndi.internal.WLContextImpl.bind(WLContextImpl.java:359)
at javax.naming.InitialContext.bind(InitialContext.java:355)
at
org.apache.ojb.weblogic.OjbODMGStartup.bind(OjbODMGStartup.java:89)
at
org.apache.ojb.weblogic.OjbODMGStartup.startup(OjbODMGStartup.java:58
)
at
weblogic.t3.srvr.StartupClassService.invokeStartup(StartupClassServic
e.java:177)


-Original Message-
From: Bates, Alex 
Sent: Wednesday, December 31, 2003 10:19 AM
To: OJB Users List
Subject: Has anyone run OJB on WebLogic 8.1?



I tried following the instructions in the deployment documentation for OJB,
creating a startup class for WebLogic similar to the example posted on the
website.  

I'm getting an error that WL is unable to bind the factory to JNDI.  Then,
downstream of course I get errors that ojb/defaultODMG is not bound (we're
using the ODMG API).  

Here's the error binding to JNDI, and code for startup classes.  Am I doing
something wrong?  We are trying to port to WL 8.1 for an urgent customer
request, so any help is appreciated.



Info WLS Kernel  BEA-000287 Invoking startup class:
org.apache.ojb.weblogic.OjbODMGStartup.startup(null)
 
Info WebLogicServer wusab210009-0n9 myserver main WLS Kernel
 BEA-000288 org.apache.ojb.weblogic.OjbODMGStartup reports: Startup
Class error: impossible to bind OJB ODMG factory 



Here is the code:

public interface OjbODMGFactory extends ODMGJ2EEFactory, Serializable {

}


public class OjbODMGStartup implements OjbODMGFactory, T3StartupDef,
Serializable {

private String DEFAULT_JNDI_NAME = ojb/defaultODMG;
private String defaultPropsFile =
org/apache/ojb/weblogic/OJB.properties;

private T3ServicesDef services;

public void setServices (T3ServicesDef services)
{
this.services = services;
}

public Implementation getInstance()
{
return OJBJ2EE_2.getInstance();
}

public String startup (String name, Hashtable args)
throws Exception
{

try
{
String jndiName = (String)args.get (jndiname);
if (jndiName == null || jndiName.length () == 0)
jndiName = DEFAULT_JNDI_NAME;

String propsFile = (String)args.get (propsfile);
if (propsFile == null || propsFile.length () == 0)
{
System.setProperty(OJB.properties, defaultPropsFile  );
}
else
{
System.setProperty(OJB.properties, propsFile  );
}

InitialContext ctx = new InitialContext ();
bind (ctx, jndiName, this);

// return a message for logging
return Bound OJBODMGFactory to  + jndiName;
}
catch (Exception e)
{
e.printStackTrace();
// return a message for logging
return
Startup Class error: impossible to bind OJB ODMG
factory;
}
}

private void bind(Context ctx, String name, Object val)
throws NamingException
{
Name n;
for (n = ctx.getNameParser().parse(name);
 n.size()  1; n = n.getSuffix(1))
{
String ctxName = n.get(0);
try
{
ctx = (Context) ctx.lookup(ctxName);
}
catch (NameNotFoundException namenotfoundexception)
{
ctx = ctx.createSubcontext(ctxName);
}
}
ctx.bind(n.get(0), val);
}
}




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to specify non-default DataSource for ODMG/PB api in different scenarios?

2003-08-30 Thread Bates, Alex
Hello,

I'm using the ODMG/PB APIs in the following situations; in each I need to be
able to tell OJB to use a named DataSource (defined in
repository_database.xml) other than the default.  Any help would be
appreciated -

--

Transaction tx = odmg.currentTransaction();
tx.lock(obj, Transaction.WRITE);

--

db = odmg.getDatabase(null);
db.deletePersistent(obj);

--

PersistenceBroker broker = ((HasBroker)
odmg.currentTransaction()).getBroker();
Connection conn = null;
try {
conn = broker.serviceConnectionManager().getConnection();
} catch (LookupException e) {
e.printStackTrace();
}

--

// Must mark object as dirty to signal OJB to persist
Transaction tx = odmg.currentTransaction();
((NarrowTransaction)tx).markDirty(obj);

---


Thanks!

Alex


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: OJB uses jdbc cursor to Update - but my cursor doesn't suppor t up date!

2003-08-14 Thread Bates, Alex

Okay, I tried a couple ways but I must be doing something wrong.  I'm using
rc4, and I'm getting a ClassCastException when I try to cast to
TransactionImpl because the instance is actually a NarrowTransaction

14:16:36,217 INFO  [STDOUT] query: yy select bonus;
14:16:36,217 INFO  [STDOUT] tx:
[EMAIL PROTECTED]
14:16:36,217 ERROR [STDERR] java.lang.ClassCastException

Any idea why the txn is a NarrowTransaction as opposed to a TransactionImpl,
or how to change? 

Thx,

Alex



-Original Message-
From: Bates, Alex 
Sent: Friday, August 08, 2003 11:34 AM
To: OJB Users List
Subject: RE: OJB uses jdbc cursor to Update - but my cursor doesn't suppor t
up date!



Thanks Thomas!  Will give this a try!

-Original Message-
From: Thomas Mahler [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 08, 2003 11:25 AM
To: OJB Users List
Subject: Re: OJB uses jdbc cursor to Update - but my cursor doesn't suppor t
up date!


Hi Alex,

Bates, Alex wrote:
 Hi Thomas,
 
 Hmmm, so it doesn't use updatable cursors.  So OJB is not recognizing
 that an update has taken place.  When I call ODMG's 
 Transaction.lock(obj, Transaction.WRITE), how does it determine if an 
 update has taken place?  In my app, the servlet tier gets a Vector of 
 O/R mapped objects from the EJB tier, updates a given object, then 
 calls the EJB tier updateObject() method to update it.  Is there a 
 problem with this?  I noticed in your ODMG examples you explicitly 
 lock an object before calling the update methods - but I assumed it 
 was different in an EJB-based app.
 
 Q: is there a problem with this scenario?

Yes! ODMG has no notion of long transactions. that is ODMG want's you to 
perform all changes to object after locking them to the transactions.

So changing objects on the client, then sending them back to the server 
and locking them to a transaction will fail!

That's because the ODMG transaction manager was not able to track the 
state of that object.

The trick is as Follows:

After locking the changed object from the client call:
((o.a.ojb.odmg.TransactionImpl) tx).markDirty(instance);



 *servlet app retrieves O/R mapped object via EJB layer (which uses
 ODMG), but object is not locked (optimistic) *servlet calls setter 
 methods on the object *servlet calls EJB updateObject method, which 
 calls Transaction.lock
 
 Q2: do I need to put an explicit READ lock on a retrieved list of
 objects returned by the EJB tier?

Yes, that would be another option. But it would mean to keep the ODMG tx 
open during the client operations. And when the client returns the 
changes object you have to looup the proper transaction.

cheers,
Thomas

 
 
 Details:
 
 
 Here is my app's architecture:
 
 *OJB: uses the ODMG API w/in Jboss 3.2.1
 
 *EJB tier: uses a PersistenceManagerBean SessionBean w/ insert,
 update, delete methods; the implementation of the update methods are 
 as follows
 
 /**
  * Store object that has been mapped in OJB repository
  * @param obj
  *
  * @ejb:interface-method
  */
 public Object updateObject(Object obj) throws DataAccessException
 {
 
 return storeObject(obj);
 }
 
 /**
  */
 public Object storeObject(Object obj) throws DataAccessException
 {
 try
 {
 if(log.isDebugEnabled()) log.debug(storeObject);
 
 Transaction tx = odmg.currentTransaction();
 tx.lock(obj, Transaction.WRITE);
 }
 catch (Throwable t)
 {
 t.printStackTrace();
 System.out.println(t.getMessage());
 }
 return obj;
 }
 
 Here is the method used to retrieve a list for the servlet tier:
 /**
  * @ejb:interface-method
  */
 public Vector getVector(Class klass) throws DataAccessException {
 
 Vector result = null;
 try {
 
 OQLQuery query = odmg.newOQLQuery();
 query.create(select allObjects from  + klass.getName());
 DList list = (DList) query.execute();
 
 result = new Vector();
 Object[] vals = list.toArray();
 for (int i=0; ilist.size(); i++) {
 // Retrieve associated CLOB
 if (klass.newInstance() instanceof ClobVOInterface)
 {
 ClobVOInterface vo = (ClobVOInterface)list.get(i);
 retrieveClob((ClobVOInterface)vo);
 }
 
 result.add(list.get(i));
 }
 
 } catch (Throwable t) {
 t.printStackTrace();
 }
 
 return result;
 }
 
 *DAO:
 DAO used by servlet tier to perform updates/retrieval (servlet doesn't 
 directly access PM), w/ following code:
 
 public class DefaultDAO implements DAOInterface {
 
 public void updateVO(VOInterface obj) throws DataAccessException {
 PersistenceManagerRemote pm =
 ServiceLocator.getInstance().getPersistenceManager();
 try

RE: OJB uses jdbc cursor to Update - but my cursor doesn't suppor t up date!

2003-08-14 Thread Bates, Alex

Thanks Thomas!  Will give this a try!

-Original Message-
From: Thomas Mahler [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 08, 2003 11:25 AM
To: OJB Users List
Subject: Re: OJB uses jdbc cursor to Update - but my cursor doesn't suppor t
up date!


Hi Alex,

Bates, Alex wrote:
 Hi Thomas,
 
 Hmmm, so it doesn't use updatable cursors.  So OJB is not recognizing 
 that an update has taken place.  When I call ODMG's 
 Transaction.lock(obj, Transaction.WRITE), how does it determine if an 
 update has taken place?  In my app, the servlet tier gets a Vector of 
 O/R mapped objects from the EJB tier, updates a given object, then 
 calls the EJB tier updateObject() method to update it.  Is there a 
 problem with this?  I noticed in your ODMG examples you explicitly 
 lock an object before calling the update methods - but I assumed it 
 was different in an EJB-based app.
 
 Q: is there a problem with this scenario?

Yes! ODMG has no notion of long transactions. that is ODMG want's you to 
perform all changes to object after locking them to the transactions.

So changing objects on the client, then sending them back to the server 
and locking them to a transaction will fail!

That's because the ODMG transaction manager was not able to track the 
state of that object.

The trick is as Follows:

After locking the changed object from the client call:
((o.a.ojb.odmg.TransactionImpl) tx).markDirty(instance);



 *servlet app retrieves O/R mapped object via EJB layer (which uses 
 ODMG), but object is not locked (optimistic) *servlet calls setter 
 methods on the object *servlet calls EJB updateObject method, which 
 calls Transaction.lock
 
 Q2: do I need to put an explicit READ lock on a retrieved list of 
 objects returned by the EJB tier?

Yes, that would be another option. But it would mean to keep the ODMG tx 
open during the client operations. And when the client returns the 
changes object you have to looup the proper transaction.

cheers,
Thomas

 
 
 Details:
 
 
 Here is my app's architecture:
 
 *OJB: uses the ODMG API w/in Jboss 3.2.1
 
 *EJB tier: uses a PersistenceManagerBean SessionBean w/ insert, 
 update, delete methods; the implementation of the update methods are 
 as follows
 
 /**
  * Store object that has been mapped in OJB repository
  * @param obj
  *
  * @ejb:interface-method
  */
 public Object updateObject(Object obj) throws DataAccessException 
 {
 
 return storeObject(obj);
 }
 
 /**
  */
 public Object storeObject(Object obj) throws DataAccessException
 {
 try
 {
 if(log.isDebugEnabled()) log.debug(storeObject);
 
 Transaction tx = odmg.currentTransaction();
 tx.lock(obj, Transaction.WRITE);
 }
 catch (Throwable t)
 {
 t.printStackTrace();
 System.out.println(t.getMessage());
 }
 return obj;
 }
 
 Here is the method used to retrieve a list for the servlet tier:
 /**
  * @ejb:interface-method
  */
 public Vector getVector(Class klass) throws DataAccessException {
 
 Vector result = null;
 try {
 
 OQLQuery query = odmg.newOQLQuery();
 query.create(select allObjects from  + klass.getName());
 DList list = (DList) query.execute();
 
 result = new Vector();
 Object[] vals = list.toArray();
 for (int i=0; ilist.size(); i++) {
 // Retrieve associated CLOB
 if (klass.newInstance() instanceof ClobVOInterface)
 {
 ClobVOInterface vo = (ClobVOInterface)list.get(i);
 retrieveClob((ClobVOInterface)vo);
 }
 
 result.add(list.get(i));
 }
 
 } catch (Throwable t) {
 t.printStackTrace();
 }
 
 return result;
 }
 
 *DAO:
 DAO used by servlet tier to perform updates/retrieval (servlet doesn't
 directly access PM), w/ following code:
 
 public class DefaultDAO implements DAOInterface {
 
 public void updateVO(VOInterface obj) throws DataAccessException {
 PersistenceManagerRemote pm = 
 ServiceLocator.getInstance().getPersistenceManager();
 try {
 pm.updateObject(obj);
 } catch (DataAccessException e) {
 e.printStackTrace();
 } catch (RemoteException e) {
 e.printStackTrace();
 }
 }
 
 public Vector getAllVO(Class klass, ACL acl) throws 
 DataAccessException {
 PersistenceManagerRemote pm = 
 ServiceLocator.getInstance().getPersistenceManager();
 try {
 return pm.getVector(klass, acl);
 } catch (DataAccessException e) {
 e.printStackTrace();
 } catch (RemoteException e) {
 e.printStackTrace();
 }
 
 return null;
 }
 
 
 
 *Servlet tier:
 Uses DAO method to retrieve list of objects

RE: OJB uses jdbc cursor to Update - but my cursor doesn't suppor t up date!

2003-08-14 Thread Bates, Alex

Thanks - In the meantime, how about this for a workaround:

I'll modify the NarrowTransaction class by adding a getter for its internal
Transaction member, which is an instance of TransactionImpl - I'll use this
getter in my code to retrieve the internal TransactionImpl, which I can then
use to set the dirty flag -

Alex


-Original Message-
From: Michael Becke [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 08, 2003 2:27 PM
To: OJB Users List
Subject: Re: OJB uses jdbc cursor to Update - but my cursor doesn't suppor t
up date!


I just submitted a bug (#OJB199) regarding this.

Mike

Bates, Alex wrote:

 Okay, I tried a couple ways but I must be doing something wrong.  I'm 
 using rc4, and I'm getting a ClassCastException when I try to cast to 
 TransactionImpl because the instance is actually a NarrowTransaction
 
 14:16:36,217 INFO  [STDOUT] query: yy select bonus; 
 14:16:36,217 INFO  [STDOUT] tx: 
 [EMAIL PROTECTED]
 14:16:36,217 ERROR [STDERR] java.lang.ClassCastException
 
 Any idea why the txn is a NarrowTransaction as opposed to a 
 TransactionImpl, or how to change?
 
 Thx,
 
 Alex
 
 
 
 -Original Message-
 From: Bates, Alex
 Sent: Friday, August 08, 2003 11:34 AM
 To: OJB Users List
 Subject: RE: OJB uses jdbc cursor to Update - but my cursor doesn't suppor
t
 up date!
 
 
 
 Thanks Thomas!  Will give this a try!
 
 -Original Message-
 From: Thomas Mahler [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 08, 2003 11:25 AM
 To: OJB Users List
 Subject: Re: OJB uses jdbc cursor to Update - but my cursor doesn't suppor
t
 up date!
 
 
 Hi Alex,
 
 Bates, Alex wrote:
 
Hi Thomas,

Hmmm, so it doesn't use updatable cursors.  So OJB is not recognizing 
that an update has taken place.  When I call ODMG's 
Transaction.lock(obj, Transaction.WRITE), how does it determine if an 
update has taken place?  In my app, the servlet tier gets a Vector of 
O/R mapped objects from the EJB tier, updates a given object, then 
calls the EJB tier updateObject() method to update it.  Is there a 
problem with this?  I noticed in your ODMG examples you explicitly 
lock an object before calling the update methods - but I assumed it 
was different in an EJB-based app.

Q: is there a problem with this scenario?
 
 
 Yes! ODMG has no notion of long transactions. that is ODMG want's you 
 to
 perform all changes to object after locking them to the transactions.
 
 So changing objects on the client, then sending them back to the 
 server
 and locking them to a transaction will fail!
 
 That's because the ODMG transaction manager was not able to track the
 state of that object.
 
 The trick is as Follows:
 
 After locking the changed object from the client call:
 ((o.a.ojb.odmg.TransactionImpl) tx).markDirty(instance);
 
 
 
 
*servlet app retrieves O/R mapped object via EJB layer (which uses 
ODMG), but object is not locked (optimistic) *servlet calls setter 
methods on the object *servlet calls EJB updateObject method, which 
calls Transaction.lock

Q2: do I need to put an explicit READ lock on a retrieved list of 
objects returned by the EJB tier?
 
 
 Yes, that would be another option. But it would mean to keep the ODMG 
 tx
 open during the client operations. And when the client returns the 
 changes object you have to looup the proper transaction.
 
 cheers,
 Thomas
 
 

Details:


Here is my app's architecture:

*OJB: uses the ODMG API w/in Jboss 3.2.1

*EJB tier: uses a PersistenceManagerBean SessionBean w/ insert, 
update, delete methods; the implementation of the update methods are 
as follows

/**
 * Store object that has been mapped in OJB repository
 * @param obj
 *
 * @ejb:interface-method
 */
public Object updateObject(Object obj) throws DataAccessException 
{

return storeObject(obj);
}

/**
 */
public Object storeObject(Object obj) throws DataAccessException
{
try
{
if(log.isDebugEnabled()) log.debug(storeObject);

Transaction tx = odmg.currentTransaction();
tx.lock(obj, Transaction.WRITE);
}
catch (Throwable t)
{
t.printStackTrace();
System.out.println(t.getMessage());
}
return obj;
}

Here is the method used to retrieve a list for the servlet tier:
/**
 * @ejb:interface-method
 */
public Vector getVector(Class klass) throws DataAccessException {

Vector result = null;
try {

OQLQuery query = odmg.newOQLQuery();
query.create(select allObjects from  + klass.getName());
DList list = (DList) query.execute();

result = new Vector();
Object[] vals = list.toArray();
for (int i=0; ilist.size(); i++) {
// Retrieve associated CLOB
if (klass.newInstance() instanceof ClobVOInterface)
{
ClobVOInterface vo = (ClobVOInterface)list.get(i

RE: Updates treated as inserts by ODMG

2003-08-14 Thread Bates, Alex

Sorry, this was a mis-post.  After further testing (and resolving an
application error), the problem is actually that updates aren't working (no
errors thrown, but database isn't updated).

Will do more extensive testing to isolate problem before reposting.

Regards,

Alex


-Original Message-
From: Bates, Alex 
Sent: Wednesday, August 06, 2003 5:22 PM
To: [EMAIL PROTECTED]
Subject: Updates treated as inserts by ODMG


Hello,

I have a VO defined as follows:

class ResultSetVO {
Object id
String label;
int maxRows;
// details ommitted
};


---

   class-descriptor
  class=com.teradata.tap.component.system.resultset.ResultSetVO
  table=TapResultset
   
  field-descriptor
 name=id
 column=ID
 jdbc-type=INTEGER
 primarykey=true
 autoincrement=true
  /
  field-descriptor
 name=label
 column=Label
 jdbc-type=VARCHAR
  /
  field-descriptor
 name=maxRows
 column=MaxRows
 jdbc-type=INTEGER
  /

---

When I do an update, it inserts the object (generates a new ID for it) and
saves it.  Example:  I retrieve a ResultSetVO with label 'Test1', an id of
4, and maxRows = 100.  I change maxRows to 200, and call
odmg.currentTransaction.lock( myRs, Transaction.WRITE );

Instead of updating my existing 'Test1' ResultSetVO in the database, OJB
inserts a new ResultSetVO - generates ID (5 in this case), and saves another
with label 'Test1'.  It doesn't delete the old ResultSetVO or anything like
that.

Question: could this be cause by having an INTEGER column in the database,
but using Object to represent the id in the ResultSetVO class??


Thanks in advance,
Alex


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: OJB uses jdbc cursor to Update - but my cursor doesn't support up date!

2003-08-10 Thread Bates, Alex
Hi Thomas,

Hmmm, so it doesn't use updatable cursors.  So OJB is not recognizing that
an update has taken place.  When I call ODMG's Transaction.lock(obj,
Transaction.WRITE), how does it determine if an update has taken place?  In
my app, the servlet tier gets a Vector of O/R mapped objects from the EJB
tier, updates a given object, then calls the EJB tier updateObject() method
to update it.  Is there a problem with this?  I noticed in your ODMG
examples you explicitly lock an object before calling the update methods -
but I assumed it was different in an EJB-based app.

Q: is there a problem with this scenario?
*servlet app retrieves O/R mapped object via EJB layer (which uses ODMG),
but object is not locked (optimistic)
*servlet calls setter methods on the object
*servlet calls EJB updateObject method, which calls Transaction.lock

Q2: do I need to put an explicit READ lock on a retrieved list of objects
returned by the EJB tier?


Details:


Here is my app's architecture:

*OJB: uses the ODMG API w/in Jboss 3.2.1

*EJB tier: uses a PersistenceManagerBean SessionBean w/ insert, update,
delete methods; the implementation of the update methods are as follows

/**
 * Store object that has been mapped in OJB repository
 * @param obj
 *
 * @ejb:interface-method
 */
public Object updateObject(Object obj) throws DataAccessException {

return storeObject(obj);
}

/**
 */
public Object storeObject(Object obj) throws DataAccessException
{
try
{
if(log.isDebugEnabled()) log.debug(storeObject);

Transaction tx = odmg.currentTransaction();
tx.lock(obj, Transaction.WRITE);
}
catch (Throwable t)
{
t.printStackTrace();
System.out.println(t.getMessage());
}
return obj;
}

Here is the method used to retrieve a list for the servlet tier:
/**
 * @ejb:interface-method
 */
public Vector getVector(Class klass) throws DataAccessException {

Vector result = null;
try {

OQLQuery query = odmg.newOQLQuery();
query.create(select allObjects from  + klass.getName());
DList list = (DList) query.execute();

result = new Vector();
Object[] vals = list.toArray();
for (int i=0; ilist.size(); i++) {
// Retrieve associated CLOB
if (klass.newInstance() instanceof ClobVOInterface)
{
ClobVOInterface vo = (ClobVOInterface)list.get(i);
retrieveClob((ClobVOInterface)vo);
}

result.add(list.get(i));
}

} catch (Throwable t) {
t.printStackTrace();
}

return result;
}

*DAO: 
DAO used by servlet tier to perform updates/retrieval (servlet doesn't
directly access PM), w/ following code:

public class DefaultDAO implements DAOInterface {

public void updateVO(VOInterface obj) throws DataAccessException {
PersistenceManagerRemote pm =
ServiceLocator.getInstance().getPersistenceManager();
try {
pm.updateObject(obj);
} catch (DataAccessException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
}

public Vector getAllVO(Class klass, ACL acl) throws DataAccessException
{
PersistenceManagerRemote pm =
ServiceLocator.getInstance().getPersistenceManager();
try {
return pm.getVector(klass, acl);
} catch (DataAccessException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}

return null;
}



*Servlet tier:
Uses DAO method to retrieve list of objects; then has edit form that allows
user to edit; here's the servlet update code 

  QueryVO query = (QueryVO)component;
query.setLabel(validator.getUIValue(label));
query.setSql(validator.getUIValue(sql));
query.setMaxRows(validator.getUIValueAsInt(maxRows));
 
query.setQueryTimeoutSecs(validator.getUIValueAsInt(queryTimeoutSecs));

DAOFactory.getDAO(DefaultDAO.class.getName()).updateVO(component,
acl);


-Original Message-
From: Thomas Mahler [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 07, 2003 11:08 PM
To: OJB Users List
Subject: Re: OJB uses jdbc cursor to Update - but my cursor doesn't support
up date!


Hi Alex

Bates, Alex wrote:
 Hello,
 
 I've isolated the root cause of my problem.  But turning debugging on, 
 I saw all the SQL OJB was generating in my JBoss log file.
 
 OJB generates SQL for SELECT and INSERT.  But for UPDATE, no SQL is 
 generated - it assumes it has an Updatable Cursor.  But my driver 
 cursor does not support update.

OJB does not use Updatable Cursors.
Using UC would mean to have a cursor  opened between read and the final 
broker.store() call. We don't

RE: OJB uses jdbc cursor to Update - but my cursor doesn't suppor t up date!

2003-08-10 Thread Bates, Alex

Actually ended up just adding a proxy method to NarrowTransaction which maps
down to the underlying TransactionImpl:

public void markDirty(Object anObject) {
if (tx instanceof TransactionImpl)
((TransactionImpl)tx).markDirty((anObject));
else
throw new UnsupportedOperationException(Not supported
operation);
}


-Original Message-
From: Bates, Alex 
Sent: Friday, August 08, 2003 2:31 PM
To: OJB Users List
Subject: RE: OJB uses jdbc cursor to Update - but my cursor doesn't suppor t
up date!



Thanks - In the meantime, how about this for a workaround:

I'll modify the NarrowTransaction class by adding a getter for its internal
Transaction member, which is an instance of TransactionImpl - I'll use this
getter in my code to retrieve the internal TransactionImpl, which I can then
use to set the dirty flag -

Alex


-Original Message-
From: Michael Becke [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 08, 2003 2:27 PM
To: OJB Users List
Subject: Re: OJB uses jdbc cursor to Update - but my cursor doesn't suppor t
up date!


I just submitted a bug (#OJB199) regarding this.

Mike

Bates, Alex wrote:

 Okay, I tried a couple ways but I must be doing something wrong.  I'm
 using rc4, and I'm getting a ClassCastException when I try to cast to 
 TransactionImpl because the instance is actually a NarrowTransaction
 
 14:16:36,217 INFO  [STDOUT] query: yy select bonus;
 14:16:36,217 INFO  [STDOUT] tx: 
 [EMAIL PROTECTED]
 14:16:36,217 ERROR [STDERR] java.lang.ClassCastException
 
 Any idea why the txn is a NarrowTransaction as opposed to a
 TransactionImpl, or how to change?
 
 Thx,
 
 Alex
 
 
 
 -Original Message-
 From: Bates, Alex
 Sent: Friday, August 08, 2003 11:34 AM
 To: OJB Users List
 Subject: RE: OJB uses jdbc cursor to Update - but my cursor doesn't 
 suppor
t
 up date!
 
 
 
 Thanks Thomas!  Will give this a try!
 
 -Original Message-
 From: Thomas Mahler [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 08, 2003 11:25 AM
 To: OJB Users List
 Subject: Re: OJB uses jdbc cursor to Update - but my cursor doesn't 
 suppor
t
 up date!
 
 
 Hi Alex,
 
 Bates, Alex wrote:
 
Hi Thomas,

Hmmm, so it doesn't use updatable cursors.  So OJB is not recognizing
that an update has taken place.  When I call ODMG's 
Transaction.lock(obj, Transaction.WRITE), how does it determine if an 
update has taken place?  In my app, the servlet tier gets a Vector of 
O/R mapped objects from the EJB tier, updates a given object, then 
calls the EJB tier updateObject() method to update it.  Is there a 
problem with this?  I noticed in your ODMG examples you explicitly 
lock an object before calling the update methods - but I assumed it 
was different in an EJB-based app.

Q: is there a problem with this scenario?
 
 
 Yes! ODMG has no notion of long transactions. that is ODMG want's you
 to
 perform all changes to object after locking them to the transactions.
 
 So changing objects on the client, then sending them back to the
 server
 and locking them to a transaction will fail!
 
 That's because the ODMG transaction manager was not able to track the 
 state of that object.
 
 The trick is as Follows:
 
 After locking the changed object from the client call:
 ((o.a.ojb.odmg.TransactionImpl) tx).markDirty(instance);
 
 
 
 
*servlet app retrieves O/R mapped object via EJB layer (which uses
ODMG), but object is not locked (optimistic) *servlet calls setter 
methods on the object *servlet calls EJB updateObject method, which 
calls Transaction.lock

Q2: do I need to put an explicit READ lock on a retrieved list of
objects returned by the EJB tier?
 
 
 Yes, that would be another option. But it would mean to keep the ODMG
 tx
 open during the client operations. And when the client returns the 
 changes object you have to looup the proper transaction.
 
 cheers,
 Thomas
 
 

Details:


Here is my app's architecture:

*OJB: uses the ODMG API w/in Jboss 3.2.1

*EJB tier: uses a PersistenceManagerBean SessionBean w/ insert,
update, delete methods; the implementation of the update methods are 
as follows

/**
 * Store object that has been mapped in OJB repository
 * @param obj
 *
 * @ejb:interface-method
 */
public Object updateObject(Object obj) throws DataAccessException
{

return storeObject(obj);
}

/**
 */
public Object storeObject(Object obj) throws DataAccessException
{
try
{
if(log.isDebugEnabled()) log.debug(storeObject);

Transaction tx = odmg.currentTransaction();
tx.lock(obj, Transaction.WRITE);
}
catch (Throwable t)
{
t.printStackTrace();
System.out.println(t.getMessage());
}
return obj;
}

Here is the method used to retrieve a list for the servlet tier:
/**
 * @ejb:interface-method
 */
public Vector getVector(Class klass) throws

Updates treated as inserts by ODMG

2003-08-09 Thread Bates, Alex
Hello,

I have a VO defined as follows:

class ResultSetVO {
Object id
String label;
int maxRows;
// details ommitted
};


---

   class-descriptor
  class=com.teradata.tap.component.system.resultset.ResultSetVO
  table=TapResultset
   
  field-descriptor
 name=id
 column=ID
 jdbc-type=INTEGER
 primarykey=true
 autoincrement=true
  /
  field-descriptor
 name=label
 column=Label
 jdbc-type=VARCHAR
  /
  field-descriptor
 name=maxRows
 column=MaxRows
 jdbc-type=INTEGER
  /

---

When I do an update, it inserts the object (generates a new ID for it) and
saves it.  Example:  I retrieve a ResultSetVO with label 'Test1', an id of
4, and maxRows = 100.  I change maxRows to 200, and call
odmg.currentTransaction.lock( myRs, Transaction.WRITE );

Instead of updating my existing 'Test1' ResultSetVO in the database, OJB
inserts a new ResultSetVO - generates ID (5 in this case), and saves another
with label 'Test1'.  It doesn't delete the old ResultSetVO or anything like
that.

Question: could this be cause by having an INTEGER column in the database,
but using Object to represent the id in the ResultSetVO class??


Thanks in advance,
Alex


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: 1:N association - truncating list to 1 when query

2003-07-15 Thread Bates, Alex

One more piece of information: the list is getting truncated to 1 even when
each ResultSetVO is mapped to a different QueryVO (1:1 instead of N:1).  

I've tried several different combinations, but same result.  I noticed that
the JUnit examples all seem to have the parent store a collection of the
children (in addition to the child storing a parent reference), so
bidirectional navigation.  Whereas mine is one direction, from child to
parent.  Could this be relevent here?  

Alex


-Original Message-
From: Bates, Alex 
Sent: Tuesday, July 15, 2003 9:36 AM
To: OJB Users List
Subject: RE: 1:N association - truncating list to 1 when query



Thanks for the recommendations on this.  I tried implementing the changes
you referred to, but I must be doing something wrong because I'm still
seeing the list truncated to 1 when I have multiple ResultSets mapped to the
same Query.

As you can see below, I added a foreign key field to the ResultSetVO class
called queryId (and added QueryID column to TapResultset table), and refer
to it in the referenece-descriptor.

In the TapQuery table, there is a single QueryVO with and id of 1.  In the
TapResultset table, there are two ResultSetVOs, whose QueryID column has
value of 1 (pointing to the same QueryVO).

But, when I retrieve the list of ResultSetVOs, it's truncated to 1.  Is
there a problem with the new mapping?


!-- Definitions for com.teradata.tap.component.system.resultset.ResultSetVO
--
   class-descriptor
  class=com.teradata.tap.component.system.resultset.ResultSetVO
  table=TapResultset
   
  field-descriptor
 name=id
 column=ID
 jdbc-type=INTEGER
 primarykey=true
 autoincrement=true
  /
  field-descriptor
 name=label
 column=Label
 jdbc-type=VARCHAR
  /
  field-descriptor
 name=maxRows
 column=MaxRows
 jdbc-type=INTEGER
  /
  field-descriptor
 name=queryTimeoutSecs
 column=QueryTimeoutSecs
 jdbc-type=INTEGER
  /
  field-descriptor
 name=queryId
 column=QueryID
 jdbc-type=INTEGER
  /
reference-descriptor name=query
class-ref=com.teradata.tap.component.system.query.QueryVO
auto-retrieve=true
auto-update=true 
foreignkey field-ref=queryId /
/reference-descriptor
   /class-descriptor 


-Original Message-
From: Thomas Mahler [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 10, 2003 11:13 PM
To: OJB Users List
Subject: Re: 1:N association - truncating list to 1 when query


Hi Alex,

Bates, Alex wrote:
 I have a 1:N association - but in my case, the 1 doesn't store a
 collection of the N.  Instead, each of the N stores a reference the 
 parent 1.  I didn't see any examples of how to do this in the JUnits 
 or docs.

Have a look at the Productgroup - Article examples in the testcases.
Productgroup has a collection of Atricles. Ok, you don't have this, so 
just omitt the collection-descriptor.
And each Article has a reference to its productgroup using 
areferencedescriptor.

So what you describe is not that special and OJB will handle it without 
any problems.

please see my comments below:

 To make things more concrete, I have a QueryVO class (not to be
 confused with OJB's query classes), which has a 1:N relationship with 
 ResultSetVO class.  Each ResultSetVO has a single parent QueryVO 
 (QueryVO is a member of ResultSetVO).
 
 ---  Class definitions 
 
 public class ResultSetVO implements VOInterface {
 protected Object id = null;
 protected String label = null;
 protected QueryVO query = null;   ..
 }

There is no foreign attribute referencing the associated QueryVO !

 
 public class QueryVO implements VOInterface {
 protected Object id;
 protected String label;
 protected String sql;
 }
 
 So, what I want to be able to do is: navigate from the CHILD (one of
 the N) to the PARENT (the 1).  Notice that ResultSetVO stores a 
 reference to the parent QueryVO, but QueryVO does NOT store a 
 collection of child ResultSetVOs.
 
 All the examples I see in the docs and Junit that use
 inverse-foreignkey use it for the opposite: the parent has a 
 collection of children (in my case, QueryVO would have a collection of 
 ResultSetVOs).  But my case is different: I need to define how 
 ResultSetVO can reference QueryVO.
 
 Using the mapping file below, I am able to create ResultSetVOs that
 are mapped to QueryVOs, and persist them (without errors).  However, 
 when I try to retrieve the list of ResultSetVOs, it always truncates 
 the list at 1.  I found this to be true using both the low-level PB 
 API, and using an ODMG OQL query.
 
 Details: I'm running the Jboss/J2EE version of OJB; using the ODMG
 API; at the bottom is the log output where the truncation occurs.
 
 
 ---  Mapping File

1:N association - truncating list to 1 when query

2003-07-10 Thread Bates, Alex

I have a 1:N association - but in my case, the 1 doesn't store a collection
of the N.  Instead, each of the N stores a reference the parent 1.  I didn't
see any examples of how to do this in the JUnits or docs. 

To make things more concrete, I have a QueryVO class (not to be confused
with OJB's query classes), which has a 1:N relationship with ResultSetVO
class.  Each ResultSetVO has a single parent QueryVO (QueryVO is a member of
ResultSetVO).  

---  Class definitions 

public class ResultSetVO implements VOInterface {
protected Object id = null;
protected String label = null;
protected QueryVO query = null; ..
}

public class QueryVO implements VOInterface {
protected Object id;
protected String label;
protected String sql;
}

So, what I want to be able to do is: navigate from the CHILD (one of the N)
to the PARENT (the 1).  Notice that ResultSetVO stores a reference to the
parent QueryVO, but QueryVO does NOT store a collection of child
ResultSetVOs.

All the examples I see in the docs and Junit that use inverse-foreignkey use
it for the opposite: the parent has a collection of children (in my case,
QueryVO would have a collection of ResultSetVOs).  But my case is different:
I need to define how ResultSetVO can reference QueryVO.

Using the mapping file below, I am able to create ResultSetVOs that are
mapped to QueryVOs, and persist them (without errors).  However, when I try
to retrieve the list of ResultSetVOs, it always truncates the list at 1.  I
found this to be true using both the low-level PB API, and using an ODMG OQL
query.

Details: I'm running the Jboss/J2EE version of OJB; using the ODMG API; at
the bottom is the log output where the truncation occurs.


---  Mapping File 

!-- Definitions for com.teradata.tap.component.system.query.QueryVO --
   class-descriptor
  class=com.teradata.tap.component.system.query.QueryVO
  table=TapQuery
   
  field-descriptor
 name=id
 column=ID
 jdbc-type=INTEGER
 primarykey=true
 autoincrement=true
  /
  field-descriptor
 name=label
 column=Label
 jdbc-type=VARCHAR
  /
  field-descriptor
 name=sql
 column=SqlString
 jdbc-type=VARCHAR
  /
   /class-descriptor 

!-- Definitions for com.teradata.tap.component.system.resultset.ResultSetVO
--
   class-descriptor
  class=com.teradata.tap.component.system.resultset.ResultSetVO
  table=TapResultset
   
  field-descriptor
 name=id
 column=ID
 jdbc-type=INTEGER
 primarykey=true
 autoincrement=true
  /
  field-descriptor
 name=label
 column=Label
 jdbc-type=VARCHAR
  /
  field-descriptor
 name=maxRows
 column=MaxRows
 jdbc-type=INTEGER
  /
  field-descriptor
 name=queryTimeoutSecs
 column=QueryTimeoutSecs
 jdbc-type=INTEGER
  /
reference-descriptor name=query
class-ref=com.teradata.tap.component.system.query.QueryVO
auto-retrieve=true
auto-update=true 
foreignkey field-ref=id /
/reference-descriptor
   /class-descriptor 


 Detailed logging output --

2003-07-10 17:18:15,864 DEBUG
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] executeQuery : Query from
class com.teradata.tap.component.system.resultset.ResultSetVO where
[EMAIL PROTECTED]
2003-07-10 17:18:15,879 DEBUG
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] SQL: SELECT
A0.MaxRows,A0.QueryTimeoutSecs,A0.Label,A0.ID FROM TapResultset A0
2003-07-10 17:18:16,192 DEBUG [org.apache.ojb.broker.accesslayer.RsIterator]
hasNext() - true
2003-07-10 17:18:16,223 DEBUG
[org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] getObjectByIdentity
com.teradata.tap.component.system.query.QueryVO{22}
2003-07-10 17:18:16,223 DEBUG
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] SQL: SELECT
SqlString,Label,ID FROM TapQuery WHERE ID = ? 
2003-07-10 17:18:16,333 DEBUG
[org.apache.ojb.broker.accesslayer.StatementManager] closeResources was
called
2003-07-10 17:18:16,333 WARN
[org.jboss.resource.adapter.jdbc.WrappedConnection] Closing a statement you
left open, please do your own housekeeping
2003-07-10 17:18:16,333 DEBUG
[org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl] do
datasource lookup, name: java:TeradataDS, user: tapuser
2003-07-10 17:18:16,333 DEBUG
[org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] Request new
connection from ConnectionFactory:
[EMAIL PROTECTED]
2003-07-10 17:18:16,379 DEBUG
[org.apache.ojb.broker.accesslayer.StatementManager] closeResources was
called
2003-07-10 17:18:16,379 DEBUG [org.apache.ojb.broker.accesslayer.RsIterator]
hasNext() - false
2003-07-10 17:18:16,379 DEBUG 

How to deploy OJB on Jboss 3.2

2003-06-19 Thread Bates, Alex
Armin,

Found the fix to get OJB to deploy (without having to redeploy) on JBoss 3.2
with its new classloader scheme.

The jboss.xml from db-ojb-1.0.rc2-beans.jar must be modified to this:  (the
change is a new depends element added in)


jboss.xml

?xml version=1.0 encoding=UTF-8?
!DOCTYPE jboss PUBLIC -//JBoss//DTD JBOSS//EN
http://www.jboss.org/j2ee/dtd/jboss.dtd;

jboss

   enterprise-beans

  session
 ejb-nameODMGSessionBean/ejb-name
 jndi-nameorg.apache.ojb.ejb.ODMGSessionBean/jndi-name
 
local-jndi-nameorg.apache.ojb.ejb.ODMGSessionBeanLocal/local-jndi-name
 depends
optional-attribute-name=Invokerjboss:service=invoker,type=jrmp/depends
  /session
  session
 ejb-namePBSessionBean/ejb-name
 jndi-nameorg.apache.ojb.ejb.PBSessionBean/jndi-name
 
local-jndi-nameorg.apache.ojb.ejb.PBSessionBeanLocal/local-jndi-name
 depends
optional-attribute-name=Invokerjboss:service=invoker,type=jrmp/depends
  /session
  session
 ejb-nameArticleManagerODMGBean/ejb-name
 jndi-nameorg.apache.ojb.ejb.ArticleManagerODMGBean/jndi-name
 
local-jndi-nameorg.apache.ojb.ejb.ArticleManagerODMGBeanLocal/local-jndi-
name
 depends
optional-attribute-name=Invokerjboss:service=invoker,type=jrmp/depends
  /session
  session
 ejb-nameArticleManagerPBBean/ejb-name
 jndi-nameorg.apache.ojb.ejb.ArticleManagerPBBean/jndi-name
 
local-jndi-nameorg.apache.ojb.ejb.ArticleManagerPBBeanLocal/local-jndi-na
me
 depends
optional-attribute-name=Invokerjboss:service=invoker,type=jrmp/depends
  /session
  session
 ejb-namePersonArticleManagerODMGBean/ejb-name
 
jndi-nameorg.apache.ojb.ejb.PersonArticleManagerODMGBean/jndi-name
 
local-jndi-nameorg.apache.ojb.ejb.PersonArticleManagerODMGBeanLocal/local
-jndi-name
 depends
optional-attribute-name=Invokerjboss:service=invoker,type=jrmp/depends
  /session
  session
 ejb-namePersonArticleManagerPBBean/ejb-name
 
jndi-nameorg.apache.ojb.ejb.PersonArticleManagerPBBean/jndi-name
 
local-jndi-nameorg.apache.ojb.ejb.PersonArticleManagerPBBeanLocal/local-j
ndi-name
 depends
optional-attribute-name=Invokerjboss:service=invoker,type=jrmp/depends
  /session
  session
 ejb-namePersonManagerODMGBean/ejb-name
 jndi-nameorg.apache.ojb.ejb.PersonManagerODMGBean/jndi-name
 
local-jndi-nameorg.apache.ojb.ejb.PersonManagerODMGBeanLocal/local-jndi-n
ame
 depends
optional-attribute-name=Invokerjboss:service=invoker,type=jrmp/depends
  /session
  session
 ejb-namePersonManagerPBBean/ejb-name
 jndi-nameorg.apache.ojb.ejb.PersonManagerPBBean/jndi-name
 
local-jndi-nameorg.apache.ojb.ejb.PersonManagerPBBeanLocal/local-jndi-nam
e
 depends
optional-attribute-name=Invokerjboss:service=invoker,type=jrmp/depends
  /session

   /enterprise-beans

   resource-managers
   /resource-managers

/jboss


-Original Message-
From: Bates, Alex 
Sent: Wednesday, June 18, 2003 9:37 PM
To: OJB Users List
Subject: RE: OJB/JBoss depends on me startup problem - but redeployment
works fine!



I heard back from the Jboss newsgroup on this one.  But not sure exactly how
to implement the workaround (Adrian's #3 seems like the best bet).

Below is the response from Adrian Bock, JBoss Director of Support -

-Original Message-
From: Adrian Brock [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 18, 2003 6:42 PM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] depends on me startup problem - but redeployment
works fine!


Hi,

The changes to the way the transaction manager is
deployed have highlighted this problem.

The root problem is that an ejb shouldn't be
deployed until its declared invokers have started.

There are a number of possible workarounds:
1) Make the EJB Deployer depend upon the invoker
(no ejbs will be deployed until the invoker starts)
2) Move the transaction manager deployment
back into jboss-service.xml (allowing the invoker
to start before the scanner starts looking at /deploy)
3) Declare a dependency for each ejb on the invoker(s)
in jboss.xml

The real fix will be to make (3) automatic.

Regards,
Adrian

 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
 
 

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of
 Bates, Alex
 Sent: 19 June 2003 01:52
 To: [EMAIL PROTECTED]
 Subject: [JBoss-user] depends on me startup problem - but 
 redeployment works fine!
 
 
 
 I'm trying to deploy Apache OJB in Jboss 3.2.0 as ojb.sar, with two 
 MBeans defined in jboss-service.xml.
 
 This packaging structure worked fine in Jboss 3.0.6, but in 3.2 lots 
 of exceptions are thrown at init, followed by the depends on
 me message shown
 below.  The root problem appears to be the invoker is null error
 (jboss:service=invoker,type=jrmp)
 
 Yet, if I redeploy my EJB by copying db-ojb-1.0.rc2-beans.jar

RE: OJB/JBoss depends on me startup problem - but redeployment works fine!

2003-06-18 Thread Bates, Alex

I heard back from the Jboss newsgroup on this one.  But not sure exactly how
to implement the workaround (Adrian's #3 seems like the best bet).

Below is the response from Adrian Bock, JBoss Director of Support -

-Original Message-
From: Adrian Brock [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 18, 2003 6:42 PM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] depends on me startup problem - but redeployment
works fine!


Hi,

The changes to the way the transaction manager is
deployed have highlighted this problem.

The root problem is that an ejb shouldn't be
deployed until its declared invokers have started.

There are a number of possible workarounds:
1) Make the EJB Deployer depend upon the invoker
(no ejbs will be deployed until the invoker starts)
2) Move the transaction manager deployment
back into jboss-service.xml (allowing the invoker
to start before the scanner starts looking at /deploy)
3) Declare a dependency for each ejb on the invoker(s)
in jboss.xml

The real fix will be to make (3) automatic.

Regards,
Adrian

 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
 
 

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 Bates, Alex
 Sent: 19 June 2003 01:52
 To: [EMAIL PROTECTED]
 Subject: [JBoss-user] depends on me startup problem - but 
 redeployment works fine!
 
 
 
 I'm trying to deploy Apache OJB in Jboss 3.2.0 as ojb.sar,
 with two MBeans
 defined in jboss-service.xml.
 
 This packaging structure worked fine in Jboss 3.0.6, but in
 3.2 lots of
 exceptions are thrown at init, followed by the depends on 
 me message shown
 below.  The root problem appears to be the invoker is null error
 (jboss:service=invoker,type=jrmp)
 
 Yet, if I redeploy my EJB by copying db-ojb-1.0.rc2-beans.jar
 (the EJB jar)
 back into the ojb.sar directory after bringing up Jboss 3.2, 
 it works fine!
 
 So, it appears that this EJB jar has some dependencies which
 need to be 
 explicitly declared in JBoss.  I tried many different 
 Class-Path references
 in the EJB's manifest.mf file, but to no avail.  
 
 Any advice would be appreciated (SWAGs are fine too ;-)
 
 --
 
 13:51:24,051 ERROR [URLDeploymentScanner] MBeanException:
 Exception in MBean
 
 ope
 ration 'checkIncompleteDeployments()'
 Cause: Incomplete Deployment listing:
 Packages waiting for a deployer:
   none
 Incompletely deployed packages:
   none
 MBeans waiting for classes:
   none
 MBeans waiting for other MBeans:
 [ObjectName:
 jboss.j2ee:jndiName=org.apache.ojb.ejb.PersonManagerPBBean,service=
 EJB
 state: FAILED
 I Depend On:
 Depends On Me: java.lang.RuntimeException: invoker is null: 
 jboss:service=invok
 er,type=jrmp, ObjectName: 
 jboss.j2ee:jndiName=org.apache.ojb.ejb.ArticleManagerP
 BBean,service=EJB
 state: FAILED
 I Depend On:
 Depends On Me: java.lang.RuntimeException: invoker is null: 
 jboss:service=invok
 er,type=jrmp, ObjectName: 
 jboss.j2ee:jndiName=org.apache.ojb.ejb.PersonManagerOD
 MGBean,service=EJB
 state: FAILED
 I Depend On:
 Depends On Me: java.lang.RuntimeException: invoker is null: 
 jboss:service=invok
 er,type=jrmp, ObjectName: 
 jboss.j2ee:jndiName=org.apache.ojb.ejb.PBSessionBean,s
 ervice=EJB
 state: FAILED
 I Depend On:
 Depends On Me: java.lang.RuntimeException: invoker is null: 
 jboss:service=invok
 er,type=jrmp, ObjectName: 
 jboss.j2ee:jndiName=org.apache.ojb.ejb.PersonArticleMa
 nagerODMGBean,service=EJB
 state: FAILED
 I Depend On:
 Depends On Me: java.lang.RuntimeException: invoker is null: 
 jboss:service=invok
 er,type=jrmp, ObjectName: 
 jboss.j2ee:jndiName=org.apache.ojb.ejb.ODMGSessionBean
 ,service=EJB
 state: FAILED
 I Depend On:
 Depends On Me: java.lang.RuntimeException: invoker is null: 
 jboss:service=invok
 er,type=jrmp, ObjectName: 
 jboss.j2ee:jndiName=org.apache.ojb.ejb.PersonArticleMa
 nagerPBBean,service=EJB
 state: FAILED
 I Depend On:
 Depends On Me: java.lang.RuntimeException: invoker is null: 
 jboss:service=invok
 er,type=jrmp, ObjectName: 
 jboss.j2ee:jndiName=org.apache.ojb.ejb.ArticleManagerO
 DMGBean,service=EJB
 state: FAILED
 I Depend On:
 Depends On Me: java.lang.RuntimeException: invoker is null: 
 jboss:service=invok
 er,type=jrmp]
 
 
 META-INF\jboss-service.xml
 
 ?xml version=1.0 encoding=UTF-8?
 server
 mbean code=org.apache.ojb.jboss.PBFactory
 name=DefaultDomain:service=PBAPI,name=ojb/PBAPI
 dependsjboss.jca:service=RARDeployer/depends
 attribute name=JndiNameojb/PBAPI/attribute
 /mbean
 
 mbean code=org.apache.ojb.jboss.ODMGFactory
 name=DefaultDomain:service=ODMG,name=ojb/defaultODMG
 dependsjboss.jca:service=RARDeployer/depends
 attribute name=JndiNameojb/defaultODMG/attribute
 /mbean
 /server
 
 
 
 
 ---
 This SF.Net email is sponsored by: INetU
 Attention Web Developers

App server-specific startup class needed?

2003-06-05 Thread Bates, Alex

What are the reasons for writing startup classes (ODMGFactory and PBFactory)
specific to an app server (extending jboss.ServiceMBeanSupport for JBoss,
and extending T3StartupDef for WebLogic, and xxx for WebSphere)?

Could this be achieved using JMX alone, or does the spec not meet the needs
to initialize the OJB factory classes and bind them to JNDI?  The reason for
asking is we are trying to support multiple app servers, and avoid coding to
specific vendors/versions where possible.

Thanks,

Alex

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



OJB + commercial JDO ?

2003-05-29 Thread Bates, Alex

Has anyone used OJB with a commercial JDO implementation?  (esp. Solar
Metric?)  If so, could you give an idea of the work required to integrate
the two?

thanks,

Alex

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]