New delegators for external datasources throw errors

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

New delegators for external datasources throw errors

Christian Carlow-OFBizzer
https://cwiki.apache.org/confluence/display/OFBIZ/Load+Legacy+Data+by
+Connecting+to+the+Legacy+Database
suggests creating a separate delegator to contain the external
datasource <group-map> elements

But, https://cwiki.apache.org/confluence/display/OFBIZ/FAQ+-+Tips
+-+Tricks+-+Cookbook+-+HowTo
says to use the default delegator

Creating a separate delegator causes startup to crash due to the default
delegator not being able to find a helperName in
getModelFieldTypeReader() so getModelFieldType() is performed on null:
return this.getModelFieldTypeReader(entity).getModelFieldType(type);
(GenericDelegator.java:561)

If the <group-map> is redundantly specified in the default delegator
then startup succeeds.

Is this a bug?  Shouldn't <group-map> for the external entity only have
to be specified for the delegator that will use it?

The calling code
org.ofbiz.entity.model.ModelEntityChecker.checkEntities(ModelEntityChecker.java:111) has lines above it accounting for a helperName but just adds to warningList.  Adding a continue statement in place of warningList.add() allows startup to succeed but errors are thrown related to the missing helperName once the external entities are referenced.

Am I missing something when it comes to creating new delegators?  To be
honest I don't really know why I would need a separate one from default?
Can someone explain?

Below is the stacktrace:
Caused by: java.lang.NullPointerException
        at
org.ofbiz.entity.GenericDelegator.getEntityFieldType(GenericDelegator.java:561) ~[ofbiz-entity.jar:?]
        at
org.ofbiz.entity.model.ModelEntityChecker.checkEntities(ModelEntityChecker.java:111) ~[ofbiz-entity.jar:?]
        at org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:224)
~[ofbiz-entity.jar:?]
        at
org.ofbiz.entity.DelegatorFactoryImpl.getInstance(DelegatorFactoryImpl.java:33) ~[ofbiz-entity.jar:?]
        at
org.ofbiz.entity.DelegatorFactoryImpl.getInstance(DelegatorFactoryImpl.java:25) ~[ofbiz-entity.jar:?]
        at
org.ofbiz.base.util.UtilObject.getObjectFromFactory(UtilObject.java:200)
~[ofbiz-base.jar:?]
        at org.ofbiz.entity.DelegatorFactory
$DelegatorConfigurable.call(DelegatorFactory.java:83)
~[ofbiz-entity.jar:?]
        at org.ofbiz.entity.DelegatorFactory
$DelegatorConfigurable.call(DelegatorFactory.java:74)
~[ofbiz-entity.jar:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
~[?:1.8.0_45]
        at java.util.concurrent.Executors
$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_45]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
~[?:1.8.0_45]
        at java.util.concurrent.ScheduledThreadPoolExecutor
$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
~[?:1.8.0_45]
        at java.util.concurrent.ScheduledThreadPoolExecutor
$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
~[?:1.8.0_45]
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_45]
        at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_45]
        at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_45]
java.lang.NullPointerException



Reply | Threaded
Open this post in threaded view
|

Re: New delegators for external datasources throw errors

Adrian Crum-3
No, do not connect a separate delegator. You only want a separate
delegator when you need a different BEHAVIOR, not a different DATA SOURCE.

Adrian Crum
Sandglass Software
www.sandglass-software.com

On 6/16/2015 7:17 PM, Christian Carlow wrote:

> https://cwiki.apache.org/confluence/display/OFBIZ/Load+Legacy+Data+by
> +Connecting+to+the+Legacy+Database
> suggests creating a separate delegator to contain the external
> datasource <group-map> elements
>
> But, https://cwiki.apache.org/confluence/display/OFBIZ/FAQ+-+Tips
> +-+Tricks+-+Cookbook+-+HowTo
> says to use the default delegator
>
> Creating a separate delegator causes startup to crash due to the default
> delegator not being able to find a helperName in
> getModelFieldTypeReader() so getModelFieldType() is performed on null:
> return this.getModelFieldTypeReader(entity).getModelFieldType(type);
> (GenericDelegator.java:561)
>
> If the <group-map> is redundantly specified in the default delegator
> then startup succeeds.
>
> Is this a bug?  Shouldn't <group-map> for the external entity only have
> to be specified for the delegator that will use it?
>
> The calling code
> org.ofbiz.entity.model.ModelEntityChecker.checkEntities(ModelEntityChecker.java:111) has lines above it accounting for a helperName but just adds to warningList.  Adding a continue statement in place of warningList.add() allows startup to succeed but errors are thrown related to the missing helperName once the external entities are referenced.
>
> Am I missing something when it comes to creating new delegators?  To be
> honest I don't really know why I would need a separate one from default?
> Can someone explain?
>
> Below is the stacktrace:
> Caused by: java.lang.NullPointerException
> at
> org.ofbiz.entity.GenericDelegator.getEntityFieldType(GenericDelegator.java:561) ~[ofbiz-entity.jar:?]
> at
> org.ofbiz.entity.model.ModelEntityChecker.checkEntities(ModelEntityChecker.java:111) ~[ofbiz-entity.jar:?]
> at org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:224)
> ~[ofbiz-entity.jar:?]
> at
> org.ofbiz.entity.DelegatorFactoryImpl.getInstance(DelegatorFactoryImpl.java:33) ~[ofbiz-entity.jar:?]
> at
> org.ofbiz.entity.DelegatorFactoryImpl.getInstance(DelegatorFactoryImpl.java:25) ~[ofbiz-entity.jar:?]
> at
> org.ofbiz.base.util.UtilObject.getObjectFromFactory(UtilObject.java:200)
> ~[ofbiz-base.jar:?]
> at org.ofbiz.entity.DelegatorFactory
> $DelegatorConfigurable.call(DelegatorFactory.java:83)
> ~[ofbiz-entity.jar:?]
> at org.ofbiz.entity.DelegatorFactory
> $DelegatorConfigurable.call(DelegatorFactory.java:74)
> ~[ofbiz-entity.jar:?]
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> ~[?:1.8.0_45]
> at java.util.concurrent.Executors
> $RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_45]
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> ~[?:1.8.0_45]
> at java.util.concurrent.ScheduledThreadPoolExecutor
> $ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
> ~[?:1.8.0_45]
> at java.util.concurrent.ScheduledThreadPoolExecutor
> $ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
> ~[?:1.8.0_45]
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_45]
> at java.util.concurrent.ThreadPoolExecutor
> $Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_45]
> at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_45]
> java.lang.NullPointerException
>
>
>