This one time, at band camp, Jens Saade said:

Jens,

Please see my comments inline:


JS>.... forgot to mention I use poolman for connection pooling between my
JS>system and the mysql db.
JS>
JS>Jens Saade wrote:
JS>
JS>>
JS>> Hi all,
JS>>
JS>> I am currently experiencing weird problems with castor jdo.
JS>> I am using mysql 4.0.16 on debian linux, jdk 1.4.1_02 (1.4.2._x
JS>> versions somehow crash with sig 11), aswell as castor 0.9.5.2 / 0.9.5
JS>>
JS>> While running perfectly under windoze exactly the same code throws
JS>> exception (win: jdk 1.4.1_04, mysql  Ver 12.21 Distrib 4.0.14, for
JS>> Win95/Win98 (i32))
JS>>
JS>> The stacktrace: ---------------------------------
JS>>
JS>> org.exolab.castor.jdo.TransactionNotInProgressException: This
JS>> transaction is not open
JS>>        at
JS>> org.exolab.castor.jdo.engine.DatabaseImpl.rollback(DatabaseImpl.java:551)
JS>>        at
JS>> de.fusionsoft.pce.core.engine.ItemManager.getAllItems(ItemManager.java:267)
JS>>
JS>>        at
JS>> de.fusionsoft.pce.core.engine.PceServiceImpl.getAllItems(PceServiceImpl.java:239)
JS>>
JS>>        at
JS>> de.fusionsoft.pce.core.engine._PceServiceImpl_Tie._invoke(Unknown Source)
JS>>        at
JS>> com.sun.corba.ee.internal.corba.ServerDelegate.dispatch(ServerDelegate.java:355)
JS>>
JS>>        at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:255)
JS>>        at
JS>> com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.java:84)
JS>>
JS>>        at
JS>> com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:99)
JS>>
JS>> 2004-03-10 20:09:34,667 ERROR [pce.core.engine.ItemManager] : Could
JS>> not execute statement 'selectAllItemsOql' :
JS>> org.exolab.castor.jdo.ObjectModifiedException: Transaction aborted:
JS>> Object of type de.fusionsoft.pce.core.items.types.News with identity 1
JS>> has been modified by a concurrent transaction (cache entry is
JS>> different from database row)
JS>>        at
JS>> org.exolab.castor.jdo.engine.SQLEngine.store(SQLEngine.java:883)
JS>>        at
JS>> org.exolab.castor.persist.ClassMolder.store(ClassMolder.java:1616)
JS>>        at org.exolab.castor.persist.LockEngine.store(LockEngine.java:758)
JS>>        at
JS>> org.exolab.castor.persist.TransactionContext.prepare(TransactionContext.java:1540)
JS>>
JS>>        at
JS>> org.exolab.castor.jdo.engine.DatabaseImpl.commit(DatabaseImpl.java:528)
JS>>        at
JS>> de.fusionsoft.pce.core.engine.ItemManager.getAllItems(ItemManager.java:264)
JS>>
JS>>        at
JS>> de.fusionsoft.pce.core.engine.PceServiceImpl.getAllItems(PceServiceImpl.java:239)
JS>>
JS>>        at
JS>> de.fusionsoft.pce.core.engine._PceServiceImpl_Tie._invoke(Unknown Source)
JS>>        at
JS>> com.sun.corba.ee.internal.corba.ServerDelegate.dispatch(ServerDelegate.java:355)
JS>>
JS>>        at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:255)
JS>>        at
JS>> com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.java:84)
JS>>
JS>>        at
JS>> com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:99)
JS>>
JS>>
JS>>
JS>> I am also experiencing a new error when i try to insert a new item -
JS>> this is prolly a dependency error ...

This looks like a locking issue. What type of access are you
specifying in the mapping descriptor for the News object listed
below in the exception?

JS>>    org.exolab.castor.jdo.LockNotGrantedException:
JS>> persist.readLockTimeoutde.fusionsoft.pce.core.items.types.News/2/105
JS>> by [EMAIL PROTECTED]
JS>>        at
JS>> org.exolab.castor.persist.ObjectLock.acquireLoadLock(ObjectLock.java:428)
JS>>        at
JS>> org.exolab.castor.persist.LockEngine$TypeInfo.acquire(LockEngine.java:1201)
JS>>
JS>>        at
JS>> org.exolab.castor.persist.LockEngine$TypeInfo.access$300(LockEngine.java:1026)
JS>>
JS>>        at org.exolab.castor.persist.LockEngine.load(LockEngine.java:355)
JS>>        at
JS>> org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:649)
JS>>
JS>>        at
JS>> org.exolab.castor.persist.QueryResults.fetch(QueryResults.java:229)
JS>>        at
JS>> 
org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:641)
JS>>
JS>>        at
JS>> 
org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:624)
JS>>
JS>>        at
JS>> de.fusionsoft.pce.core.engine.ItemManager.filterItemsByRight(ItemManager.java:304)
JS>>
JS>>        at
JS>> de.fusionsoft.pce.core.engine.ItemManager.getAllItems(ItemManager.java:262)
JS>>
JS>>        at
JS>> de.fusionsoft.pce.core.engine.PceServiceImpl.getAllItems(PceServiceImpl.java:239)
JS>>
JS>>        at
JS>> de.fusionsoft.pce.core.engine._PceServiceImpl_Tie._invoke(Unknown Source)
JS>>        at
JS>> com.sun.corba.ee.internal.corba.ServerDelegate.dispatch(ServerDelegate.java:355)
JS>>
JS>>        at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:255)
JS>>        at
JS>> com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.java:84)
JS>>
JS>>        at
JS>> com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:99)
JS>>
JS>>
JS>>
JS>>
JS>> ----------sourcecode ------
JS>>    public Item[] getAllItems(String sessionId, int reqItemTypeId,
JS>> String reqSortby, boolean reqAscending, int reqMaxLimit) throws
JS>> ItemException, SecurityException {
JS>>          UserRegistry userReg = UserRegistry.getInstance(jdo);
JS>>
JS>>        long tokenId = userReg.getUserIdForSession(sessionId);
JS>>        if (tokenId == 0) {
JS>>            logger.error("tokenId could not be resolved from
JS>> UserRegistry for sessionId " + sessionId);
JS>>            return null;
JS>>        }
JS>>
JS>>        logger.debug("getAllItems() called: sessionId=" + sessionId + "
JS>> reqItemTypeId=" + reqItemTypeId + " reqSortby=" + reqSortby + "
JS>> reqAscending=" + reqAscending + " reqMaxLimit=" + reqMaxLimit);
JS>>        Item[] items = null;
JS>>              Item tmpItem = null;
JS>>        OQLQuery selectAllItemsOql = null;
JS>>        QueryResults results = null;
JS>>
JS>>        ItemType reqItemType;
JS>>        String reqItemTypeName;
JS>>        try {
JS>>            reqItemType = itemTypes[reqItemTypeId];
JS>>        } catch (IndexOutOfBoundsException e) {
JS>>            throw new ItemException("Invalid ItemType provided: " +
JS>> reqItemTypeId + " does not exist. " + e);
JS>>        }
JS>>
JS>>        // only proceed if we got a valid itemType reference
JS>>        if (reqItemType != null) {
JS>>                      Database db = null;
JS>>            try {
JS>>                db = jdo.getDatabase();
JS>>                db.begin();
JS>>
JS>>                // prepare statement properties
JS>>                reqItemTypeName = reqItemType.getTypeName();
JS>>
JS>>                if (reqSortby == null || reqSortby.equals(""))
JS>>                    reqSortby = SORTFIELD_DEFAULT;
JS>>
JS>>                String reqOrder;
JS>>                if (reqAscending)
JS>>                    reqOrder = "ASC";
JS>>                else
JS>>                    reqOrder = "DESC";
JS>>
JS>>                if (reqMaxLimit == 0)
JS>>                    reqMaxLimit = LIMIT_DEFAULT;
JS>>                logger.debug("Selecting
JS>> de.fusionsoft.pce.core.items.types." + reqItemTypeName);
JS>>                selectAllItemsOql = db.getOQLQuery("SELECT p FROM
JS>> de.fusionsoft.pce.core.items.types." + reqItemTypeName + " p ORDER BY
JS>> " + reqSortby + " " + reqOrder + " LIMIT $1");
JS>>                selectAllItemsOql.bind(reqMaxLimit);
JS>>                results = selectAllItemsOql.execute(true);

It seems as if there is a tx available when the OQL is executed
above because there's a call above to db.begin() so I'm a bit perplexed.

JS>>                items = filterItemsByRight(reqItemTypeId, tokenId,
JS>> results);
JS>>                results.close();
JS>>                db.commit();
JS>>            } catch (PersistenceException e) {
JS>>                try {
JS>>                    db.rollback();
JS>>                } catch (TransactionNotInProgressException e1) {
JS>>                    e1.printStackTrace();
JS>>                }
JS>>                logger.error("Could not execute statement
JS>> 'selectAllItemsOql' :", e);
JS>>            } finally {
JS>>                try {
JS>>                    if (!db.isClosed())
JS>>                        db.close();
JS>>                } catch (PersistenceException e) {
JS>>                    logger.error("Could not close DB connection while
JS>> executing statement 'selectAllItemsOql' :", e);
JS>>                    throw new ItemException(e.getMessage());
JS>>                }
JS>>            }
JS>>
JS>>        } else {
JS>>            throw new ItemException("Invalid ItemType provided: " +
JS>> reqItemTypeId + " is not applicable.");
JS>>
JS>>        }
JS>>        return items;
JS>>    }
JS>> ----------------
JS>>
JS>> Note that I do not change result objects in any way.
JS>>
JS>>
JS>>
JS>> Anyone knows what to do?


When I'm perplexed in this way, I try to break down the problem to
the bare minimum amount of code. I suggest you take that strategy
and get the easiest possible thing working first. Just comment out
everything down to the bare minimum. Then gradually uncomment code
until you find the problem. In order to comment further on the
problem, I would need to see the results of this type of troubleshooting.

Bruce
--
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

The Castor Project
http://www.castor.org/

Apache Geronimo
http://incubator.apache.org/projects/geronimo.html

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to