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:


my versions are:


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;

public class CustomerDaoImpl implements CustomerDao{

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

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

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

My entity looks like:

public interface Customer extends RawEntity<Integer> {
    int getId();

    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.