XSD schema conversion anyone?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

XSD schema conversion anyone?

Iain Fogg
I have a slightly complicated XML Schema (.xsd) that I would like to
import into OFBiz.

Has anyone written a tool to convert XML schemas into OFBiz  entity
definitions?

Cheers, Iain


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.7/410 - Release Date: 5/08/2006

Reply | Threaded
Open this post in threaded view
|

Re: XSD schema conversion anyone?

BJ Freeman
the XSD defines the layout.
the XML is where the Entities definitions are.
you can try using an XST file to convert.

Iain Fogg sent the following on 8/7/2006 7:53 AM:
> I have a slightly complicated XML Schema (.xsd) that I would like to
> import into OFBiz.
>
> Has anyone written a tool to convert XML schemas into OFBiz  entity
> definitions?
>
> Cheers, Iain
>
>
Reply | Threaded
Open this post in threaded view
|

Re: XSD schema conversion anyone?

Iain Fogg
That's my question...has anyone already buit an XST to do the conversion
to OFBiz Entity defs?

BJ Freeman wrote:

> the XSD defines the layout.
> the XML is where the Entities definitions are.
> you can try using an XST file to convert.
>
> Iain Fogg sent the following on 8/7/2006 7:53 AM:
>
>> I have a slightly complicated XML Schema (.xsd) that I would like to
>> import into OFBiz.
>>
>> Has anyone written a tool to convert XML schemas into OFBiz  entity
>> definitions?
>>
>> Cheers, Iain
>>
>>
>
>



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 7/08/2006

Reply | Threaded
Open this post in threaded view
|

Re: XSD schema conversion anyone?

cjhowe
Correct me if I'm wrong, but wouldn't you need to know
what the source elements are in order to make an XST
to entity def?  Absent knowing the structure of your
source it wouldn't matter what someone else's XST
looks like, it wouldn't work with yours.

--- Iain Fogg <[hidden email]> wrote:

> That's my question...has anyone already buit an XST
> to do the conversion
> to OFBiz Entity defs?
>
> BJ Freeman wrote:
>
> > the XSD defines the layout.
> > the XML is where the Entities definitions are.
> > you can try using an XST file to convert.
> >
> > Iain Fogg sent the following on 8/7/2006 7:53 AM:
> >
> >> I have a slightly complicated XML Schema (.xsd)
> that I would like to
> >> import into OFBiz.
> >>
> >> Has anyone written a tool to convert XML schemas
> into OFBiz  entity
> >> definitions?
> >>
> >> Cheers, Iain
> >>
> >>
> >
> >
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.405 / Virus Database: 268.10.7/411 -
> Release Date: 7/08/2006
>
>

Reply | Threaded
Open this post in threaded view
|

Re: XSD schema conversion anyone?

Iain Fogg
Chris,

Good question, and this probably exposes my ignorance of XST. Maybe it's
not the right technology. Maybe I need to find a tool that can translate
from XSD -> SQL. Then it would be straightforward to map the relational
table defs to the OFBiz entity def. My small brain can't get round the
mapping of the hierarchical XML Schema to a relational one - at least
not given it's size. Maybe when I was younger :-)

In case anyone is interested, the schema I want to map is the ONIX
schema (used in the book trade).

Cheers, Iain

Chris Howe wrote:

>Correct me if I'm wrong, but wouldn't you need to know
>what the source elements are in order to make an XST
>to entity def?  Absent knowing the structure of your
>source it wouldn't matter what someone else's XST
>looks like, it wouldn't work with yours.
>
>--- Iain Fogg <[hidden email]> wrote:
>
>  
>
>>That's my question...has anyone already buit an XST
>>to do the conversion
>>to OFBiz Entity defs?
>>
>>BJ Freeman wrote:
>>
>>    
>>
>>>the XSD defines the layout.
>>>the XML is where the Entities definitions are.
>>>you can try using an XST file to convert.
>>>
>>>Iain Fogg sent the following on 8/7/2006 7:53 AM:
>>>
>>>      
>>>
>>>>I have a slightly complicated XML Schema (.xsd)
>>>>        
>>>>
>>that I would like to
>>    
>>
>>>>import into OFBiz.
>>>>
>>>>Has anyone written a tool to convert XML schemas
>>>>        
>>>>
>>into OFBiz  entity
>>    
>>
>>>>definitions?
>>>>
>>>>Cheers, Iain
>>>>
>>>>
>>>>        
>>>>
>>>      
>>>
>>
>>--
>>No virus found in this outgoing message.
>>Checked by AVG Free Edition.
>>Version: 7.1.405 / Virus Database: 268.10.7/411 -
>>Release Date: 7/08/2006
>>
>>
>>    
>>
>
>
>
>  
>



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 7/08/2006

Reply | Threaded
Open this post in threaded view
|

Re: XSD schema conversion anyone?

David E Jones-2

Is the intent to map it to the OFBiz data model or services? I'm  
guessing that's not the case if you're trying to create entities to  
represent it.

If you're trying to create a data model for an XML Schema and not  
mapping it to an existing data model, then you'll have to design a  
data model to match it. XML is an hierarchical data structure which  
is very different from a relational (table-based) one. Some design  
will have to be done to decide how to structure things because there  
are no natural equivalencies. There are, of course, some common  
patterns for dealing with hierarchical and other structures in SQL,  
but doing an effective mapping requires more of an understanding of  
the data model so that the same data can be captured in both places  
and this is very difficult to automate. You might find some  
commercial tools that give you a good first pass though... ie to go  
from XSD to SQL DDL.

-David


On Aug 7, 2006, at 6:51 PM, Iain Fogg wrote:

> Chris,
>
> Good question, and this probably exposes my ignorance of XST. Maybe  
> it's not the right technology. Maybe I need to find a tool that can  
> translate from XSD -> SQL. Then it would be straightforward to map  
> the relational table defs to the OFBiz entity def. My small brain  
> can't get round the mapping of the hierarchical XML Schema to a  
> relational one - at least not given it's size. Maybe when I was  
> younger :-)
>
> In case anyone is interested, the schema I want to map is the ONIX  
> schema (used in the book trade).
>
> Cheers, Iain
>
> Chris Howe wrote:
>
>> Correct me if I'm wrong, but wouldn't you need to know
>> what the source elements are in order to make an XST
>> to entity def?  Absent knowing the structure of your
>> source it wouldn't matter what someone else's XST
>> looks like, it wouldn't work with yours.
>>
>> --- Iain Fogg <[hidden email]> wrote:
>>
>>
>>> That's my question...has anyone already buit an XST
>>> to do the conversion to OFBiz Entity defs?
>>>
>>> BJ Freeman wrote:
>>>
>>>
>>>> the XSD defines the layout.
>>>> the XML is where the Entities definitions are.
>>>> you can try using an XST file to convert.
>>>>
>>>> Iain Fogg sent the following on 8/7/2006 7:53 AM:
>>>>
>>>>
>>>>> I have a slightly complicated XML Schema (.xsd)
>>>>>
>>> that I would like to
>>>>> import into OFBiz.
>>>>>
>>>>> Has anyone written a tool to convert XML schemas
>>>>>
>>> into OFBiz  entity
>>>>> definitions?
>>>>>
>>>>> Cheers, Iain
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>> --
>>> No virus found in this outgoing message.
>>> Checked by AVG Free Edition.
>>> Version: 7.1.405 / Virus Database: 268.10.7/411 -
>>> Release Date: 7/08/2006
>>>
>>>
>>>
>>
>>
>>
>>
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date:  
> 7/08/2006
>

Reply | Threaded
Open this post in threaded view
|

Transaction problem with ofbiz-workflow start (geronimo issue????)

David Garrett
Hi,

I am trying to upgrade to a much more recent version of Ofbiz.

The problem I have is starting a workflow with the orignial ofbiz-workflow
(ie not trying to use Shark yet)

I was wondering whether the transaction problem related to the change to
geronimo TM.

I have a VERY simple workflow which is initiated with
WorkflowEngine.runAsync(..)

Any suggestions appreciated.

It fails on:
                beganTransaction = TransactionUtil.begin();

The code executed is very small ... In WorkflowEngine
    public void runAsync(String localName, ModelService modelService, Map
context, GenericRequester requester, boolean persist) throws
GenericServiceException {      
        // Suspend the current transaction
        TransactionManager tm = TransactionFactory.getTransactionManager();
        if (tm == null) {
            throw new GenericServiceException("Cannot get the transaction
manager; cannot run persisted services.");
        }

        Transaction parentTrans = null;
        boolean beganTransaction = false;
        try {
            try {
                parentTrans = tm.suspend();                
                beganTransaction = TransactionUtil.begin();  <======
EXCEPTION GENERATED HERE!!!!
                //Debug.logInfo("Suspended transaction; began new: " +
beganTransaction, module);
            } catch (SystemException se) {
                Debug.logError(se, "Cannot suspend transaction: " +
se.getMessage(), module);
            } catch (GenericTransactionException e) {
                Debug.logError(e, "Cannot begin nested transaction: " +
e.getMessage(), module);
            }


The exception is as follows:

2006-08-08 11:22:51,099 (http-0.0.0.0-8443-Processor3) [
ServiceDispatcher.java:468:DEBUG] [[ASync service started...-
total:0.0,since last(Begin):0.0]] - 'leadmgt / processWf'
2006-08-08 11:22:58,700 (http-0.0.0.0-8443-Processor3) [
TransactionUtil.java:530:WARN ]
---- exception report
----------------------------------------------------------
WARNING: In setTransactionBeginStack a stack placeholder was already in
place, here is where the transaction began:
Exception: java.lang.Exception
Message: Tx Stack Placeholder
---- stack trace
---------------------------------------------------------------
java.lang.Exception: Tx Stack Placeholder
org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(Transa
ctionUtil.java:524)
org.ofbiz.entity.transaction.TransactionUtil.begin(TransactionUtil.java:111)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:498)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:620)
org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:181)
org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:188)
org.ofbiz.webapp.event.ServiceEventHandler.invoke(ServiceEventHandler.java:2
90)
org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:407)
<+++.-.-.-.-.-.... Snip>
----------------------------------------------------------------------------
----

2006-08-08 11:22:58,700 (http-0.0.0.0-8443-Processor3) [
TransactionUtil.java:532:WARN ]
---- exception report
----------------------------------------------------------
WARNING: In setTransactionBeginStack a stack placeholder was already in
place, here is the current location:
Exception: java.lang.Exception
Message: Current Stack Trace
---- stack trace
---------------------------------------------------------------
java.lang.Exception: Current Stack Trace
org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(Transa
ctionUtil.java:531)
org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(Transa
ctionUtil.java:525)
org.ofbiz.entity.transaction.TransactionUtil.begin(TransactionUtil.java:111)
org.ofbiz.entity.transaction.TransactionUtil.begin(TransactionUtil.java:57)
org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:100)
org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:553)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:620)
org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:181)
org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:188)
org.ofbiz.webapp.event.ServiceEventHandler.invoke(ServiceEventHandler.java:2
90)
org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:407)
<+++.-.-.-.-.-.... Snip>
----------------------------------------------------------------------------
----

2006-08-08 11:22:58,710 (http-0.0.0.0-8443-Processor3) [
WfProcessMgrImpl.java:97 :INFO ] [WfProcessMgr.init] : Create process
manager (org.ofbiz.leadmgt[null] / processWf[null])
2006-08-08 11:22:58,730 (http-0.0.0.0-8443-Processor3) [
ServiceDispatcher.java:564:DEBUG] [[ASync service failed...-
total:7.631,since last(ASync service sta...):7.631]] - 'leadmgt / processWf'
2006-08-08 11:22:58,730 (http-0.0.0.0-8443-Processor3) [
ServiceDispatcher.java:567:ERROR]
---- exception report
----------------------------------------------------------
Service [processWf] threw an unexpected exception/error
Exception: org.ofbiz.service.GenericServiceException
Message: Cannot resume transaction (Caller context is not an unspecified
transaction context)
---- stack trace
---------------------------------------------------------------
org.ofbiz.service.GenericServiceException: Cannot resume transaction (Caller
context is not an unspecified transaction context)
org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:281)
org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:553)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:620)
org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:181)


Reply | Threaded
Open this post in threaded view
|

Re: XSD schema conversion anyone?

BJ Freeman
In reply to this post by Iain Fogg
what chris said is correct.
The onix DTD or XSD describes how the actual data is formated in the
XML. it is not the data.
there is no way to automatically translate the onix DTD to ofbiz
entities. this has to be done by hand.
One way, if this is going to be a daily import, is to write a import
routine.  One routine reads the onix data using the onix DTD and puts in
a map that is then used to put the map data into ofbiz.
Another way is to read the XML using Dom then write out xml format for
ofbiz entities and use the webtools services to import into ofbiz.




Iain Fogg sent the following on 8/7/2006 5:51 PM:

> Chris,
>
> Good question, and this probably exposes my ignorance of XST. Maybe it's
> not the right technology. Maybe I need to find a tool that can translate
> from XSD -> SQL. Then it would be straightforward to map the relational
> table defs to the OFBiz entity def. My small brain can't get round the
> mapping of the hierarchical XML Schema to a relational one - at least
> not given it's size. Maybe when I was younger :-)
>
> In case anyone is interested, the schema I want to map is the ONIX
> schema (used in the book trade).
>
> Cheers, Iain
>
> Chris Howe wrote:
>
>> Correct me if I'm wrong, but wouldn't you need to know
>> what the source elements are in order to make an XST
>> to entity def?  Absent knowing the structure of your
>> source it wouldn't matter what someone else's XST
>> looks like, it wouldn't work with yours.
>>
>> --- Iain Fogg <[hidden email]> wrote:
>>
>>  
>>
>>> That's my question...has anyone already buit an XST
>>> to do the conversion to OFBiz Entity defs?
>>>
>>> BJ Freeman wrote:
>>>
>>>  
>>>> the XSD defines the layout.
>>>> the XML is where the Entities definitions are.
>>>> you can try using an XST file to convert.
>>>>
>>>> Iain Fogg sent the following on 8/7/2006 7:53 AM:
>>>>
>>>>    
>>>>> I have a slightly complicated XML Schema (.xsd)
>>>>>      
>>> that I would like to  
>>>>> import into OFBiz.
>>>>>
>>>>> Has anyone written a tool to convert XML schemas
>>>>>      
>>> into OFBiz  entity  
>>>>> definitions?
>>>>>
>>>>> Cheers, Iain
>>>>>
>>>>>
>>>>>      
>>>>    
>>>
>>> --
>>> No virus found in this outgoing message.
>>> Checked by AVG Free Edition.
>>> Version: 7.1.405 / Virus Database: 268.10.7/411 -
>>> Release Date: 7/08/2006
>>>
>>>
>>>  
>>
>>
>>
>>  
>>
>
>
>
Reply | Threaded
Open this post in threaded view
|

RE: Transaction problem with ofbiz-workflow start (geronimo issue????)

David Garrett
In reply to this post by David Garrett
More Information ... Hopefully simplified:

I try to start the ofbiz-workflow by calling an async service from an event
as follows
    <request-map uri="processWf">
        <security https="true" auth="true"/>
        <event type="service" path="async" invoke="processWf"/>
        <response name="success" type="view" value="main"/>
        <response name="error" type="view" value="main"/>
    </request-map>
It calls the following service
    <service name="processWf" engine="ofbiz-workflow"
location="org.ofbiz.leadmgt" invoke="processWf" >
        <description>Service for testing workflow engine</description>
        <attribute name="communicationEventId" type="String" mode="INOUT"
optional="true"/>
    </service>

Then the problem is with nested transactions below

ServiceEventHandler.invoke(...)
  dispatcher.runAsync(serviceName, serviceContext); // ServiceEventHandler
line 290  
    ServiceDispatcher.runAsync(...)
      // First transaction starts OK
      beganTrans = TransactionUtil.begin(service.transactionTimeout);
//ServiceDispatcher.runAsync line 498)
      ...
      engine.runAsync(...); //ServiceDispatcher.runAsync line 553)
        WorkflowEngine.runAsync(...)
          // 2nd transaction begin FAILS
          beganTransaction = TransactionUtil.begin();
//WorkflowEngine.runAsync line 100
            ...
            TransactionUtil.setTransactionBeginStack()   <==## transaction
already exists
 

Why can't the second transaction begin?

Should I start the workflow a different way which does not cause 2
transactions.

Do I need to remove the transaction within the workflow?

Thanks
David G

-----Original Message-----
From: David Garrett [mailto:[hidden email]]
Sent: Tuesday, 8 August 2006 11:40 AM
To: [hidden email]
Subject: Transaction problem with ofbiz-workflow start (geronimo issue????)

Hi,

I am trying to upgrade to a much more recent version of Ofbiz.

The problem I have is starting a workflow with the orignial ofbiz-workflow
(ie not trying to use Shark yet)

I was wondering whether the transaction problem related to the change to
geronimo TM.

I have a VERY simple workflow which is initiated with
WorkflowEngine.runAsync(..)

Any suggestions appreciated.

It fails on:
                beganTransaction = TransactionUtil.begin();

The code executed is very small ... In WorkflowEngine
    public void runAsync(String localName, ModelService modelService, Map
context, GenericRequester requester, boolean persist) throws
GenericServiceException {      
        // Suspend the current transaction
        TransactionManager tm = TransactionFactory.getTransactionManager();
        if (tm == null) {
            throw new GenericServiceException("Cannot get the transaction
manager; cannot run persisted services.");
        }

        Transaction parentTrans = null;
        boolean beganTransaction = false;
        try {
            try {
                parentTrans = tm.suspend();                
                beganTransaction = TransactionUtil.begin();  <======
EXCEPTION GENERATED HERE!!!!
                //Debug.logInfo("Suspended transaction; began new: " +
beganTransaction, module);
            } catch (SystemException se) {
                Debug.logError(se, "Cannot suspend transaction: " +
se.getMessage(), module);
            } catch (GenericTransactionException e) {
                Debug.logError(e, "Cannot begin nested transaction: " +
e.getMessage(), module);
            }


The exception is as follows:

2006-08-08 11:22:51,099 (http-0.0.0.0-8443-Processor3) [
ServiceDispatcher.java:468:DEBUG] [[ASync service started...-
total:0.0,since last(Begin):0.0]] - 'leadmgt / processWf'
2006-08-08 11:22:58,700 (http-0.0.0.0-8443-Processor3) [
TransactionUtil.java:530:WARN ]
---- exception report
----------------------------------------------------------
WARNING: In setTransactionBeginStack a stack placeholder was already in
place, here is where the transaction began:
Exception: java.lang.Exception
Message: Tx Stack Placeholder
---- stack trace
---------------------------------------------------------------
java.lang.Exception: Tx Stack Placeholder
org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(Transa
ctionUtil.java:524)
org.ofbiz.entity.transaction.TransactionUtil.begin(TransactionUtil.java:111)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:498)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:620)
org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:181)
org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:188)
org.ofbiz.webapp.event.ServiceEventHandler.invoke(ServiceEventHandler.java:2
90)
org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:407)
<+++.-.-.-.-.-.... Snip>
----------------------------------------------------------------------------
----

2006-08-08 11:22:58,700 (http-0.0.0.0-8443-Processor3) [
TransactionUtil.java:532:WARN ]
---- exception report
----------------------------------------------------------
WARNING: In setTransactionBeginStack a stack placeholder was already in
place, here is the current location:
Exception: java.lang.Exception
Message: Current Stack Trace
---- stack trace
---------------------------------------------------------------
java.lang.Exception: Current Stack Trace
org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(Transa
ctionUtil.java:531)
org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(Transa
ctionUtil.java:525)
org.ofbiz.entity.transaction.TransactionUtil.begin(TransactionUtil.java:111)
org.ofbiz.entity.transaction.TransactionUtil.begin(TransactionUtil.java:57)
org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:100)
org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:553)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:620)
org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:181)
org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:188)
org.ofbiz.webapp.event.ServiceEventHandler.invoke(ServiceEventHandler.java:2
90)
org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:407)
<+++.-.-.-.-.-.... Snip>
----------------------------------------------------------------------------
----

2006-08-08 11:22:58,710 (http-0.0.0.0-8443-Processor3) [
WfProcessMgrImpl.java:97 :INFO ] [WfProcessMgr.init] : Create process
manager (org.ofbiz.leadmgt[null] / processWf[null])
2006-08-08 11:22:58,730 (http-0.0.0.0-8443-Processor3) [
ServiceDispatcher.java:564:DEBUG] [[ASync service failed...-
total:7.631,since last(ASync service sta...):7.631]] - 'leadmgt / processWf'
2006-08-08 11:22:58,730 (http-0.0.0.0-8443-Processor3) [
ServiceDispatcher.java:567:ERROR]
---- exception report
----------------------------------------------------------
Service [processWf] threw an unexpected exception/error
Exception: org.ofbiz.service.GenericServiceException
Message: Cannot resume transaction (Caller context is not an unspecified
transaction context)
---- stack trace
---------------------------------------------------------------
org.ofbiz.service.GenericServiceException: Cannot resume transaction (Caller
context is not an unspecified transaction context)
org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:281)
org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:553)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:620)
org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:181)




Reply | Threaded
Open this post in threaded view
|

Re: Transaction problem with ofbiz-workflow start (geronimo issue????)

David E Jones-2

Without looking into it more, I'm not sure...

Which revision of OFBiz are you updating to?

The code you included in your last message for the tx management in  
the workflow engine is a little fishy, it it's not doing the suspend  
correctly and such. It should use the TransactionUtil.suspend method  
and not do it itself.

Still the way it is doing it should only cause warnings and hopefully  
allow things to continue just fine.

But yeah, changing it to use the TransactionUtil methods instead of  
the tm.suspect and tm.resume directly should solve the problem.

-David


On Aug 7, 2006, at 10:21 PM, David Garrett wrote:

> More Information ... Hopefully simplified:
>
> I try to start the ofbiz-workflow by calling an async service from  
> an event
> as follows
>     <request-map uri="processWf">
>         <security https="true" auth="true"/>
>         <event type="service" path="async" invoke="processWf"/>
>         <response name="success" type="view" value="main"/>
>         <response name="error" type="view" value="main"/>
>     </request-map>
> It calls the following service
>     <service name="processWf" engine="ofbiz-workflow"
> location="org.ofbiz.leadmgt" invoke="processWf" >
>         <description>Service for testing workflow engine</description>
>         <attribute name="communicationEventId" type="String"  
> mode="INOUT"
> optional="true"/>
>     </service>
>
> Then the problem is with nested transactions below
>
> ServiceEventHandler.invoke(...)
>   dispatcher.runAsync(serviceName, serviceContext); //  
> ServiceEventHandler
> line 290
>     ServiceDispatcher.runAsync(...)
>       // First transaction starts OK
>       beganTrans = TransactionUtil.begin(service.transactionTimeout);
> //ServiceDispatcher.runAsync line 498)
>       ...
>       engine.runAsync(...); //ServiceDispatcher.runAsync line 553)
>         WorkflowEngine.runAsync(...)
>           // 2nd transaction begin FAILS
>           beganTransaction = TransactionUtil.begin();
> //WorkflowEngine.runAsync line 100
>             ...
>             TransactionUtil.setTransactionBeginStack()   <==##  
> transaction
> already exists
>
>
> Why can't the second transaction begin?
>
> Should I start the workflow a different way which does not cause 2
> transactions.
>
> Do I need to remove the transaction within the workflow?
>
> Thanks
> David G
>
> -----Original Message-----
> From: David Garrett [mailto:[hidden email]]
> Sent: Tuesday, 8 August 2006 11:40 AM
> To: [hidden email]
> Subject: Transaction problem with ofbiz-workflow start (geronimo  
> issue????)
>
> Hi,
>
> I am trying to upgrade to a much more recent version of Ofbiz.
>
> The problem I have is starting a workflow with the orignial ofbiz-
> workflow
> (ie not trying to use Shark yet)
>
> I was wondering whether the transaction problem related to the  
> change to
> geronimo TM.
>
> I have a VERY simple workflow which is initiated with
> WorkflowEngine.runAsync(..)
>
> Any suggestions appreciated.
>
> It fails on:
>                 beganTransaction = TransactionUtil.begin();
>
> The code executed is very small ... In WorkflowEngine
>     public void runAsync(String localName, ModelService  
> modelService, Map
> context, GenericRequester requester, boolean persist) throws
> GenericServiceException {
>         // Suspend the current transaction
>         TransactionManager tm =  
> TransactionFactory.getTransactionManager();
>         if (tm == null) {
>             throw new GenericServiceException("Cannot get the  
> transaction
> manager; cannot run persisted services.");
>         }
>
>         Transaction parentTrans = null;
>         boolean beganTransaction = false;
>         try {
>             try {
>                 parentTrans = tm.suspend();
>                 beganTransaction = TransactionUtil.begin();  <======
> EXCEPTION GENERATED HERE!!!!
>                 //Debug.logInfo("Suspended transaction; began new: " +
> beganTransaction, module);
>             } catch (SystemException se) {
>                 Debug.logError(se, "Cannot suspend transaction: " +
> se.getMessage(), module);
>             } catch (GenericTransactionException e) {
>                 Debug.logError(e, "Cannot begin nested transaction:  
> " +
> e.getMessage(), module);
>             }
>
>
> The exception is as follows:
>
> 2006-08-08 11:22:51,099 (http-0.0.0.0-8443-Processor3) [
> ServiceDispatcher.java:468:DEBUG] [[ASync service started...-
> total:0.0,since last(Begin):0.0]] - 'leadmgt / processWf'
> 2006-08-08 11:22:58,700 (http-0.0.0.0-8443-Processor3) [
> TransactionUtil.java:530:WARN ]
> ---- exception report
> ----------------------------------------------------------
> WARNING: In setTransactionBeginStack a stack placeholder was  
> already in
> place, here is where the transaction began:
> Exception: java.lang.Exception
> Message: Tx Stack Placeholder
> ---- stack trace
> ---------------------------------------------------------------
> java.lang.Exception: Tx Stack Placeholder
> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(
> Transa
> ctionUtil.java:524)
> org.ofbiz.entity.transaction.TransactionUtil.begin
> (TransactionUtil.java:111)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 498)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 620)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 181)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 188)
> org.ofbiz.webapp.event.ServiceEventHandler.invoke
> (ServiceEventHandler.java:2
> 90)
> org.ofbiz.webapp.control.RequestHandler.runEvent
> (RequestHandler.java:407)
> <+++.-.-.-.-.-.... Snip>
> ----------------------------------------------------------------------
> ------
> ----
>
> 2006-08-08 11:22:58,700 (http-0.0.0.0-8443-Processor3) [
> TransactionUtil.java:532:WARN ]
> ---- exception report
> ----------------------------------------------------------
> WARNING: In setTransactionBeginStack a stack placeholder was  
> already in
> place, here is the current location:
> Exception: java.lang.Exception
> Message: Current Stack Trace
> ---- stack trace
> ---------------------------------------------------------------
> java.lang.Exception: Current Stack Trace
> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(
> Transa
> ctionUtil.java:531)
> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(
> Transa
> ctionUtil.java:525)
> org.ofbiz.entity.transaction.TransactionUtil.begin
> (TransactionUtil.java:111)
> org.ofbiz.entity.transaction.TransactionUtil.begin
> (TransactionUtil.java:57)
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:100)
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 553)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 620)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 181)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 188)
> org.ofbiz.webapp.event.ServiceEventHandler.invoke
> (ServiceEventHandler.java:2
> 90)
> org.ofbiz.webapp.control.RequestHandler.runEvent
> (RequestHandler.java:407)
> <+++.-.-.-.-.-.... Snip>
> ----------------------------------------------------------------------
> ------
> ----
>
> 2006-08-08 11:22:58,710 (http-0.0.0.0-8443-Processor3) [
> WfProcessMgrImpl.java:97 :INFO ] [WfProcessMgr.init] : Create process
> manager (org.ofbiz.leadmgt[null] / processWf[null])
> 2006-08-08 11:22:58,730 (http-0.0.0.0-8443-Processor3) [
> ServiceDispatcher.java:564:DEBUG] [[ASync service failed...-
> total:7.631,since last(ASync service sta...):7.631]] - 'leadmgt /  
> processWf'
> 2006-08-08 11:22:58,730 (http-0.0.0.0-8443-Processor3) [
> ServiceDispatcher.java:567:ERROR]
> ---- exception report
> ----------------------------------------------------------
> Service [processWf] threw an unexpected exception/error
> Exception: org.ofbiz.service.GenericServiceException
> Message: Cannot resume transaction (Caller context is not an  
> unspecified
> transaction context)
> ---- stack trace
> ---------------------------------------------------------------
> org.ofbiz.service.GenericServiceException: Cannot resume  
> transaction (Caller
> context is not an unspecified transaction context)
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:281)
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 553)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 620)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 181)
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

RE: Transaction problem with ofbiz-workflow start (geronimo issue????)

David Garrett
In reply to this post by David Garrett
Thankyou!

The code I am using is about 2 weeks old.

I checked the code for WorkflowEngine.java is the same as the current.

So are you suggesting update the calls in org.ofbiz.workflow.WorkflowEngine
as below. This creates a similar exception in the resume (which is also
changed).

To call as follows
        //CHANGE ... remove TransactionManager tm =
TransactionFactory.getTransactionManager();
        //if (tm == null) {
        //    throw new GenericServiceException("Cannot get the transaction
manager; cannot run persisted services.");
        //}

        Transaction parentTrans = null;
        boolean beganTransaction = false;
        try {
            try {
                parentTrans = TransactionUtil.suspend();                
                beganTransaction = TransactionUtil.begin();
                //Debug.logInfo("Suspended transaction; began new: " +
beganTransaction, module);
//            } catch (SystemException se) {
//                Debug.logError(se, "Cannot suspend transaction: " +
se.getMessage(), module);
            } catch (GenericTransactionException e) {
                Debug.logError(e, "Cannot begin nested transaction: " +
e.getMessage(), module);
            }


AND

                    try
                    {
                        // REMOVE tm.resume(parentTrans);
                        TransactionUtil.resume(parentTrans);
                        //Debug.logInfo("Resumed the parent transaction.",
module);
                    }
                    catch (GenericTransactionException e)
                    {
                      throw new GenericServiceException("Cannot resume
transaction", e);
                    }
//                } catch (InvalidTransactionException ite) {
//                    throw new GenericServiceException("Cannot resume
transaction", ite);
//                } catch (SystemException se) {
//                    throw new GenericServiceException("Unexpected
transaction error", se);
//                }





2006-08-08 15:44:36,138 (http-0.0.0.0-8443-Processor3) [
TransactionUtil.java:530:WARN ]
---- exception report
----------------------------------------------------------
WARNING: In setTransactionBeginStack a stack placeholder was already in
place, here is where the transaction began:
Exception: java.lang.Exception
Message: Tx Stack Placeholder
---- stack trace
---------------------------------------------------------------
java.lang.Exception: Tx Stack Placeholder
org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(Transa
ctionUtil.java:524)
org.ofbiz.entity.transaction.TransactionUtil.begin(TransactionUtil.java:111)
org.ofbiz.entity.transaction.TransactionUtil.begin(TransactionUtil.java:57)
org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:100)
org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:553)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:620)
org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:181)
org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:188)
org.ofbiz.webapp.event.ServiceEventHandler.invoke(ServiceEventHandler.java:2
90)
.... SNIP
----------------------------------------------------------------------------
----

2006-08-08 15:44:36,148 (http-0.0.0.0-8443-Processor3) [
TransactionUtil.java:532:WARN ]
---- exception report
----------------------------------------------------------
WARNING: In setTransactionBeginStack a stack placeholder was already in
place, here is the current location:
Exception: java.lang.Exception
Message: Current Stack Trace
---- stack trace
---------------------------------------------------------------
java.lang.Exception: Current Stack Trace
org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(Transa
ctionUtil.java:531)
org.ofbiz.entity.transaction.TransactionUtil.resume(TransactionUtil.java:321
)
org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:280)
org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:553)
org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:620)
org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:181)
org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:188)
org.ofbiz.webapp.event.ServiceEventHandler.invoke(ServiceEventHandler.java:2
90)
.... SNIP
----------------------------------------------------------------------------
----

2006-08-08 15:44:36,148 (http-0.0.0.0-8443-Processor3) [
ServiceDispatcher.java:564:DEBUG] [[ASync service failed...-
total:4.496,since last(ASync service sta...):4.496]] - 'leadmgt / processWf'
2006-08-08 15:44:36,148 (http-0.0.0.0-8443-Processor3) [
ServiceDispatcher.java:567:ERROR]
---- exception report
----------------------------------------------------------
Service [processWf] threw an unexpected exception/error
Exception: org.ofbiz.service.GenericServiceException
Message: Cannot resume transaction (System error, could not resume
transaction (Caller context is not an unspecified transaction context))
---- stack trace
---------------------------------------------------------------
org.ofbiz.service.GenericServiceException: Cannot resume transaction (System
error, could not resume transaction (Caller context is not an unspecified
transaction context))
org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:285)

-----Original Message-----
From: David E Jones [mailto:[hidden email]]
Sent: Tuesday, 8 August 2006 2:44 PM
To: [hidden email]
Subject: Re: Transaction problem with ofbiz-workflow start (geronimo
issue????)


Without looking into it more, I'm not sure...

Which revision of OFBiz are you updating to?

The code you included in your last message for the tx management in the
workflow engine is a little fishy, it it's not doing the suspend correctly
and such. It should use the TransactionUtil.suspend method and not do it
itself.

Still the way it is doing it should only cause warnings and hopefully allow
things to continue just fine.

But yeah, changing it to use the TransactionUtil methods instead of the
tm.suspect and tm.resume directly should solve the problem.

-David


On Aug 7, 2006, at 10:21 PM, David Garrett wrote:

> More Information ... Hopefully simplified:
>
> I try to start the ofbiz-workflow by calling an async service from an
> event as follows
>     <request-map uri="processWf">
>         <security https="true" auth="true"/>
>         <event type="service" path="async" invoke="processWf"/>
>         <response name="success" type="view" value="main"/>
>         <response name="error" type="view" value="main"/>
>     </request-map>
> It calls the following service
>     <service name="processWf" engine="ofbiz-workflow"
> location="org.ofbiz.leadmgt" invoke="processWf" >
>         <description>Service for testing workflow engine</description>
>         <attribute name="communicationEventId" type="String"  
> mode="INOUT"
> optional="true"/>
>     </service>
>
> Then the problem is with nested transactions below
>
> ServiceEventHandler.invoke(...)
>   dispatcher.runAsync(serviceName, serviceContext); //
> ServiceEventHandler line 290
>     ServiceDispatcher.runAsync(...)
>       // First transaction starts OK
>       beganTrans = TransactionUtil.begin(service.transactionTimeout);
> //ServiceDispatcher.runAsync line 498)
>       ...
>       engine.runAsync(...); //ServiceDispatcher.runAsync line 553)
>         WorkflowEngine.runAsync(...)
>           // 2nd transaction begin FAILS
>           beganTransaction = TransactionUtil.begin();
> //WorkflowEngine.runAsync line 100
>             ...
>             TransactionUtil.setTransactionBeginStack()   <==##  
> transaction
> already exists
>
>
> Why can't the second transaction begin?
>
> Should I start the workflow a different way which does not cause 2
> transactions.
>
> Do I need to remove the transaction within the workflow?
>
> Thanks
> David G
>
> -----Original Message-----
> From: David Garrett [mailto:[hidden email]]
> Sent: Tuesday, 8 August 2006 11:40 AM
> To: [hidden email]
> Subject: Transaction problem with ofbiz-workflow start (geronimo  
> issue????)
>
> Hi,
>
> I am trying to upgrade to a much more recent version of Ofbiz.
>
> The problem I have is starting a workflow with the orignial ofbiz-
> workflow
> (ie not trying to use Shark yet)
>
> I was wondering whether the transaction problem related to the  
> change to
> geronimo TM.
>
> I have a VERY simple workflow which is initiated with
> WorkflowEngine.runAsync(..)
>
> Any suggestions appreciated.
>
> It fails on:
>                 beganTransaction = TransactionUtil.begin();
>
> The code executed is very small ... In WorkflowEngine
>     public void runAsync(String localName, ModelService  
> modelService, Map
> context, GenericRequester requester, boolean persist) throws
> GenericServiceException {
>         // Suspend the current transaction
>         TransactionManager tm =  
> TransactionFactory.getTransactionManager();
>         if (tm == null) {
>             throw new GenericServiceException("Cannot get the  
> transaction
> manager; cannot run persisted services.");
>         }
>
>         Transaction parentTrans = null;
>         boolean beganTransaction = false;
>         try {
>             try {
>                 parentTrans = tm.suspend();
>                 beganTransaction = TransactionUtil.begin();  <======
> EXCEPTION GENERATED HERE!!!!
>                 //Debug.logInfo("Suspended transaction; began new: " +
> beganTransaction, module);
>             } catch (SystemException se) {
>                 Debug.logError(se, "Cannot suspend transaction: " +
> se.getMessage(), module);
>             } catch (GenericTransactionException e) {
>                 Debug.logError(e, "Cannot begin nested transaction:  
> " +
> e.getMessage(), module);
>             }
>
>
> The exception is as follows:
>
> 2006-08-08 11:22:51,099 (http-0.0.0.0-8443-Processor3) [
> ServiceDispatcher.java:468:DEBUG] [[ASync service started...-
> total:0.0,since last(Begin):0.0]] - 'leadmgt / processWf'
> 2006-08-08 11:22:58,700 (http-0.0.0.0-8443-Processor3) [
> TransactionUtil.java:530:WARN ]
> ---- exception report
> ----------------------------------------------------------
> WARNING: In setTransactionBeginStack a stack placeholder was  
> already in
> place, here is where the transaction began:
> Exception: java.lang.Exception
> Message: Tx Stack Placeholder
> ---- stack trace
> ---------------------------------------------------------------
> java.lang.Exception: Tx Stack Placeholder
> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(
> Transa
> ctionUtil.java:524)
> org.ofbiz.entity.transaction.TransactionUtil.begin
> (TransactionUtil.java:111)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 498)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 620)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 181)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 188)
> org.ofbiz.webapp.event.ServiceEventHandler.invoke
> (ServiceEventHandler.java:2
> 90)
> org.ofbiz.webapp.control.RequestHandler.runEvent
> (RequestHandler.java:407)
> <+++.-.-.-.-.-.... Snip>
> ----------------------------------------------------------------------
> ------
> ----
>
> 2006-08-08 11:22:58,700 (http-0.0.0.0-8443-Processor3) [
> TransactionUtil.java:532:WARN ]
> ---- exception report
> ----------------------------------------------------------
> WARNING: In setTransactionBeginStack a stack placeholder was  
> already in
> place, here is the current location:
> Exception: java.lang.Exception
> Message: Current Stack Trace
> ---- stack trace
> ---------------------------------------------------------------
> java.lang.Exception: Current Stack Trace
> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(
> Transa
> ctionUtil.java:531)
> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(
> Transa
> ctionUtil.java:525)
> org.ofbiz.entity.transaction.TransactionUtil.begin
> (TransactionUtil.java:111)
> org.ofbiz.entity.transaction.TransactionUtil.begin
> (TransactionUtil.java:57)
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:100)
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 553)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 620)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 181)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 188)
> org.ofbiz.webapp.event.ServiceEventHandler.invoke
> (ServiceEventHandler.java:2
> 90)
> org.ofbiz.webapp.control.RequestHandler.runEvent
> (RequestHandler.java:407)
> <+++.-.-.-.-.-.... Snip>
> ----------------------------------------------------------------------
> ------
> ----
>
> 2006-08-08 11:22:58,710 (http-0.0.0.0-8443-Processor3) [
> WfProcessMgrImpl.java:97 :INFO ] [WfProcessMgr.init] : Create process
> manager (org.ofbiz.leadmgt[null] / processWf[null])
> 2006-08-08 11:22:58,730 (http-0.0.0.0-8443-Processor3) [
> ServiceDispatcher.java:564:DEBUG] [[ASync service failed...-
> total:7.631,since last(ASync service sta...):7.631]] - 'leadmgt /  
> processWf'
> 2006-08-08 11:22:58,730 (http-0.0.0.0-8443-Processor3) [
> ServiceDispatcher.java:567:ERROR]
> ---- exception report
> ----------------------------------------------------------
> Service [processWf] threw an unexpected exception/error
> Exception: org.ofbiz.service.GenericServiceException
> Message: Cannot resume transaction (Caller context is not an  
> unspecified
> transaction context)
> ---- stack trace
> ---------------------------------------------------------------
> org.ofbiz.service.GenericServiceException: Cannot resume  
> transaction (Caller
> context is not an unspecified transaction context)
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:281)
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 553)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 620)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 181)
>
>
>
>


WorkflowEngine.zip (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: XSD schema conversion anyone?

Iain Fogg
In reply to this post by BJ Freeman
I might be missing something here....

XML Schema defines the structure of data, albeit in a heirarchical data
model.
Unless I've completely missed the mark, the OFBiz data model is
relational; certainly the entitydefs looks pretty relational to me
(tables, fields, pks, fks, cardinality contraints, and so on) - not to
mention the underlying implementation.

Generally, there is nothing in a hierarchical data model that can't be
implemented in a relational one. So assuming XML Schema has no nasty
features, then there is no reason you couldn't apply a mapping from one
to the other. At least, that's in theory :-)

I've have just stumbled across a tool that might do precisely what I
want - I'll report back if it works, in case anyone else is interested.
If it works, it'll generate the SQL DDL to create the tables - going
from there to OFBiz ought to be a doddle.

Thanks for the feedback.

Cheers, Iain

BJ Freeman wrote:

> what chris said is correct.
> The onix DTD or XSD describes how the actual data is formated in the
> XML. it is not the data.
> there is no way to automatically translate the onix DTD to ofbiz
> entities. this has to be done by hand.
> One way, if this is going to be a daily import, is to write a import
> routine.  One routine reads the onix data using the onix DTD and puts
> in a map that is then used to put the map data into ofbiz.
> Another way is to read the XML using Dom then write out xml format for
> ofbiz entities and use the webtools services to import into ofbiz.
>
>
>
>
> Iain Fogg sent the following on 8/7/2006 5:51 PM:
>
>> Chris,
>>
>> Good question, and this probably exposes my ignorance of XST. Maybe
>> it's not the right technology. Maybe I need to find a tool that can
>> translate from XSD -> SQL. Then it would be straightforward to map
>> the relational table defs to the OFBiz entity def. My small brain
>> can't get round the mapping of the hierarchical XML Schema to a
>> relational one - at least not given it's size. Maybe when I was
>> younger :-)
>>
>> In case anyone is interested, the schema I want to map is the ONIX
>> schema (used in the book trade).
>>
>> Cheers, Iain
>>
>> Chris Howe wrote:
>>
>>> Correct me if I'm wrong, but wouldn't you need to know
>>> what the source elements are in order to make an XST
>>> to entity def?  Absent knowing the structure of your
>>> source it wouldn't matter what someone else's XST
>>> looks like, it wouldn't work with yours.
>>>
>>> --- Iain Fogg <[hidden email]> wrote:
>>>
>>>  
>>>
>>>> That's my question...has anyone already buit an XST
>>>> to do the conversion to OFBiz Entity defs?
>>>>
>>>> BJ Freeman wrote:
>>>>
>>>>  
>>>>
>>>>> the XSD defines the layout.
>>>>> the XML is where the Entities definitions are.
>>>>> you can try using an XST file to convert.
>>>>>
>>>>> Iain Fogg sent the following on 8/7/2006 7:53 AM:
>>>>>
>>>>>    
>>>>>
>>>>>> I have a slightly complicated XML Schema (.xsd)
>>>>>>      
>>>>>
>>>> that I would like to  
>>>>
>>>>>> import into OFBiz.
>>>>>>
>>>>>> Has anyone written a tool to convert XML schemas
>>>>>>      
>>>>>
>>>> into OFBiz  entity  
>>>>
>>>>>> definitions?
>>>>>>
>>>>>> Cheers, Iain
>>>>>>
>>>>>>
>>>>>>      
>>>>>
>>>>>    
>>>>
>>>>
>>>> --
>>>> No virus found in this outgoing message.
>>>> Checked by AVG Free Edition.
>>>> Version: 7.1.405 / Virus Database: 268.10.7/411 -
>>>> Release Date: 7/08/2006
>>>>
>>>>
>>>>  
>>>
>>>
>>>
>>>
>>>  
>>>
>>
>>
>>
>
>



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 7/08/2006

Reply | Threaded
Open this post in threaded view
|

Re: Transaction problem with ofbiz-workflow start (geronimo issue????)

David E Jones-2
In reply to this post by David Garrett

David,

In rev 429598 I committed some changes to use TransactionUtil instead  
of tm, and that should take care of the warnings.

For the actual error you're getting: the transaction management code  
in that class is a mess. The way it uses try/catch blocks is just so  
wrong for safe transaction management, and I'm not sure if I want to  
reorganize the whole thing right now (especially not for something  
that I'd like to see disappear altogether anyway, with future efforts  
going into the Shark integration which must be scary because no one  
has touched it for quite a while, ie hardly anything since Andy ended  
his efforts on it)...

If you are interested in pursuing this the proper way to do such  
things is basically to use 2 and only 2 try/catch blocks, one inside  
the other. The outside one should handle the suspend/resume (with the  
resume in the finally block) and the inside one should handle the  
begin/rollback/commit (with the rollback/commit in the finally block).

A good example to look at is in the ServiceDispatcher.java file, in  
the runSync method that starts on line 239.

It may be that once this transaction issue is cleaned up you'll  
really find some dumb little error (or bad little error) that just  
isn't being handled correctly, and because the tx management code is  
just SO bad in this method it is showing up as a tx problem...

-David J.


On Aug 8, 2006, at 12:11 AM, David Garrett wrote:

> Thankyou!
>
> The code I am using is about 2 weeks old.
>
> I checked the code for WorkflowEngine.java is the same as the current.
>
> So are you suggesting update the calls in  
> org.ofbiz.workflow.WorkflowEngine
> as below. This creates a similar exception in the resume (which is  
> also
> changed).
>
> To call as follows
>         //CHANGE ... remove TransactionManager tm =
> TransactionFactory.getTransactionManager();
>         //if (tm == null) {
>         //    throw new GenericServiceException("Cannot get the  
> transaction
> manager; cannot run persisted services.");
>         //}
>
>         Transaction parentTrans = null;
>         boolean beganTransaction = false;
>         try {
>             try {
>                 parentTrans = TransactionUtil.suspend();
>                 beganTransaction = TransactionUtil.begin();
>                 //Debug.logInfo("Suspended transaction; began new: " +
> beganTransaction, module);
> //            } catch (SystemException se) {
> //                Debug.logError(se, "Cannot suspend transaction: " +
> se.getMessage(), module);
>             } catch (GenericTransactionException e) {
>                 Debug.logError(e, "Cannot begin nested transaction:  
> " +
> e.getMessage(), module);
>             }
>
>
> AND
>
>                     try
>                     {
>                         // REMOVE tm.resume(parentTrans);
>                         TransactionUtil.resume(parentTrans);
>                         //Debug.logInfo("Resumed the parent  
> transaction.",
> module);
>                     }
>                     catch (GenericTransactionException e)
>                     {
>                       throw new GenericServiceException("Cannot resume
> transaction", e);
>                     }
> //                } catch (InvalidTransactionException ite) {
> //                    throw new GenericServiceException("Cannot resume
> transaction", ite);
> //                } catch (SystemException se) {
> //                    throw new GenericServiceException("Unexpected
> transaction error", se);
> //                }
>
>
>
>
>
> 2006-08-08 15:44:36,138 (http-0.0.0.0-8443-Processor3) [
> TransactionUtil.java:530:WARN ]
> ---- exception report
> ----------------------------------------------------------
> WARNING: In setTransactionBeginStack a stack placeholder was  
> already in
> place, here is where the transaction began:
> Exception: java.lang.Exception
> Message: Tx Stack Placeholder
> ---- stack trace
> ---------------------------------------------------------------
> java.lang.Exception: Tx Stack Placeholder
> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(
> Transa
> ctionUtil.java:524)
> org.ofbiz.entity.transaction.TransactionUtil.begin
> (TransactionUtil.java:111)
> org.ofbiz.entity.transaction.TransactionUtil.begin
> (TransactionUtil.java:57)
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:100)
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 553)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 620)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 181)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 188)
> org.ofbiz.webapp.event.ServiceEventHandler.invoke
> (ServiceEventHandler.java:2
> 90)
> .... SNIP
> ----------------------------------------------------------------------
> ------
> ----
>
> 2006-08-08 15:44:36,148 (http-0.0.0.0-8443-Processor3) [
> TransactionUtil.java:532:WARN ]
> ---- exception report
> ----------------------------------------------------------
> WARNING: In setTransactionBeginStack a stack placeholder was  
> already in
> place, here is the current location:
> Exception: java.lang.Exception
> Message: Current Stack Trace
> ---- stack trace
> ---------------------------------------------------------------
> java.lang.Exception: Current Stack Trace
> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(
> Transa
> ctionUtil.java:531)
> org.ofbiz.entity.transaction.TransactionUtil.resume
> (TransactionUtil.java:321
> )
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:280)
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 553)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 620)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 181)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 188)
> org.ofbiz.webapp.event.ServiceEventHandler.invoke
> (ServiceEventHandler.java:2
> 90)
> .... SNIP
> ----------------------------------------------------------------------
> ------
> ----
>
> 2006-08-08 15:44:36,148 (http-0.0.0.0-8443-Processor3) [
> ServiceDispatcher.java:564:DEBUG] [[ASync service failed...-
> total:4.496,since last(ASync service sta...):4.496]] - 'leadmgt /  
> processWf'
> 2006-08-08 15:44:36,148 (http-0.0.0.0-8443-Processor3) [
> ServiceDispatcher.java:567:ERROR]
> ---- exception report
> ----------------------------------------------------------
> Service [processWf] threw an unexpected exception/error
> Exception: org.ofbiz.service.GenericServiceException
> Message: Cannot resume transaction (System error, could not resume
> transaction (Caller context is not an unspecified transaction  
> context))
> ---- stack trace
> ---------------------------------------------------------------
> org.ofbiz.service.GenericServiceException: Cannot resume  
> transaction (System
> error, could not resume transaction (Caller context is not an  
> unspecified
> transaction context))
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:285)
>
> -----Original Message-----
> From: David E Jones [mailto:[hidden email]]
> Sent: Tuesday, 8 August 2006 2:44 PM
> To: [hidden email]
> Subject: Re: Transaction problem with ofbiz-workflow start (geronimo
> issue????)
>
>
> Without looking into it more, I'm not sure...
>
> Which revision of OFBiz are you updating to?
>
> The code you included in your last message for the tx management in  
> the
> workflow engine is a little fishy, it it's not doing the suspend  
> correctly
> and such. It should use the TransactionUtil.suspend method and not  
> do it
> itself.
>
> Still the way it is doing it should only cause warnings and  
> hopefully allow
> things to continue just fine.
>
> But yeah, changing it to use the TransactionUtil methods instead of  
> the
> tm.suspect and tm.resume directly should solve the problem.
>
> -David
>
>
> On Aug 7, 2006, at 10:21 PM, David Garrett wrote:
>
>> More Information ... Hopefully simplified:
>>
>> I try to start the ofbiz-workflow by calling an async service from an
>> event as follows
>>     <request-map uri="processWf">
>>         <security https="true" auth="true"/>
>>         <event type="service" path="async" invoke="processWf"/>
>>         <response name="success" type="view" value="main"/>
>>         <response name="error" type="view" value="main"/>
>>     </request-map>
>> It calls the following service
>>     <service name="processWf" engine="ofbiz-workflow"
>> location="org.ofbiz.leadmgt" invoke="processWf" >
>>         <description>Service for testing workflow engine</
>> description>
>>         <attribute name="communicationEventId" type="String"
>> mode="INOUT"
>> optional="true"/>
>>     </service>
>>
>> Then the problem is with nested transactions below
>>
>> ServiceEventHandler.invoke(...)
>>   dispatcher.runAsync(serviceName, serviceContext); //
>> ServiceEventHandler line 290
>>     ServiceDispatcher.runAsync(...)
>>       // First transaction starts OK
>>       beganTrans = TransactionUtil.begin(service.transactionTimeout);
>> //ServiceDispatcher.runAsync line 498)
>>       ...
>>       engine.runAsync(...); //ServiceDispatcher.runAsync line 553)
>>         WorkflowEngine.runAsync(...)
>>           // 2nd transaction begin FAILS
>>           beganTransaction = TransactionUtil.begin();
>> //WorkflowEngine.runAsync line 100
>>             ...
>>             TransactionUtil.setTransactionBeginStack()   <==##
>> transaction
>> already exists
>>
>>
>> Why can't the second transaction begin?
>>
>> Should I start the workflow a different way which does not cause 2
>> transactions.
>>
>> Do I need to remove the transaction within the workflow?
>>
>> Thanks
>> David G
>>
>> -----Original Message-----
>> From: David Garrett [mailto:[hidden email]]
>> Sent: Tuesday, 8 August 2006 11:40 AM
>> To: [hidden email]
>> Subject: Transaction problem with ofbiz-workflow start (geronimo
>> issue????)
>>
>> Hi,
>>
>> I am trying to upgrade to a much more recent version of Ofbiz.
>>
>> The problem I have is starting a workflow with the orignial ofbiz-
>> workflow
>> (ie not trying to use Shark yet)
>>
>> I was wondering whether the transaction problem related to the
>> change to
>> geronimo TM.
>>
>> I have a VERY simple workflow which is initiated with
>> WorkflowEngine.runAsync(..)
>>
>> Any suggestions appreciated.
>>
>> It fails on:
>>                 beganTransaction = TransactionUtil.begin();
>>
>> The code executed is very small ... In WorkflowEngine
>>     public void runAsync(String localName, ModelService
>> modelService, Map
>> context, GenericRequester requester, boolean persist) throws
>> GenericServiceException {
>>         // Suspend the current transaction
>>         TransactionManager tm =
>> TransactionFactory.getTransactionManager();
>>         if (tm == null) {
>>             throw new GenericServiceException("Cannot get the
>> transaction
>> manager; cannot run persisted services.");
>>         }
>>
>>         Transaction parentTrans = null;
>>         boolean beganTransaction = false;
>>         try {
>>             try {
>>                 parentTrans = tm.suspend();
>>                 beganTransaction = TransactionUtil.begin();  <======
>> EXCEPTION GENERATED HERE!!!!
>>                 //Debug.logInfo("Suspended transaction; began new:  
>> " +
>> beganTransaction, module);
>>             } catch (SystemException se) {
>>                 Debug.logError(se, "Cannot suspend transaction: " +
>> se.getMessage(), module);
>>             } catch (GenericTransactionException e) {
>>                 Debug.logError(e, "Cannot begin nested transaction:
>> " +
>> e.getMessage(), module);
>>             }
>>
>>
>> The exception is as follows:
>>
>> 2006-08-08 11:22:51,099 (http-0.0.0.0-8443-Processor3) [
>> ServiceDispatcher.java:468:DEBUG] [[ASync service started...-
>> total:0.0,since last(Begin):0.0]] - 'leadmgt / processWf'
>> 2006-08-08 11:22:58,700 (http-0.0.0.0-8443-Processor3) [
>> TransactionUtil.java:530:WARN ]
>> ---- exception report
>> ----------------------------------------------------------
>> WARNING: In setTransactionBeginStack a stack placeholder was
>> already in
>> place, here is where the transaction began:
>> Exception: java.lang.Exception
>> Message: Tx Stack Placeholder
>> ---- stack trace
>> ---------------------------------------------------------------
>> java.lang.Exception: Tx Stack Placeholder
>> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack
>> (
>> Transa
>> ctionUtil.java:524)
>> org.ofbiz.entity.transaction.TransactionUtil.begin
>> (TransactionUtil.java:111)
>> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
>> 498)
>> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
>> 620)
>> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
>> 181)
>> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
>> 188)
>> org.ofbiz.webapp.event.ServiceEventHandler.invoke
>> (ServiceEventHandler.java:2
>> 90)
>> org.ofbiz.webapp.control.RequestHandler.runEvent
>> (RequestHandler.java:407)
>> <+++.-.-.-.-.-.... Snip>
>> ---------------------------------------------------------------------
>> -
>> ------
>> ----
>>
>> 2006-08-08 11:22:58,700 (http-0.0.0.0-8443-Processor3) [
>> TransactionUtil.java:532:WARN ]
>> ---- exception report
>> ----------------------------------------------------------
>> WARNING: In setTransactionBeginStack a stack placeholder was
>> already in
>> place, here is the current location:
>> Exception: java.lang.Exception
>> Message: Current Stack Trace
>> ---- stack trace
>> ---------------------------------------------------------------
>> java.lang.Exception: Current Stack Trace
>> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack
>> (
>> Transa
>> ctionUtil.java:531)
>> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack
>> (
>> Transa
>> ctionUtil.java:525)
>> org.ofbiz.entity.transaction.TransactionUtil.begin
>> (TransactionUtil.java:111)
>> org.ofbiz.entity.transaction.TransactionUtil.begin
>> (TransactionUtil.java:57)
>> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:100)
>> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
>> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
>> 553)
>> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
>> 620)
>> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
>> 181)
>> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
>> 188)
>> org.ofbiz.webapp.event.ServiceEventHandler.invoke
>> (ServiceEventHandler.java:2
>> 90)
>> org.ofbiz.webapp.control.RequestHandler.runEvent
>> (RequestHandler.java:407)
>> <+++.-.-.-.-.-.... Snip>
>> ---------------------------------------------------------------------
>> -
>> ------
>> ----
>>
>> 2006-08-08 11:22:58,710 (http-0.0.0.0-8443-Processor3) [
>> WfProcessMgrImpl.java:97 :INFO ] [WfProcessMgr.init] : Create process
>> manager (org.ofbiz.leadmgt[null] / processWf[null])
>> 2006-08-08 11:22:58,730 (http-0.0.0.0-8443-Processor3) [
>> ServiceDispatcher.java:564:DEBUG] [[ASync service failed...-
>> total:7.631,since last(ASync service sta...):7.631]] - 'leadmgt /
>> processWf'
>> 2006-08-08 11:22:58,730 (http-0.0.0.0-8443-Processor3) [
>> ServiceDispatcher.java:567:ERROR]
>> ---- exception report
>> ----------------------------------------------------------
>> Service [processWf] threw an unexpected exception/error
>> Exception: org.ofbiz.service.GenericServiceException
>> Message: Cannot resume transaction (Caller context is not an
>> unspecified
>> transaction context)
>> ---- stack trace
>> ---------------------------------------------------------------
>> org.ofbiz.service.GenericServiceException: Cannot resume
>> transaction (Caller
>> context is not an unspecified transaction context)
>> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:281)
>> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
>> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
>> 553)
>> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
>> 620)
>> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
>> 181)
>>
>>
>>
>>
>
> <WorkflowEngine.zip>

Reply | Threaded
Open this post in threaded view
|

Re: XSD schema conversion anyone?

Iain Fogg
In reply to this post by David E Jones-2
David,

Basically I'm looking to augment the standard OFBiz functionality with
functionality specifically required in the book selling business. As an
absolute minimum, I need to be able to periodically refresh the OFBiz
product and supplier data with a subset of the ONIX data (new titles,
price changes, supplier info, etc).  I also want to look at ways of
providing a richer set of search options specific to the book trade (eg,
title, publisher, ISBN, etc), and to have all of the ONIX data available
for back-office (and sometimes front-of-house) enquiries.

I've seen it suggested that one of the ways to provide richer content in
the OFBiz Product database is to use the Feature mechanism. I've played
around with this a little bit, and it might work, but I'd need to be
convinced about performance and maintainability. The ONIX dataset can
contain hundreds of thousands of records, and modelling these with the
OFBiz Feature feature seems a bit clumsy. I'm not sure what the impact
would be on search queries.

I'm still exploring  my requirements, and at this stage about the only
thing I know for sure is that I need to synch ONIX data with OFBiz to
ensure OFBiz is using up-to-date info. Probably the other  thing I know
for sure is that I need richer search options, and response needs to be  
reasonable.

At the end of the day, one of the things I need to work out is how to
"integrate" (and I use the term loosely), ONIX and OFBiz.

Cheers, Iain


David E. Jones wrote:

>
> Is the intent to map it to the OFBiz data model or services? I'm  
> guessing that's not the case if you're trying to create entities to  
> represent it.
>
> If you're trying to create a data model for an XML Schema and not  
> mapping it to an existing data model, then you'll have to design a  
> data model to match it. XML is an hierarchical data structure which  
> is very different from a relational (table-based) one. Some design  
> will have to be done to decide how to structure things because there  
> are no natural equivalencies. There are, of course, some common  
> patterns for dealing with hierarchical and other structures in SQL,  
> but doing an effective mapping requires more of an understanding of  
> the data model so that the same data can be captured in both places  
> and this is very difficult to automate. You might find some  
> commercial tools that give you a good first pass though... ie to go  
> from XSD to SQL DDL.
>
> -David
>
>
> On Aug 7, 2006, at 6:51 PM, Iain Fogg wrote:
>
>> Chris,
>>
>> Good question, and this probably exposes my ignorance of XST. Maybe  
>> it's not the right technology. Maybe I need to find a tool that can  
>> translate from XSD -> SQL. Then it would be straightforward to map  
>> the relational table defs to the OFBiz entity def. My small brain  
>> can't get round the mapping of the hierarchical XML Schema to a  
>> relational one - at least not given it's size. Maybe when I was  
>> younger :-)
>>
>> In case anyone is interested, the schema I want to map is the ONIX  
>> schema (used in the book trade).
>>
>> Cheers, Iain
>>
>> Chris Howe wrote:
>>
>>> Correct me if I'm wrong, but wouldn't you need to know
>>> what the source elements are in order to make an XST
>>> to entity def?  Absent knowing the structure of your
>>> source it wouldn't matter what someone else's XST
>>> looks like, it wouldn't work with yours.
>>>
>>> --- Iain Fogg <[hidden email]> wrote:
>>>
>>>
>>>> That's my question...has anyone already buit an XST
>>>> to do the conversion to OFBiz Entity defs?
>>>>
>>>> BJ Freeman wrote:
>>>>
>>>>
>>>>> the XSD defines the layout.
>>>>> the XML is where the Entities definitions are.
>>>>> you can try using an XST file to convert.
>>>>>
>>>>> Iain Fogg sent the following on 8/7/2006 7:53 AM:
>>>>>
>>>>>
>>>>>> I have a slightly complicated XML Schema (.xsd)
>>>>>>
>>>> that I would like to
>>>>
>>>>>> import into OFBiz.
>>>>>>
>>>>>> Has anyone written a tool to convert XML schemas
>>>>>>
>>>> into OFBiz  entity
>>>>
>>>>>> definitions?
>>>>>>
>>>>>> Cheers, Iain
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> --
>>>> No virus found in this outgoing message.
>>>> Checked by AVG Free Edition.
>>>> Version: 7.1.405 / Virus Database: 268.10.7/411 -
>>>> Release Date: 7/08/2006
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>> --
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition.
>> Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date:  
>> 7/08/2006
>>
>
>
>



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 7/08/2006

Reply | Threaded
Open this post in threaded view
|

Re: XSD schema conversion anyone?

David E Jones-2

That's a little bit different then...

What you probably need/want is some code to take in the incoming ONIX  
files and map the information to existing OFBiz entities rather than  
creating new ones.

As you're doing the mapping you'll get into the issue you brought up  
here about what should go where. Different things will most likely be  
best handled in different ways. For example, the "publisher" would be  
handled well by a ProductFeature, but the title and ISBN would not as  
they are unique to each book. Those could be put into ProductContent  
records (with new ProductContentTypes) and handled with existing  
code, or perhaps even just added as fields to the Product entity, and  
then only small changes would be needed in the ProductSearch code (or  
no changes... it's been a while since I wrote it so I don't remember  
exactly).

In any case, I think you'll find pretty flexible and efficient  
performing search capabilities in the ProductSearch stuff. Make sure  
you're looking at a moderately recent version of OFBiz (ie not one of  
the ancient releases, like 3.0.0 or something).

-David


On Aug 8, 2006, at 12:43 AM, Iain Fogg wrote:

> David,
>
> Basically I'm looking to augment the standard OFBiz functionality  
> with functionality specifically required in the book selling  
> business. As an absolute minimum, I need to be able to periodically  
> refresh the OFBiz product and supplier data with a subset of the  
> ONIX data (new titles, price changes, supplier info, etc).  I also  
> want to look at ways of providing a richer set of search options  
> specific to the book trade (eg, title, publisher, ISBN, etc), and  
> to have all of the ONIX data available for back-office (and  
> sometimes front-of-house) enquiries.
>
> I've seen it suggested that one of the ways to provide richer  
> content in the OFBiz Product database is to use the Feature  
> mechanism. I've played around with this a little bit, and it might  
> work, but I'd need to be convinced about performance and  
> maintainability. The ONIX dataset can contain hundreds of thousands  
> of records, and modelling these with the OFBiz Feature feature  
> seems a bit clumsy. I'm not sure what the impact would be on search  
> queries.
>
> I'm still exploring  my requirements, and at this stage about the  
> only thing I know for sure is that I need to synch ONIX data with  
> OFBiz to ensure OFBiz is using up-to-date info. Probably the other  
> thing I know for sure is that I need richer search options, and  
> response needs to be  reasonable.
>
> At the end of the day, one of the things I need to work out is how  
> to "integrate" (and I use the term loosely), ONIX and OFBiz.
>
> Cheers, Iain
>
>
> David E. Jones wrote:
>
>>
>> Is the intent to map it to the OFBiz data model or services? I'm  
>> guessing that's not the case if you're trying to create entities  
>> to  represent it.
>>
>> If you're trying to create a data model for an XML Schema and not  
>> mapping it to an existing data model, then you'll have to design  
>> a  data model to match it. XML is an hierarchical data structure  
>> which  is very different from a relational (table-based) one. Some  
>> design  will have to be done to decide how to structure things  
>> because there  are no natural equivalencies. There are, of course,  
>> some common  patterns for dealing with hierarchical and other  
>> structures in SQL,  but doing an effective mapping requires more  
>> of an understanding of  the data model so that the same data can  
>> be captured in both places  and this is very difficult to  
>> automate. You might find some  commercial tools that give you a  
>> good first pass though... ie to go  from XSD to SQL DDL.
>>
>> -David
>>
>>
>> On Aug 7, 2006, at 6:51 PM, Iain Fogg wrote:
>>
>>> Chris,
>>>
>>> Good question, and this probably exposes my ignorance of XST.  
>>> Maybe  it's not the right technology. Maybe I need to find a tool  
>>> that can  translate from XSD -> SQL. Then it would be  
>>> straightforward to map  the relational table defs to the OFBiz  
>>> entity def. My small brain  can't get round the mapping of the  
>>> hierarchical XML Schema to a  relational one - at least not given  
>>> it's size. Maybe when I was  younger :-)
>>>
>>> In case anyone is interested, the schema I want to map is the  
>>> ONIX  schema (used in the book trade).
>>>
>>> Cheers, Iain
>>>
>>> Chris Howe wrote:
>>>
>>>> Correct me if I'm wrong, but wouldn't you need to know
>>>> what the source elements are in order to make an XST
>>>> to entity def?  Absent knowing the structure of your
>>>> source it wouldn't matter what someone else's XST
>>>> looks like, it wouldn't work with yours.
>>>>
>>>> --- Iain Fogg <[hidden email]> wrote:
>>>>
>>>>
>>>>> That's my question...has anyone already buit an XST
>>>>> to do the conversion to OFBiz Entity defs?
>>>>>
>>>>> BJ Freeman wrote:
>>>>>
>>>>>
>>>>>> the XSD defines the layout.
>>>>>> the XML is where the Entities definitions are.
>>>>>> you can try using an XST file to convert.
>>>>>>
>>>>>> Iain Fogg sent the following on 8/7/2006 7:53 AM:
>>>>>>
>>>>>>
>>>>>>> I have a slightly complicated XML Schema (.xsd)
>>>>>>>
>>>>> that I would like to
>>>>>
>>>>>>> import into OFBiz.
>>>>>>>
>>>>>>> Has anyone written a tool to convert XML schemas
>>>>>>>
>>>>> into OFBiz  entity
>>>>>
>>>>>>> definitions?
>>>>>>>
>>>>>>> Cheers, Iain
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> No virus found in this outgoing message.
>>>>> Checked by AVG Free Edition.
>>>>> Version: 7.1.405 / Virus Database: 268.10.7/411 -
>>>>> Release Date: 7/08/2006
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> No virus found in this outgoing message.
>>> Checked by AVG Free Edition.
>>> Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date:  
>>> 7/08/2006
>>>
>>
>>
>>
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date:  
> 7/08/2006
>

Reply | Threaded
Open this post in threaded view
|

Re: XSD schema conversion anyone?

Iain Fogg
David,

You probably worked out that I've only been playing with OFBiz for a few
weeks :-)

Yep, I've got the SVN from a day or two back.

Thanks for the pointer to being able to create new product content types
- I'll have to look into those.

Cheers, Iain

David E Jones wrote:

>
> That's a little bit different then...
>
> What you probably need/want is some code to take in the incoming ONIX  
> files and map the information to existing OFBiz entities rather than  
> creating new ones.
>
> As you're doing the mapping you'll get into the issue you brought up  
> here about what should go where. Different things will most likely be  
> best handled in different ways. For example, the "publisher" would be  
> handled well by a ProductFeature, but the title and ISBN would not as  
> they are unique to each book. Those could be put into ProductContent  
> records (with new ProductContentTypes) and handled with existing  
> code, or perhaps even just added as fields to the Product entity, and  
> then only small changes would be needed in the ProductSearch code (or  
> no changes... it's been a while since I wrote it so I don't remember  
> exactly).
>
> In any case, I think you'll find pretty flexible and efficient  
> performing search capabilities in the ProductSearch stuff. Make sure  
> you're looking at a moderately recent version of OFBiz (ie not one of  
> the ancient releases, like 3.0.0 or something).
>
> -David
>
>
> On Aug 8, 2006, at 12:43 AM, Iain Fogg wrote:
>
>> David,
>>
>> Basically I'm looking to augment the standard OFBiz functionality  
>> with functionality specifically required in the book selling  
>> business. As an absolute minimum, I need to be able to periodically  
>> refresh the OFBiz product and supplier data with a subset of the  
>> ONIX data (new titles, price changes, supplier info, etc).  I also  
>> want to look at ways of providing a richer set of search options  
>> specific to the book trade (eg, title, publisher, ISBN, etc), and  to
>> have all of the ONIX data available for back-office (and  sometimes
>> front-of-house) enquiries.
>>
>> I've seen it suggested that one of the ways to provide richer  
>> content in the OFBiz Product database is to use the Feature  
>> mechanism. I've played around with this a little bit, and it might  
>> work, but I'd need to be convinced about performance and  
>> maintainability. The ONIX dataset can contain hundreds of thousands  
>> of records, and modelling these with the OFBiz Feature feature  seems
>> a bit clumsy. I'm not sure what the impact would be on search  queries.
>>
>> I'm still exploring  my requirements, and at this stage about the  
>> only thing I know for sure is that I need to synch ONIX data with  
>> OFBiz to ensure OFBiz is using up-to-date info. Probably the other  
>> thing I know for sure is that I need richer search options, and  
>> response needs to be  reasonable.
>>
>> At the end of the day, one of the things I need to work out is how  
>> to "integrate" (and I use the term loosely), ONIX and OFBiz.
>>
>> Cheers, Iain
>>
>>
>> David E. Jones wrote:
>>
>>>
>>> Is the intent to map it to the OFBiz data model or services? I'm  
>>> guessing that's not the case if you're trying to create entities  
>>> to  represent it.
>>>
>>> If you're trying to create a data model for an XML Schema and not  
>>> mapping it to an existing data model, then you'll have to design  a  
>>> data model to match it. XML is an hierarchical data structure  
>>> which  is very different from a relational (table-based) one. Some  
>>> design  will have to be done to decide how to structure things  
>>> because there  are no natural equivalencies. There are, of course,  
>>> some common  patterns for dealing with hierarchical and other  
>>> structures in SQL,  but doing an effective mapping requires more  of
>>> an understanding of  the data model so that the same data can  be
>>> captured in both places  and this is very difficult to  automate.
>>> You might find some  commercial tools that give you a  good first
>>> pass though... ie to go  from XSD to SQL DDL.
>>>
>>> -David
>>>
>>>
>>> On Aug 7, 2006, at 6:51 PM, Iain Fogg wrote:
>>>
>>>> Chris,
>>>>
>>>> Good question, and this probably exposes my ignorance of XST.  
>>>> Maybe  it's not the right technology. Maybe I need to find a tool  
>>>> that can  translate from XSD -> SQL. Then it would be  
>>>> straightforward to map  the relational table defs to the OFBiz  
>>>> entity def. My small brain  can't get round the mapping of the  
>>>> hierarchical XML Schema to a  relational one - at least not given  
>>>> it's size. Maybe when I was  younger :-)
>>>>
>>>> In case anyone is interested, the schema I want to map is the  
>>>> ONIX  schema (used in the book trade).
>>>>
>>>> Cheers, Iain
>>>>
>>>> Chris Howe wrote:
>>>>
>>>>> Correct me if I'm wrong, but wouldn't you need to know
>>>>> what the source elements are in order to make an XST
>>>>> to entity def?  Absent knowing the structure of your
>>>>> source it wouldn't matter what someone else's XST
>>>>> looks like, it wouldn't work with yours.
>>>>>
>>>>> --- Iain Fogg <[hidden email]> wrote:
>>>>>
>>>>>
>>>>>> That's my question...has anyone already buit an XST
>>>>>> to do the conversion to OFBiz Entity defs?
>>>>>>
>>>>>> BJ Freeman wrote:
>>>>>>
>>>>>>
>>>>>>> the XSD defines the layout.
>>>>>>> the XML is where the Entities definitions are.
>>>>>>> you can try using an XST file to convert.
>>>>>>>
>>>>>>> Iain Fogg sent the following on 8/7/2006 7:53 AM:
>>>>>>>
>>>>>>>
>>>>>>>> I have a slightly complicated XML Schema (.xsd)
>>>>>>>>
>>>>>> that I would like to
>>>>>>
>>>>>>>> import into OFBiz.
>>>>>>>>
>>>>>>>> Has anyone written a tool to convert XML schemas
>>>>>>>>
>>>>>> into OFBiz  entity
>>>>>>
>>>>>>>> definitions?
>>>>>>>>
>>>>>>>> Cheers, Iain
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> No virus found in this outgoing message.
>>>>>> Checked by AVG Free Edition.
>>>>>> Version: 7.1.405 / Virus Database: 268.10.7/411 -
>>>>>> Release Date: 7/08/2006
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> No virus found in this outgoing message.
>>>> Checked by AVG Free Edition.
>>>> Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date:  
>>>> 7/08/2006
>>>>
>>>
>>>
>>>
>>
>>
>>
>> --
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition.
>> Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date:  
>> 7/08/2006
>>
>
>
>



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 7/08/2006

Reply | Threaded
Open this post in threaded view
|

RE: Transaction problem with ofbiz-workflow start (geronimo issue????)

David Garrett
In reply to this post by David Garrett
 
Thanks,

I had tried these changes but they still create an error on the resume
(module attached).

I am "happy" to try to clean up the transaction processing but before I
start I'd just like to check ...

Am I better fixing the ofbiz-workflow legacy code or is Shark sufficiently
working that I can use Shark?

I am not after a full Shark implemenation. All I am looking for is a similar
level of implementation as previously was available.

So ... Is the Ofbiz/shark likely to run my simple workflows?

If you think I can get them working ... My efforts may be better spent on
incremental improvements to Shark.

David G

PS I have attached a mimimal module that shows the resume failure.

-----Original Message-----
From: David E Jones [mailto:[hidden email]]
Sent: Tuesday, 8 August 2006 4:41 PM
To: [hidden email]
Subject: Re: Transaction problem with ofbiz-workflow start (geronimo
issue????)


David,

In rev 429598 I committed some changes to use TransactionUtil instead of tm,
and that should take care of the warnings.

For the actual error you're getting: the transaction management code in that
class is a mess. The way it uses try/catch blocks is just so wrong for safe
transaction management, and I'm not sure if I want to reorganize the whole
thing right now (especially not for something that I'd like to see disappear
altogether anyway, with future efforts going into the Shark integration
which must be scary because no one has touched it for quite a while, ie
hardly anything since Andy ended his efforts on it)...

If you are interested in pursuing this the proper way to do such things is
basically to use 2 and only 2 try/catch blocks, one inside the other. The
outside one should handle the suspend/resume (with the resume in the finally
block) and the inside one should handle the begin/rollback/commit (with the
rollback/commit in the finally block).

A good example to look at is in the ServiceDispatcher.java file, in the
runSync method that starts on line 239.

It may be that once this transaction issue is cleaned up you'll really find
some dumb little error (or bad little error) that just isn't being handled
correctly, and because the tx management code is just SO bad in this method
it is showing up as a tx problem...

-David J.


On Aug 8, 2006, at 12:11 AM, David Garrett wrote:

> Thankyou!
>
> The code I am using is about 2 weeks old.
>
> I checked the code for WorkflowEngine.java is the same as the current.
>
> So are you suggesting update the calls in
> org.ofbiz.workflow.WorkflowEngine as below. This creates a similar
> exception in the resume (which is also changed).
>
> To call as follows
>         //CHANGE ... remove TransactionManager tm =
> TransactionFactory.getTransactionManager();
>         //if (tm == null) {
>         //    throw new GenericServiceException("Cannot get the  
> transaction
> manager; cannot run persisted services.");
>         //}
>
>         Transaction parentTrans = null;
>         boolean beganTransaction = false;
>         try {
>             try {
>                 parentTrans = TransactionUtil.suspend();
>                 beganTransaction = TransactionUtil.begin();
>                 //Debug.logInfo("Suspended transaction; began new: " +
> beganTransaction, module);
> //            } catch (SystemException se) {
> //                Debug.logError(se, "Cannot suspend transaction: " +
> se.getMessage(), module);
>             } catch (GenericTransactionException e) {
>                 Debug.logError(e, "Cannot begin nested transaction:  
> " +
> e.getMessage(), module);
>             }
>
>
> AND
>
>                     try
>                     {
>                         // REMOVE tm.resume(parentTrans);
>                         TransactionUtil.resume(parentTrans);
>                         //Debug.logInfo("Resumed the parent
> transaction.", module);
>                     }
>                     catch (GenericTransactionException e)
>                     {
>                       throw new GenericServiceException("Cannot resume
> transaction", e);
>                     }
> //                } catch (InvalidTransactionException ite) {
> //                    throw new GenericServiceException("Cannot resume
> transaction", ite);
> //                } catch (SystemException se) {
> //                    throw new GenericServiceException("Unexpected
> transaction error", se);
> //                }
>
>
>
>
>
> 2006-08-08 15:44:36,138 (http-0.0.0.0-8443-Processor3) [
> TransactionUtil.java:530:WARN ]
> ---- exception report
> ----------------------------------------------------------
> WARNING: In setTransactionBeginStack a stack placeholder was  
> already in
> place, here is where the transaction began:
> Exception: java.lang.Exception
> Message: Tx Stack Placeholder
> ---- stack trace
> ---------------------------------------------------------------
> java.lang.Exception: Tx Stack Placeholder
> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(
> Transa
> ctionUtil.java:524)
> org.ofbiz.entity.transaction.TransactionUtil.begin
> (TransactionUtil.java:111)
> org.ofbiz.entity.transaction.TransactionUtil.begin
> (TransactionUtil.java:57)
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:100)
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 553)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 620)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 181)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 188)
> org.ofbiz.webapp.event.ServiceEventHandler.invoke
> (ServiceEventHandler.java:2
> 90)
> .... SNIP
> ----------------------------------------------------------------------
> ------
> ----
>
> 2006-08-08 15:44:36,148 (http-0.0.0.0-8443-Processor3) [
> TransactionUtil.java:532:WARN ]
> ---- exception report
> ----------------------------------------------------------
> WARNING: In setTransactionBeginStack a stack placeholder was  
> already in
> place, here is the current location:
> Exception: java.lang.Exception
> Message: Current Stack Trace
> ---- stack trace
> ---------------------------------------------------------------
> java.lang.Exception: Current Stack Trace
> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack(
> Transa
> ctionUtil.java:531)
> org.ofbiz.entity.transaction.TransactionUtil.resume
> (TransactionUtil.java:321
> )
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:280)
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 553)
> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
> 620)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 181)
> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
> 188)
> org.ofbiz.webapp.event.ServiceEventHandler.invoke
> (ServiceEventHandler.java:2
> 90)
> .... SNIP
> ----------------------------------------------------------------------
> ------
> ----
>
> 2006-08-08 15:44:36,148 (http-0.0.0.0-8443-Processor3) [
> ServiceDispatcher.java:564:DEBUG] [[ASync service failed...-
> total:4.496,since last(ASync service sta...):4.496]] - 'leadmgt /  
> processWf'
> 2006-08-08 15:44:36,148 (http-0.0.0.0-8443-Processor3) [
> ServiceDispatcher.java:567:ERROR]
> ---- exception report
> ----------------------------------------------------------
> Service [processWf] threw an unexpected exception/error
> Exception: org.ofbiz.service.GenericServiceException
> Message: Cannot resume transaction (System error, could not resume
> transaction (Caller context is not an unspecified transaction  
> context))
> ---- stack trace
> ---------------------------------------------------------------
> org.ofbiz.service.GenericServiceException: Cannot resume  
> transaction (System
> error, could not resume transaction (Caller context is not an  
> unspecified
> transaction context))
> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:285)
>
> -----Original Message-----
> From: David E Jones [mailto:[hidden email]]
> Sent: Tuesday, 8 August 2006 2:44 PM
> To: [hidden email]
> Subject: Re: Transaction problem with ofbiz-workflow start (geronimo
> issue????)
>
>
> Without looking into it more, I'm not sure...
>
> Which revision of OFBiz are you updating to?
>
> The code you included in your last message for the tx management in  
> the
> workflow engine is a little fishy, it it's not doing the suspend  
> correctly
> and such. It should use the TransactionUtil.suspend method and not  
> do it
> itself.
>
> Still the way it is doing it should only cause warnings and  
> hopefully allow
> things to continue just fine.
>
> But yeah, changing it to use the TransactionUtil methods instead of  
> the
> tm.suspect and tm.resume directly should solve the problem.
>
> -David
>
>
> On Aug 7, 2006, at 10:21 PM, David Garrett wrote:
>
>> More Information ... Hopefully simplified:
>>
>> I try to start the ofbiz-workflow by calling an async service from an
>> event as follows
>>     <request-map uri="processWf">
>>         <security https="true" auth="true"/>
>>         <event type="service" path="async" invoke="processWf"/>
>>         <response name="success" type="view" value="main"/>
>>         <response name="error" type="view" value="main"/>
>>     </request-map>
>> It calls the following service
>>     <service name="processWf" engine="ofbiz-workflow"
>> location="org.ofbiz.leadmgt" invoke="processWf" >
>>         <description>Service for testing workflow engine</
>> description>
>>         <attribute name="communicationEventId" type="String"
>> mode="INOUT"
>> optional="true"/>
>>     </service>
>>
>> Then the problem is with nested transactions below
>>
>> ServiceEventHandler.invoke(...)
>>   dispatcher.runAsync(serviceName, serviceContext); //
>> ServiceEventHandler line 290
>>     ServiceDispatcher.runAsync(...)
>>       // First transaction starts OK
>>       beganTrans = TransactionUtil.begin(service.transactionTimeout);
>> //ServiceDispatcher.runAsync line 498)
>>       ...
>>       engine.runAsync(...); //ServiceDispatcher.runAsync line 553)
>>         WorkflowEngine.runAsync(...)
>>           // 2nd transaction begin FAILS
>>           beganTransaction = TransactionUtil.begin();
>> //WorkflowEngine.runAsync line 100
>>             ...
>>             TransactionUtil.setTransactionBeginStack()   <==##
>> transaction
>> already exists
>>
>>
>> Why can't the second transaction begin?
>>
>> Should I start the workflow a different way which does not cause 2
>> transactions.
>>
>> Do I need to remove the transaction within the workflow?
>>
>> Thanks
>> David G
>>
>> -----Original Message-----
>> From: David Garrett [mailto:[hidden email]]
>> Sent: Tuesday, 8 August 2006 11:40 AM
>> To: [hidden email]
>> Subject: Transaction problem with ofbiz-workflow start (geronimo
>> issue????)
>>
>> Hi,
>>
>> I am trying to upgrade to a much more recent version of Ofbiz.
>>
>> The problem I have is starting a workflow with the orignial ofbiz-
>> workflow
>> (ie not trying to use Shark yet)
>>
>> I was wondering whether the transaction problem related to the
>> change to
>> geronimo TM.
>>
>> I have a VERY simple workflow which is initiated with
>> WorkflowEngine.runAsync(..)
>>
>> Any suggestions appreciated.
>>
>> It fails on:
>>                 beganTransaction = TransactionUtil.begin();
>>
>> The code executed is very small ... In WorkflowEngine
>>     public void runAsync(String localName, ModelService
>> modelService, Map
>> context, GenericRequester requester, boolean persist) throws
>> GenericServiceException {
>>         // Suspend the current transaction
>>         TransactionManager tm =
>> TransactionFactory.getTransactionManager();
>>         if (tm == null) {
>>             throw new GenericServiceException("Cannot get the
>> transaction
>> manager; cannot run persisted services.");
>>         }
>>
>>         Transaction parentTrans = null;
>>         boolean beganTransaction = false;
>>         try {
>>             try {
>>                 parentTrans = tm.suspend();
>>                 beganTransaction = TransactionUtil.begin();  <======
>> EXCEPTION GENERATED HERE!!!!
>>                 //Debug.logInfo("Suspended transaction; began new:  
>> " +
>> beganTransaction, module);
>>             } catch (SystemException se) {
>>                 Debug.logError(se, "Cannot suspend transaction: " +
>> se.getMessage(), module);
>>             } catch (GenericTransactionException e) {
>>                 Debug.logError(e, "Cannot begin nested transaction:
>> " +
>> e.getMessage(), module);
>>             }
>>
>>
>> The exception is as follows:
>>
>> 2006-08-08 11:22:51,099 (http-0.0.0.0-8443-Processor3) [
>> ServiceDispatcher.java:468:DEBUG] [[ASync service started...-
>> total:0.0,since last(Begin):0.0]] - 'leadmgt / processWf'
>> 2006-08-08 11:22:58,700 (http-0.0.0.0-8443-Processor3) [
>> TransactionUtil.java:530:WARN ]
>> ---- exception report
>> ----------------------------------------------------------
>> WARNING: In setTransactionBeginStack a stack placeholder was
>> already in
>> place, here is where the transaction began:
>> Exception: java.lang.Exception
>> Message: Tx Stack Placeholder
>> ---- stack trace
>> ---------------------------------------------------------------
>> java.lang.Exception: Tx Stack Placeholder
>> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack
>> (
>> Transa
>> ctionUtil.java:524)
>> org.ofbiz.entity.transaction.TransactionUtil.begin
>> (TransactionUtil.java:111)
>> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
>> 498)
>> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
>> 620)
>> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
>> 181)
>> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
>> 188)
>> org.ofbiz.webapp.event.ServiceEventHandler.invoke
>> (ServiceEventHandler.java:2
>> 90)
>> org.ofbiz.webapp.control.RequestHandler.runEvent
>> (RequestHandler.java:407)
>> <+++.-.-.-.-.-.... Snip>
>> ---------------------------------------------------------------------
>> -
>> ------
>> ----
>>
>> 2006-08-08 11:22:58,700 (http-0.0.0.0-8443-Processor3) [
>> TransactionUtil.java:532:WARN ]
>> ---- exception report
>> ----------------------------------------------------------
>> WARNING: In setTransactionBeginStack a stack placeholder was
>> already in
>> place, here is the current location:
>> Exception: java.lang.Exception
>> Message: Current Stack Trace
>> ---- stack trace
>> ---------------------------------------------------------------
>> java.lang.Exception: Current Stack Trace
>> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack
>> (
>> Transa
>> ctionUtil.java:531)
>> org.ofbiz.entity.transaction.TransactionUtil.setTransactionBeginStack
>> (
>> Transa
>> ctionUtil.java:525)
>> org.ofbiz.entity.transaction.TransactionUtil.begin
>> (TransactionUtil.java:111)
>> org.ofbiz.entity.transaction.TransactionUtil.begin
>> (TransactionUtil.java:57)
>> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:100)
>> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
>> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
>> 553)
>> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
>> 620)
>> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
>> 181)
>> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
>> 188)
>> org.ofbiz.webapp.event.ServiceEventHandler.invoke
>> (ServiceEventHandler.java:2
>> 90)
>> org.ofbiz.webapp.control.RequestHandler.runEvent
>> (RequestHandler.java:407)
>> <+++.-.-.-.-.-.... Snip>
>> ---------------------------------------------------------------------
>> -
>> ------
>> ----
>>
>> 2006-08-08 11:22:58,710 (http-0.0.0.0-8443-Processor3) [
>> WfProcessMgrImpl.java:97 :INFO ] [WfProcessMgr.init] : Create process
>> manager (org.ofbiz.leadmgt[null] / processWf[null])
>> 2006-08-08 11:22:58,730 (http-0.0.0.0-8443-Processor3) [
>> ServiceDispatcher.java:564:DEBUG] [[ASync service failed...-
>> total:7.631,since last(ASync service sta...):7.631]] - 'leadmgt /
>> processWf'
>> 2006-08-08 11:22:58,730 (http-0.0.0.0-8443-Processor3) [
>> ServiceDispatcher.java:567:ERROR]
>> ---- exception report
>> ----------------------------------------------------------
>> Service [processWf] threw an unexpected exception/error
>> Exception: org.ofbiz.service.GenericServiceException
>> Message: Cannot resume transaction (Caller context is not an
>> unspecified
>> transaction context)
>> ---- stack trace
>> ---------------------------------------------------------------
>> org.ofbiz.service.GenericServiceException: Cannot resume
>> transaction (Caller
>> context is not an unspecified transaction context)
>> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:281)
>> org.ofbiz.workflow.WorkflowEngine.runAsync(WorkflowEngine.java:82)
>> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
>> 553)
>> org.ofbiz.service.ServiceDispatcher.runAsync(ServiceDispatcher.java:
>> 620)
>> org.ofbiz.service.GenericDispatcher.runAsync(GenericDispatcher.java:
>> 181)
>>
>>
>>
>>
>
> <WorkflowEngine.zip>



Reply | Threaded
Open this post in threaded view
|

Re: XSD schema conversion anyone?

cjhowe
In reply to this post by David E Jones-2
Except for there not currently being a ProductRole
entity, why wouldn't the publisher be handled as a
party?



--- David E Jones <[hidden email]>
wrote:

>
> That's a little bit different then...
>
> What you probably need/want is some code to take in
> the incoming ONIX  
> files and map the information to existing OFBiz
> entities rather than  
> creating new ones.
>
> As you're doing the mapping you'll get into the
> issue you brought up  
> here about what should go where. Different things
> will most likely be  
> best handled in different ways. For example, the
> "publisher" would be  
> handled well by a ProductFeature, but the title and
> ISBN would not as  
> they are unique to each book. Those could be put
> into ProductContent  
> records (with new ProductContentTypes) and handled
> with existing  
> code, or perhaps even just added as fields to the
> Product entity, and  
> then only small changes would be needed in the
> ProductSearch code (or  
> no changes... it's been a while since I wrote it so
> I don't remember  
> exactly).
>
> In any case, I think you'll find pretty flexible and
> efficient  
> performing search capabilities in the ProductSearch
> stuff. Make sure  
> you're looking at a moderately recent version of
> OFBiz (ie not one of  
> the ancient releases, like 3.0.0 or something).
>
> -David
>
>
> On Aug 8, 2006, at 12:43 AM, Iain Fogg wrote:
>
> > David,
> >
> > Basically I'm looking to augment the standard
> OFBiz functionality  
> > with functionality specifically required in the
> book selling  
> > business. As an absolute minimum, I need to be
> able to periodically  
> > refresh the OFBiz product and supplier data with a
> subset of the  
> > ONIX data (new titles, price changes, supplier
> info, etc).  I also  
> > want to look at ways of providing a richer set of
> search options  
> > specific to the book trade (eg, title, publisher,
> ISBN, etc), and  
> > to have all of the ONIX data available for
> back-office (and  
> > sometimes front-of-house) enquiries.
> >
> > I've seen it suggested that one of the ways to
> provide richer  
> > content in the OFBiz Product database is to use
> the Feature  
> > mechanism. I've played around with this a little
> bit, and it might  
> > work, but I'd need to be convinced about
> performance and  
> > maintainability. The ONIX dataset can contain
> hundreds of thousands  
> > of records, and modelling these with the OFBiz
> Feature feature  
> > seems a bit clumsy. I'm not sure what the impact
> would be on search  
> > queries.
> >
> > I'm still exploring  my requirements, and at this
> stage about the  
> > only thing I know for sure is that I need to synch
> ONIX data with  
> > OFBiz to ensure OFBiz is using up-to-date info.
> Probably the other  
> > thing I know for sure is that I need richer search
> options, and  
> > response needs to be  reasonable.
> >
> > At the end of the day, one of the things I need to
> work out is how  
> > to "integrate" (and I use the term loosely), ONIX
> and OFBiz.
> >
> > Cheers, Iain
> >
> >
> > David E. Jones wrote:
> >
> >>
> >> Is the intent to map it to the OFBiz data model
> or services? I'm  
> >> guessing that's not the case if you're trying to
> create entities  
> >> to  represent it.
> >>
> >> If you're trying to create a data model for an
> XML Schema and not  
> >> mapping it to an existing data model, then you'll
> have to design  
> >> a  data model to match it. XML is an hierarchical
> data structure  
> >> which  is very different from a relational
> (table-based) one. Some  
> >> design  will have to be done to decide how to
> structure things  
> >> because there  are no natural equivalencies.
> There are, of course,  
> >> some common  patterns for dealing with
> hierarchical and other  
> >> structures in SQL,  but doing an effective
> mapping requires more  
> >> of an understanding of  the data model so that
> the same data can  
> >> be captured in both places  and this is very
> difficult to  
> >> automate. You might find some  commercial tools
> that give you a  
> >> good first pass though... ie to go  from XSD to
> SQL DDL.
> >>
> >> -David
> >>
> >>
> >> On Aug 7, 2006, at 6:51 PM, Iain Fogg wrote:
> >>
> >>> Chris,
> >>>
> >>> Good question, and this probably exposes my
> ignorance of XST.  
> >>> Maybe  it's not the right technology. Maybe I
> need to find a tool  
> >>> that can  translate from XSD -> SQL. Then it
> would be  
> >>> straightforward to map  the relational table
> defs to the OFBiz  
> >>> entity def. My small brain  can't get round the
> mapping of the  
> >>> hierarchical XML Schema to a  relational one -
> at least not given  
> >>> it's size. Maybe when I was  younger :-)
> >>>
> >>> In case anyone is interested, the schema I want
> to map is the  
> >>> ONIX  schema (used in the book trade).
> >>>
> >>> Cheers, Iain
> >>>
> >>> Chris Howe wrote:
> >>>
> >>>> Correct me if I'm wrong, but wouldn't you need
> to know
> >>>> what the source elements are in order to make
> an XST
> >>>> to entity def?  Absent knowing the structure of
> your
> >>>> source it wouldn't matter what someone else's
> XST
> >>>> looks like, it wouldn't work with yours.
> >>>>
> >>>> --- Iain Fogg <[hidden email]> wrote:
> >>>>
> >>>>
> >>>>> That's my question...has anyone already buit
> an XST
> >>>>> to do the conversion to OFBiz Entity defs?
> >>>>>
> >>>>> BJ Freeman wrote:
> >>>>>
> >>>>>
> >>>>>> the XSD defines the layout.
> >>>>>> the XML is where the Entities definitions
> are.
> >>>>>> you can try using an XST file to convert.
> >>>>>>
> >>>>>> Iain Fogg sent the following on 8/7/2006 7:53
> AM:
> >>>>>>
> >>>>>>
> >>>>>>> I have a slightly complicated XML Schema
> (.xsd)
> >>>>>>>
> >>>>> that I would like to
> >>>>>
> >>>>>>> import into OFBiz.
> >>>>>>>
> >>>>>>> Has anyone written a tool to convert XML
> schemas
> >>>>>>>
> >>>>> into OFBiz  entity
> >>>>>
> >>>>>>> definitions?
>
=== message truncated ===

Reply | Threaded
Open this post in threaded view
|

Re: XSD schema conversion anyone?

David E Jones-2

Not if you want to do a parametric search on it.

On Aug 8, 2006, at 1:39 AM, Chris Howe wrote:

> Except for there not currently being a ProductRole
> entity, why wouldn't the publisher be handled as a
> party?
>
>
>
> --- David E Jones <[hidden email]>
> wrote:
>
>>
>> That's a little bit different then...
>>
>> What you probably need/want is some code to take in
>> the incoming ONIX
>> files and map the information to existing OFBiz
>> entities rather than
>> creating new ones.
>>
>> As you're doing the mapping you'll get into the
>> issue you brought up
>> here about what should go where. Different things
>> will most likely be
>> best handled in different ways. For example, the
>> "publisher" would be
>> handled well by a ProductFeature, but the title and
>> ISBN would not as
>> they are unique to each book. Those could be put
>> into ProductContent
>> records (with new ProductContentTypes) and handled
>> with existing
>> code, or perhaps even just added as fields to the
>> Product entity, and
>> then only small changes would be needed in the
>> ProductSearch code (or
>> no changes... it's been a while since I wrote it so
>> I don't remember
>> exactly).
>>
>> In any case, I think you'll find pretty flexible and
>> efficient
>> performing search capabilities in the ProductSearch
>> stuff. Make sure
>> you're looking at a moderately recent version of
>> OFBiz (ie not one of
>> the ancient releases, like 3.0.0 or something).
>>
>> -David
>>
>>
>> On Aug 8, 2006, at 12:43 AM, Iain Fogg wrote:
>>
>>> David,
>>>
>>> Basically I'm looking to augment the standard
>> OFBiz functionality
>>> with functionality specifically required in the
>> book selling
>>> business. As an absolute minimum, I need to be
>> able to periodically
>>> refresh the OFBiz product and supplier data with a
>> subset of the
>>> ONIX data (new titles, price changes, supplier
>> info, etc).  I also
>>> want to look at ways of providing a richer set of
>> search options
>>> specific to the book trade (eg, title, publisher,
>> ISBN, etc), and
>>> to have all of the ONIX data available for
>> back-office (and
>>> sometimes front-of-house) enquiries.
>>>
>>> I've seen it suggested that one of the ways to
>> provide richer
>>> content in the OFBiz Product database is to use
>> the Feature
>>> mechanism. I've played around with this a little
>> bit, and it might
>>> work, but I'd need to be convinced about
>> performance and
>>> maintainability. The ONIX dataset can contain
>> hundreds of thousands
>>> of records, and modelling these with the OFBiz
>> Feature feature
>>> seems a bit clumsy. I'm not sure what the impact
>> would be on search
>>> queries.
>>>
>>> I'm still exploring  my requirements, and at this
>> stage about the
>>> only thing I know for sure is that I need to synch
>> ONIX data with
>>> OFBiz to ensure OFBiz is using up-to-date info.
>> Probably the other
>>> thing I know for sure is that I need richer search
>> options, and
>>> response needs to be  reasonable.
>>>
>>> At the end of the day, one of the things I need to
>> work out is how
>>> to "integrate" (and I use the term loosely), ONIX
>> and OFBiz.
>>>
>>> Cheers, Iain
>>>
>>>
>>> David E. Jones wrote:
>>>
>>>>
>>>> Is the intent to map it to the OFBiz data model
>> or services? I'm
>>>> guessing that's not the case if you're trying to
>> create entities
>>>> to  represent it.
>>>>
>>>> If you're trying to create a data model for an
>> XML Schema and not
>>>> mapping it to an existing data model, then you'll
>> have to design
>>>> a  data model to match it. XML is an hierarchical
>> data structure
>>>> which  is very different from a relational
>> (table-based) one. Some
>>>> design  will have to be done to decide how to
>> structure things
>>>> because there  are no natural equivalencies.
>> There are, of course,
>>>> some common  patterns for dealing with
>> hierarchical and other
>>>> structures in SQL,  but doing an effective
>> mapping requires more
>>>> of an understanding of  the data model so that
>> the same data can
>>>> be captured in both places  and this is very
>> difficult to
>>>> automate. You might find some  commercial tools
>> that give you a
>>>> good first pass though... ie to go  from XSD to
>> SQL DDL.
>>>>
>>>> -David
>>>>
>>>>
>>>> On Aug 7, 2006, at 6:51 PM, Iain Fogg wrote:
>>>>
>>>>> Chris,
>>>>>
>>>>> Good question, and this probably exposes my
>> ignorance of XST.
>>>>> Maybe  it's not the right technology. Maybe I
>> need to find a tool
>>>>> that can  translate from XSD -> SQL. Then it
>> would be
>>>>> straightforward to map  the relational table
>> defs to the OFBiz
>>>>> entity def. My small brain  can't get round the
>> mapping of the
>>>>> hierarchical XML Schema to a  relational one -
>> at least not given
>>>>> it's size. Maybe when I was  younger :-)
>>>>>
>>>>> In case anyone is interested, the schema I want
>> to map is the
>>>>> ONIX  schema (used in the book trade).
>>>>>
>>>>> Cheers, Iain
>>>>>
>>>>> Chris Howe wrote:
>>>>>
>>>>>> Correct me if I'm wrong, but wouldn't you need
>> to know
>>>>>> what the source elements are in order to make
>> an XST
>>>>>> to entity def?  Absent knowing the structure of
>> your
>>>>>> source it wouldn't matter what someone else's
>> XST
>>>>>> looks like, it wouldn't work with yours.
>>>>>>
>>>>>> --- Iain Fogg <[hidden email]> wrote:
>>>>>>
>>>>>>
>>>>>>> That's my question...has anyone already buit
>> an XST
>>>>>>> to do the conversion to OFBiz Entity defs?
>>>>>>>
>>>>>>> BJ Freeman wrote:
>>>>>>>
>>>>>>>
>>>>>>>> the XSD defines the layout.
>>>>>>>> the XML is where the Entities definitions
>> are.
>>>>>>>> you can try using an XST file to convert.
>>>>>>>>
>>>>>>>> Iain Fogg sent the following on 8/7/2006 7:53
>> AM:
>>>>>>>>
>>>>>>>>
>>>>>>>>> I have a slightly complicated XML Schema
>> (.xsd)
>>>>>>>>>
>>>>>>> that I would like to
>>>>>>>
>>>>>>>>> import into OFBiz.
>>>>>>>>>
>>>>>>>>> Has anyone written a tool to convert XML
>> schemas
>>>>>>>>>
>>>>>>> into OFBiz  entity
>>>>>>>
>>>>>>>>> definitions?
>>
> === message truncated ===
>