Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

LocalContainerEntityManagerFactoryBean spring

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name' entityManagerFactory' defined

The built environment has been tossing about for a long time, and later encountered this kind of similar problem. It turns out that this is the reason, and I have already cried and fainted.

Error reporting phenomenon:

Javax.servlet.ServletException: Servlet.init () for servlet mvc-dispatcher threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase.java:501) org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:79) org.apache.catalina.valves.AbstractAccessLogValve.invoke (AbstractAccessLogValve.java:610) org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:537) org.apache.coyote.http11.AbstractHttp11Processor.process (AbstractHttp11Processor.java:1085) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process (AbstractProtocol.java:658) org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process (Http11NioProtocol.java:222) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun (NioEndpoint.java:1556) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run (NioEndpoint.java:1513) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1142) Java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:617) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run (TaskThread.java:61) java.lang.Thread.run (Thread.java:745)

Root cause

Org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name' entityManagerFactory' defined in ServletContext resource [/ WEB-INF/mvc-dispatcher-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'packagesToScan' of bean class [org.springframework.orm.jpa.LocalEntityManagerFactoryBean]: Bean property' packagesToScan' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean (AbstractAutowireCapableBeanFactory.java:1578) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:545) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:482) org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject (AbstractBeanFactory.java:306) org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:230) Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:302) org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:197) org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons (DefaultListableBeanFactory.java:753) org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:839) org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:538) org.springframework. Web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext (FrameworkServlet.java:666) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext (FrameworkServlet.java:632) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext (FrameworkServlet.java:680) org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext (FrameworkServlet.java:551) org.springframework.web.servlet.FrameworkServlet.initServletBean (FrameworkServlet.java:492) org.springframework.web.servlet.HttpServletBean.init (HttpServletBean. Java:136) javax.servlet.GenericServlet.init (GenericServlet.java:158) org.apache.catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase.java:501) org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:79) org.apache.catalina.valves.AbstractAccessLogValve.invoke (AbstractAccessLogValve.java:610) org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:537) org.apache.coyote. Http11.AbstractHttp11Processor.process (AbstractHttp11Processor.java:1085) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process (AbstractProtocol.java:658) org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process (Http11NioProtocol.java:222) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun (NioEndpoint.java:1556) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run (NioEndpoint.java:1513) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java: 1142) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:617) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run (TaskThread.java:61) java.lang.Thread.run (Thread.java:745)

Root cause

Comparison of the results:

Environment building reference article: http://my.oschina.net/gaussik/blog/513444, always reported errors, to solve this problem, searched countless posts, by comparison with the original is this reason.

#

Paste the correct configuration file:

Dispatcher-servlet-mvc.xml

Com.mysql.jdbc.Driver

Jdbc:mysql://192.168.200.33:3306/fastdfs?useSSL=false

Adminuser

Localadmin2015!

False

True

UTF-8

True

True

Update

True

Org.hibernate.dialect.MySQL5Dialect

True

True

True

Org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider

five

six hundred

1800

fifty

SELECT 1

True

3000

#

2.persistences.xml

Org.hibernate.ejb.HibernatePersistence

#

The project has run smoothly, fastdfs+springmvc+ spring data jpa + hibernate + fastdfs java api

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report