2017-10-12 16 views
0

내 raml 파일이 아래와 같이 보이는 raml을 처음으로 사용하고 있습니다. 내 인터페이스를 실행하는 동안raml을 사용하는 방법?

#%RAML 0.8 
title: Contact 
version: 1 
baseUri: http://abc/api/{version} 
traits: 
    - client-id-required: 
     queryParameters: 
     client_id: 
      type: string 
     client_secret: 
      type: string 
/contact: 
    post: 
    is: [client-id-required] 
    description: Create a new contact record 
    body: 
     application/json: 
     example: !include contactCreateReq_sample.json 
     schema: !include contactCreateReq.json 
    responses: 
     200: 
     body: 
      application/json: 
      example: !include contactCreateRes_sample.json 
      schema: !include contactCreateRes.json 
    put: 
    is: [client-id-required] 
    description: update a customer record 
    body: 
     application/json: 
     example: !include contactUpdateReq_sample.json 
     schema: !include contactUpdateReq.json 
    responses: 
     200: 
     body: 
      application/json: 
      example: !include contactUpdateRes_sample.json 
      schema: !include contactUpdateRes.json 
    delete: 
    is: [client-id-required] 
    description: update a customer record 
    body: 
     application/json: 
     example: !include contactUpdateReq_sample.json 
     schema: !include contactUpdateReq.json 
    responses: 
     200: 
     body: 
      application/json: 
      example: !include contactUpdateRes_sample.json 
      schema: !include contactUpdateRes.json  
    /{functionId}: 
    post: 
     is: [client-id-required] 
     description: Create a new contact function record 
     responses: 
     200: 
      body: 
      application/json: 
       example: !include contactCreateReq_sample.json 
       schema: !include contactCreateReq.json 
    put: 
     is: [client-id-required] 
     description: Update an existing contact function record 
     responses: 
     200: 
      body: 
      application/json: 
       example: !include contactUpdateRes_sample.json 
       schema: !include contactUpdateRes.json 

오류 메시지가 아래에지고, 나는 모든 raml 파일의 경우 같은 종류의 오류가 raml 파일의 몇 가지있다. 그것은 내 로컬 컴퓨터에서 실행하려고 노력 중이 야 생산에서 인터페이스를 작동하고 언급 한 오류있어. 제 코드에 빠진 내용이 있으면 알려주십시오.

ERROR 2017-10-12 13:02:26,292 [main] org.mule.module.launcher.application.DefaultMuleApplication: null 
org.mule.module.apikit.exception.ApikitRuntimeException: Invalid API descriptor -- errors found: 1 

RAML resource not found -- file: contact.raml 

    at org.mule.module.apikit.parser.ParserWrapperV1.validate(ParserWrapperV1.java:68) ~[mule-module-apikit-3.8.5-HF1.jar:?] 
    at org.mule.module.apikit.ParserService.validateRaml(ParserService.java:86) ~[mule-module-apikit-3.8.5-HF1.jar:?] 
    at org.mule.module.apikit.AbstractConfiguration.initialise(AbstractConfiguration.java:112) ~[mule-module-apikit-3.8.5-HF1.jar:?] 
    at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source) ~[?:?] 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121] 
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121] 
    at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:237) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.lifecycle.phases.MuleContextInitialisePhase.applyLifecycle(MuleContextInitialisePhase.java:71) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.lifecycle.RegistryLifecycleCallback.doApplyLifecycle(RegistryLifecycleCallback.java:99) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.lifecycle.RegistryLifecycleCallback.onTransition(RegistryLifecycleCallback.java:71) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.lifecycle.RegistryLifecycleManager.invokePhase(RegistryLifecycleManager.java:155) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.lifecycle.RegistryLifecycleManager.fireLifecycle(RegistryLifecycleManager.java:126) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.registry.AbstractRegistry.fireLifecycle(AbstractRegistry.java:146) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:116) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:177) ~[mule-module-spring-config-3.8.5.jar:3.8.5] 
    at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:100) ~[mule-module-spring-config-3.8.5.jar:3.8.5] 
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:43) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:102) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:54) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:43) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.context.DefaultMuleContextFactory$1.configure(DefaultMuleContextFactory.java:89) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:222) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:81) ~[mule-core-3.8.5.jar:3.8.5] 
    at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:203) ~[mule-module-launcher-3.8.5.jar:3.8.5] 
    at org.mule.module.launcher.artifact.ArtifactWrapper$2.execute(ArtifactWrapper.java:63) ~[mule-module-launcher-3.8.5.jar:3.8.5] 
    at org.mule.module.launcher.artifact.ArtifactWrapper.executeWithinArtifactClassLoader(ArtifactWrapper.java:136) ~[mule-module-launcher-3.8.5.jar:3.8.5] 
    at org.mule.module.launcher.artifact.ArtifactWrapper.init(ArtifactWrapper.java:58) ~[mule-module-launcher-3.8.5.jar:3.8.5] 
    at org.mule.module.launcher.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:25) ~[mule-module-launcher-3.8.5.jar:3.8.5] 
    at org.mule.module.launcher.DefaultArchiveDeployer.deployArtifact(DefaultArchiveDeployer.java:317) ~[mule-module-launcher-3.8.5.jar:3.8.5] 
    at org.mule.module.launcher.DefaultArchiveDeployer.deployPackagedArtifact(DefaultArchiveDeployer.java:172) ~[mule-module-launcher-3.8.5.jar:3.8.5] 
    at org.mule.module.launcher.DefaultArchiveDeployer.deployPackagedArtifact(DefaultArchiveDeployer.java:261) ~[mule-module-launcher-3.8.5.jar:3.8.5] 
    at org.mule.module.launcher.DefaultArchiveDeployer.deployPackagedArtifact(DefaultArchiveDeployer.java:76) ~[mule-module-launcher-3.8.5.jar:3.8.5] 
    at org.mule.module.launcher.DeploymentDirectoryWatcher.deployPackedApps(DeploymentDirectoryWatcher.java:279) ~[mule-module-launcher-3.8.5.jar:3.8.5] 
    at org.mule.module.launcher.DeploymentDirectoryWatcher.start(DeploymentDirectoryWatcher.java:151) ~[mule-module-launcher-3.8.5.jar:3.8.5] 
    at org.mule.module.launcher.MuleDeploymentService.start(MuleDeploymentService.java:134) ~[mule-module-launcher-3.8.5.jar:3.8.5] 
    at org.mule.module.launcher.MuleContainer.start(MuleContainer.java:172) ~[mule-module-launcher-3.8.5.jar:3.8.5] 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_121] 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121] 
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121] 
    at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:33) ~[tooling-support-3.8.5.jar:?] 
INFO 2017-10-12 13:02:26,292 [main] org.mule.module.launcher.application.DefaultMuleApplication: App 'sfdc-sap-api-interface-v4.7-prod' never started, nothing to dispose of 
ERROR 2017-10-12 13:02:26,307 [main] org.mule.module.launcher.DefaultArchiveDeployer: 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
+ Failed to deploy artifact        + 
+ 'sfdc-sap-api-interface-v4.7-prod', see below   + 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
org.mule.module.launcher.DeploymentInitException: ApikitRuntimeException: Invalid API descriptor -- errors found: 1 

RAML resource not found -- file: contact.raml 

    at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:212) ~[mule-module-launcher-3.8.5.jar:3.8.5] 
    at org.mule.module.launcher.artifact.ArtifactWrapper$2.execute(ArtifactWrapper.java:63) ~[mule-module-launcher-3.8.5.jar:3.8.5] 
    at org.mule.module.launcher.artifact.ArtifactWrapper.executeWithinArtifactClassLoader(ArtifactWrapper.java:136) ~[mule-module-launcher-3.8.5.jar:3.8.5] 

답변

1

응용 프로그램이 빌드되는 동안 raml 파일이 클래스 경로에 없으면 이러한 오류가 발생합니다.

. Anypoint Studio을 사용하여 을 구축하는 경우.

1.Go To 프로젝트 등록 정보에서 Java 빌드 경로. "소스"탭에서

2.Click는

3.Click는 폴더 추가 버튼을 클릭합니다.

4. "contact.raml"이있는 폴더를 확인하십시오. 일반적으로 raml 필렛은 "api"폴더에 보관됩니다. 따라서 "api"폴더를 확인한 후 "OK"을 클릭하십시오.

5.Click "contact.raml는"존재하는 곳

폴더 추가 " 적용". 일반적으로 raml 필렛은 "api"폴더에 보관됩니다. 따라서 "api"폴더를 확인하고 "OK"를 클릭하십시오. 그런 다음 프로젝트를 정리하고 다시 빌드하십시오. 프로젝트을 구축 할 수 받는다는 사용

B 당신이 .If .

pom 파일에 "mule-module-apikit"종속성이 있는지 확인하고, 추가하지 않을 경우 아래에있는 플러그인과 리소스 디렉토리를 지정하고 try를 사용하십시오. 아래의 예제는 pom.xml

<groupId>org.codehaus.mojo</groupId> 
     <artifactId>build-helper-maven-plugin</artifactId> 
     <version>1.7</version> 
     <executions> 
      <execution> 
       <id>add-resource</id> 
       <phase>generate-resources</phase> 
       <goals> 
        <goal>add-resource</goal> 
       </goals> 
       <configuration> 
        <resources> 
         <resource> 
          <directory>src/main/app/</directory> 
         </resource> 
         <resource> 
          <directory>mappings/</directory> 
         </resource> 
         <resource> 
          <directory>src/main/api</directory> 
         </resource> 
        </resources> 
       </configuration> 
      </execution> 
     </executions> 
    </plugin>