spring和dubbo搭建时启动报错!!!!一天了都没解决,大神帮忙看看,非常感谢

hhwf1990 2017-01-19 12:59:17
报错信息:

log4j:WARN File option not set for appender [file].
log4j:WARN Are you using FileAppender instead of ConsoleAppender?
log4j:ERROR Either File or DatePattern options are not set for appender [file].
2017-01-19 12:49:30,613 INFO [com.alibaba.dubbo.common.logger.LoggerFactory] - using logger: com.alibaba.dubbo.common.logger.log4j.Log4jLoggerAdapter
log4j:ERROR No output stream or file set for the appender named [file].
2017-01-19 12:49:30,972 WARN [org.springframework.context.support.ClassPathXmlApplicationContext] - Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bhz.sys.facade.SysUserFacade': Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1093)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1038)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
at Provider.main(Provider.java:6)



spring-context的配置:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">

<!-- 配置dubbo服务-->
<import resource="classpath:dubbo-provider.xml" />

<!-- 引入配置文件 -->
<context:property-placeholder location="classpath:config.properties" />

<!-- 配置数据源 -->
<bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource">
<property name="driver" value="${jdbc.driver}" />
<property name="driverUrl" value="${jdbc.url}" />
<property name="user" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="minimumConnectionCount" value="${jdbc.minConnection}" />
<property name="maximumConnectionCount" value="${jdbc.maxConnection}" />
<property name="maximumConnectionLifetime" value="${jdbc.maxConnectionLife}" />
<property name="maximumActiveTime" value="${jdbc.maxActiveTime}" />
<property name="prototypeCount" value="${jdbc.prototypeCount}" />
<property name="houseKeepingTestSql" value="${jdbc.testSql}" />
</bean>

<!-- 配置事务管理器 -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>

<!-- 注解方式配置事物 -->
<tx:annotation-driven transaction-manager="transactionManager" />

<!-- 注解解析 -->
<context:annotation-config />

<!-- 扫描所有spring bean注解 -->
<context:component-scan base-package="bhz" />

<!-- 动态代理 -->
<aop:aspectj-autoproxy/>




</beans>


dubbo-provide.xml的配置

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

<!-- 引入配置文件 -->
<context:property-placeholder location="classpath:config.properties" />

<dubbo:application name="${dubbox.application}" owner="programmer" organization="dubbox"/>

<!-- zookeeper注册中心 -->
<dubbo:registry address="${dubbox.registry.address}"/>

<dubbo:annotation package="bhz" />

<!-- kryo实现序列化 -->
<dubbo:protocol name="dubbo" serialization="kryo" optimizer="bhz.sys.serial.SerializationOptimizerImpl" />

<!-- rest -->
<dubbo:protocol name="rest" server="${dubbox.rest.server}" port="${dubbox.rest.port}" contextpath="${dubbox.rest.contextpath}" threads="${dubbox.rest.threads}" accepts="${dubbox.rest.accepts}" />


<!-- 具体的实现bean -->
<bean id="sysUserService" class="bhz.sys.service.SysUserService" />

<!-- 声明需要暴露的服务接口,同时提供本地dubbo方法调用和rest方法调用 -->

<dubbo:service interface="bhz.sys.facade.SysUserFacade" ref="sysUserService" protocol="rest,dubbo" />





</beans>

...全文
2887 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
西门呀在吹雪 2017-09-27
  • 打赏
  • 举报
回复
log4j 有个file节点没配置
  • 打赏
  • 举报
回复
这贴都块 一年了, 楼主早解决了吧?
点滴寸土 2017-07-03
  • 打赏
  • 举报
回复
参考我这个 http://blog.csdn.net/weisong530624687/article/details/72674093
jun1210 2017-06-16
  • 打赏
  • 举报
回复
dubbo有几个配置一定要写好

25,985

社区成员

发帖
与我相关
我的任务
社区描述
高性能WEB开发
社区管理员
  • 高性能WEB开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧