Entity Manager null pointer exception

Hello, I followed https://developer.atlassian.com/server/framework/atlassian-sdk/getting-started-with-active-objects/ tutorial, where I was trying to create Active object in Jira
Unfortunately I am still getting
ERROR [c.a.j.web.servlet.InternalServerErrorServlet] {errorId=744e2106-a204-48a0-8768-c93b53062649, interpretedMsg=, cause=java.lang.NullPointerException, stacktrace=java.lang.NullPointerE
xception [INFO] [talledLocalContainer] at net.java.ao.EntityManager.create(EntityManager.java:338)

I am using library:

<dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-plugin</artifactId>
            <version>${ao.version}</version>
            <scope>provided</scope>
        </dependency>

my versions are:

       <amps.version>6.3.15</amps.version>
        <plugin.testrunner.version>1.2.3</plugin.testrunner.version>
        <atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
        <jira.version>7.5.0</jira.version>
        <javax.el.version>2.2.4</javax.el.version>
        <ao.version>1.4.0</ao.version>

Part of code where I am calling ao.create object and it is falling here

import com.atlassian.activeobjects.external.ActiveObjects;
import com.atlassian.plugin.spring.scanner.annotation.component.Scanned;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.sal.api.transaction.TransactionCallback;
import net.java.ao.Query;
import javax.inject.Inject;
import javax.inject.Named;
.
.

@Scanned
@Named
public class CustomerDaoImpl implements CustomerDao{

    private final ActiveObjects activeObjects;
    private static final Logger log = Logger.getLogger(CustomerServiceImpl.class);

    @Inject
    public CustomerDaoImpl(@ComponentImport ActiveObjects activeObjects){this.activeObjects = activeObjects;}

    public Customer create(CustomerDto customerDto){
//there is error point: 
        return this.activeObjects.executeInTransaction(new TransactionCallback<Customer>(){
            @Override
            public Customer doInTransaction()
            {
                Customer customer = activeObjects.create(Customer.class);
                customer.setName("customer");
                customer.save(); // (4)
                return customer;
            }
        });

My entity looks like:

@Preload
@Table("crm_customer")
public interface Customer extends RawEntity<Integer> {
    @AutoIncrement
    @NotNull
    @PrimaryKey("ID")
    int getId();

    @NotNull
    String getName();
    void setName(String name);

Guys, I read tons of articles this weekend, unfortunately I have not found any solution.
Please do you have any idea what causes this problem?
Entity manager should be provided by JIRA AO plugin but it is not.
I am developing standart jira-plugin, iwth usage atlas-run command so my database is standart H2 JIRA embedded database.

Do not extend RawEntity, just extend Entity. Do not define ID, that will be defined automatically for you. That seems to be the only difference I can spy between your and my own approach.

1 Like

Did you correctly define your entities in your plugin descriptor ?

This error means getters and setter are wrong… I had to double check syntax of them …
I was using DBParams…

    public DBParam[] toMapOfParams(){
        DBParam[] dbParams = new DBParam[5];
        List<DBParam> listparameterov = new ArrayList<DBParam>();
        if(getCountry() != null) {
            listparameterov.add(new DBParam("COUNTRY", getCountry()));
        }
        if(getName() != null) {
            listparameterov.add(new DBParam("NAME", getName()));
        }

and SYNTAX of PARAM has to be exactly same as name of AO object.