Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

generate with error: Provider org.glassfish.json.JsonProviderImpl could not be instantiated: java.lang.ClassCastException #53

Open
hungcaovu opened this issue Mar 31, 2022 · 1 comment

Comments

@hungcaovu
Copy link

Describe the bug
I used to generate RAML file from salefore: https://github.com/SalesforceCommerceCloud/commerce-sdk/tree/master/apis/product/products

it shown the error as below.

Note: it worked well with api.raml file.

To Reproduce
Steps to reproduce the behavior:

  1. Config raml like this:
    ${project.build.resources[0].directory}/apis/product/catalogs/catalogs.raml
  2. Run and gennerate code
    Expected behavior
    Java file will be generated successfully.

Screenshots
If applicable, add screenshots to help explain your problem.

[INFO] Total time: 8.466 s
[INFO] Finished at: 2022-03-31T17:12:00+07:00
[INFO] Final Memory: 23M/257M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.mule.raml.codegen:raml-client-generator-maven-plugin:0.11:generate-client (default) on project raml-client-generator-example: Exception while generating client. Internal error while trying to call public abstract java.lang.String org.raml.v2.api.model.v10.datamodel.TypeDeclaration.toJsonSchema(): InvocationTargetException: Provider org.glassfish.json.JsonProviderImpl could not be instantiated: java.lang.ClassCastException: org.glassfish.json.JsonProviderImpl (loaded by org.codehaus.plexus.classworlds.realm.ClassRealm@0x00000001000602b0) cannot be cast to javax.json.spi.JsonProvider (loaded by org.codehaus.plexus.classworlds.realm.ClassRealm@0x00000001000602b0) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.mule.raml.codegen:raml-client-generator-maven-plugin:0.11:generate-client (default) on project raml-client-generator-example: Exception while generating client.
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception while generating client.
	at org.mule.client.codegen.maven.plugin.RamlJavaClientGeneratorMojo.execute(RamlJavaClientGeneratorMojo.java:90)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
Caused by: java.lang.RuntimeException: Internal error while trying to call public abstract java.lang.String org.raml.v2.api.model.v10.datamodel.TypeDeclaration.toJsonSchema()
	at org.raml.yagi.framework.model.ModelProxyBuilder$SimpleProxy.invoke(ModelProxyBuilder.java:79)
	at com.sun.proxy.$Proxy30.toJsonSchema(Unknown Source)
	at org.mule.raml.impl.v10.model.ApiModelImpl.getTypeAsString(ApiModelImpl.java:103)
	at org.mule.raml.impl.v10.model.ApiModelImpl.getSchemas(ApiModelImpl.java:78)
	at org.mule.client.codegen.RamlJavaClientGenerator.generate(RamlJavaClientGenerator.java:138)
	at org.mule.client.codegen.RamlJavaClientGenerator.generate(RamlJavaClientGenerator.java:129)
	at org.mule.client.codegen.maven.plugin.RamlJavaClientGeneratorMojo.execute(RamlJavaClientGeneratorMojo.java:85)
	... 22 more
Caused by: java.lang.reflect.InvocationTargetException
	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.raml.yagi.framework.model.ModelProxyBuilder$SimpleProxy.fromMethod(ModelProxyBuilder.java:98)
	at org.raml.yagi.framework.model.ModelProxyBuilder$SimpleProxy.invoke(ModelProxyBuilder.java:74)
	... 28 more
Caused by: javax.json.JsonException: Provider org.glassfish.json.JsonProviderImpl could not be instantiated: java.lang.ClassCastException: org.glassfish.json.JsonProviderImpl (loaded by org.codehaus.plexus.classworlds.realm.ClassRealm@0x00000001000602b0) cannot be cast to javax.json.spi.JsonProvider (loaded by org.codehaus.plexus.classworlds.realm.ClassRealm@0x00000001000602b0)
	at javax.json.spi.JsonProvider.provider(JsonProvider.java:100)
	at javax.json.Json.createBuilderFactory(Json.java:282)
	at org.raml.v2.internal.impl.v10.type.TypeToJsonSchemaVisitor.<init>(TypeToJsonSchemaVisitor.java:59)
	at org.raml.v2.internal.impl.commons.model.type.TypeDeclaration.toJsonSchema(TypeDeclaration.java:270)
	... 34 more
Caused by: java.lang.ClassCastException: org.glassfish.json.JsonProviderImpl (loaded by org.codehaus.plexus.classworlds.realm.ClassRealm@0x00000001000602b0) cannot be cast to javax.json.spi.JsonProvider (loaded by org.codehaus.plexus.classworlds.realm.ClassRealm@0x00000001000602b0)
	at javax.json.spi.JsonProvider.provider(JsonProvider.java:95)
	... 37 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :raml-client-generator-example

Desktop (please complete the following information):

  • OS: Win 10
@uip-robot-zz
Copy link

Git2Gus App is installed but the .git2gus/config.json doesn't exist.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants