Running story failed after upgrading to latest jbehave version 4.5.1 - jbehave

I have been using older jbehave version - 3.9.5, tried to upgrade to latest version - 4.5.1. However, while executing tests, it fails with AbstractMethodError
Below is the exact error encountered:
Failed to run story ABC/ABC-144.31.story
java.lang.AbstractMethodError: com.jbehaveforjira.javaclient.JiraStoryReporter.beforeScenario(Lorg/jbehave/core/model/Scenario;)V
at org.jbehave.core.reporters.DelegatingStoryReporter.beforeScenario(DelegatingStoryReporter.java:58)
at org.jbehave.core.reporters.ConcurrentStoryReporter.beforeScenario(ConcurrentStoryReporter.java:176)
at org.jbehave.core.embedder.PerformableTree$PerformableScenario.perform(PerformableTree.java:1007)
at org.jbehave.core.embedder.PerformableTree$PerformableStory.performScenarios(PerformableTree.java:907)
at org.jbehave.core.embedder.PerformableTree$PerformableStory.perform(PerformableTree.java:882)
at org.jbehave.core.embedder.PerformableTree.performCancellable(PerformableTree.java:435)
at org.jbehave.core.embedder.PerformableTree.perform(PerformableTree.java:402)
at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:293)
at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Based on this error and after debugging understood that before Scenario (String title) and two other methods have been deprecated in latest version.
I commented these methods in below classes/interface locally and rebuilt my application, but it didn't solve the problem. Please help to provide any help/suggestion.
org.jbehave.core.reporters.ConcurrentStoryReporter, org.jbehave.core.reporters.DelegatingStoryReporter,
org.jbehave.core.reporters.StoryReporter
org.jbehave.core.embedder.PerformableTree

I was able to update my jbehave from 4.1.3 to 4.5.1. I encountered the same error when only updating jbehave-core. So in addition to updating your jbehave version, you must also update other dependencies in your project. In my case, I updated the following: jbehave-core(to 4.5.1), serenity-core(to 1.9.40), serenity-jbehave(to 1.46.0). Please check your pom.xml or the jar files in your build path.

Related

Error running Scala tests in Intelli-J

I'm having some problems getting my Scala tests running via the Intelli-J Run/Debug configuration. The tests are working if I run them directly in the SBT console.
My configuration looks like this:
I'm getting this error in the Run console panel:
java.lang.IllegalArgumentException: ERROR: -r has been deprecated for a very long time and is no longer supported, to prepare for reusing it for a different purpose in the near future. Please change all uses of -r to -C.
at org.scalatest.tools.ArgsParser$.checkArgsForValidity(ArgsParser.scala:41)
at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:857)
at org.scalatest.tools.Runner$.run(Runner.scala:850)
at org.scalatest.tools.Runner.run(Runner.scala)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:141)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:32)
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:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
I've checked my plugins are all up-to-date. Do I need to use a particular version of Scala? Or is there some additional setup I'm missing?
For anyone who has this problem even with newer version of IntelliJ, here is how I went about figuring out where the issue was. I pulled in the scalatest dependency at the top of the pom for the module I was trying to run tests in. Then an individual test would run without this error. I moved the dependency down the pom until the problem recurred to figure out which dependency was causing the problem. Then I found that the dependency had some really old dependencies including an older version of scalatest that weren't showing up in my dependency tree. Also, this jar dependency had scalatest as a dependency not marked with scope test.
It appears to have been a problem with the Scala plugin under Intelli-J 13.
I fixed this by upgrading to Intelli-J 2016.3, which I presume has been changed to pass the newer -C switch to ScalaTestRunner.
#JasonF pointed out in his comment below that a project dependency can also cause a problem with the scalatest plugin (this was the case for him). It's worth attempting to run the tests of a fresh sample Scala project to test for this scenario before upgrading the IDE.

Error upgrading to Mongo java driver 3.2.2

we have migrated to MongoDB 3.2.6. What could be the compatible mongo version jars for below dependencies,
mongo java driver version (org.mongodb)
spring data mongo version (org.springframework.data)
spring data commons version (spring-data-commons)
I have tried to upgrade these to 3.2.2 for java driver and 1.9.4.RELEASE for spring data and spring commons but facing maven compatible issues. Below 2 issues i'm unable to resolve as of now.
Kindly suggest what could be the problem.
Issue 1:
The type org.springframework.data.repository.query.QueryByExampleExecutor cannot be resolved. It is indirectly referenced from required .class files
Issue 2:
Error occured processing XML 'Invalid default: public abstract java.lang.Class
org.springframework.data.mongodb.repository.config.EnableMongoRepositories.repositoryBaseClass()'. See Error Log for more details
Tried mvn clean dependency:tree and it is successful. But mvn clean compile is failing with Issue 1 error mentioned above.
Answer:
I'm able to resolve both the issues by upgrading to 1.12.1 for spring-data-commons. This will resolve above mentioned compile time issues.
Below are my current settings.
mongo-java-driver to 3.2.2, spring-data-mongodb to 1.9.4.RELEASE, spring-data-commons to 1.12.1.
As per Spring data commons documentation Spring Data Commons I also upgraded my Spring framework version to 4.2.8.RELEASE.
Facing below issue which I couldn't resolve. Any ideas will be appreciated.
Issue1:
06:37:33.943 [localhost-startStop-1] DEBUG o.s.c.t.c.AnnotationAttributesReadingVisitor - Failed to class-load type while reading annotation metadata. This is a non-fatal error, but certain annotation metadata may be unavailable.
java.lang.ClassNotFoundException: javax.annotation.Nullable
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305) ~[catalina.jar:na]
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139) ~[catalina.jar:na]
at org.springframework.core.type.classreading.RecursiveAnnotationAttributesVisitor.visitEnd(RecursiveAnnotationAttributesVisitor.java:47) ~[spring-core-4.2.8.RELEASE.jar:4.2.8.RELEASE]
at org.springframework.asm.ClassReader.readAnnotationValues(ClassReader.java:1802) [spring-core-4.2.8.RELEASE.jar:4.2.8.RELEASE]
at org.springframework.asm.ClassReader.readMethod(ClassReader.java:976) [spring-core-4.2.8.RELEASE.jar:4.2.8.RELEASE]
at org.springframework.asm.ClassReader.accept(ClassReader.java:695) [spring-core-4.2.8.RELEASE.jar:4.2.8.RELEASE]
at org.springframework.asm.ClassReader.accept(ClassReader.java:508) [spring-core-4.2.8.RELEASE.jar:4.2.8.RELEASE]
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:64) [spring-core-4.2.8.RELEASE.jar:4.2.8.RELEASE]
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98) [spring-core-4.2.8.RELEASE.jar:4.2.8.RELEASE]
at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102) [spring-core-4.2.8.RELEASE.jar:4.2.8.RELEASE]
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93) [spring-core-4.2.8.RELEASE.jar:4.2.8.RELEASE]
at org.springframework.core.type.filter.AbstractTypeHierarchyTraversingFilter.match(AbstractTypeHierarchyTraversingFilter.java:121) [spring-core-4.2.8.RELEASE.jar:4.2.8.RELEASE]
at org.springframework.core.type.filter.AbstractTypeHierarchyTraversingFilter.match(AbstractTypeHierarchyTraversingFilter.java:105) [spring-core-4.2.8.RELEASE.jar:4.2.8.RELEASE]
at org.springframework.data.repository.config.RepositoryConfigurationDelegate$LenientAssignableTypeFilter.match(RepositoryConfigurationDelegate.java:202) [spring-data-commons-1.12.1.RELEASE.jar:na]
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.isCandidateComponent(ClassPathScanningCandidateComponentProvider.java:346) [spring-context-4.2.8.RELEASE.jar:4.2.8.RELEASE]
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:280) [spring-context-4.2.8.RELEASE.jar:4.2.8.RELEASE]
at org.springframework.data.repository.config.RepositoryConfigurationDelegate.multipleStoresDetected(RepositoryConfigurationDelegate.java:167) [spring-data-commons-1.12.1.RELEASE.jar:na]
at org.springframework.data.repository.config.RepositoryConfigurationDelegate.<init>(RepositoryConfigurationDelegate.java:88) [spring-data-commons-1.12.1.RELEASE.jar:na]
at org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport.registerBeanDefinitions(RepositoryBeanDefinitionRegistrarSupport.java:80) [spring-data-commons-1.12.1.RELEASE.jar:na]
Tried adding dependency jsr305 from com.google.code.findbugs but still seeing same exceptions.

akka-kryo-serialization ClassNotFoundException: scala.Enumeration$Val

Sometimes when updating a dependency version for my project, when I would run the project I would get the following error:
ERROR 09:31:34:241 apply$mcV$sp - Class could not be loaded and/or registered: scala.Enumeration$Val
ERROR 09:31:34:247 apply$mcV$sp - exception caught during akka-kryo-serialization startup: java.lang.ClassNotFoundException: scala.Enumeration$Val
java.lang.RuntimeException: Nonzero exit code: 1
at scala.sys.package$.error(package.scala:27)
I usually got lucky and was able to fix this by tweaking the versions of my dependencies.
Until I updated my akka version from 2.3.6 to 2.3.12, specifically akka-contrib which contains akka-cluster, akka-remote and akka-peristance.
Turns out that the problem was actually occurring during the transition between akka 2.3.8 and 2.3.9. Looking at the change log, I found that between these two versions the Scala version was upgraded from 2.11.4 to 2.11.5.
My project was building on scala 2.11.4. Upgrading to 2.11.5 fixed the problem.
I couldn't find any help online for this, and lost a couple days trying to figure this out. I'm hoping that this will help someone else out.

Unable to register extension org.sonar.plugins.scala.cobertura.CoberturaSensor

I am using SonarQube 5.1 and its running on localhost. It was working out of box for java, but when i added the plugin for scala - http://docs.codehaus.org/display/SONAR/Scala+Plugin (i checked out the code from github, build the jar and then installed in sonarqube installation), now every time i invoke the gradle command sonarRunner - I am getting this error:
19:52:55.232 [ERROR] [system.err] ERROR: Unable to execute Sonar
19:52:55.233 [ERROR] [system.err] ERROR: Caused by: Unable to register extension org.sonar.plugins.scala.cobertura.CoberturaSensor
19:52:55.233 [ERROR] [system.err] ERROR: Caused by: org/sonar/plugins/cobertura/api/AbstractCoberturaParser
19:52:55.233 [ERROR] [system.err] ERROR: Caused by: org.sonar.plugins.cobertura.api.AbstractCoberturaParser
I tried searching for cause of the issue but could not find anything online. Please help me.
It took me about a million years to find this, so I hope it's helpful to someone. This error is caused by updates to the sonar api that cause incompatibility with versions older than 4.5.
The solution is to use the updated version of the sonar scala plugin which is available here: https://github.com/1and1/sonar-scala
This built straight away for me and started analyzing scala without error.
There are several things you can update in your project and on your Sonar server.
Go to your SonarQube Update Center
Go to Administration -> System -> Update Center
Update the CorberturaSenor plugin
As per this screenshot, find the specific plugin you are using and click update if available(This screenshot is showing a findbugs plugin but it will be the same concept for CorberturaSenor).
Update sonarqube dependency in your project
This example is in Gradle:
dependencies {
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.1-rc1"
}
Update sonar version
This example is in Gradle
sonarqube {
version='2.1-rc1'
}
Update your CoberturaSensor plugin dependency in your project.
Get the fully qualified name of your dependency you are using and search for a new version. Then update it in your build tool.
Check here for more info on this error: Unable to register extension org.sonar.plugins.*

Getting IncompatibleClassChangeError while running shark-0.9.0 with hadoop 2.2.0

I am getting the following error while running shark 0.9.0.
Exception in thread "main" java.lang.IncompatibleClassChangeError: Found class scala.collection.mutable.ArrayOps, but interface was expected
at shark.SharkCliDriver$.main(SharkCliDriver.scala:82)
at shark.SharkCliDriver.main(SharkCliDriver.scala)
Any solution regarding the problem is highly appreciable.
Its a backward compatibility issue.
This exception is raised when the version of scala-library.jar is different during compilation and execution. Make sure that you use the same library version during compiling and executing.
if you are using hadoop 2.x version, do the below steps
find path to shark installation folder -name hadoop-core-1.0.4.jar
remove all the hadoop-core-1.0.4.jar
check this
http://bigdataanalyze.blogspot.com/2014/03/issues-on-shark-with-cdh5-beta2-1.html