NutzCN Logo
问答 dubbo实现类继承其他实现类后无法发布
发布于 171天前 作者 threefish 170 次浏览 复制 上一个帖子 下一个帖子
标签:

接口

public interface IDubboBaseService<T> {
    <T> T fastInsert(T obj);
}
public interface IDubboDemoService extends IDubboBaseService<Role>{
    String sayHi(String name);
}

实现类

public class DubboBaseServiceImpl<T> extends EntityService<T> implements IDubboBaseService<T> {
    @Override
    public <T> T fastInsert(T obj) {
        return obj;
    }
}
@IocBean(name = "dubboDemoService", args = {"refer:dao"})
public class DubboDemoServiceImpl extends DubboBaseServiceImpl<Role> implements IDubboDemoService {
    private Dao dao;

    public DubboDemoServiceImpl(Dao dao) {
        this.dao = dao;
    }

    @Override
    public String sayHi(String name) {
        return "hi," + name;
    }
}

如果实现类不继承 DubboBaseServiceImpl 可以正确发布提供者服务。一旦继承了就会报一下错误

2018-03-01 10:35:39 ERROR NutLoading:125 - Error happend during start serivce!
org.nutz.ioc.IocException: IocBean[dubboManager -> dubboDemoService_Server] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:240)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:270)
	at org.nutz.integration.dubbo.DubboManager.init(DubboManager.java:27)
	at org.nutz.integration.dubbo.DubboManager$FM$init$62febe830a4a6764c634d9e263964cee.invoke(DubboManager.java)
	at org.nutz.ioc.impl.ObjectMakerImpl$2.trigger(ObjectMakerImpl.java:180)
	at org.nutz.ioc.weaver.DefaultWeaver.onCreate(DefaultWeaver.java:89)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:141)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:240)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:270)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:160)
	at com.demo.MainSetup.init(MainSetup.java:45)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:278)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
	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:279)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4572)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5215)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
	at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1702)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:482)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:431)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
	at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
	at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
	at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
	at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
	at sun.rmi.transport.Transport$1.run(Transport.java:200)
	at sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: java.io.IOException: invalid constant type: 15
	at javassist.CtClassType.getClassFile2(CtClassType.java:203)
	at javassist.CtClassType.subtypeOf(CtClassType.java:303)
	at javassist.CtClassType.subtypeOf(CtClassType.java:318)
	at javassist.compiler.MemberResolver.compareSignature(MemberResolver.java:247)
	at javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:119)
	at javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:144)
	at javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:144)
	at javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:96)
	at javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:704)
	at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:681)
	at javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:156)
	at javassist.compiler.ast.CallExpr.accept(CallExpr.java:45)
	at javassist.compiler.JvstTypeChecker.atCastToWrapper(JvstTypeChecker.java:125)
	at javassist.compiler.JvstTypeChecker.atCastExpr(JvstTypeChecker.java:97)
	at javassist.compiler.ast.CastExpr.accept(CastExpr.java:54)
	at javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:241)
	at javassist.compiler.CodeGen.compileExpr(CodeGen.java:228)
	at javassist.compiler.CodeGen.atReturnStmnt2(CodeGen.java:597)
	at javassist.compiler.JvstCodeGen.atReturnStmnt(JvstCodeGen.java:424)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:362)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:350)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
	at javassist.compiler.CodeGen.atIfStmnt(CodeGen.java:390)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:354)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:350)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
	at javassist.compiler.MemberCodeGen.atTryStmnt(MemberCodeGen.java:203)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:366)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:350)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
	at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:291)
	at javassist.compiler.CodeGen.atMethodDecl(CodeGen.java:273)
	at javassist.compiler.ast.MethodDecl.accept(MethodDecl.java:43)
	at javassist.compiler.Javac.compileMethod(Javac.java:168)
	at javassist.compiler.Javac.compile(Javac.java:94)
	at javassist.CtNewMethod.make(CtNewMethod.java:73)
	at javassist.CtNewMethod.make(CtNewMethod.java:44)
	at com.alibaba.dubbo.common.bytecode.ClassGenerator.toClass(ClassGenerator.java:318)
	at com.alibaba.dubbo.common.bytecode.Wrapper.makeWrapper(Wrapper.java:346)
	at com.alibaba.dubbo.common.bytecode.Wrapper.getWrapper(Wrapper.java:89)
	at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory.getInvoker(JavassistProxyFactory.java:40)
	at com.alibaba.dubbo.rpc.proxy.wrapper.StubProxyFactoryWrapper.getInvoker(StubProxyFactoryWrapper.java:104)
	at com.alibaba.dubbo.rpc.ProxyFactory$Adpative.getInvoker(ProxyFactory$Adpative.java)
	at com.alibaba.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:483)
	at com.alibaba.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:281)
	at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:242)
	at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:143)
	at org.nutz.integration.dubbo.ServiceBean._init(ServiceBean.java:163)
	at org.nutz.integration.dubbo.ServiceBean$FM$_init$62febe830a4a6764c634d9e263964cee.invoke(ServiceBean.java)
	at org.nutz.ioc.impl.ObjectMakerImpl$2.trigger(ObjectMakerImpl.java:180)
	at org.nutz.ioc.weaver.DefaultWeaver.onCreate(DefaultWeaver.java:89)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:141)
	... 64 more
Caused by: java.io.IOException: invalid constant type: 15
	at javassist.bytecode.ConstPool.readOne(ConstPool.java:1090)
	at javassist.bytecode.ConstPool.read(ConstPool.java:1033)
	at javassist.bytecode.ConstPool.<init>(ConstPool.java:149)
	at javassist.bytecode.ClassFile.read(ClassFile.java:737)
	at javassist.bytecode.ClassFile.<init>(ClassFile.java:108)
	at javassist.CtClassType.getClassFile2(CtClassType.java:190)
	... 118 more
2018-03-01 10:35:39 ERROR NutLoading:127 - try to depose ioc
3 回复
 <dubbo:service  id="dubboDemoService_Server" interface="com.demo.service.IDubboDemoService" ref="dubboDemoService" timeout="3000"/>

javassist版本问题,不支持jdk8, 更新一下就好了

更新后解决了

<!-- https://mvnrepository.com/artifact/org.javassist/javassist -->
        <dependency>
            <groupId>org.javassist</groupId>
            <artifactId>javassist</artifactId>
            <version>3.22.0-GA</version>
        </dependency>
添加回复
请先登陆
回到顶部