[OFBiz] Users - Struggling to read in XML seed data
David Jones
jonesde at ofbiz.org
Mon Aug 2 07:24:08 EDT 2004
Ah, I see. You're working with a different deployment method, and were
even working with a different transaction manager.
Yeah, sorry, it's tough to support that sort of thing. Dealing with
transaction managers and app server deployments is a bit tricky and
it's pretty much impossible for us to answer questions about those
things without significant effort.
-David
On Jul 25, 2004, at 8:39 AM, Adrian G. Klingel wrote:
> Hmmm. I changed my Tomcat JNDI data source factory from:
>
> org.apache.commons.dbcp.BasicDataSourceFactory
>
> To:
>
> org.objectweb.jndi.DataSourceFactory
>
> And I moved the requisite jars out of my WEB-INF/lib and up to Tomcat's
> common/lib, and now things are working.
>
> But if a foreign key constraint is violated in my xml data, then the
> whole
> file fails. I guess the whole thing is treated as a single
> transaction.
>
> Is there any way to commit each row, or at least do a commit after each
> entity is read, short of splitting the seed data into a bunch of
> separate
> files?
>
> Thanks again,
> Adrian
>
>
> -----Original Message-----
> From: Adrian G. Klingel [mailto:Adrian.Klingel at exaweb.com]
> Sent: Sunday, July 25, 2004 8:20 AM
> To: users at ofbiz.dev.java.net
> Subject: RE: [OFBiz] Users - Struggling to read in XML seed data
>
>
> I set it to 5000000. It's still trying to rollback.
>
> The only thing I can think of is that there are some problems with my
> seed
> data file, and it is trying to rollback on several occasions where the
> checking for the existence of foreign key constraints is bailing out.
>
> I guess the seed data file must be perfect, and I can't just have the
> program spit out rows that cause a problem. And the SQLProcessor does
> spit
> out that warning when it's trying to rollback. I guess I don't
> understand
> the message:
>
> 9234 [ SQLProcessor.java:186:WARN ] [SQLProcessor.rollback]: SQL
> Exception while rolling back insert. Error was:java.sql.SQLException:
> Cannot
> rollback a transactional connection: See JDBC 2.0 Optional Package
> Specification section 7.1 (p25)
> 9234 [ SQLProcessor.java:187:WARN ]
> ---- exception report
> ----------------------------------------------------------
> Exception: java.sql.SQLException
> Message: Cannot rollback a transactional connection: See JDBC 2.0
> Optional
> Package Specification section 7.1 (p25)
>
> I think this is due to a fundamental lack of understanding on my part
> of
> this functionality.
>
> The final error ends up being:
>
> 9274 [ EntityDataLoader.java:211:ERROR]
> ---- exception report
> ----------------------------------------------------------
> [install.loadData]: Error loading XML Resource
> "file:/dev/eclipse/workspace/myapp/myfile"; Error was: A transaction
> error
> occurred reading data
> Exception: org.xml.sax.SAXException
> Message: A transaction error occurred reading data
> ---- stack trace
> ---------------------------------------------------------------
> org.ofbiz.entity.GenericDataSourceException: SQL Exception occurred on
> commit (Cannot commit a transactional connection: See JDBC 2.0 Optional
> Package Specification section 7.1 (p25))
> org.ofbiz.entity.util.EntitySaxReader.parse(EntitySaxReader.java:203)
>
> Thanks again for any help you can give.
>
> Adrian
>
>
>
> -----Original Message-----
> From: David Jones [mailto:jonesde at ofbiz.org]
> Sent: Sunday, July 25, 2004 5:24 AM
> To: users at ofbiz.dev.java.net
> Subject: Re: [OFBiz] Users - Struggling to read in XML seed data
>
>
>
> Cute... Here's my guess: in your call the last parameter is "1". That
> parameter is the timeout for the transaction, and for a 1 ms
> (milli-second) timeout, I'm surprised anything is making it in.....
>
> Our default timeout is 7,200,000 milli-seconds, which is 7200 seconds
> or 2 hours. Try increasing the timeout, and increasing it a LOT! (like
> a few million times what you have specified...).
>
> -David
>
>
> On Jul 25, 2004, at 10:16 AM, Adrian Klingel wrote:
>
>> After about 14 hours, I'm really no further than where I started this
>> morning.
>>
>> Let me just begin by saying that I am absolutely baffled by the
>> complexity (and necessity) of some of the JDBC transaction management.
>>
>> I am struggling to load seed data by calling the static
>> EntityDataLoader method like this:
>>
>> int loadData = EntityDataLoader.loadData(new
>> URL("file://\\myfile.xml"),"localoracle",delegator,new ArrayList(),1);
>> If the file only contains a couple of records, then it loads. But if
>> it contains around (and I say "around", because this sometimes works
>> and sometimes doesn't) 100 records, then it pukes with this message:
>>
>> **********************************************
>>
>> 10264[ SQLProcessor.java:186:WARN ] [SQLProcessor.rollback]: SQL
>> Exception while rolling back insert. Error was:java.sql.SQLException:
>> Cannot rollback a transactional connection: See JDBC 2.0 Optional
>> Package Specification section 7.1 (p25)
>>
>> 10274[ SQLProcessor.java:187:WARN ]
>>
>> ---- exception report
>> ----------------------------------------------------------
>>
>> Exception: java.sql.SQLException
>>
>> Message: Cannot rollback a transactional connection: See JDBC 2.0
>> Optional Package Specification section 7.1 (p25)
>>
>> ---- stack trace
>> ---------------------------------------------------------------
>>
>> java.sql.SQLException: Cannot rollback a transactional connection: See
>> JDBC 2.0 Optional Package Specification section 7.1
>> (p25)org.ofbiz.minerva.pool.jdbc.xa.wrapper.XAClientConnection.rollbac
>> k
>> (XAClientConnection.java:262)
>> org.ofbiz.entity.jdbc.SQLProcessor.rollback(SQLProcessor.java:
>> 174)org.ofbiz.entity.jdbc.SQLProcessor.commit(SQLProcessor.java:
>> 155)org.ofbiz.entity.jdbc.SQLProcessor.close(SQLProcessor.java:
>> 199)org.ofbiz.entity.datasource.GenericDAO.singleInsert(GenericDAO.jav
>> a
>> :
>> 175)org.ofbiz.entity.datasource.GenericDAO.singleStore(GenericDAO.java
>> :
>> 293)org.ofbiz.entity.datasource.GenericDAO.storeAll(GenericDAO.java:
>> 332)org.ofbiz.entity.datasource.GenericHelperDAO.storeAll(GenericHelpe
>> r
>> DAO.java:
>> 244)org.ofbiz.entity.GenericDelegator.storeAll(GenericDelegator.java:
>> 1655)org.ofbiz.entity.GenericDelegator.storeAll(GenericDelegator.java:
>> 1601)org.ofbiz.entity.util.EntitySaxReader.writeValues(EntitySaxReader
>> .
>> java:
>> 213)org.ofbiz.entity.util.EntitySaxReader.endElement(EntitySaxReader.j
>> a
>> va:333)org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
>> Source)org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElemen
>> t
>> (Unknown Source)
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement
>> (
>> Unknown
>> Source)org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentC
>> o
>> ntentDispatcher.dispatch(Unknown
>> Source)org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocum
>> e
>> nt(UnknownSource)
>> org.apache.xerces.parsers.XML11Configuration.parse(Unknown
>> Source)org.apache.xerces.parsers.XML11Configuration.parse(Unknown
>> Source)org.apache.xerces.parsers.XMLParser.parse(Unknown
>> Source)org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
>> Source)org.ofbiz.entity.util.EntitySaxReader.parse(EntitySaxReader.jav
>> a
>> :193)org.ofbiz.entity.util.EntitySaxReader.parse(EntitySaxReader.java:
>> 157)org.ofbiz.entity.util.EntityDataLoader.loadData(EntityDataLoader.j
>> a
>> va:207)
>>
>> **********************************************
>>
>> It is difficult for me to communicate the depth of my frustration. The
>> unreliability of the error (sometimes it works with 100 rows,
>> sometimes not) leads me to believe that it has something to do with
>> the timing of the transaction.
>>
>> You can see that the commit() and rollback() methods of SQLProcessor
>> are causing that Minerva error message, but there is something more
>> sinister going on. Even when I comment out the bodies of those two
>> methods, I still get a transaction-related error message.
>>
>> This error causes NONE of my seed data to be stored. Using the
>> webtools is not an option for me. This is the only way it can be.
>>
>> Here are the details of my configuration:
>>
>> Oracle 9i database
>> Oracle ojdbc14.jar driver (could this stupid incomplete driver be
>> causing yet ANOTHER problem?
>>
>> Tomcat 5.0.16
>>
>> Codebase: CVS (as recently as three days ago)
>>
>> Note: I am NOT using the embedded server. I want to be able to
>> deploy my application on any server.
>>
>> lines in my context xml file are:
>>
>>
>> <Context path="/myapp" reloadable="true"
>> docBase="C:\dev\eclipse\workspace\myapp\context" >
>>
>> <Resource name="jdbc/myapp" auth="Container"
>> type="javax.sql.DataSource"/>
>>
>> <ResourceParams name="jdbc/myapp">
>>
>> <parameter>
>>
>> <name>factory</name>
>>
>> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>>
>> </parameter>
>>
>> <parameter>
>>
>> <name>username</name>
>>
>> <value>user</value>
>>
>> </parameter>
>>
>> <parameter>
>>
>> <name>password</name>
>>
>> <value>pwd</value>
>>
>> </parameter>
>>
>> <parameter>
>>
>> <name>driverClassName</name>
>>
>> <value>oracle.jdbc.driver.OracleDriver</value>
>>
>> </parameter>
>>
>> <parameter>
>>
>> <name>url</name>
>>
>> <value>jdbc:oracle:thin:@abominus:1521:ofbiz</value>
>>
>> </parameter>
>>
>> </ResourceParams>
>>
>> <Resource name="UserTransaction" auth="Container"
>> type="javax.transaction.UserTransaction"/>
>>
>> <ResourceParams name="UserTransaction">
>>
>> <parameter>
>>
>> <name>factory</name>
>>
>> <value>org.objectweb.jotm.UserTransactionFactory</value>
>>
>> </parameter>
>>
>> <parameter>
>>
>> <name>jotm.timeout</name>
>>
>> <value>3000</value>
>>
>> </parameter>
>>
>> <parameter>
>>
>> <name>maxActive</name>
>>
>> <value>20</value>
>>
>> </parameter>
>>
>> <parameter>
>>
>> <name>maxIdle</name>
>>
>> <value>10</value>
>>
>> </parameter>
>>
>> <parameter>
>>
>> <name>maxWait</name>
>>
>> <value>-1</value>
>>
>> </parameter>
>>
>> </ResourceParams>
>>
>> </Context>
>>
>> I will appreciate any help anyone can offer. You have no idea how
>> much I'll appreciate it!
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe at ofbiz.dev.java.net
> For additional commands, e-mail: users-help at ofbiz.dev.java.net
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe at ofbiz.dev.java.net
> For additional commands, e-mail: users-help at ofbiz.dev.java.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2363 bytes
Desc: not available
Url : http://lists.ofbiz.org/pipermail/users/attachments/20040802/c711671c/smime.bin
More information about the Users
mailing list