- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个使用 Spring MVC、Spring Security 和 Spring Data 的 Spring 应用程序。一切都曾经完美地工作,直到我将 Spring Data 的版本从 1.9.0.RELEASE
更新到 2.x
。
这是无法创建的存储库 bean (BeanCreationException):
@Repository // Enables exception translation
public interface UsuarioRepository extends CrudRepository<Usuario, Long> {
@Query("SELECT u FROM Usuario u WHERE LOWER(u.login) = LOWER(:login)")
Usuario findByLogin(@Param("login") String login);
@Query(value = "SELECT * FROM Usuario WHERE fl_ativo = true", nativeQuery = true)
Iterable<Usuario> findAllActives();
}
这是pom.xml
(Maven):
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- Artifact details -->
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.nooder</groupId>
<artifactId>portal-jstl</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<!-- Properties -->
<properties>
<project.build.version.log4j>2.8.2</project.build.version.log4j>
<project.build.version.junit>4.12</project.build.version.junit>
<project.build.version.slf4j>1.7.25</project.build.version.slf4j>
<project.build.version.hibernate>5.2.12.Final</project.build.version.hibernate>
<project.build.version.spring>4.3.8.RELEASE</project.build.version.spring>
<project.build.version.spring.data>2.0.2.RELEASE</project.build.version.spring.data>
<project.build.version.spring.security>4.2.2.RELEASE</project.build.version.spring.security>
</properties>
<!-- Environment settings -->
<profiles>
<profile>
<id>dev</id>
<properties>
<build.environment>dev</build.environment>
<build.environment.name>development</build.environment.name>
</properties>
</profile>
<profile>
<id>tst</id>
<properties>
<build.environment>tst</build.environment>
<build.environment.name>test</build.environment.name>
</properties>
</profile>
<profile>
<id>qas</id>
<properties>
<build.environment>qas</build.environment>
<build.environment.name>quality</build.environment.name>
</properties>
</profile>
<profile>
<id>prd</id>
<properties>
<build.environment>prd</build.environment>
<build.environment.name>production</build.environment.name>
</properties>
</profile>
</profiles>
<!-- Dependencies -->
<dependencies>
<!-- Spring MVC -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${project.build.version.spring}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${project.build.version.spring}</version>
</dependency>
<!-- Spring Data (JPA tools) -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>${project.build.version.spring.data}</version>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${project.build.version.spring.security}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${project.build.version.spring.security}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${project.build.version.spring.security}</version>
</dependency>
<!-- Spring MVC automatic object serialization JSON module for lazy collections -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-hibernate5</artifactId>
<version>2.9.1</version>
</dependency>
<!-- JUnit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${project.build.version.junit}</version>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${project.build.version.hibernate}</version>
</dependency>
<!-- Database drivers (DEV: Postgres; TST/QAS/PRD: SQL Server) -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.1.1</version>
</dependency>
<!-- Servlets -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- CDI: br.com.portal.factory.sap (Produces, Disposes, RequestScoped...) -->
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<!-- Log4j 2 -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${project.build.version.log4j}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${project.build.version.log4j}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>${project.build.version.log4j}</version>
</dependency>
</dependencies>
<!-- Build -->
<build>
<finalName>portal</finalName>
<!-- Resources -->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<filters>
<filter>src/main/filters/settings.${build.environment}.properties</filter>
</filters>
</build>
</project>
堆栈跟踪:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'usuarioRepository': Initialization of bean failed; nested exception is java.lang.AbstractMethodError
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:742)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1174)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1090)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:980)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4829)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5139)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1425)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1415)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1425)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1415)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:657)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495)
Caused by: java.lang.AbstractMethodError
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:99)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:302)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1531)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
... 48 more
nov 29, 2017 1:55:04 PM org.apache.catalina.core.StandardContext loadOnStartup
GRAVE: Servlet [spring] in web application [/portal] threw load() exception
java.lang.AbstractMethodError
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:99)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:302)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1531)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:742)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1174)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1090)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:980)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4829)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5139)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1425)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1415)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1425)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1415)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:657)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495)
如果还有与此问题相关的其他内容,请告诉我,我会更新问题。
最佳答案
这是由于您配置的 Spring Framework 与 Spring Data 2.x 所需的 Spring Framework(即 Spring Framework 5.x)之间存在版本冲突。
将 Spring Framework 升级到 5.x 以解决该问题。
为了避免 Spring Security 和 Spring Framework 出现同样的问题,您可能也应该将其更新到 5.x 版本。
关于java - 启动 Spring 应用程序时出错 : Initialization of bean failed; nested exception is AbstractMethodError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47558017/
这个问题在这里已经有了答案: Python try...except comma vs 'as' in except (5 个回答) 关闭7年前。 在python中,有两种方法可以捕获异常 excep
在 Java 中,我有一个从 Exception 扩展的异常类,但是每当我抛出它时,编译器都会说它需要被捕获/必须声明方法 throws异常。 当我使用从 Exception 扩展的 RuntimeE
我有一组用户、组以及用户和组之间的映射。我有各种操作这些集合的函数,但是不能为不存在的用户添加用户组映射,也不能删除仍然有用户作为成员的组等。 所以基本上我希望这些函数抛出必须由调用者明确处理的“异常
我正在尝试使用上载控件上载20兆的文件,并且在Visual Studio的内置Web服务器上可以正常工作,但是一旦将其发布到生产服务器(我无权访问),我总是收到以下错误消息: Server Error
我想断言运行某些代码时会引发特定异常(SSLHandshakeException)。 assertThatThrownBy(() -> { // some code }).is
这个问题我暂时解决不了。我很乐意提供一些建议。 当我尝试抛出异常时(我自己创建了一个 Java 风格的异常) throw Exception (); 编译器提出抗议: DataTypes/Date.c
我有以下文件: from fabric.api import env, execute, run env.hosts = ['1.2.3.4'] def taskA(): run('ls')
我正在阅读一些包含类似于以下功能的源代码: def dummy_function(): try: g = 1/0 except Exception as e:
根据标准 ML 的定义(修订版): The idea is that dynamic evaluation of a non-expansive expression will neither gen
当 GHCi 在运行时发现调用产生的值与函数的模式匹配不匹配时,有没有办法让 GHCi 产生更好的异常消息? 它目前给出了产生非详尽模式匹配的函数的行号,虽然有时会有所帮助,但确实需要一轮调试,有时我
我有一个最佳实践问题。我意识到这是主观的,但想问问比我更聪明的人,这是否是一种常见的编程实践。 如果您有一种不希望干扰应用程序重要功能的非关键方法,那么使用这样的错误接收器是否常见? Try
在编程中,异常是否总是错误(被零除,访问冲突等等)? 如果不是,您能否提供不是错误的异常示例? 谢谢。 最佳答案 异常通常用于管理错误,它们使错误处理更加容易,但它们并不总是错误。 任何需要单独代码路
我很想知道 OCaml 运行时如何处理异常以使它们如此轻量。他们是使用 setjmp/longjmp 还是在每个函数中返回一个特殊值并传播它? 在我看来,longjmp会给系统带来一点压力,但只有在引
在我的 C# 代码中,我可以访问 MyNamespace.Exception 以及 System.Exception。当我想捕获其中一个异常时,理想情况下我会完全限定要捕获的异常或使用别名来明确说明。
我正在使用 Visual C++ 2005 Express Edition 并遇到以下链接器错误: 19>mylib1.lib(mylibsource1.obj) : error LNK2019: u
这个问题在这里已经有了答案: Is there "Break on Exception" in IntelliJ? (6 个回答) 关闭7年前。 我想在调试器中运行我的测试套件并中断任何意外异常,但是
Like in this picture 我知道它们都可以正常工作,但我只是想知道它们之间有何不同? PS:我是初学者。 最佳答案 A LogEvent可以同时包含消息和异常。如果您使用第一种形式:
我知道避免 Doctrine 上的异常似乎是一种奇怪的行为,但我需要这样做,因为我在一个旧项目中工作,过去有人执行了一些迁移,然后他决定删除它,所以现在复制起来很复杂本地生产环境没有崩溃,这就是为什么
我想创建一个名为 SecurityException 的新异常。 我应该把代码放在哪里? class SecurityException extends CakeException {}; 谢谢! 最
我一直在使用throw new Exception("...")在我的代码中,因为我找不到其他可以使用的东西。我正在寻找像 C++'s 这样的东西 out_of_range 和 logic_error
我是一名优秀的程序员,十分优秀!