Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

ActiveObjects v1.1.5 in jira 7.0.4 error

this is my code 

package io.codeclou.kitchen.duty.rest;

import com.atlassian.activeobjects.external.ActiveObjects;
import com.atlassian.plugins.rest.common.security.AnonymousAllowed;
import com.atlassian.sal.api.transaction.TransactionCallback;
import io.codeclou.kitchen.duty.ao.Week;

import javax.inject.Named;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

@Named
@Path("/planning")
public class KitchenDutyPlanningResource {

private ActiveObjects activeObjects;

public KitchenDutyPlanningResource(ActiveObjects activeObjects) {
this.activeObjects = activeObjects;
}

public KitchenDutyPlanningResource() {
}


@GET
@Path("/persistTest")
@Produces({MediaType.APPLICATION_JSON})
@AnonymousAllowed
public Response persistTest() {
activeObjects.executeInTransaction(new TransactionCallback<Week>()
{
@Override
public Week doInTransaction()
{
final Week testWeek = activeObjects.create(Week.class);
testWeek.setWeek(42);
testWeek.save();
return testWeek;
}
});
return Response.ok("ok").build();
}

@GET
@Path("/health")
@Produces({MediaType.APPLICATION_JSON})
@AnonymousAllowed
public Response health() {
return Response.ok("ok").build();
}

} and i got this error
 <status-code>500</status-code>
    <stack-trace>java.lang.NullPointerException&#xD;
    at io.codeclou.kitchen.duty.rest.KitchenDutyPlanningResource.persistTest(KitchenDutyPlanningResource.java:34)&#xD;
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&#xD;
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)&#xD;
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)&#xD;
    at java.lang.reflect.Method.invoke(Method.java:498)&#xD;
    at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$ResponseOutInvoker$1.invoke(DispatchProviderHelper.java:234)&#xD;
    at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$1.intercept(DispatchProviderHelper.java:100)&#xD;
    at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:61)&#xD;
    at com.atlassian.plugins.rest.common.expand.interceptor.ExpandInterceptor.intercept(ExpandInterceptor.java:38)&#xD;
    at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:61)&#xD;
    at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper.

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
1.1.5
TAGS
AUG Leaders

Atlassian Community Events