Druid 启动dubbo报错。

发布于 2021-11-27 14:51:52 字数 15144 浏览 837 评论 4

15-09-07.11:30:52.025 [main            ] ERROR DruidDataSource         - init datasource error

java.sql.SQLException: connect error, url http://maven.apache.org, driverClass com.mysql.jdbc.Driver

at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1412) ~[druid-1.0.0.jar:1.0.0]

at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:602) ~[druid-1.0.0.jar:1.0.0]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_51]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_51]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_51]

at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_51]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1608) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1549) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:323) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1387) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1128) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:323) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:615) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1045) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:949) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:438) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:416) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:550) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:150) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:303) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]

at com.alibaba.dubbo.container.spring.SpringContainer.start(SpringContainer.java:50) [dubbo-2.4.10.jar:2.4.10]

at com.alibaba.dubbo.container.Main.main(Main.java:80) [dubbo-2.4.10.jar:2.4.10]

at com.wangyin.idauth.bankelem.provider.ProviderStartup.main(ProviderStartup.java:13) [test-classes/:na]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

不再见 2021-11-30 14:57:49

之前用的就是参数文件传递的,用druid启动就报错。最后用的C3p0,可以。

配置如下:

--------------------------------------

 <!-- 配置数据源 Druid --> <!-- 这里不需要配置destroy-method,因为bboss持久层在jvm退出时会自动调用数据源的close方法 -->
<!--  <bean name="teslaDataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
  <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  <property name="url" value="${url}"/>
  <property name="username" value="${username}"/>
  <property name="password" value="${password}"/>
  <property name="filters" value="stat" />
  <property name="maxActive" value="20" />
  <property name="initialSize" value="1" />
  <property name="maxWait" value="60000" />
  <property name="minIdle" value="1" />
  <property name="timeBetweenEvictionRunsMillis" value="3000" />
  <property name="minEvictableIdleTimeMillis" value="300000" />
  <property name="validationQuery" value="SELECT 1 from dual" />
  <property name="testWhileIdle" value="true" />
  <property name="testOnBorrow" value="false" />
  <property name="testOnReturn" value="false" />
  <property name="poolPreparedStatements" value="true" />
  <property name="maxPoolPreparedStatementPerConnectionSize" value="20" />
 </bean> -->
 
 
 <!-- C3P0数据源-->
  <bean id="teslaDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="driverClass" value="${jdbc_driver}" /> 
        <property name="jdbcUrl" value="${jdbc_url}" /> 
        <property name="user" value="${jdbc_name}" /> 
        <property name="password" value="${jdbc_pwd}" />
        <property name="minPoolSize" value="${jdbc_minPoolSize}" /> 
        <property name="maxPoolSize" value="${jdbc_maxPoolSize}" /> 
        <property name="idleConnectionTestPeriod" value="${jdbc_idleConnectionTestPeriod}" /> 
        <property name="maxIdleTime" value="${jdbc_maxIdleTime}" />
        <property name="acquireIncrement" value="${jdbc_acquireIncrement}" /> 
        <property name="acquireRetryAttempts" value="${jdbc_acquireRetryAttempts}" />
        <property name="acquireRetryDelay" value="${jdbc_acquireRetryDelay}" /> 
    </bean>

少女情怀诗 2021-11-30 10:45:13

数据库

已下线请稍等 2021-11-29 23:06:37

你好:

   看到你发的了,我就查了下druid,你试试,看看行不

利用属性文件传递参数:

#MySQL驱动
driverClassName=com.mysql.jdbc.Driver
#MySQL连接地址
url=jdbc:mysql://192.168.0.14:3306/test
#数据库用户
username=moster
#该用户密码
password=shzygjrmdwg
#初始化
initialSize=1
#最大连接数
maxIdle=25
#最小连接数
minIdle=1
简单气质女生网名 2021-11-29 21:09:16

感觉是链接不上数据库

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文