2019-02-17 13:01:11,138 [localhost-startStop-1] ERROR [org.springframework.web.c
ontext.ContextLoader] - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean def
inition with name 'dataSource' defined in class path resource [spring-mybatis.xm
l]: Could not resolve placeholder 'jdbc.driverClassName' in string value "${jdbc
.driverClassName}"; nested exception is java.lang.IllegalArgumentException: Coul
d not resolve placeholder 'jdbc.driverClassName' in string value "${jdbc.driverC
lassName}"
        at org.springframework.beans.factory.config.PlaceholderConfigurerSupport
.doProcessProperties(PlaceholderConfigurerSupport.java:211)
        at org.springframework.beans.factory.config.PropertyPlaceholderConfigure
r.processProperties(PropertyPlaceholderConfigurer.java:223)
        at org.springframework.beans.factory.config.PropertyResourceConfigurer.p
ostProcessBeanFactory(PropertyResourceConfigurer.java:86)
        at org.springframework.context.support.PostProcessorRegistrationDelegate
.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265)
        at org.springframework.context.support.PostProcessorRegistrationDelegate
.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:162)
        at org.springframework.context.support.AbstractApplicationContext.invoke
BeanFactoryPostProcessors(AbstractApplicationContext.java:609)
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:464)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebA
pplicationContext(ContextLoader.java:403)
        at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:306)
        at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:106)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:5157)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContex
t.java:5680)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:1017)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:99
3)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:1296)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig
.java:2039)``````

解决方案 »

  1.   

    看这个意思你不是用相同的包部署的,大概是开发环境吧。 'jdbc.driverClassName' in string value "${jdbc.driverC
    lassName}" 这个没有被替换成实际的值。
      

  2.   

    你是同一个war包,分别扔到2个服务器上这样搞的?
      

  3.   

    那只能先看看spring-mybatis.xml里dataSource中,${jdbc.driverClassName}是不是真的存在了。如果有先改了再说吧,诡异。