Closed jiangqiushi closed 4 years ago
你的 service-center 使用的哪个版本?
你使用的service-center是哪里来的呢?貌似是sc的版本太旧了,更换一个新版本的再试一下吧
你使用的service-center是哪里来的呢?貌似是sc的版本太旧了,更换一个新版本的再试一下吧
是service center的版本太老了,升级了版本之后服务发现正常了,但是路径匹配有问题。 我的代码是这样写的。
@RestSchema(schemaId = "tts")
@Path("/")
public class TTSService {
@Path("/v1/tts/text2audio")
@POST
@ApiOperation(value = "文本转语音", httpMethod = "POST", response = File.class, consumes = "application/json")
public ResponseEntity<InputStream> processTTS(@RequestBody @Valid TTSReq req) throws IOException {
// code
}
}
服务端注册日志:
2020-08-17 17:13:02.110|INFO |[vert.x-eventloop-thread-26]||[org.apache.servicecomb.transport.rest.vertx.RestServerVerticle:230]|rest listen success. address=0.0.0.0:18083
2020-08-17 17:13:02.111|INFO |[main]||[org.apache.servicecomb.core.transport.TransportManager:63]|endpoint to publish: rest://10.31.57.86:18083?sslEnabled=false
2020-08-17 17:13:02.166|INFO |[main]||[org.apache.servicecomb.core.provider.producer.ProducerBootListener:65]|generate swagger for smurf/tts_service/tts, swagger: ---swagger: "2.0"info: version: "1.0.0" title: "swagger definition for com.huawei.smurf.tts.api.TTSService" x-java-interface: "gen.swagger.TTSServiceIntf"basePath: "/TTSService"schemes:- "http"consumes:- "application/json"produces:- "application/json"paths: /processTTS: post: summary: "文本转语音" operationId: "processTTS" consumes: - "application/json" parameters: - in: "body" name: "req" required: true schema: $ref: "#/definitions/TTSReq" responses: "200": description: "response of 200" schema: type: "file"definitions: TTSReq: type: "object" required: - "appID" - "taskID" - "text" properties: speed: type: "string" minLength: 0 maxLength: 10 pattern: "^\\d+(\\.\\d)?$" appID: type: "string" minLength: 1 maxLength: 256 taskID: type: "string" pattern: "^[A-Za-z0-9_\\-]{1,64}$" text: type: "string" minLength: 1 maxLength: 2147483647 preference: type: "string" minLength: 0 maxLength: 256 emotion: type: "string" minLength: 0 maxLength: 256 compressorType: type: "string" minLength: 0 maxLength: 1 language: type: "string" minLength: 0 maxLength: 1 x-java-class: "com.huawei.smurf.tts.model.TTSReq"
2020-08-17 17:13:02.171|INFO |[main]||[org.apache.servicecomb.foundation.common.utils.SPIServiceUtils:79]|Found SPI service org.apache.servicecomb.common.rest.codec.produce.ProduceProcessor, count=2.
2020-08-17 17:13:02.171|INFO |[main]||[org.apache.servicecomb.foundation.common.utils.SPIServiceUtils:82]| 0. org.apache.servicecomb.common.rest.codec.produce.ProduceJsonProcessor.
2020-08-17 17:13:02.171|INFO |[main]||[org.apache.servicecomb.foundation.common.utils.SPIServiceUtils:82]| 1. org.apache.servicecomb.common.rest.codec.produce.ProduceTextPlainProcessor.
2020-08-17 17:13:02.177|INFO |[main]||[org.apache.servicecomb.common.rest.locator.ServicePathManager:74]|add schema to service paths. smurf:tts_service:tts.
2020-08-17 17:13:02.177|INFO |[main]||[org.apache.servicecomb.common.rest.locator.MicroservicePaths:101]|Swagger mapped "{[/TTSService/processTTS/], method=[POST], produces=[application/json]}" onto public org.springframework.http.ResponseEntity com.huawei.smurf.tts.api.TTSService.processTTS(com.huawei.smurf.tts.model.TTSReq) throws java.io.IOException
2020-08-17 17:13:02.180|INFO |[main]||[org.apache.servicecomb.serviceregistry.task.MicroserviceRegisterTask:77]|running microservice register task.
2020-08-17 17:13:02.301|INFO |[main]||[org.apache.servicecomb.serviceregistry.task.MicroserviceRegisterTask:85]|Microservice exists in service center, no need to register. id=[b0ebd0c8228eb8e17e1c428f901efe10b958287f] appId=[smurf], name=[tts_service], version=[1.0.0], env=[development]
2020-08-17 17:13:02.320|WARN |[main]||[org.apache.servicecomb.serviceregistry.task.MicroserviceRegisterTask:136]|SchemaIds is different between local and service center. serviceId=[b0ebd0c8228eb8e17e1c428f901efe10b958287f] appId=[smurf], name=[tts_service], version=[1.0.0], env=[development], local schemaIds=[tts], service center schemaIds=[tts_service, tts, ttsservice]
2020-08-17 17:13:02.328|INFO |[main]||[org.apache.servicecomb.serviceregistry.task.MicroserviceRegisterTask:194]|schemaId [tts] exists [true], summary exists [true]
2020-08-17 17:13:02.332|WARN |[main]||[org.apache.servicecomb.serviceregistry.task.MicroserviceRegisterTask:253]|schema[tts]'s content is changed and the current environment is [development], so re-register it. It's recommended to change servicecomb_description.version after schema change, or restart consumer to make changes get notified.
2020-08-17 17:13:02.333|INFO |[main]||[org.apache.servicecomb.foundation.common.utils.SPIServiceUtils:79]|Found SPI service org.apache.servicecomb.serviceregistry.adapter.EnvAdapter, count=1.
2020-08-17 17:13:02.333|INFO |[main]||[org.apache.servicecomb.foundation.common.utils.SPIServiceUtils:82]| 0. org.apache.servicecomb.serviceregistry.adapter.DefaultEnvAdapter.
2020-08-17 17:13:02.334|INFO |[main]||[org.apache.servicecomb.serviceregistry.adapter.EnvAdapterManager:56]|Start process schema with adapter default-env-adapter
2020-08-17 17:13:02.345|INFO |[main]||[org.apache.servicecomb.serviceregistry.client.http.ServiceRegistryClientImpl:396]|register schema b0ebd0c8228eb8e17e1c428f901efe10b958287f/tts success.
2020-08-17 17:13:02.345|WARN |[main]||[org.apache.servicecomb.serviceregistry.task.MicroserviceRegisterTask:329]|There are schemas only existing in service center: [tts_service, ttsservice], which means there are interfaces changed. It's recommended to increment microservice version before deploying.
2020-08-17 17:13:02.345|WARN |[main]||[org.apache.servicecomb.serviceregistry.task.MicroserviceRegisterTask:332]|ATTENTION: The schemas in new version are less than the old version, which may cause compatibility problems.
2020-08-17 17:13:02.346|INFO |[main]||[org.apache.servicecomb.serviceregistry.task.ServiceCenterTask:64]|read MicroserviceRegisterTask status is FINISHED
2020-08-17 17:13:02.346|INFO |[main]||[org.apache.servicecomb.serviceregistry.task.MicroserviceInstanceRegisterTask:60]|running microservice instance register task.
2020-08-17 17:13:02.346|INFO |[main]||[org.apache.servicecomb.serviceregistry.adapter.EnvAdapterManager:63]|Start process instance with adapter default-env-adapter
2020-08-17 17:13:02.371|INFO |[main]||[org.apache.servicecomb.serviceregistry.task.MicroserviceInstanceRegisterTask:83]|Register microservice instance success. microserviceId=b0ebd0c8228eb8e17e1c428f901efe10b958287f instanceId=da1a9217e06911eabb67fa163e428fcf endpoints=[rest://10.31.57.86:18083?sslEnabled=false] lease 3s
2020-08-17 17:13:02.371|INFO |[main]||[org.apache.servicecomb.serviceregistry.task.ServiceCenterTask:64]|read MicroserviceInstanceRegisterTask status is FINISHED
2020-08-17 17:13:02.371|INFO |[main]||[org.apache.servicecomb.serviceregistry.RegistryUtils:428]|receive MicroserviceInstanceRegisterTask event of [Default]
2020-08-17 17:13:02.371|INFO |[main]||[org.apache.servicecomb.serviceregistry.RegistryUtils:433]|ServiceRegistry[Default] has completed instance registry
2020-08-17 17:13:02.372|INFO |[main]||[org.apache.servicecomb.core.SCBEngine:575]|receive MicroserviceInstanceRegisterTask event, check instance Id...
2020-08-17 17:13:02.372|INFO |[main]||[org.apache.servicecomb.core.SCBEngine:578]|instance registry succeeds for the first time, will send AFTER_REGISTRY event.
2020-08-17 17:13:02.373|INFO |[main]||[org.apache.servicecomb.foundation.common.utils.SPIServiceUtils:79]|Found SPI service org.apache.servicecomb.common.accessLog.AccessLogInitializer, count=2.
2020-08-17 17:13:02.373|INFO |[main]||[org.apache.servicecomb.foundation.common.utils.SPIServiceUtils:82]| 0. org.apache.servicecomb.common.accessLog.client.ClientDefaultInitializer.
2020-08-17 17:13:02.373|INFO |[main]||[org.apache.servicecomb.foundation.common.utils.SPIServiceUtils:82]| 1. org.apache.servicecomb.common.accessLog.server.ServerDefaultInitializer.
2020-08-17 17:13:02.382|INFO |[main]||[org.apache.servicecomb.foundation.common.utils.SPIServiceUtils:79]|Found SPI service org.apache.servicecomb.common.accessLog.core.parser.VertxRestAccessLogItemMeta, count=1.
2020-08-17 17:13:02.382|INFO |[main]||[org.apache.servicecomb.foundation.common.utils.SPIServiceUtils:82]| 0. org.apache.servicecomb.common.accessLog.core.parser.impl.DefaultCompositeVertxRestAccessLogItemMeta.
2020-08-17 17:13:02.382|INFO |[main]||[org.apache.servicecomb.common.accessLog.core.parser.impl.VertxRestAccessLogPatternParser:150]|parse the pattern of access log: [%h - - %t %r %s %B traceId:%SCB-traceId]
2020-08-17 17:13:02.386|WARN |[main]||[org.apache.servicecomb.core.SCBEngine:582]|ServiceComb is ready.
2020-08-17 17:13:02.397|INFO |[main]||[org.apache.servicecomb.core.SCBEngine:534]|Waiting for status up. timeout: 10000ms
2020-08-17 17:13:02.398|INFO |[main]||[org.apache.servicecomb.core.SCBEngine:543]|Status already changed to up.
// 通过RestTemplate调用,路径为cse://tts_service/v1/tts/text2audio
客户端错误日志:
2020-08-17 17:14:17.107 | ERROR | [gw_worker_9] | [runtime] | RestTemplate postForResponseEntity request for url(cse://tts_service/v1/tts/text2audio), response:InvocationException: code=404;msg=CommonExceptionData [message=Not Found]
2020-08-17 17:14:17.107 | ERROR | [gw_worker_9] | [runtime] | ces request error: InvocationException: code=404;msg=CommonExceptionData [message=Not Found]; nested exception is InvocationException: code=404;msg=CommonExceptionData [message=Not Found]
能共享下原因吗? 看起来是配置错误了, 或者少引用了 jar 包。 生成的 swagger 是不对的。
maven依赖
microservice.yaml配置
错误日志: