org.activiti.engine.ActivitiClassLoadingException Java Examples

The following examples show how to use org.activiti.engine.ActivitiClassLoadingException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HerdErrorInformationExceptionHandler.java    From herd with Apache License 2.0 6 votes vote down vote up
/**
 * Handle Activiti exceptions. Note that this method properly handles a null response being passed in.
 *
 * @param exception the exception.
 * @param response the response.
 *
 * @return the error information.
 */
@ExceptionHandler(value = ActivitiException.class)
@ResponseBody
public ErrorInformation handleActivitiException(Exception exception, HttpServletResponse response)
{
    if ((ExceptionUtils.indexOfThrowable(exception, ActivitiClassLoadingException.class) != -1) ||
        (ExceptionUtils.indexOfType(exception, ELException.class) != -1))
    {
        // These exceptions are caused by invalid workflow configurations (i.e. user error) so they are considered a bad request.
        return getErrorInformationAndSetStatus(HttpStatus.BAD_REQUEST, exception, response);
    }
    else
    {
        // For all other exceptions, something is wrong that we weren't expecting so we'll return this as an internal server error and log the error.
        logError("An Activiti error occurred.", exception);
        return getErrorInformationAndSetStatus(HttpStatus.INTERNAL_SERVER_ERROR, exception, response);
    }
}
 
Example #2
Source File: DefaultActiviti5CompatibilityHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void handleActivitiException(org.activiti5.engine.ActivitiException e) {
  if (e instanceof org.activiti5.engine.delegate.BpmnError) {
    org.activiti5.engine.delegate.BpmnError activiti5BpmnError = (org.activiti5.engine.delegate.BpmnError) e;
    throw new BpmnError(activiti5BpmnError.getErrorCode(), activiti5BpmnError.getMessage());
    
  } else if (e instanceof org.activiti5.engine.ActivitiClassLoadingException) {
    throw new ActivitiClassLoadingException(e.getMessage(), e.getCause());
    
  } else if (e instanceof org.activiti5.engine.ActivitiObjectNotFoundException) {
    org.activiti5.engine.ActivitiObjectNotFoundException activiti5ObjectNotFoundException = (org.activiti5.engine.ActivitiObjectNotFoundException) e;
    throw new ActivitiObjectNotFoundException(activiti5ObjectNotFoundException.getMessage(), 
        activiti5ObjectNotFoundException.getObjectClass(), activiti5ObjectNotFoundException.getCause());
    
  } else if (e instanceof org.activiti5.engine.ActivitiOptimisticLockingException) {
    throw new ActivitiOptimisticLockingException(e.getMessage());
    
  } else if (e instanceof org.activiti5.engine.ActivitiIllegalArgumentException) {
    throw new ActivitiIllegalArgumentException(e.getMessage(), e.getCause());
    
  } else {
    if (e.getCause() instanceof org.activiti5.engine.ActivitiClassLoadingException) {
      throw new ActivitiException(e.getMessage(), new ActivitiClassLoadingException(e.getCause().getMessage(), e.getCause().getCause()));
    } else if (e.getCause() instanceof org.activiti5.engine.impl.javax.el.PropertyNotFoundException) {
      throw new ActivitiException(e.getMessage(), new PropertyNotFoundException(e.getCause().getMessage(), e.getCause().getCause()));
    } else if (e.getCause() instanceof org.activiti5.engine.ActivitiException) {
      throw new ActivitiException(e.getMessage(), new ActivitiException(e.getCause().getMessage(), e.getCause().getCause()));
    } else {
      throw new ActivitiException(e.getMessage(), e.getCause());
    }
  }
}
 
Example #3
Source File: JavaServiceTaskTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Deployment
public void testUnexistingClassDelegation() {
  try {
    runtimeService.startProcessInstanceByKey("unexistingClassDelegation");
    fail();
  } catch (ActivitiException e) {
    assertTrue(e.getMessage().contains("couldn't instantiate class org.activiti.BogusClass"));
    assertNotNull(e.getCause());
    assertTrue(e.getCause() instanceof ActivitiClassLoadingException);
  }
}
 
Example #4
Source File: JavaServiceTaskTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Deployment
public void testUnexistingClassDelegation() {
  try {
    runtimeService.startProcessInstanceByKey("unexistingClassDelegation");
    fail();
  } catch (ActivitiException e) {
    assertTrue(e.getMessage().contains("couldn't instantiate class org.activiti.BogusClass"));
    assertNotNull(e.getCause());
    assertTrue(e.getCause() instanceof ActivitiClassLoadingException);
  }
}
 
Example #5
Source File: HerdErrorInformationExceptionHandlerTest.java    From herd with Apache License 2.0 5 votes vote down vote up
@Test
public void testActivitiExceptionBadRequest() throws Exception
{
    // Test out both ActivitiClassLoadingException and ELException.
    validateErrorInformation(exceptionHandler
        .handleActivitiException(new ActivitiClassLoadingException(ActivitiClassLoadingException.class.getName(), new RuntimeException(MESSAGE)),
            new MockHttpServletResponse()), HttpStatus.BAD_REQUEST, false);
    validateErrorInformation(exceptionHandler.handleActivitiException(new ELException(MESSAGE), new MockHttpServletResponse()), HttpStatus.BAD_REQUEST);
}