Hi,
I created plugin with custom rest API, which return data from active objects’entities. It works well on Test instance. Plugin was installed on Prod instance.
At first, about a month, there were no problems. Now it works strange: for some days it also works well, but then all custom API begin to return error “org.eclipse.gemini.blueprint.service.importer.ServiceProxyDestroyedException: service proxy has been destroyed”. It shows, that there is error in code with active obects’entity call.
Example:
SettingResource.java
@Path("settings")
@Produces({MediaType.APPLICATION_JSON})
public classSettingsResource {
@GET
@Produces({MediaType.APPLICATION_JSON})
public Response getSettings() throws Exception {
List<XmlSettings> xmlSettings = Lists.newArrayList();
for (SettingsEntity entity : AOFactory.getInstance().getSettingsAO().getSettings() {
xmlSettings.add(SettingsMapper.toXmlSettings(entity));
}
return Response.ok(xmlSettings).build();
}
}
SettingsAOIMpl.java
public class SettingsAOIMpl implements SettingsAO {
private final ActiveObjects ao;
public SettingsAOIMpl(ActiveObjects ao) {
this.ao = ao;
}
public SettingsEntity[] getSettings() throws Exception {
return ao.executeInTransaction(new TransactionCallback<SettingsEntity[]) {
@Override
public SettingsEntity[] doInTransaction() {
return ao.find(Settings.class, Query.select());
}
});
}
}
Rest API returns error SettingsAOIMp.getSettings.
If I reinstall plugin, It works well for some days again and then error returns.
How can I solve the problem? How to check connection with Active objects?
And how to restore this connection if it fail?