如何修复"NoSuchMethodError ParameterMetadataImpl< init>"

编程入门 行业动态 更新时间:2024-10-11 15:15:18
本文介绍了如何修复"NoSuchMethodError ParameterMetadataImpl< init>"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我运行代码中显示的searchByKeywords方法时,我收到一条错误消息,提示缺少org.hibernate.query.internal.ParameterMetadataImpl的构造函数:

When I run the searchByKeywords method show in the code, I receive an error message about a missing constructor for org.hibernate.query.internal.ParameterMetadataImpl:

java.lang.NoSuchMethodError: org.hibernate.query.internal.ParameterMetadataImpl.<init>([Lorg/hibernate/engine/query/spi/OrdinalParameterDescriptor;Ljava/util/Map;)V at org.hibernate.search.impl.FullTextSessionImpl.createFullTextQuery(FullTextSessionImpl.java:88) ~[hibernate-search-orm-5.9.2.Final.jar:5.9.2.Final] at org.hibernate.search.impl.FullTextSessionImpl.createFullTextQuery(FullTextSessionImpl.java:78) ~[hibernate-search-orm-5.9.2.Final.jar:5.9.2.Final] at org.hibernate.search.impl.FullTextSessionImpl.createFullTextQuery(FullTextSessionImpl.java:52) ~[hibernate-search-orm-5.9.2.Final.jar:5.9.2.Final] at de.estructor.portal.data.jpa.repo.training.TrainingRepoSearchImpl.searchByKeywords(TrainingRepoSearchImpl.java:50) ~[classes/:na]

当我要求我的IDE打开文件时,我可以看到构造函数的存在形式为

When I ask my IDE to open the file, I can see that the constructor exists as

public ParameterMetadataImpl( Map<Integer,OrdinalParameterDescriptor> ordinalDescriptorMap, Map<String, NamedParameterDescriptor> namedDescriptorMap) {

这是我的pom.xml:

Here's my pom.xml:

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="maven.apache/POM/4.0.0" xmlns:xsi="www.w3/2001/XMLSchema-instance" xsi:schemaLocation="maven.apache/POM/4.0.0 maven.apache/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>de.estructor</groupId> <artifactId>data</artifactId> <version>0.0.1</version> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.1.RELEASE</version> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-rest</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-data</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency> <dependency> <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> </dependency> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> <version>0.9.0</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-jsr310</artifactId> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-test</artifactId> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-rest-hal-browser</artifactId> </dependency> <dependency> <groupId>com.github.javafaker</groupId> <artifactId>javafaker</artifactId> <version>0.16</version> <scope>test</scope> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.9.2</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.9.2</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-data-rest</artifactId> <version>2.9.2</version> </dependency> <dependency> <groupId>org.skyscreamer</groupId> <artifactId>jsonassert</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>com.icegreen</groupId> <artifactId>greenmail</artifactId> <version>1.5.7</version> <scope>test</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-search</artifactId> <version>5.9.2.Final</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-search-elasticsearch</artifactId> <version>5.9.2.Final</version> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-envers</artifactId> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-resource-server</artifactId> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-client</artifactId> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-jose</artifactId> </dependency> <dependency> <groupId>org.springframework.security.oauth</groupId> <artifactId>spring-security-oauth2</artifactId> <version>2.3.4.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.security.oauth.boot</groupId> <artifactId>spring-security-oauth2-autoconfigure</artifactId> <version>2.1.1.RELEASE</version> </dependency> <dependency> <groupId>com.auth0</groupId> <artifactId>auth0</artifactId> <version>1.9.1</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <executable>true</executable> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> </plugin> </plugins> </build> <repositories> <repository> <id>spring-releases</id> <url>repo.spring.io/libs-release</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>spring-releases</id> <url>repo.spring.io/libs-release</url> </pluginRepository> </pluginRepositories> </project>

这是我的代码,如果我在使用休眠搜索的方式中应该出现问题的情况下会产生错误:

Here's the my code that produces the error in case something should be wrong in how I use hibernate search:

public List<Training> searchByKeywords(final String[] keywords) { FullTextEntityManager fullTextEm = Search.getFullTextEntityManager(this.entityManager); QueryBuilder qb = fullTextEm.getSearchFactory().buildQueryBuilder().forEntity(Training.class).get(); List<Query> queryList = new LinkedList<Query>(); for (String keyword : keywords) { keyword = keyword.trim().toLowerCase(); queryList.add(qb.keyword().onFields(searchFields).matching(keyword).createQuery()); } BooleanQuery.Builder booleanQuery = new BooleanQuery.Builder(); for (Query q : queryList) { booleanQuery.add(q, Occur.MUST); } FullTextQuery fullTextQuery = fullTextEm.createFullTextQuery(booleanQuery.build(), Training.class); return (List<Training>) fullTextQuery.getResultList(); }

推荐答案

您使用的Hibernate ORM和Hibernate Search版本不兼容.

You are using incompatible versions of Hibernate ORM and Hibernate Search.

在此处查看我们的兼容性列表: hibernate/search/releases/#兼容性矩阵.

See our compatibility matrix here: hibernate/search/releases/#compatibility-matrix .

您的Spring Boot版本使用的是ORM 5.3.x,因此您应该使用Search 5.10.x(最新的版本是5.10.5.Final).

Your version of Spring Boot is using ORM 5.3.x so you should be using Search 5.10.x (latest is 5.10.5.Final).

更多推荐

如何修复"NoSuchMethodError ParameterMetadataImpl&lt; init&gt;"

本文发布于:2023-11-25 06:38:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628701.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ParameterMetadataImpl   NoSuchMethodError   quot   amp   gt

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!