springboot整合activiti6.0出现Unable to start embedded Tomcat

  最近在照着某课视频,在魔改activiti6.0 ,整合springboot,真是的欲生欲死,几近进行不下去了!昨天就遇到了一个问题,Unable to start embedded Tomcat,我照着视频上操作,视频过去了,我却出现了这个问题!本来不打算写下这个问题的,今天上班路上,还是觉得有必要写下来,昨天百度了好久,也没有找到具体解决办法。

  先简单说下什么原因,因为activiti6.0里面采用了Security框架,所以在整合的时候,需要先排除这些不需要的类。如果你也是看的某课的视频,那你到这里,可以继续按视频往下看,照着操作就行了,到了视频中后面再打开启动类的时候,照着加上需要排除的类即可。

  我这边先凭着记忆写下,需要改动的地方,等后面魔改好了,上传一会改好的源码。

  目录结构

springboot整合activiti6.0出现Unable to start embedded Tomcat_第1张图片

  1.在启动类中加上需要排除的类

import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;

@SpringBootApplication(exclude = {
        SecurityAutoConfiguration.class,
        HibernateJpaAutoConfiguration.class,
        org.activiti.spring.boot.SecurityAutoConfiguration.class 

})
2.有个需求说key值为空了,就是因为这个activiti-app.properties中security.rememberme.key=testkey和springboot中冲突了,需要修改,将activiti-app.properties中修为为appconf.security.rememberme.key=testkey,项目中大概有三到四处用到了这个security.rememberme.key,建议使用全局替换,需要全部修改。
appconf.security.rememberme.key=testkey

3.还有地方会说找不到processes文件夹,当你建好文件夹,如果没有文件的话,他还是会报找不到的异常,因为空文件夹,会被默认忽略。照着上面目录结构图操作下就解决了。

4.application.yml文件

#禁用liquibase(用于数据库重构和迁移的开源工具)
liquibase:
  enabled: false


#模板路径
spring:
  freemarker:
    check-template-location: false
  activiti:
    check-process-definitions: false

#端口
server:
  port: 9999
  context-path: "/activiti-app"

5.logback.xml文件,可能存在些问题,请有能力的大佬帮助改正下,感谢回复



    
    
    
    
    
    

    
    
        
            ${mdc}
            ${encoding}
        
    
    
     
        
            
            ${LOG_HOME}/activiti6.log.%d{yyyy-MM-dd}.log
            
            30
        
        
            
            %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
        
        
        
            10MB
        
    

    
        ERROR
    
    
        DEBUG
    
    
    
        
        
    

6.后面还会加两个依赖

        
            org.springframework.boot
            spring-boot-starter-actuator
            1.2.6.RELEASE
        
        
            org.springframework.boot
            spring-boot-starter-hateoas
            1.2.6.RELEASE
        

这里我也放出这个pom文件,所有的依赖,用来给各位参考



    4.0.0
    
        org.activiti
        activiti-ui-root
        6.0.0-boot2
    
    activiti-app
    war

    

        
            org.activiti
            activiti-spring-boot-starter-basic
            6.0.0
        
        
            org.springframework.boot
            spring-boot-starter-web
            1.2.6.RELEASE
        
        
            org.springframework.boot
            spring-boot-starter-actuator
            1.2.6.RELEASE
        
        
            org.springframework.boot
            spring-boot-starter-hateoas
            1.2.6.RELEASE
        
    	
            org.activiti
            activiti-app-conf
            
                
                    org.slf4j
                    slf4j-log4j12
                
            
        

		
            com.h2database
            h2
        
        
            mysql
            mysql-connector-java
        
        
            org.springframework.boot
            spring-boot-autoconfigure
            1.2.6.RELEASE
            compile
        




    

    
    

        activiti-app

        
            
                src/main/resources
                true
                
                    **/*
                
            
        

        
            
                org.zeroturnaround
                jrebel-maven-plugin
                1.1.1
                
                    
                        generate-rebel-xml
                        process-resources
                        
                            generate
                        
                    
                
            

            
                org.apache.maven.plugins
                maven-war-plugin
                2.5
            

            
                org.springframework.boot
                spring-boot-maven-plugin
                1.2.6.RELEASE
            
            
                org.apache.tomcat.maven
                tomcat7-maven-plugin
                
                    /activiti-app
                    9999
                    org.apache.coyote.http11.Http11NioProtocol
                    
                        4000
                    
                
            

            
                org.apache.maven.plugins
                maven-eclipse-plugin
                2.9
                
                    true
                    true
                
            

        

        
            

                
                
                    org.eclipse.m2e
                    lifecycle-mapping
                    1.0.0
                    
                        
                            
                                
                                    
                                        
                                            org.zeroturnaround
                                        
                                        
                                            jrebel-maven-plugin
                                        
                                        
                                            [1.1.1,)
                                        
                                        
                                            generate
                                        
                                    
                                    
                                        
                                    
                                
                            
                        
                    
                
            
        
    


7.还会排除conf包中的两个类,直接全选注释就可以了

springboot整合activiti6.0出现Unable to start embedded Tomcat_第2张图片

conf修改了,别忘了安装下

springboot整合activiti6.0出现Unable to start embedded Tomcat_第3张图片

到这里记忆里面的都写了,至于还有那些没写到,就记不起了,实现了会上传一份源码,魔改好了,大家直接用就可以了,activiti6.0实在是繁琐。至于那些类为什么会被排除,其实百度都有很多老程分析过了,感兴趣可以自己百度下。

 

此致

敬礼

 

你可能感兴趣的:(springboot整合activiti6.0出现Unable to start embedded Tomcat)