간단한 스프링 부트 프로젝트에서 메이븐 테스트를하는 동안 오류가 발생했습니다. Maven 유효성 검사 및 컴파일을 실행할 수 있습니다.스프링 부트 - 메이븐 빌드 에러
소스 코드는 다음과 같습니다 :
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Microservice1Application {
\t public static void main(String[] args) {
\t \t SpringApplication.run(Microservice1Application.class, args);
\t }
}
테스트 코드는 다음과 같습니다 :
package com.example.demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class Microservice1ApplicationTests {
\t @Test
\t public void contextLoads() {
\t }
}
내가 점점 오전 오류가아래 :
-------------------------------------------------------------------------------
Test set: com.example.demo.Microservice1ApplicationTests
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.895 sec <<< FAILURE! - in com.example.demo.Microservice1ApplicationTests
contextLoads(com.example.demo.Microservice1ApplicationTests) Time elapsed: 0.011 sec <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
\t at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)
\t at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287)
\t at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
\t at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289)
\t at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
\t at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
\t at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
\t at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1078)
\t at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857)
\t at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
\t at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
\t at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:264)
\t at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:228)
Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
\t at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:100)
\t at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:54)
당신이 도와 주실 수 있습니까?
_There의 일환으로 속성과 "hibernate.driver"로 "hibernate.dialect"을 추가 것을 볼 수있다
:
마지막으로 최대 절전 모드 설정은 다음과 같을 수 있습니다 시험 실패입니다. 먼저 어떤 테스트가 실패하는지 확인하십시오. _ 개별 테스트 결과에 대한 target ... surefire-reports를 참조하십시오 _ – pirho
다음과 같이 오류가 표시됩니다 테스트 세트 : com.example.demo.Microservice1ApplicationTests ---------------- -------------------------------------------------- ------------- 테스트 실행 : 1, 실패 : 0, 오류 : 1, 건너 뛰기 : 0, 경과 시간 : 2.702 초 <<< 실패! - com.example.demo.Microservice1ApplicationTests에서 contextLoads (com.example.demo.Microservice1ApplicationTests) 경과 시간 : 0.001 초 <<< 오류! java.lang.IllegalStateException : ApplicationContext를로드하지 못했습니다. – DS2017
이 항목을 질문에 추가하고 주석이 아닌 형식으로 올바르게 입력하십시오. 질문을 수정하십시오. 실패한 테스트 케이스를 찾으십시오. 그들은 이유 때문에 실패하거나 유효한 시험이 아닙니다. – pirho