NutzCN Logo
问答 dubbo annotation 无法发布
发布于 2561天前 作者 yiziyu 2031 次浏览 复制 上一个帖子 下一个帖子
标签:
 <!--   <bean id="uploadService" class="com.supermap.file.UploadService"/>

    
    <dubbo:service interface="com.supermap.file.IUploadService" ref="uploadService"/> -->
    <dubbo:annotation package="com.supermap.file" />

service指定的可以发布,annotation无法发布这是为什么呢 @Service 注解都有

17 回复

基于注解的扫描

与官方写法一样, 声明一下需要扫描的package, 即可使用@Reference和@Service注解

<dubbo:annotation package="com.foo.bar.service" />

文档中这个怎么理解呢

换最新快照版试试

最新快照在哪儿呢?

报错了

2017-12-18 23:53:14,586 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:80) DEBUG - Found @IocBean : class com.supermap.file.UploadServiceimpl
2017-12-18 23:53:14,592 org.nutz.ioc.loader.annotation.AnnotationIocLoader.<init>(AnnotationIocLoader.java:56) INFO  - Found 1 classes in 1 base-packages!
beans = ["uploadService"]
2017-12-18 23:53:14,598 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:125) ERROR - Error happend during start serivce!
java.lang.RuntimeException: java.lang.ClassNotFoundException: dubbo
	at org.nutz.lang.Lang.wrapThrow(Lang.java:185)
	at org.nutz.mvc.ioc.provider.ComboIocProvider.create(ComboIocProvider.java:23)
	at org.nutz.mvc.impl.NutLoading.createIoc(NutLoading.java:385)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:103)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:91)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: dubbo
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:191)
	at org.nutz.lang.Lang.loadClass(Lang.java:2074)
	at org.nutz.ioc.loader.combo.ComboIocLoader.createIocLoader(ComboIocLoader.java:118)
	at org.nutz.ioc.loader.combo.ComboIocLoader.<init>(ComboIocLoader.java:94)
	at org.nutz.mvc.ioc.provider.ComboIocProvider.create(ComboIocProvider.java:20)
	... 18 more

nutz是什么版本的?

报告兽总 1.r.63

maven?? 普通javaee项目?? 怎么加的jar包??

整个项目是maven 单独引用的nutz-integration-dubbo-1.r.65-20171116.025018-1.jar

下载了nutz-integration-dubbo 工程,做工程间的引用也不行

那怎么做呢

看文档,配repositories就好啦

十二月 19, 2017 12:15:57 上午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter nutz
org.nutz.mvc.LoadingException: org.nutz.ioc.IocException: IocBean[dubboManager -> p1iegdpj1sgt3o154b8ksigs4j] throw Exception when creating
	at org.nutz.mvc.LoadingException$FC$9a86caf9ff5d3b587784fcdf555a4a7d.invoke(LoadingException.java)
	at org.nutz.lang.born.AbstractConstructorBorning.call(AbstractConstructorBorning.java:25)
	at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:19)
	at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
	at org.nutz.lang.Mirror.born(Mirror.java:1010)
	at org.nutz.lang.Lang.wrapThrow(Lang.java:201)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:135)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:91)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.nutz.ioc.IocException: IocBean[dubboManager -> p1iegdpj1sgt3o154b8ksigs4j] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:150)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:216)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:245)
	at org.nutz.integration.dubbo.DubboManager.init(DubboManager.java:27)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.nutz.ioc.trigger.MethodEventTrigger.trigger(MethodEventTrigger.java:18)
	at org.nutz.ioc.weaver.DefaultWeaver.onCreate(DefaultWeaver.java:72)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:139)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:216)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:245)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:152)
	at com.supermap.server.core.Setup.init(Setup.java:21)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:278)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
	... 16 more
Caused by: java.lang.IllegalStateException: <dubbo:service interface="" /> interface not allow null!
	at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:227)
	at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:214)
	at org.nutz.integration.dubbo.ServiceBean._init(ServiceBean.java:163)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.nutz.ioc.trigger.MethodEventTrigger.trigger(MethodEventTrigger.java:18)
	at org.nutz.ioc.weaver.DefaultWeaver.onCreate(DefaultWeaver.java:72)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:139)
	... 32 more

配置

<?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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans        http://www.springframework.org/schema/beans/spring-beans.xsd        http://code.alibabatech.com/schema/dubbo        http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
 
    <dubbo:application name="file-server"  />
 
    <dubbo:registry address="zookeeper://127.0.0.1:2181" />
 
    <dubbo:protocol name="dubbo" port="20880" />
    <dubbo:annotation package="com.supermap.file" />
</beans>
@IocBean
@Service(interfaceClass=TimeService.class)
public class TimeServiceImpl implements TimeService {

	public long now() {
		return System.currentTimeMillis();
	}

}

谢谢兽总,可以了,粗心了

添加回复
请先登陆
回到顶部