Uploaded image for project: 'Red Hat Process Automation Manager'
  1. Red Hat Process Automation Manager
  2. RHPAM-76

MigrationManager API throws NPE when used in Kie-Spring environment

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 7.0.0.GA
    • 6.x.x
    • jBPM Core
    • Kie-Spring based embedded jbpm application.
      EAP 6.4.13
      BPMS 6.4.1

    • Hide

      1. Create a Kie-Spring based application like: https://github.com/mswiderski/spring-jbpm-app
      2. Add a /migration endpoint with a controller like:

      @Controller
      @RequestMapping("/migration")
      public class MigrationController {
          @Autowired
          private DeploymentService deploymentService;
      
          @Autowired
          private ProcessService processService;
      
          @Autowired
          private UserTaskService userTaskService;
      
          @RequestMapping(value = "/", method = RequestMethod.GET)
          @ResponseBody
          public String performMigration() {
              try {
                  KModuleDeploymentUnit migrationSource = new KModuleDeploymentUnit(
                          "example",
                          "migration-target",
                          "1.0");
                  migrationSource.setStrategy(RuntimeStrategy.PER_PROCESS_INSTANCE);
      
                  KModuleDeploymentUnit migrationTarget = new KModuleDeploymentUnit(
                          "example",
                          "migration-target",
                          "2.0");
                  migrationTarget.setStrategy(RuntimeStrategy.PER_PROCESS_INSTANCE);
      
                  if (!deploymentService.isDeployed(migrationSource.getIdentifier())) {
                      deploymentService.deploy(migrationSource);
                  }
      
                  if (!deploymentService.isDeployed(migrationTarget.getIdentifier())) {
                      deploymentService.deploy(migrationTarget);
                  }
      
                  ProcessInstanceMigrationServiceImpl processInstanceMigrationServiceImpl = new ProcessInstanceMigrationServiceImpl();
      
                  processInstanceMigrationServiceImpl.migrate(migrationSource.getIdentifier(), 3L, migrationTarget.getIdentifier(), "migration-target.migration-process");
      
              } catch (Throwable e) {
                  e.printStackTrace();
              }
      
              return "Success";
          }
      }
      

      3. Attempt to perform a migration.

      Show
      1. Create a Kie-Spring based application like: https://github.com/mswiderski/spring-jbpm-app 2. Add a /migration endpoint with a controller like: @Controller @RequestMapping( "/migration" ) public class MigrationController { @Autowired private DeploymentService deploymentService; @Autowired private ProcessService processService; @Autowired private UserTaskService userTaskService; @RequestMapping(value = "/" , method = RequestMethod.GET) @ResponseBody public String performMigration() { try { KModuleDeploymentUnit migrationSource = new KModuleDeploymentUnit( "example" , "migration-target" , "1.0" ); migrationSource.setStrategy(RuntimeStrategy.PER_PROCESS_INSTANCE); KModuleDeploymentUnit migrationTarget = new KModuleDeploymentUnit( "example" , "migration-target" , "2.0" ); migrationTarget.setStrategy(RuntimeStrategy.PER_PROCESS_INSTANCE); if (!deploymentService.isDeployed(migrationSource.getIdentifier())) { deploymentService.deploy(migrationSource); } if (!deploymentService.isDeployed(migrationTarget.getIdentifier())) { deploymentService.deploy(migrationTarget); } ProcessInstanceMigrationServiceImpl processInstanceMigrationServiceImpl = new ProcessInstanceMigrationServiceImpl(); processInstanceMigrationServiceImpl.migrate(migrationSource.getIdentifier(), 3L, migrationTarget.getIdentifier(), "migration-target.migration-process" ); } catch (Throwable e) { e.printStackTrace(); } return "Success" ; } } 3. Attempt to perform a migration.

    Description

      When using MigrationManager api in a Kie-Spring application, the following stacktrace is seen:

      08:51:37,341 ERROR [stderr] (http-127.0.0.1:8080-1) java.lang.NullPointerException
      08:51:37,341 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.jbpm.runtime.manager.impl.migration.MigrationManager.migrate(MigrationManager.java:230)
      08:51:37,341 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.jbpm.runtime.manager.impl.migration.MigrationManager.migrate(MigrationManager.java:102)
      08:51:37,342 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.jbpm.kie.services.impl.admin.ProcessInstanceMigrationServiceImpl.migrate(ProcessInstanceMigrationServiceImpl.java:46)
      08:51:37,342 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.jbpm.spring.web.MigrationController.performMigration(MigrationController.java:61)
      08:51:37,342 ERROR [stderr] (http-127.0.0.1:8080-1) 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      08:51:37,342 ERROR [stderr] (http-127.0.0.1:8080-1) 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      08:51:37,342 ERROR [stderr] (http-127.0.0.1:8080-1) 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      08:51:37,342 ERROR [stderr] (http-127.0.0.1:8080-1) 	at java.lang.reflect.Method.invoke(Method.java:498)
      08:51:37,342 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
      08:51:37,342 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
      08:51:37,342 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
      08:51:37,342 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
      08:51:37,342 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:685)
      08:51:37,343 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
      08:51:37,343 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919)
      08:51:37,343 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851)
      08:51:37,343 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
      08:51:37,343 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844)
      08:51:37,343 ERROR [stderr] (http-127.0.0.1:8080-1) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
      08:51:37,343 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
      08:51:37,343 ERROR [stderr] (http-127.0.0.1:8080-1) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
      08:51:37,343 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
      08:51:37,343 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
      08:51:37,344 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      08:51:37,344 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
      08:51:37,344 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
      08:51:37,344 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      08:51:37,344 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
      08:51:37,344 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      08:51:37,344 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
      08:51:37,345 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      08:51:37,345 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
      08:51:37,345 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      08:51:37,345 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
      08:51:37,345 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      08:51:37,345 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
      08:51:37,345 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      08:51:37,345 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
      08:51:37,346 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      08:51:37,346 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:155)
      08:51:37,346 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      08:51:37,346 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
      08:51:37,346 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      08:51:37,346 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
      08:51:37,346 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      08:51:37,346 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
      08:51:37,347 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
      08:51:37,347 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      08:51:37,347 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
      08:51:37,347 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      08:51:37,348 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
      08:51:37,348 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
      08:51:37,348 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
      08:51:37,348 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
      08:51:37,348 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
      08:51:37,348 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
      08:51:37,348 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
      08:51:37,349 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
      08:51:37,349 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
      08:51:37,349 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150)
      08:51:37,349 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
      08:51:37,349 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
      08:51:37,349 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
      08:51:37,350 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854)
      08:51:37,350 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:656)
      08:51:37,350 ERROR [stderr] (http-127.0.0.1:8080-1) 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)
      08:51:37,350 ERROR [stderr] (http-127.0.0.1:8080-1) 	at java.lang.Thread.run(Thread.java:745)
      

      This appears to be due to a ClassCastException in TransactionManagerFactory.get().newTransactionManager(env), from Spring's JtaTransactionManager to javax.transaction.TransactionManager. Other components of the KIE services wrap the Spring txm when initializing (SingleSessionCommandService and TaskTransactionInterceptor), but MigrationManager does not.

      Attachments

        Issue Links

          Activity

            People

              rhn-support-tsurdilo Tihomir Surdilovic (Inactive)
              djeremiah David Murphy (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: