작성
·
51
·
수정됨
0
안녕하세요.
그런데 섹션3 의 'Querydsl 검색처리' 영상을 다 보고 TDD 테스트를 돌리는데 계속 아래와 같은 에러가 납니다.. 몇일동안 찾아봤는데도 아예 해결이 되지 않아서 여기에 질문드리게 됐네요.. ㅠㅠ
혹시 몰라 콘솔탭에 있는거 전부 다 복사해 왔습니다.
강의를 파트별로 정리하면서 공부하고 있어서 앞에 Ex01 이런식으로 이름이 붙어 있습니다.
왜 안되는지 도저히 모르겠어요..
(게시글이 10000자 이상 안써진다고 해서 댓글에 다음 메세지들 쓰겠습니다.)
(혹시 몰라서 대댓글로 코드들도 남깁니다.)
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.3.6)
2024-12-02T05:13:22.977+09:00 INFO 7780 --- [ restartedMain] c.zerock.apiserver.ApiserverApplication : Starting ApiserverApplication using Java 17.0.13 with PID 7780 (C:\Users\hykim\Desktop\apiserver\build\classes\java\main started by hykim in C:\Users\hykim\Desktop\apiserver)
2024-12-02T05:13:22.993+09:00 INFO 7780 --- [ restartedMain] c.zerock.apiserver.ApiserverApplication : No active profile set, falling back to 1 default profile: "default"
2024-12-02T05:13:23.010+09:00 INFO 7780 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2024-12-02T05:13:23.010+09:00 INFO 7780 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2024-12-02T05:13:23.322+09:00 INFO 7780 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2024-12-02T05:13:23.353+09:00 INFO 7780 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 28 ms. Found 1 JPA repository interface.
2024-12-02T05:13:23.632+09:00 INFO 7780 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
2024-12-02T05:13:23.638+09:00 INFO 7780 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-12-02T05:13:23.638+09:00 INFO 7780 --- [ restartedMain] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.33]
2024-12-02T05:13:23.665+09:00 INFO 7780 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2024-12-02T05:13:23.665+09:00 INFO 7780 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 655 ms
2024-12-02T05:13:23.733+09:00 INFO 7780 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2024-12-02T05:13:23.761+09:00 INFO 7780 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.5.3.Final
2024-12-02T05:13:23.777+09:00 INFO 7780 --- [ restartedMain] o.h.c.internal.RegionFactoryInitiator : HHH000026: Second-level cache disabled
2024-12-02T05:13:23.936+09:00 INFO 7780 --- [ restartedMain] o.s.o.j.p.SpringPersistenceUnitInfo : No LoadTimeWeaver setup: ignoring JPA class transformer
2024-12-02T05:13:23.951+09:00 INFO 7780 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2024-12-02T05:13:23.989+09:00 INFO 7780 --- [ restartedMain] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection org.mariadb.jdbc.Connection@6303bda2
2024-12-02T05:13:23.990+09:00 INFO 7780 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2024-12-02T05:13:24.411+09:00 INFO 7780 --- [ restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
2024-12-02T05:13:24.438+09:00 INFO 7780 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2024-12-02T05:13:24.535+09:00 WARN 7780 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ex04_10_TodoServiceImpl' defined in file [C:\Users\hykim\Desktop\apiserver\build\classes\java\main\com\zerock\apiserver\service\Ex04_10_TodoServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'ex04_13_TodoRepository' defined in com.zerock.apiserver.repository.Ex04_13_TodoRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for public abstract org.springframework.data.domain.Page com.zerock.apiserver.repository.search.Ex04_11_TodoSearch.search1(com.zerock.apiserver.dto.Ex04_7_PageRequestDto); Reason: Paging query needs to have a Pageable parameter; Offending method: public abstract org.springframework.data.domain.Page com.zerock.apiserver.repository.search.Ex04_11_TodoSearch.search1(com.zerock.apiserver.dto.Ex04_7_PageRequestDto)
2024-12-02T05:13:24.535+09:00 INFO 7780 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2024-12-02T05:13:24.537+09:00 INFO 7780 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2024-12-02T05:13:24.538+09:00 INFO 7780 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2024-12-02T05:13:24.539+09:00 INFO 7780 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2024-12-02T05:13:24.545+09:00 INFO 7780 --- [ restartedMain] .s.b.a.l.ConditionEvaluationReportLogger :
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-12-02T05:13:24.556+09:00 ERROR 7780 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ex04_10_TodoServiceImpl' defined in file [C:\Users\hykim\Desktop\apiserver\build\classes\java\main\com\zerock\apiserver\service\Ex04_10_TodoServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'ex04_13_TodoRepository' defined in com.zerock.apiserver.repository.Ex04_13_TodoRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for public abstract org.springframework.data.domain.Page com.zerock.apiserver.repository.search.Ex04_11_TodoSearch.search1(com.zerock.apiserver.dto.Ex04_7_PageRequestDto); Reason: Paging query needs to have a Pageable parameter; Offending method: public abstract org.springframework.data.domain.Page com.zerock.apiserver.repository.search.Ex04_11_TodoSearch.search1(com.zerock.apiserver.dto.Ex04_7_PageRequestDto)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:795) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:237) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1375) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1212) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:971) ~[spring-context-6.1.15.jar:6.1.15]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625) ~[spring-context-6.1.15.jar:6.1.15]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.3.6.jar:3.3.6]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.3.6.jar:3.3.6]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.3.6.jar:3.3.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) ~[spring-boot-3.3.6.jar:3.3.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.3.6.jar:3.3.6]
답변 2
0
본문 글 이어서 메세지 남깁니다.
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.3.6.jar:3.3.6]
at com.zerock.apiserver.ApiserverApplication.main(ApiserverApplication.java:10) ~[main/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.3.6.jar:3.3.6]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ex04_13_TodoRepository' defined in com.zerock.apiserver.repository.Ex04_13_TodoRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for public abstract org.springframework.data.domain.Page com.zerock.apiserver.repository.search.Ex04_11_TodoSearch.search1(com.zerock.apiserver.dto.Ex04_7_PageRequestDto); Reason: Paging query needs to have a Pageable parameter; Offending method: public abstract org.springframework.data.domain.Page com.zerock.apiserver.repository.search.Ex04_11_TodoSearch.search1(com.zerock.apiserver.dto.Ex04_7_PageRequestDto)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1806) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1443) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1353) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:782) ~[spring-beans-6.1.15.jar:6.1.15]
... 24 common frames omitted
Caused by: org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract org.springframework.data.domain.Page com.zerock.apiserver.repository.search.Ex04_11_TodoSearch.search1(com.zerock.apiserver.dto.Ex04_7_PageRequestDto); Reason: Paging query needs to have a Pageable parameter; Offending method: public abstract org.springframework.data.domain.Page com.zerock.apiserver.repository.search.Ex04_11_TodoSearch.search1(com.zerock.apiserver.dto.Ex04_7_PageRequestDto)
at org.springframework.data.repository.query.QueryCreationException.create(QueryCreationException.java:101) ~[spring-data-commons-3.3.6.jar:3.3.6]
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:119) ~[spring-data-commons-3.3.6.jar:3.3.6]
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.mapMethodsToQuery(QueryExecutorMethodInterceptor.java:103) ~[spring-data-commons-3.3.6.jar:3.3.6]
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lambda$new$0(QueryExecutorMethodInterceptor.java:92) ~[spring-data-commons-3.3.6.jar:3.3.6]
at java.base/java.util.Optional.map(Optional.java:260) ~[na:na]
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.<init>(QueryExecutorMethodInterceptor.java:92) ~[spring-data-commons-3.3.6.jar:3.3.6]
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:357) ~[spring-data-commons-3.3.6.jar:3.3.6]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:290) ~[spring-data-commons-3.3.6.jar:3.3.6]
at org.springframework.data.util.Lazy.getNullable(Lazy.java:135) ~[spring-data-commons-3.3.6.jar:3.3.6]
at org.springframework.data.util.Lazy.get(Lazy.java:113) ~[spring-data-commons-3.3.6.jar:3.3.6]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:296) ~[spring-data-commons-3.3.6.jar:3.3.6]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:132) ~[spring-data-jpa-3.3.6.jar:3.3.6]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1802) ~[spring-beans-6.1.15.jar:6.1.15]
... 35 common frames omitted
Caused by: java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter; Offending method: public abstract org.springframework.data.domain.Page com.zerock.apiserver.repository.search.Ex04_11_TodoSearch.search1(com.zerock.apiserver.dto.Ex04_7_PageRequestDto)
at org.springframework.util.Assert.isTrue(Assert.java:111) ~[spring-core-6.1.15.jar:6.1.15]
at org.springframework.data.repository.query.QueryMethod.validate(QueryMethod.java:130) ~[spring-data-commons-3.3.6.jar:3.3.6]
at org.springframework.data.repository.query.QueryMethod.<init>(QueryMethod.java:103) ~[spring-data-commons-3.3.6.jar:3.3.6]
at org.springframework.data.jpa.repository.query.JpaQueryMethod.<init>(JpaQueryMethod.java:116) ~[spring-data-jpa-3.3.6.jar:3.3.6]
at org.springframework.data.jpa.repository.query.DefaultJpaQueryMethodFactory.build(DefaultJpaQueryMethodFactory.java:44) ~[spring-data-jpa-3.3.6.jar:3.3.6]
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:94) ~[spring-data-jpa-3.3.6.jar:3.3.6]
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:115) ~[spring-data-commons-3.3.6.jar:3.3.6]
... 47 common frames omitted
일단 에러 메시지의 핵심은
Caused by: org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract org.springframework.data.domain.Page com.zerock.apiserver.repository.search.Ex04_11_TodoSearch.search1(com.zerock.apiserver.dto.Ex04_7_PageRequestDto); Reason: Paging query needs to have a Pageable parameter; Offending method: public abstract org.springframework.data.domain.Page com.zerock.apiserver.repository.search.Ex04_11_TodoSearch.search1(com.zerock.apiserver.dto.Ex04_7_PageRequestDto)
부분이네요..
우선 Querydsl의 인터페이스와 구현클래스는 이름이 일치해야만 합니다.
Ex04_11_TodoSearch
Ex04_11_TodoSearchImpl
로 되어야 합니다.
코드는
https://drive.google.com/drive/folders/1ZLHRKaXx8Ou8kZNd1WE6qALxq_wJODXW?usp=drive_link
로 프로젝트 자체를 압축해서 올려주세요
강사님 공유 권한이 없다고 나와요.. 권한 풀어주실수 있을까요?
아니시면 혹시 몰라서 급한대로 제 드라이브에 압축해서 올려놨습니다. (아래 링크)
https://drive.google.com/drive/folders/1TQxdqkRD8xvXIHzVoI5fp2hm_HZaE0aT
내일쯤 답 주실줄 알았는데 빠른 답변 감사합니다. ㅠㅠ
와 대박! 강사님 되요!!!
전 3일동안 밤새가면서 검색해도 못고쳤었는데...
Querydsl의 인터페이스와 구현클래스는 이름이 같아야 한다라는거였다니..
진짜진짜 감사합니다!!
좋은하루 보내세요.
0
안녕하세요, 인프런 AI 인턴입니다.
tjdwnsdks님, ‘Querydsl 검색처리’ 관련 TDD 테스트 수행 중 발생한 에러로 인해 어려움을 겪고 계시네요. 해당 에러는 Paging query needs to have a Pageable parameter
라는 메시지를 기반으로 Spring Data JPA에서 PagingQuery를 사용할 때 Pageable
파라미터가 필요하다는 것을 나타냅니다.
비슷한 오류와 해결 방법을 다룬 답변을 찾았습니다. 아래 링크를 통해 확인해 보세요.
위의 링크가 도움이 되시길 바라며, 추가적으로 명확한 해결책을 위한 몇 가지 조언을 드리자면:
- Ex04_11_TodoSearch.search1
메소드의 파라미터에 Pageable
형식의 인자가 포함되어 있는지 확인해보세요.
- Querydsl 설정 및 의존성 관련 문제가 없는지 재점검해보세요.
프로젝트 설정 중 발생할 수 있는 일반적인 문제와 해결 방안을 확인할 수 있는 답변들이니, 참고하여 문제 해결에 도움이 되길 바랍니다.
저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다.
현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏
추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.
혹시 몰라서 코드들도 올립니다.
= Ex01_Todo =
= Ex04_1_TodoDto=
= Ex04_7_PageRequestDto=
= Ex04_8_PageResponseDTO=
= Ex04_11_TodoSearch=
= Ex04_12_TodoSearchImpl=
= Ex04_13_TodoRepository=
= Ex04_9_TodoService=
= Ex04_10_TodoServiceImpl=