java callout : messagecontext.setvariable : cannot access DataProvider

Hi,

When i try to package my app (mvn clean package), i get this error :

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project ..

[ERROR] JWTParser.java:[64,16] error: cannot access DataProvider

the error comes from that line:

messageContext.setVariable("X-OIDC-VALIDATION-RESULT", "FAIL");

is seems that i have a problem with messageContext.setVariable.

I'm using the same POM then the one used in the tutorials

Can some one help me plz

Solved Solved
0 7 394
1 ACCEPTED SOLUTION

t works for me

I was using fish shell lol.

I come back to my /bin/bash and I can package my app

Thank you @wwitman

View solution in original post

7 REPLIES 7

Hi @karimksafraouiextern - The setVariable() method looks normal. I'm curious which tutorial are you following?

Hi @wwitman

this is the tutorial i used :

https://github.com/apigee/api-platform-samples/tree/master/doc-samples/java-properties/callout

Even if I try to package this example, I get the same error

Hi @karimksafraouiextern -- I'm able to run the sample successfully - I wonder if there is a configuration problem. I have Java version 1.8.0_131 and Maven 3.5.0. Would you mind sharing the trace from the mvn command (mvn clean package -e) when run for the example? I followed these instructions.

Hi @wwitman

My config is:

MacOs Sierra 10.12.14

Java 1.8.0-101

Maven 3.3.3

when i remove the messagecontext.setVariable, i'm able de package my app.

This is the "mvn clean package -e" output of my app :

[INFO] Compiling 3 source files to /Users/xxxxxx/Src/workspace/xxxxx/JC-OIDC-validation/callout/target/classes

[INFO] -------------------------------------------------------------

[ERROR] COMPILATION ERROR :

[INFO] -------------------------------------------------------------

[ERROR] /Users/xxxxxx/Src/workspace/xxxxxx/JC-OIDC-validation/callout/src/main/java/org/xxxxxx/oidc/validator/JWTParser.java:[64,16] error: cannot access DataProvider

[INFO] 1 error

[INFO] -------------------------------------------------------------

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 6.422 s

[INFO] Finished at: 2017-06-15T23:30:38+02:00

[INFO] Final Memory: 14M/123M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project JC-OIDC-validation: Compilation failure

[ERROR] /Users/xxxxxx/Src/workspace/xxxxxx/JC-OIDC-validation/callout/src/main/java/org/xxxxxx/oidc/validator/JWTParser.java:[64,16] error: cannot access DataProvider

[ERROR] -> [Help 1]

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project JC-OIDC-validation: Compilation failure

/Users/xxxxxx/Src/workspace/xxxxxx/JC-OIDC-validation/callout/src/main/java/org/xxxxxx/oidc/validator/JWTParser.java:[64,16] error: cannot access DataProvider

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:862)

at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)

at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)

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.CompilationFailureException: Compilation failure

/Users/xxxxxx/Src/workspace/xxxxxx/JC-OIDC-validation/callout/src/main/java/org/xxxxxx/oidc/validator/JWTParser.java:[64,16] error: cannot access DataProvider

at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:656)

at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)

at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)

at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)

... 20 more

[ERROR]

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[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/MojoFailureException

Hi @karimksafraouiextern - I'm afraid I don't know what to add that would help you. Maybe someone else can offer a suggestion. It seems like there's a dependency related to your project that's missing in the pom file and that might be causing the compile error. The default example should compile as is if unmodified (it's simple with only one source file and a pre-built project structure). The build file is only meant as a basic example, and you'll need to modify it for your project as needed. Can you compile your project using javac? I can't tell why messageContext.setVariable() is causing a problem or what the error it is throwing (I don't see a reference to it in the output listed above). I don't have any other suggestions at this time. If I find a solution or find some other problem with the example, I'll be happy to post it here.

t works for me

I was using fish shell lol.

I come back to my /bin/bash and I can package my app

Thank you @wwitman

@karimksafraouiextern

I'm happy (and relieved) to hear you got it working 🙂 Thanks for letting me know. I'll add a note to the sample project doc.