Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter 0 of method transactionManager in org.activiti.spring.boot.JpaProcessEngineAutoConfiguration$JpaConfiguration required a bean of type 'javax.persistence.EntityManagerFactory' that could not be found. #2738

Open
lw5885799 opened this issue May 11, 2019 · 6 comments

Comments

@lw5885799
Copy link

When I start up my project with mybaits + tkmybaits + activiti in springboot2,x, it shows the error.
` * Spring Boot Version: 2.0.6.RELEASE
*/

2019-05-11 09:07:04,706 [ INFO] - com.aiqin.bms.slcs.api.MainBootApplication - Starting MainBootApplication on DESKTOP-4B0QMM2 with PID 21620 (started by 耿耿 in C:\Users\耿耿\git\slcs-api)
2019-05-11 09:07:04,708 [ INFO] - com.aiqin.bms.slcs.api.MainBootApplication - The following profiles are active: ${profile.name}
2019-05-11 09:07:04,762 [ INFO] - org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext - Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@3c3d9b6b: startup date [Sat May 11 09:07:04 CST 2019]; root of context hierarchy
2019-05-11 09:07:05,801 [ INFO] - org.springframework.beans.factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'basicErrorController' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration; factoryMethodName=basicErrorController; initMethodName=null; destroyMethodName=(inferred); defined in org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=com.aiqin.ground.spring.boot.core.config.GroundWebMvcConfig; factoryMethodName=basicErrorController; initMethodName=null; destroyMethodName=(inferred); defined in com.aiqin.ground.spring.boot.core.config.GroundWebMvcConfig]
2019-05-11 09:07:07,036 [ INFO] - org.springframework.boot.web.embedded.tomcat.TomcatWebServer - Tomcat initialized with port(s): 8080 (http)
2019-05-11 09:07:07,051 [ INFO] - org.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"]
2019-05-11 09:07:07,064 [ INFO] - org.apache.catalina.core.StandardService - Starting service [Tomcat]
2019-05-11 09:07:07,064 [ INFO] - org.apache.catalina.core.StandardEngine - Starting Servlet Engine: Apache Tomcat/8.5.34
2019-05-11 09:07:07,075 [ INFO] - org.apache.catalina.core.AprLifecycleListener - The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [D:\Java\jdk1.8.0_171\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_181/bin/server;C:/Program Files/Java/jre1.8.0_181/bin;C:/Program Files/Java/jre1.8.0_181/lib/amd64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;D:\Java\jdk1.8.0_171\bin;D:\Java\jdk1.8.0_171\jre\bin;D:\nodejs;D:\Git\cmd;D:\apache-maven-3.5.3\bin;C:\Users\耿耿\AppData\Local\Microsoft\WindowsApps;C:\Users\耿耿\AppData\Roaming\npm;C:\Users\耿耿\AppData\Local\BypassRuntm;C:\Users\耿耿\AppData\Local\Programs\Fiddler;D:\eclipse;;.]
2019-05-11 09:07:07,256 [ INFO] - org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
2019-05-11 09:07:07,256 [ INFO] - org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 2494 ms
2019-05-11 09:07:07,354 [ INFO] - org.springframework.boot.web.servlet.ServletRegistrationBean - Servlet dispatcherServlet mapped to [/]
2019-05-11 09:07:07,355 [ INFO] - org.springframework.boot.web.servlet.ServletRegistrationBean - Servlet statViewServlet mapped to [/druid/]
2019-05-11 09:07:07,360 [ INFO] - org.springframework.boot.web.servlet.FilterRegistrationBean - Mapping filter: 'characterEncodingFilter' to: [/
]
2019-05-11 09:07:07,360 [ INFO] - org.springframework.boot.web.servlet.FilterRegistrationBean - Mapping filter: 'webStatFilter' to urls: [/*]
2019-05-11 09:07:07,544 [ WARN] - org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'activitiConfig': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'transactionManager' defined in class path resource [org/activiti/spring/boot/JpaProcessEngineAutoConfiguration$JpaConfiguration.class]: Unsatisfied dependency expressed through method 'transactionManager' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'javax.persistence.EntityManagerFactory' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2019-05-11 09:07:07,547 [ INFO] - org.apache.catalina.core.StandardService - Stopping service [Tomcat]
2019-05-11 09:07:07,568 [ WARN] - org.apache.catalina.loader.WebappClassLoaderBase - The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)
2019-05-11 09:07:07,574 [ INFO] - org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener -

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-11 09:07:07,598 [ERROR] - org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter -


APPLICATION FAILED TO START


Description:

Parameter 0 of method transactionManager in org.activiti.spring.boot.JpaProcessEngineAutoConfiguration$JpaConfiguration required a bean of type 'javax.persistence.EntityManagerFactory' that could not be found.

Action:

Consider defining a bean of type 'javax.persistence.EntityManagerFactory' in your configuration.`

any idea?

@salaboy
Copy link
Contributor

salaboy commented May 11, 2019

@lw5885799 which version of activiti are you using?
We moved Activiti 7.x to work with Spring Boot 2.1.x, unfortunately, as far as I remember there were some problems with spring boot 2.0.x

@salaboy salaboy added this to the 7.1.0.M2 milestone May 11, 2019
@salaboy salaboy added this to Open in Activiti 7.x via automation May 11, 2019
@lw5885799
Copy link
Author

@salaboy I use 5.22.0 version. Lots of people said it is a conflict with tymybaits. They said activiti would judge if you are using JPA. If not, then activiti would use mybaits. But, tkMybaits would mislead activiti to active JPA condition. Is it possible problem?

@salaboy salaboy modified the milestones: 7.1.0.M2, NonActiviti7 May 13, 2019
@salaboy salaboy removed this from Open in Activiti 7.x May 13, 2019
@salaboy
Copy link
Contributor

salaboy commented May 13, 2019

@lw5885799 JPA is used for variables only. This might be a problem of using 5.x with Spring Boot 2.x Also if you have spring-data in the classpath it will bring JPA with it as far as I remember.

@lw5885799
Copy link
Author

@salaboy Is there a way to choose my ORM framework in activiti5?

@salaboy
Copy link
Contributor

salaboy commented May 13, 2019

@lw5885799 for performance reasons, I believe that there is no way to do that. MyBatis is the ORM that is used by the engine with some specific tuning to perform correctly. You can use JPA for storing JPA entities in process variables, but that is where the integration ends. Right now, if the problem is that JPA is failing to be configured by spring boot, that is a different problem. If you are using this class: org/activiti/spring/boot/JpaProcessEngineAutoConfiguration, that was created to work with Spring Boot 1.5.x not Spring Boot 2.x and there were a lot of changes between those two release streams.

@lw5885799
Copy link
Author

Thank you for replying. I would try add JPA implement in my project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Activiti 5.x
  
Awaiting triage
Development

No branches or pull requests

2 participants