Bo Li created SC-74:
-----------------------

             Summary: POJO中包含的static方法被暴露为契约接口,启动时会报错
                 Key: SC-74
                 URL: https://issues.apache.org/jira/browse/SC-74
             Project: Apache ServiceComb
          Issue Type: Bug
          Components: Java-Chassis
            Reporter: Bo Li


使用场景:使用@rpcschema将一个单例POJO暴露为契约接口,但是调用该类中的public方法时,会报下面的错:
Exception in thread "main" java.lang.NullPointerException
at 
io.servicecomb.swagger.generator.core.utils.ClassUtils.getOrCreateClass(ClassUtils.java:135)
at 
io.servicecomb.swagger.converter.model.ModelImplConverter.doConvert(ModelImplConverter.java:55)
at 
io.servicecomb.swagger.converter.AbstractConverter.convert(AbstractConverter.java:42)
at 
io.servicecomb.swagger.converter.ConverterMgr.findJavaType(ConverterMgr.java:188)
at 
io.servicecomb.swagger.converter.ConverterMgr.findByRef(ConverterMgr.java:196)
at 
io.servicecomb.swagger.converter.property.RefPropertyConverter.doConvert(RefPropertyConverter.java:30)
at 
io.servicecomb.swagger.converter.AbstractConverter.convert(AbstractConverter.java:42)
at 
io.servicecomb.swagger.converter.ConverterMgr.findJavaType(ConverterMgr.java:188)
at 
io.servicecomb.swagger.generator.core.utils.ClassUtils.createInterface(ClassUtils.java:252)
at 
io.servicecomb.swagger.generator.core.utils.ClassUtils.getOrCreateInterface(ClassUtils.java:237)
at io.servicecomb.core.definition.SchemaMeta.(SchemaMeta.java:65)
at 
io.servicecomb.core.definition.loader.SchemaLoader.registerSchema(SchemaLoader.java:92)
at 
io.servicecomb.core.definition.schema.ConsumerSchemaFactory.createSchema(ConsumerSchemaFactory.java:132)
at 
io.servicecomb.core.definition.schema.ConsumerSchemaFactory.createSchema(ConsumerSchemaFactory.java:33)
at 
io.servicecomb.core.definition.schema.AbstractSchemaFactory.getOrCreateSchema(AbstractSchemaFactory.java:59)
at 
io.servicecomb.core.definition.schema.ConsumerSchemaFactory.getOrCreateConsumerSchema(ConsumerSchemaFactory.java:122)
at 
io.servicecomb.core.definition.schema.ConsumerSchemaFactory.getOrCreateMicroserviceMeta(ConsumerSchemaFactory.java:78)
at 
io.servicecomb.core.provider.consumer.ReferenceConfig.(ReferenceConfig.java:35)
at 
io.servicecomb.core.provider.consumer.ConsumerProviderManager.getReferenceConfig(ConsumerProviderManager.java:82)
at 
io.servicecomb.core.provider.consumer.ReferenceConfigUtils.getForInvoke(ReferenceConfigUtils.java:42)
at io.servicecomb.provider.pojo.Invoker.prepare(Invoker.java:59)
at io.servicecomb.provider.pojo.Invoker.invoke(Invoker.java:81)
at com.sun.proxy.$Proxy17.selectByPrimaryKey(Unknown Source)
at com.ceewa.cloud.consumer.DubboxConsumer.testMycat(DubboxConsumer.java:49)
at com.ceewa.cloud.consumer.DubboxConsumer.main(DubboxConsumer.java:38)

在getInstance方法上添加@apioperation(value = "getInstance is not an endpoint", hidden 
= true)标签后,该问题得到解决,请问对于解决这种问题,大家有没有什么更好的建议?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to