0

I've started learning Ofbiz a few days ago but I fail to follow Ofbiz Tutorial part 3 CRUD (https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Tutorial+-+A+Beginners+Development+Guide). When I start running createPracticePerson service, I get

JavaEventHandler              |E| Problems Processing Event
java.lang.NullPointerException 

at org.ofbiz.service.engine.GenericEngineFactory.getGenericEngine (GenericEngineFactory.java:53) ~[bin/:?] 

at org.ofbiz.service.ServiceDispatcher.getGenericEngine(ServiceDispatcher.java:799) ~[bin/:?] ...

I have tried using other tutorial as reference (http://ofbiz.us/developing-enterprise-application-with-apache-ofbiz-platform), but still get the same error message. I have included some of xml files for reference. Thanks

ofbiz-component.xml

<ofbiz-component name="practice"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
      <resource-loader name="main" type="component"/>
      <classpath type="dir" location="config"/>
      <classpath type="jar" location="build/lib/*"/>      
      <service-resource type="model" loader="main" location="servicedef/services.xml"/>            
    <webapp name="practice"
       title="Practice"
       server="default-server"
       base-permission="OFBTOOLS"
       location="webapp/practice"
       mount-point="/practice"
       app-bar-display="true"/>
</ofbiz-component>

service.xml

<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
    <description>Practice Services</description>
    <vendor>OFBiz</vendor>
    <version>1.0</version>

    <service name="createPracticePerson" default-entity-name="Person" engine="engine-auto"          
             invoke="create" auth="true">
        <description>Create a Person</description>
        <auto-attributes include="pk" mode="OUT" optional="false"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
        <override name="comments" optional="true"/>
    </service>   
</services>

controller.xml

<?xml version="1.0" encoding="UTF-8"?>
<site-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/site-conf.xsd">
        <include location="component://common/webcommon/WEB-INF/common-controller.xml"/>
        <include location="component://commonext/webapp/WEB-INF/controller.xml"/>
        <description>Practice Component Site Configuration File</description>
        <owner>Copyright 2001-2009 The Apache Software Foundation</owner>
        <handler name="screenxml" type="view" class="org.ofbiz.widget.screen.ScreenXmlViewHandler"/>
        <handler name="service" type="request" class="org.ofbiz.webapp.event.ServiceEventHandler"/>
        <handler name="service-multi" type="request" class="org.ofbiz.webapp.event.ServiceMultiEventHandler"/>
        <!-- Request Mappings -->
        <request-map uri="main">
           <security https="true" auth="true"/>
           <response name="success" type="view" value="main"/>
           <response name="error" type="view" value="main"/>
        </request-map>
        <request-map uri="personForm">
           <security https="true" auth="true"/>           
           <response name="success" type="view" value="personForm"/>
           <response name="error" type="view" value="personForm"/>
        </request-map>        
        <request-map uri="createPracticePerson">
            <security https="true" auth="true"/>            
            <event type="service" invoke="createPracticePerson"/>            
            <response name="success" type="view" value="personForm"/>
            <response name="error" type="view" value="personForm"/>
        </request-map>
       <!-- end of request mappings -->

       <!-- View Mappings -->
       <view-map name="main" type="screen" page="component://practice/widget/PracticeScreens.xml#main"/>
       <view-map name="personForm" type="screen" page="component://practice/widget/PracticeScreens.xml#personForm"/>       
       <!-- end of view mappings -->
</site-conf>

PracticeForm.xml

<?xml version="1.0" encoding="UTF-8"?>
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">    
    <form name="ListPersons" type="list" list-name="persons" list-entry-name="person" target="updatePracticePerson" paginate-target="personForm">
        <auto-fields-service service-name="updatePracticePerson" default-field-type="edit" map-name="person"/>
        <field name="partyId"><hidden/></field>
        <field name="submitButton" title="Update" widget-style="smallSubmit"><submit button-type="button"/></field>
        <field name="deletePracticePerson" title="Delete Person" widget-style="buttontext">
        <hyperlink target="deletePracticePerson?partyId=${person.partyId}" description="Delete"/>
        </field>           
    </form>
    <form name="CreatePerson" type="single" target="createPracticePerson">    
        <auto-fields-service service-name="createPracticePerson"/>
        <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit button-type="button"/></field>
    </form>
</forms>

PracticeScreens.xml

<?xml version="1.0" encoding="UTF-8"?>
<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd">
    <screen name="main">
        <section>
            <actions>
                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="PracticeUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="headerItem" value="main"/>
                <set field="titleProperty" value="main page"/>  
            </actions>    
            <widgets>                
                <decorator-screen name="main-decorator" location="${parameters.commonDecoratorLocation}">
                    <decorator-section name="body">
                        <label text="${uiLabelMap.PracticeApplication}"/>                        
                    </decorator-section>
                </decorator-screen>
                <!-- <label>This is first  practice</label> -->            
            </widgets>
        </section>               
    </screen>
    <screen name="personForm">
        <section>
            <actions>
                <set field="headerItem" value="personForm"/>
                <set field="titleProperty" value="PageTitlePracticePersonForm"/>
                <entity-condition entity-name="Person" list="persons"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" location="${parameters.commonDecoratorLocation}">
                    <decorator-section name="body">
                        <label text="Person List" style="h2"/>
                        <include-form name="ListPersons" location="component://practice/widget/PracticeForms.xml"></include-form>
                        <include-form name="CreatePerson" location="component://practice/widget/PracticeForms.xml"></include-form>
                    </decorator-section>
                </decorator-screen>       
            </widgets>
        </section>
    </screen>
</screens>
maskacovnik
  • 3,080
  • 5
  • 20
  • 26

1 Answers1

0

Have you implemented the createPracticePerson service which does the actual creation of the practicePerson? there is a minilang implementation in the tutorial.

  • Yes, i did. You can find the srevice in service.xml. After changing the engine to java or simple, i can run the service. But, it wont work with engine-auto. – anonymous123 Aug 13 '15 at 08:52