maven install时出错

PioneerFighter 发布于 2017/06/23 19:10
阅读 304
收藏 0
Running me.kafeitu.demo.activiti.service.oa.leave.LeaveWorkflowServiceTest
2017-06-23 15:49:58,230  INFO [main] support.PropertySourcesPlaceholderConfigurer.loadProperties:181 | Could not load properties from class path resource [application.test.local.properties]: class path resource [application.test.local.properties] cannot be opened because it does not exist
2017-06-23 15:49:58,464  WARN [main] support.GenericApplicationContext.refresh:487 | Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'entityManagerFactory' defined in class path resource [applicationContext-test.xml]: Could not resolve placeholder 'hibernate.dialect' in string value "${hibernate.dialect}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'hibernate.dialect' in string value "${hibernate.dialect}"
    at  ... 43 more
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'entityManagerFactory' defined in class path resource [applicationContext-test.xml]: Could not resolve placeholder 'hibernate.dialect' in string value "${hibernate.dialect}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'hibernate.dialect' in string value "${hibernate.dialect}"
    ... 31 more
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'hibernate.dialect' in string value "${hibernate.dialect}"
    at ... 43 more
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.231 sec <<< FAILURE!
testAllPass(me.kafeitu.demo.activiti.service.oa.leave.LeaveWorkflowServiceTest)  Time elapsed: 0.001 sec  <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:94)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'entityManagerFactory' defined in class path resource [applicationContext-test.xml]: Could not resolve placeholder 'hibernate.dialect' in string value "${hibernate.dialect}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'hibernate.dialect' in string value "${hibernate.dialect}"
    ... 31 more
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'hibernate.dialect' in string value "${hibernate.dialect}"
    at  ... 43 more

Running me.kafeitu.demo.activiti.web.user.UserControllerTest
2017-06-23 15:49:58,470  INFO [main] support.DefaultTestContextBootstrapper.getTestExecutionListeners:182 | Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@3129f63e, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@39e579a9, org.springframework.test.context.support.DirtiesContextTestExecutionListener@89663f1, org.springframework.test.context.transaction.TransactionalTestExecutionListener@497b679e, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@44cfdbc2]
2017-06-23 15:49:58,473  INFO [main] xml.XmlBeanDefinitionReader.loadBeanDefinitions:317 | Loading XML bean definitions from class path resource [applicationContext-test.xml]
2017-06-23 15:49:58,629  INFO [main] support.GenericApplicationContext.prepareRefresh:510 | Refreshing org.springframework.context.support.GenericApplicationContext@2a64c0d9: startup date [Fri Jun 23 15:49:58 CST 2017]; root of context hierarchy
2017-06-23 15:49:58,655  INFO [main] support.PropertySourcesPlaceholderConfigurer.loadProperties:172 | Loading properties file from class path resource [application.properties]
2017-06-23 15:49:58,655  INFO [main] support.PropertySourcesPlaceholderConfigurer.loadProperties:172 | Loading properties file from class path resource [application.test.properties]
2017-06-23 15:49:58,655  INFO [main] support.PropertySourcesPlaceholderConfigurer.loadProperties:172 | Loading properties file from class path resource [application.test.local.properties]
2017-06-23 15:49:58,656  WARN [main] support.PropertySourcesPlaceholderConfigurer.loadProperties:181 | Could not load properties from class path resource [application.test.local.properties]: class path resource [application.test.local.properties] cannot be opened because it does not exist
2017-06-23 15:49:58,657  WARN [main] support.GenericApplicationContext.refresh:487 | Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'entityManagerFactory' defined in class path resource [applicationContext-test.xml]: Could not resolve placeholder 'hibernate.dialect' in string value "${hibernate.dialect}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'hibernate.dialect' in string value "${hibernate.dialect}"
    at Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'hibernate.dialect' in string value "${hibernate.dialect}"
    at  ... 43 more
2017-06-23 15:49:58,658 ERROR [main] context.TestContextManager.prepareTestInstance:215 | Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@39e579a9] to prepare test instance [me.kafeitu.demo.activiti.web.user.UserControllerTest@95e60cf]
java.lang.IllegalStateException: Failed to load ApplicationContext
    at  ... 31 more
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'hibernate.dialect' in string value "${hibernate.dialect}"
    at  ... 43 more

Results :

Failed tests:   testWithWebservice(me.kafeitu.demo.activiti.service.oa.leave.LeaveWebserviceInWorkflowTest): expected:<1> but was:<0>
  testWithWebserviceFalse(me.kafeitu.demo.activiti.service.oa.leave.LeaveWebserviceInWorkflowTest): expected:<1> but was:<0>

Tests in error: 
  testUserData(me.kafeitu.demo.activiti.dao.InitDataTest): Failed to load ApplicationContext
  allClassMapping(me.kafeitu.demo.activiti.dao.JpaMappingTest): Failed to load ApplicationContext
  crudEntity(me.kafeitu.demo.activiti.dao.LeaveDaoTest): Failed to load ApplicationContext
  testProcessEngines(me.kafeitu.demo.activiti.engine.ProcessEngineTest): Failed to load ApplicationContext
  testSave(me.kafeitu.demo.activiti.service.oa.leave.LeaveManagerTest): Failed to load ApplicationContext
  testWithWebservice(me.kafeitu.demo.activiti.service.oa.leave.LeaveWebserviceInWorkflowTest): Error parsing XML
  testWithWebserviceFalse(me.kafeitu.demo.activiti.service.oa.leave.LeaveWebserviceInWorkflowTest): resource 'diagrams/leave-webservice.bpmn' not found
  testAllPass(me.kafeitu.demo.activiti.service.oa.leave.LeaveWorkflowServiceTest): Failed to load ApplicationContext
  testUserExistInDb(me.kafeitu.demo.activiti.web.user.UserControllerTest): Failed to load ApplicationContext
  testUserNotExistInDb(me.kafeitu.demo.activiti.web.user.UserControllerTest): Failed to load ApplicationContext

Tests run: 12, Failures: 2, Errors: 10, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.160 s
[INFO] Finished at: 2017-06-23T15:49:58+08:00
[INFO] Final Memory: 39M/357M
[INFO] ------------------------------------------------------------------------

以上错误信息都指向了hibernate dialect,从XML配置文件中 找出来:

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapter" />
        <property name="packagesToScan" value="me.kafeitu.demo.activiti.entity"/>
        <property name="jpaProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>
                <prop key="net.sf.ehcache.configurationResourceName">ehcache/ehcache-hibernate-local.xml</prop>
                <prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
                <prop key="hibernate.hbm2ddl.auto">update</prop>
            </props>
        </property>
    </bean>

这么配置的EL表达式获取的dialect值是在哪里的呢?这个是maven项目导进来的!dialect四周围找过没有看到有引用的地方,是否要创建一个呢? 

加载中
0
混分丶小菜鸟
混分丶小菜鸟

错误已经很明显了,你的¥{hibernate.dialect} 没有替换呢

但是install 是不需要这些操作的,load app 是在compile的时候跑test或者run 的时候才会调用的。

 

0
木有龙井茶
木有龙井茶

跳过测试就行

返回顶部
顶部