Getting following error
{"errorType":"ServerError","message":"Unexpected server error","trace":"io.acurio.hub.core.exceptions.ServerError: Unexpected server error\n\tat deployment.acurio-studio-api.war//io.acurio.hub.api.rest.impl.DesignsResource.createDesign(DesignsResource.java:497)\n\tat deployment.acurio-studio-api.war//io.acurio.hub.api.rest.impl.DesignsResource$Proxy$_$$_WeldClientProxy.createDesign(Unknown Source)\n\tat jdk.internal.reflect.GeneratedMethodAccessor584.invoke(Unknown Source)\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:566)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:138)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:517)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:406)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$0(ResourceMethodInvoker.java:370)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:355)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:372)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:344)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:317)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:440)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:229)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:135)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:355)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:138)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:215)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:227)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)\n\tat org.jboss.resteasy.resteasy-jaxrs@3.7.0.Final//org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)\n\tat javax.servlet.api@1.0.0.Final//javax.servlet.http.HttpServlet.service(HttpServlet.java:791)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)\n\tat deployment.acurio-studio-api.war//io.acurio.hub.api.security.KeycloakAuthenticationFilter.doFilter(KeycloakAuthenticationFilter.java:73)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)\n\tat deployment.acurio-studio-api.war//io.acurio.hub.api.filters.DisableCachingFilter.doFilter(DisableCachingFilter.java:66)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)\n\tat deployment.acurio-studio-api.war//io.acurio.hub.api.filters.CorsFilter.doFilter(CorsFilter.java:64)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)\n\tat io.opentracing.contrib.opentracing-jaxrs2//io.opentracing.contrib.jaxrs2.server.SpanFinishingFilter.doFilter(SpanFinishingFilter.java:55)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)\n\tat org.wildfly.extension.undertow@17.0.1.Final//org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)\n\tat io.undertow.core@2.0.21.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)\n\tat org.keycloak.keycloak-undertow-adapter@11.0.3//org.keycloak.adapters.undertow.UndertowAuthenticatedActionsHandler.handleRequest(UndertowAuthenticatedActionsHandler.java:66)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)\n\tat io.undertow.core@2.0.21.Final//io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHandler.java:33)\n\tat io.undertow.core@2.0.21.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)\n\tat io.undertow.core@2.0.21.Final//io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)\n\tat io.undertow.core@2.0.21.Final//io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)\n\tat io.undertow.core@2.0.21.Final//io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)\n\tat io.undertow.core@2.0.21.Final//io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)\n\tat io.undertow.core@2.0.21.Final//io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)\n\tat io.undertow.core@2.0.21.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)\n\tat org.wildfly.extension.undertow@17.0.1.Final//org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)\n\tat io.undertow.core@2.0.21.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)\n\tat org.wildfly.extension.undertow@17.0.1.Final//org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)\n\tat org.keycloak.keycloak-undertow-adapter@11.0.3//org.keycloak.adapters.undertow.ServletPreAuthActionsHandler.handleRequest(ServletPreAuthActionsHandler.java:69)\n\tat io.undertow.core@2.0.21.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)\n\tat org.wildfly.extension.undertow@17.0.1.Final//org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)\n\tat org.wildfly.extension.undertow@17.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)\n\tat org.wildfly.extension.undertow@17.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)\n\tat org.wildfly.extension.undertow@17.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)\n\tat org.wildfly.extension.undertow@17.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)\n\tat io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)\n\tat io.undertow.core@2.0.21.Final//io.undertow.server.Connectors.executeRootHandler(Connectors.java:364)\n\tat io.undertow.core@2.0.21.Final//io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)\n\tat org.jboss.threads@2.3.3.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)\n\tat org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)\n\tat org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)\n\tat org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)\n\tat java.base/java.lang.Thread.run(Thread.java:834)\nCaused by: java.lang.NullPointerException\n\tat deployment.acurio-studio-api.war//io.acurio.hub.core.storage.jdbc.JdbcStorage.updateApiDesign(JdbcStorage.java:1052)\n\tat deployment.acurio-studio-api.war//io.acurio.hub.core.storage.jdbc.JdbcStorage$Proxy$_$$_WeldClientProxy.updateApiDesign(Unknown Source)\n\tat deployment.acurio-studio-api.war//io.acurio.hub.api.rest.impl.DesignsResource.createDesign(DesignsResource.java:474)\n\t... 82 more\n"}
From the following code:
public ApiDesign createDesign(NewApiDesign info) throws ServerError {
logger.debug("Creating an API Design: {}", info.getName());
metrics.apiCall("/designs", "POST");
try {
boolean isApiNameExist = storage.isApiNameWithVersionExists(info.getName(), info.getVersion());
if(isApiNameExist) {
throw new ServerError("The ApiName with version exist already.");
}
Date now = new Date();
User currentUser = this.security.getCurrentUser();
if(!currentUser.getRoles().contains("dev")) {
throw new ServerError("User does not have create access");
}
String user = currentUser.getLogin();
// The API Design meta-data
ApiDesign design = new ApiDesign();
design.setName(info.getName());
design.setDescription(info.getDescription());
design.setCreatedBy(user);
design.setCreatedOn(now);
design.setVersion(info.getVersion());
design.setComment(info.getComment());
design.setCapability(info.getCapability());
design.setApiFaceType(info.getApiFaceType());
design.setTrack(info.getTrack());
// The API Design content
ApiDesignType type;
if (info.getType() != null) {
type = info.getType();
} else {
if (info.getSpecVersion() == null || info.getSpecVersion().equals("2.0")) {
type = ApiDesignType.OpenAPI20;
} else {
type = ApiDesignType.OpenAPI30;
}
}
design.setType(type);
String content = createNewDocument(type, info.getName(), info.getDescription(),info.getVersion());
// Create the API Design in the database
String designId = storage.createApiDesign(user, design, content);
design.setId(designId);
WorkflowResponse res= initiateWorkflow(currentUser, design);
storage.updateApiDesign(res);
design.setWorkflowId(res.getWorkflowId());
design.setTaskId(res.getTaskId());
design.setStatus(res.getStatus());
metrics.apiCreate(type);
eventsService.triggerEvent(acurioEventType.DESIGN_CREATED, design);
//For Adding data to Path Info Table
//ApiDesignContent docContent = this.storage.getLatestContentDocumentForPublishing(designId);
String pathString = getPaths(content);
this.storage.createPathInfo(designId, pathString);
return design;
} catch (StorageException e) {
throw new ServerError(e);
}
catch (NotFoundException e) {
throw new ServerError(e);
}catch (Exception e) {
throw new ServerError(e);
}
}
Its breaks in the line
WorkflowResponse res= initiateWorkflow(currentUser, design);
Defenition of initiateWorkflow is below :
private WorkflowResponse initiateWorkflow(User user,ApiDesign design) {
try {
JSONObject json = new JSONObject();
json.put("userId", user.getLogin());
json.put("userGroup", "dev");
json.put("workflowName", "api-doc-process-v1");
json.put("comment", design.getComment());
Map<String, Object> map = new LinkedHashMap<String, Object>();
map.put("UNIQUE_ID", Long.parseLong(design.getId()));
json.put("variables", map);
//String path = "api/workflow/process";
String url =this.getURL("api-workflow/api/workflow/process");
HttpResponse<String> userResp = Unirest.post(url)
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.body(json.toString())
//.header("Authorization", "Bearer " + token)
.asString();
if (userResp.getStatus() != 200) {
return null;
} else {
String jsonBody = userResp.getBody();
WorkflowResponse response = mapper.readerFor(WorkflowResponse.class).readValue(jsonBody);
return response;
}
} catch (Exception e) {
logger.error("Failed to invoke workflow", e);
return null;
}
}
Its breaking in the line
HttpResponse userResp = Unirest.post(url)
@RestController
@RequestMapping("/api/workflow")
public class WorkflowController {
@Autowired
private RuntimeService runtimeService;
@Autowired
private WorkflowService workflowService;
@PostMapping(path = "/process")
public WorkflowResponseInfo invokeWorkflow(@RequestBody WorkFlowRequestInfo info) {
return this.workflowService.invokeWorkflow(info);
}
Last call in invokeworkflow
@Transactional
public WorkflowResponseInfo invokeWorkflow(WorkFlowRequestInfo info) {
Map<String, Object> variables = new LinkedHashMap<>();
if (Objects.nonNull(info.getVariables())) {
variables.putAll(info.getVariables());
}
variables.put("invoker", info.getUserId());
variables.put("invokerGroup", info.getUserGroup());
ProcessInstance instance = runtimeService.startProcessInstanceByKey(info.getWorkflowName(), variables);
Task task = taskService.createTaskQuery().processInstanceId(instance.getId()).singleResult();
// claim the task
this.taskService.claim(task.getId(), info.getUserId());
/*TrackInfo trackInfo = new TrackInfo();
trackInfo.setAssignee(info.getUserId());
trackInfo.setTaskId(task.getId());
trackInfo.setWorkflowId(instance.getId());
trackInfo.setStatus(task.getCategory());
trackDao.createTrackRecord(trackInfo);*/
int id = Objects.nonNull(variables.get("UNIQUE_ID")) ? (Integer) variables.get("UNIQUE_ID") : 0;
WorkflowResponseInfo res = new WorkflowResponseInfo();
res.setStatus(task.getCategory());
res.setTaskId(task.getId());
res.setWorkflowId(task.getProcessInstanceId());
res.setUniqueId(id);
return res;
}