APi incompatibility when using spring cloud contract - spring-cloud-contract

I'm trying to use spring cloud contract in a sample producer project. However I am seeing errors in my POM due to
Multiple annotations found at this line:
- Execution default-generateTests of goal org.springframework.cloud:spring-cloud-contract-maven-plugin:1.2.4.RELEASE:generateTests failed: An API
incompatibility was encountered while executing org.springframework.cloud:spring-cloud-contract-maven-plugin:1.2.4.RELEASE:generateTests:
java.lang.VerifyError: Bad <init> method call from inside of a branch Exception Details: Location: org/springframework/cloud/contract/verifier/
TestGenerator.<init>(Lorg/springframework/cloud/contract/verifier/config/ContractVerifierConfigProperties;)V #75: invokespecial Reason: Error exists in the
bytecode Bytecode: 0000000: b800 244d b800 2a9a 0006 a700 472a 2b2c 0000010: 122b 3212 02b9 0031 0200 1233 b800 39c0 0000020: 0033 2c12
3a32 123c 2c12 3d32 2bb9 0041 0000030: 0200 2c12 4232 1202 b900 3102 002b b900 0000040: 4605 0012 3cb8 0039 c000 3cb7 0049 a700
0000050: 2c2a 2bb8 004d 2c12 4e32 123c 2c12 4f32 0000060: 2bb9 0041 0200 b800 4d2b b900 4605 0012 0000070: 3cb8 0039 c000 3cb7 0049 b1
Stackmap Table: append_frame(#13,Object[#83])
I am using Spring Boot 1.5.14.RELEASE, Edgware.SR3, Java 1.8 and spring-cloud-contract-maven-plugin 1.2.4.RELEASE
I've tried playing around with versions of the plugin, Spring cloud and spring boot using examples from tutorials online for spring-cloud-contract yet I can't seem to get rid of the incompatibility error.
My code is here - https://github.com/craigmgordon/spring-cloud-contract/tree/Phase2/creditcheckservice-producer if it helps

I've managed to successfully build your project. You have an bug in your contract (too many quotes)
import org.springframework.cloud.contract.spec.Contract;
Contract.make{
request{
method 'POST'
url '/credit-scores'
body """
{
"citizenNumber" : 1234
}
""" // you had an extra quote here
headers{
contentType applicationJson()
}
}
response{
status 200
body """
{
"score" : "HIGH"
}
"""
headers{
contentType applicationJson()
}
}
}
Execution
➜ creditcheckservice-producer git:(Phase2) ✗ ./mvnw clean install
...
Results :
Tests in error:
CreditcardserviceTest.validate_shouldGrantACreditScoreOfHighToACitizen:24 » IllegalState
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.711 s
[INFO] Finished at: 2018-06-15T14:36:14+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project creditcheckservice-producer: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/marcingrzejszczak2/repo/contract-issues/so/foo/spring-cloud-contract/creditcheckservice-producer/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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
UPDATE:
It turned out that there was a mismatch in java versions

Related

java.lang.ExceptionInInitializerError at org.alfresco.trashcan.TrashcanCleanerTest.<clinit>(TrashcanCleanerTest.java:67)

How can I solve
java.lang.ExceptionInInitializerError
at org.alfresco.trashcan.TrashcanCleanerTest.<clinit>(TrashcanCleanerTest.java:67)
I pulled down https://github.com/Alfresco/alfresco-trashcan-cleaner-module and ran mvn clean install
It failed with this:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.alfresco.trashcan.TrashcanCleanerTest
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 17.477 sec <<< FAILURE! - in org.alfresco.trashcan.TrashcanCleanerTest
testCleanBatch(org.alfresco.trashcan.TrashcanCleanerTest) Time elapsed: 0.007 sec <<< ERROR!
java.lang.ExceptionInInitializerError
at org.alfresco.trashcan.TrashcanCleanerTest.<clinit>(TrashcanCleanerTest.java:67)
testCleanSimple(org.alfresco.trashcan.TrashcanCleanerTest) Time elapsed: 0 sec <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class org.alfresco.trashcan.TrashcanCleanerTest
Results :
Tests in error:
TrashcanCleanerTest.testCleanBatch » ExceptionInInitializer
TrashcanCleanerTest.testCleanSimple » NoClassDefFound Could not initialize cla...
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.667 s
[INFO] Finished at: 2018-06-26T13:05:46-04:00
[INFO] Final Memory: 76M/3925M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project alfresco-trashcan-cleaner: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/owiana/Downloads/alfresco-trashcan-cleaner-module-master/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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
It's failing to run this line:
private static ApplicationContext applicationContext = ApplicationContextHelper.getApplicationContext();
The question is Why?
My java is
$ java -version
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
Perhaps I'm trying to run this wrong. What step am I missing?
Try to skip tests by executing mvn clean install -DskipTests

Prevent SBT from starting interactive mode

I like to enter commands while the previous command is still running. When the command completes, my shell will immediately execute the next.
This is no longer possible with modern incarnations of SBT. If you enter anything while SBT is running, it will assume you want to execute what you've entered in SBT's interactive mode.
This is very annoying.
$ sbt test
...
[info]
[info] Passed: Total 348, Failed 0, Errors 0, Passed 348
[success] Total time: 17 s, completed 18/01/2018 4:19:49 PM
> git status
[error] Expected ID character
[error] Not a valid command: git (similar: exit, plugin, set)
[error] Expected project ID
[error] Expected configuration
[error] Expected ':' (if selecting a configuration)
[error] Expected key
[error] Not a valid key: git (similar: ivySbt, target)
[error] git status
[error] ^
>
Can I reconfigure SBT so that the process always terminates after the batch has completed and does not switch to interactive mode?

Unknown option 'auth_opts' issue in ejabberd_http_auth plugin

I currently using ejabberd_http_auth mod to authenticate a user by external http api. However after I set up the following configuration in ejabberd.yml. I got Unknown option 'auth_opts' error.
I have already installed that plugin in ejabberd using command prompt and I have disable register mod.
Configuration:
auth_method: http
auth_opts:
host: "http://localhost:8080"
connection_pool_size: 10
connection_opts: []
basic_auth: ""
path_prefix: "/test/auth/"
Error Message:
2015-12-15 00:16:16.268 [error] <0.37.0>#ejabberd_config:validate_opts:794 unknown option 'auth_opts' will be likely ignored
2015-12-15 00:16:16.366 [info] <0.37.0>#cyrsasl_digest:start:60 FQDN used to check DIGEST-MD5 SASL authentication: MY_SERVER
2015-12-15 00:16:16.367 [info] <0.37.0>#ejabberd_app:add_windows_nameservers:195 Adding machine's DNS IPs to Erlang system:
[]
2015-12-15 00:16:16.373 [error] <0.36.0> CRASH REPORT Process <0.36.0> with 0 neighbours exited with reason: call to undefined function ejabberd_auth_http:start(<<"localhost">>) in application_master:init/4 line 133
2015-12-15 00:16:16.373 [info] <0.7.0> Application ejabberd exited with reason: call to undefined function ejabberd_auth_http:start(<<"localhost">>)
Thanks a lot.
The unknown option is not the problem here.
The problem is on that line:
2015-12-15 00:16:16.373 [info] <0.7.0> Application ejabberd exited with reason: call to undefined function ejabberd_auth_http:start(<<"localhost">>)
It means ejabberd_auth_http.beam is not in your Erlang path. It means it is either not installed or placed outside Erlang VM path.

Remote EJB invocation by local client

After fixing all the errors, I am finally stuck here. When i execute the pom file, I get this error-
I am using wildfly server
May 09, 2015 12:33:31 AM org.xnio.Xnio <clinit>
INFO: XNIO Version 3.0.3.GA
May 09, 2015 12:33:31 AM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.0.3.GA
May 09, 2015 12:33:32 AM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 4.0.0.Final
Exception in thread "main" java.lang.NoClassDefFoundError: org/xnio/http/HandshakeChecker
at org.jboss.remoting3.remote.HttpUpgradeConnectionProviderFactory.createInstance(HttpUpgradeConnectionProviderFactory.java:49)
at org.jboss.remoting3.EndpointImpl.addConnectionProvider(EndpointImpl.java:420)
at org.jboss.ejb.client.remoting.EndpointPool.getEndpoint(EndpointPool.java:85)
at org.jboss.ejb.client.remoting.RemotingEndpointManager.getEndpoint(RemotingEndpointManager.java:49)
at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.setupEJBReceivers(ConfigBasedEJBClientContextSelector.java:133)
at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.getCurrent(ConfigBasedEJBClientContextSelector.java:115)
at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.getCurrent(ConfigBasedEJBClientContextSelector.java:47)
at org.jboss.ejb.client.EJBClientContext.getCurrent(EJBClientContext.java:271)
at org.jboss.ejb.client.EJBClientContext.requireCurrent(EJBClientContext.java:281)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:176)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:144)
at com.sun.proxy.$Proxy0.sayHello(Unknown Source)
at com.experian.ejb3.Client.main(Client.java:11)
Caused by: java.lang.ClassNotFoundException: org.xnio.http.HandshakeChecker
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 13 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.832s
[INFO] Finished at: Sat May 09 00:33:32 CEST 2015
[INFO] Final Memory: 6M/163M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project ejbclientmavendemo: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/MojoExecutionException
There is nothing on Internet on this error. Please help

graniteds-tutorial-data using GraniteDS 3.0.1 error

I run the following command for the example graniteds-tutorial-data in the GraniteDS 3.0.1 GA github repo, but get the error trace given at the bottom of this post,
mvn clean install asciidoctor:process-asciidoc -Dserver=ejb -Dclient=flex
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.graniteds.tutorials:tutorial-data-client-flex:1.0-SNAPSHOT (C:\Documents and Settings\463072\FreshSpaceJuno\graniteds-tutorial-data\client-flex\pom.xml) has 2 errors
[ERROR] Unresolveable build extension: Plugin org.sonatype.flexmojos:flexmojos-maven-plugin:4.2-beta or one of its dependencies could not be resolved: The following artifacts could not be resolved:
com.adobe.flex.compiler:saxon9:jar:4.5.1.21328, com.adobe.flex.compiler:xalan:jar:4.5.1.21328: Could not transfer artifact com.adobe.flex.compiler:saxon9:jar:4.5.1.21328 from/to flex-mojos-plugin-repository (http://repository.sonatype.org/content/groups/flexgroup/): GET request of: com/adobe/flex/compiler/saxon9/4.5.1.21328/saxon9-4.5.1.21328.jar from flex-mojos-plugin-repository failed: Premature end of Content-Length delimited message body (expected: 5024396; received: 3576621 -> [Help 2]
[ERROR] Unknown packaging: swf # line 17, column 16
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Any help on how to resolve this will be really appreciated. I am trying to port my application with the GraniteDS 2.0.3 to the latest 3.0.1. Also, are there any examples of a Flex EJB example using GraniteDS 3.0.1?
This is the log after I made the change you suggested.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.graniteds.tutorials:tutorial-data-server-model:jar:1.0-SNAPSHOT
[WARNING] 'parent.relativePath' points at org.graniteds.tutorials:tutorial-data instead of org.graniteds.tutorials:tutorial-parent, please verify your project structure # line 28, column 13
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.graniteds.tutorials:tutorial-data-client-flex:swf:1.0-SNAPSHOT
[WARNING] 'parent.relativePath' points at org.graniteds.tutorials:tutorial-data instead of org.graniteds.tutorials:tutorial-parent-client-flex, please verify your project structure # line 9, column 13
[WARNING] 'build.plugins.plugin.version' for org.sonatype.flexmojos:flexmojos-maven-plugin is missing. # org.graniteds.tutorials:tutorial-parent-client-flex:3.0.1.GA, C:\Documents and Settings\463072\.m2\repository\org\graniteds\tutorials\tutorial-parent-client-flex\3.0.1.GA\tutorial-parent-client-flex-3.0.1.GA.pom, line 67, column 21
[WARNING] 'dependencies.dependency.scope' for com.adobe.flex.framework:spark:swc must be one of [provided, compile, runtime, test, system] but is 'theme'. # org.graniteds.tutorials:tutorial-parent-client-flex:3.0.1.GA, C:\Documents and Settings\463072\.m2\repository\org\graniteds\tutorials\tutorial-parent-client-flex\3.0.1.GA\tutorial-parent-client-flex-3.0.1.GA.pom, line 33, column 20
[WARNING] 'dependencies.dependency.scope' for org.graniteds:granite-client-flex:swc must be one of [provided, compile, runtime, test, system] but is 'internal'. # org.graniteds.tutorials:tutorial-parent-client-flex:3.0.1.GA, C:\Documents and Settings\463072\.m2\repository\org\graniteds\tutorials\tutorial-parent-client-flex\3.0.1.GA\tutorial-parent-client-flex-3.0.1.GA.pom, line 49, column 20
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.graniteds.tutorials:tutorial-data-server-ejb:war:1.0-SNAPSHOT
[WARNING] 'parent.relativePath' points at org.graniteds.tutorials:tutorial-data instead of org.graniteds.tutorials:tutorial-parent-server-ejb, please verify your project structure # line 28, column 13
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. # org.graniteds.tutorials:tutorial-parent-server-base:3.0.1.GA, C:\Documents and Settings\463072\.m2\repository\org\graniteds\tutorials\tutorial-parent-server-base\3.0.1.GA\tutorial-parent-server-base-3.0.1.GA.pom, line 37, column 21
[WARNING] 'build.plugins.plugin.version' for org.wildfly.plugins:wildfly-maven-plugin is missing. # org.graniteds.tutorials:tutorial-parent-server-base:3.0.1.GA, C:\Documents and Settings\463072\.m2\repository\org\graniteds\tutorials\tutorial-parent-server-base\3.0.1.GA\tutorial-parent-server-base-3.0.1.GA.pom, line 84, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-war-plugin is missing. # org.graniteds.tutorials:tutorial-parent-server-base:3.0.1.GA, C:\Documents and Settings\463072\.m2\repository\org\graniteds\tutorials\tutorial-parent-server-base\3.0.1.GA\tutorial-parent-server-base-3.0.1.GA.pom, line 46, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] GraniteDS Data Tutorial - Server Model
[INFO] GraniteDS Data Tutorial - Flex Client
[INFO] GraniteDS Data Tutorial - EJB Server
[INFO] GraniteDS Data Tutorial
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building GraniteDS Data Tutorial - Server Model 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
.
.
.
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # tutorial-data-server-model ---
.
.
.
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-manager/1.9.1/plexus-compiler-manager-1.9.1.jar
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 3 source files to C:\Documents and Settings\463072\FreshSpaceJuno\graniteds-tutorial-data\server-model\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # tutorial-data-server-model ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Documents and Settings\463072\FreshSpaceJuno\graniteds-tutorial-data\server-model\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) # tutorial-data-server-model ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # tutorial-data-server-model ---
Downloading: http://repository.sonatype.org/content/groups/flexgroup/org/apache/maven/surefire/surefire-booter/2.12.4/surefire-booter-2.12.4.pom
Downloading: http://dl.bintray.com/graniteds/tutorial-dependencies/org/apache/maven/surefire/surefire-booter/2.12.4/surefire-booter-2.12.4.pom
.
.
[INFO] Installing C:\Documents and Settings\463072\FreshSpaceJuno\graniteds-tutorial-data\server-model\pom.xml to C:\Documents and Settings\463072\.m2\repository\org\graniteds\tutorials\tutorial-data-server-model\1.0-SNAPSHOT\tutorial-data-server-model-1.0-SNAPSHOT.pom
[INFO]
[INFO] --- asciidoctor-maven-plugin:0.1.4:process-asciidoc (default-cli) # tutorial-data-server-model ---
Downloading: http://repository.sonatype.org/content/groups/flexgroup/org/apache/maven/maven-plugin-api/2.0/maven-plugin-api-2.0.pom
Downloading: http://dl.bintray.com/graniteds/tutorial-dependencies/org/apache/maven/maven-plugin-api/2.0/maven-plugin-api-2.0.pom
.
.
.
Downloaded: http://repo.maven.apache.org/maven2/org/graniteds/granite-client-flex45-advanced/3.0.1.GA/granite-client-flex45-advanced-3.0.1.GA.swc (366 KB at 97.0 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] GraniteDS Data Tutorial - Server Model ............ SUCCESS [7:41.452s]
[INFO] GraniteDS Data Tutorial - Flex Client ............. FAILURE [1:18.299s]
[INFO] GraniteDS Data Tutorial - EJB Server .............. SKIPPED
[INFO] GraniteDS Data Tutorial ........................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9:08.939s
[INFO] Finished at: Thu Jan 23 12:00:48 IST 2014
[INFO] Final Memory: 25M/59M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project tutorial-data-client-flex: Could not resolve dependencies for project org.graniteds.tutorials:tutorial-data-client-flex:swf:1.0-SNAPSHOT: Could not transfer artifact com.adobe.flex.framework:framework:zip:configs:4.5.1.21328 from/to flex-mojos-repository (http://repository.sonatype.org/content/groups/flexgroup/): Checksum validation failed, expected 410a3bcaceb1ea1960b2521818dc7ab9fac35aef but is 5359ccaf2d93e09ff2ec6fffe0648c611f42314b -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :tutorial-data-client-flex
Could you try renaming temporarily your .m2 to .m2.bak so we can make sure that this is not just an issue with your local repository?
are there any examples of a Flex EJB example using GraniteDS 3.0.1?
Yes, the one you are trying to launch.
Thanks.

Resources