I am scala newbie trying to create a simple scala program to generate a html and found salatags provides an api to generate it.
I followed the scalatags and used an example ScalaJSExample.scala and getting error.
Below is my build.sbt file and the error that I am getting
[error] (run-main-0) java.lang.Error: stub
[error] java.lang.Error: stub
[error] at scala.scalajs.runtime.package$.linkingInfo(package.scala:193)
[error] at scala.scalajs.runtime.package$.environmentInfo(package.scala:187)
[error] at scala.scalajs.js.Dynamic$.global(Dynamic.scala:78)
[error] at org.scalajs.dom.package$.window$lzycompute(package.scala:235)
[error] at org.scalajs.dom.package$.window(package.scala:235)
[error] at org.scalajs.dom.package$.document$lzycompute(package.scala:236)
[error] at org.scalajs.dom.package$.document(package.scala:236)
[error] at ScalaJSExample$.delayedEndpoint$ScalaJSExample$1(HtmlRenderer.scala:199)
[error] at ScalaJSExample$delayedInit$body.apply(HtmlRenderer.scala:193)
[error] at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
[error] at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
[error] at scala.App$$anonfun$main$1.apply(App.scala:76)
[error] at scala.App$$anonfun$main$1.apply(App.scala:76)
[error] at scala.collection.immutable.List.foreach(List.scala:381)
[error] at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
[error] at scala.App$class.main(App.scala:76)
[error] at ScalaJSExample$.main(HtmlRenderer.scala:193)
[error] at ScalaJSExample.main(HtmlRenderer.scala)
[error] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] at java.lang.reflect.Method.invoke(Method.java:497)
[error] at sbt.Run.invokeMain(Run.scala:89)
[error] at sbt.Run.run0(Run.scala:83)
[error] at sbt.Run.execute$1(Run.scala:61)
[error] at sbt.Run.$anonfun$run$4(Run.scala:73)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:10)
[error] at sbt.TrapExit$App.run(TrapExit.scala:252)
[error] at java.lang.Thread.run(Thread.java:745)
[error] java.lang.RuntimeException: Nonzero exit code: 1
[error] at sbt.Run$.executeTrapExit(Run.scala:120)
[error] at sbt.Run.run(Run.scala:73)
[error] at sbt.Defaults$.$anonfun$bgRunTask$5(Defaults.scala:1155)
[error] at sbt.Defaults$.$anonfun$bgRunTask$5$adapted(Defaults.scala:1150)
[error] at sbt.internal.BackgroundThreadPool.$anonfun$run$1(DefaultBackgroundJobService.scala:331)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] at scala.util.Try$.apply(Try.scala:209)
[error] at sbt.internal.BackgroundThreadPool$BackgroundRunnable.run(DefaultBackgroundJobService.scala:254)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[error] at java.lang.Thread.run(Thread.java:745)
[error] (compile:run) Nonzero exit code: 1
[error] Total time: 4 s, completed Oct 6, 2017 6:39:55 PM
sbt:src>
and build.sbt is
scalaVersion := "2.11.7"
libraryDependencies ++= Seq(
"org.scala-js" % "scalajs-dom_sjs0.6_2.11" % "0.9.3",
"org.scala-js" % "scalajs-library_2.11" % "0.6.20",
"com.lihaoyi" % "scalatags_2.11" % "0.6.7",
"org.scala-lang" % "scala-library" % scalaVersion.value,
"com.lihaoyi" % "scalatex-api_2.11" % "0.3.6"
)
//Getting error with the below plugin and commented it out
//addSbtPlugin("com.lihaoyi" % "scalatex-api_2.12" % "0.3.6")
//scalatex.SbtPlugin.projectSettings
// scalaVersion := scalaVesrion.value
Could someone see what is wrong and what is the simple way to generate static html as simple as
hello World!
in scala with some available scala libraries or apis?
Related
I am running through the tutorial of liquibase being new. After following instructions I am able to run liquibase update command with no issues, but if I try mvn liquibase:update I receive the following error:
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.9.0:update (default-cli) on project LiquibaseDemoMysql: A type incompatibility occurred while executing org.liquibase:liquibase-maven-plugin:3.9.0:update: class java.time.LocalDateTime cannot be cast to class java.lang.String (java.time.LocalDateTime and java.lang.String are in module java.base of loader 'bootstrap')
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.liquibase:liquibase-maven-plugin:3.9.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/duart/.m2/repository/org/liquibase/liquibase-maven-plugin/3.9.0/liquibase-maven-plugin-3.9.0.jar
[ERROR] urls[1] = file:/C:/Users/duart/.m2/repository/mysql/mysql-connector-java/8.0.23/mysql-connector-java-8.0.23.jar
[ERROR] urls[2] = file:/C:/Users/duart/.m2/repository/com/google/protobuf/protobuf-java/3.11.4/protobuf-java-3.11.4.jar
[ERROR] urls[3] = file:/C:/Users/duart/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
[ERROR] urls[4] = file:/C:/Users/duart/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.2/org.eclipse.sisu.inject-0.3.2.jar
[ERROR] urls[5] = file:/C:/Users/duart/.m2/repository/org/apache/maven/maven-builder-support/3.3.9/maven-builder-support-3.3.9.jar
[ERROR] urls[6] = file:/C:/Users/duart/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar
[ERROR] urls[7] = file:/C:/Users/duart/.m2/repository/org/eclipse/aether/aether-util/1.0.2.v20150114/aether-util-1.0.2.v20150114.jar
[ERROR] urls[8] = file:/C:/Users/duart/.m2/repository/com/google/inject/guice/4.0/guice-4.0-no_aop.jar
[ERROR] urls[9] = file:/C:/Users/duart/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
[ERROR] urls[10] = file:/C:/Users/duart/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.21/plexus-interpolation-1.21.jar
[ERROR] urls[11] = file:/C:/Users/duart/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[12] = file:/C:/Users/duart/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.6/plexus-component-annotations-1.6.jar
[ERROR] urls[13] = file:/C:/Users/duart/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[14] = file:/C:/Users/duart/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[15] = file:/C:/Users/duart/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar
[ERROR] urls[16] = file:/C:/Users/duart/.m2/repository/org/liquibase/liquibase-core/3.9.0/liquibase-core-3.9.0.jar
[ERROR] urls[17] = file:/C:/Users/duart/.m2/repository/javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar
[ERROR] urls[18] = file:/C:/Users/duart/.m2/repository/org/yaml/snakeyaml/1.24/snakeyaml-1.24.jar
[ERROR] urls[19] = file:/C:/Users/duart/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
[ERROR] urls[20] = file:/C:/Users/duart/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR]
[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/PluginExecutionException
Not sure what is causing this and haven't been able to find anything online regarding this. Has anyone had this issue and no how to resolve it?
I updated the version of the liquibase-maven-plugin from 3.9.0 to the latest. The version they have you. the version given in the tutorial is outdated.
I am following this documentation for ScalikeJDBCGen, which can generate source code from MySQL schema. However on executing below command I receive ClassNotFoundException.
I can see MySql in my sbt dependencies. Also I tried to run this by removing it from dependencies with the doubt of conflict of 2 versions of same dependencies (See image below). But outcome remains same. How can I fix this?
Terminal
sbt "scalikejdbcGen product Product"
Error
[error] java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
[error] at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:435)
[error] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
[error] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
[error] at java.base/java.lang.Class.forName0(Native Method)
[error] at java.base/java.lang.Class.forName(Class.java:340)
[error] at scalikejdbc.mapper.ScalikejdbcPlugin$.generator(ScalikejdbcPlugin.scala:196)
[error] at scalikejdbc.mapper.ScalikejdbcPlugin$.$anonfun$projectSettings$2(ScalikejdbcPlugin.scala:237)
[error] at scalikejdbc.mapper.ScalikejdbcPlugin$.$anonfun$projectSettings$7(ScalikejdbcPlugin.scala:249)
[error] at scalikejdbc.mapper.ScalikejdbcPlugin$.$anonfun$projectSettings$7$adapted(ScalikejdbcPlugin.scala:247)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[error] at sbt.std.Transform$$anon$4.work(System.scala:67)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:278)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[error] at java.base/java.lang.Thread.run(Thread.java:832)
[error] (databaseMysql / Compile / scalikejdbcGen) java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Build.sbt
lazy val databaseMysql =
(project in file("database-mysql"))
.enablePlugins(ScalikejdbcPlugin)
.settings(
commonSettings,
libraryDependencies ++= Seq(
logback,
slf4j,
"mysql" % "mysql-connector-java" % "5.1.12",
"org.hsqldb" % "hsqldb" % "2.3.2",
"org.scalikejdbc" %% "scalikejdbc" % "3.5.0",
"org.scalikejdbc" %% "scalikejdbc-test" % "3.5.0" % "test",
"org.scalikejdbc" %% "scalikejdbc-config" % "3.5.0",
"com.h2database" % "h2" % "1.4.200",
"ch.qos.logback" % "logback-classic" % "1.2.3",
"org.scalikejdbc" %% "scalikejdbc-mapper-generator-core" % "3.5.0"
)
)
.dependsOn(util, signrequest, test % "test->test;compile->compile")
Adding the JDBC driver to project/plugins.sbt should work for you!
Top module is as follows;
class PE (DataWidth: Int, NumLinks: Int, NumEntries: Int, FifoDepth: Int) extends Module {
val io = IO(new Bundle {
...
})
...
}
I think that this is ordinary style for the chisel3.
I do the following run of sbt to lint the code;
sbt 'test:runMain noc.PEMain'
Then I get bellow error messages;
[warn] Multiple main classes detected. Run 'show discoveredMainClasses' to see the list
[info] Running noc.NoCMain
[info] [0.002] Elaborating design...
[error] (run-main-0) chisel3.internal.ChiselException: Error: attempted to instantiate a Module without wrapping it in Module().
[error] chisel3.internal.ChiselException: Error: attempted to instantiate a Module without wrapping it in Module().
[error] at chisel3.internal.throwException$.apply(Error.scala:13)
[error] at chisel3.core.BaseModule.<init>(Module.scala:90)
[error] at chisel3.core.UserModule.<init>(UserModule.scala:18)
[error] at chisel3.core.ImplicitModule.<init>(UserModule.scala:102)
[error] at chisel3.core.LegacyModule.<init>(UserModule.scala:127)
[error] at noc.NumGen.<init>(NoC.scala:328)
[error] at noc.FanIn_Link.<init>(NoC.scala:376)
[error] at noc.PE$$anonfun$12.apply(NoC.scala:490)
[error] at noc.PE$$anonfun$12.apply(NoC.scala:490)
[error] at chisel3.core.Module$.do_apply(Module.scala:49)
[error] at noc.PE.<init>(NoC.scala:490)
[error] at noc.NoCMain$$anonfun$1.apply(NoCMain.scala:27)
[error] at noc.NoCMain$$anonfun$1.apply(NoCMain.scala:27)
...
[error] at chisel3.internal.Builder$$anonfun$build$1.apply(Builder.scala:297)
[error] at chisel3.internal.Builder$$anonfun$build$1.apply(Builder.scala:295)
[error] at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
[error] at chisel3.internal.Builder$.build(Builder.scala:295)
[error] at chisel3.Driver$.elaborate(Driver.scala:93)
[error] at chisel3.Driver$.execute(Driver.scala:140)
[error] at chisel3.iotesters.setupTreadleBackend$.apply(TreadleBackend.scala:139)
...
[error] at logger.Logger$$anonfun$makeScope$1.apply(Logger.scala:138)
[error] at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
[error] at logger.Logger$.makeScope(Logger.scala:136)
...
[error] at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
[error] at chisel3.iotesters.Driver$.execute(Driver.scala:38)
[error] at chisel3.iotesters.Driver$.execute(Driver.scala:100)
[error] at noc.NoCMain$.delayedEndpoint$noc$NoCMain$1(NoCMain.scala:27)
[error] at noc.NoCMain$delayedInit$body.apply(NoCMain.scala:26)
[error] at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
...
[error] at scala.App$class.main(App.scala:76)
[error] at noc.NoCMain$.main(NoCMain.scala:26)
[error] at noc.NoCMain.main(NoCMain.scala)
[error] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
[error] at java.lang.Thread.run(Thread.java:745)
And lastly this error:
[error] (Test / runMain) Nonzero exit code: 1
I find warning of:
[warn] Multiple main classes detected. Run 'show discoveredMainClasses' to see the list
Command of sbt 'show discoveredMainClasses' shows;
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from /Users/hoge/Desktop/NoC/project
[info] Loading settings from build.sbt ...
[info] Set current project to en-noc (in build file:/Users/hoge/Desktop/NoC/)
[info] *
[success] Total time: 1 s, completed 2019/10/22 2:08:49
What does this error message mean and how can I fix it?
sbt 'testOnly noc.PETester'
introduced;
[info] at chisel3.core.LegacyModule.<init>(UserModule.scala:127)
This is caused at
val io = IO(new Bundle {
val No = Output(Vec(NumLinks, UInt((log2Ceil(NumLinks)).W)))
})
It seem that the main problem is:
attempted to instantiate a Module without wrapping it in Module()
This may rise due to you making a new instance of a class extended from Module but you are probably not wrapping it into one.
For example you in your code you are doing something like:
val test = new module_class
where as you should be doing
val test = Module(new module_class)
I have been following tutorials on PlayFramework, but it seems that they are all outdated and for older version of Play.
I want to try JUnit test using mysql databse not h2 in-memory database.
I am using ebean ORC (which clearly has different api than it used to have inside play 2.2, and the api is not really well documented).
Anyway I want to try JUnit test on mysql databse, but I am always getting a configuration error.
This is how the JUnit test class looks:
public class ModelsTest extends WithApplication {
public Application app;
#Before
public void setUp() throws FileNotFoundException, IOException {
java.util.Properties externalProps=new java.util.Properties();
externalProps.load(new FileInputStream("resources/test-ebean.properties"));
ServerConfig config = new ServerConfig();
config.setName("test");
config.setDefaultServer(true);
config.loadFromProperties(externalProps);
EbeanServer server = EbeanServerFactory.create(config);
app = Helpers.fakeApplication();
Helpers.start(app);
}
#Test
public void createAndRetrieveUser() {
new User("bob#bob.bob", "admin", "admin").save();
User bob = User.find.where().eq("email", "bob#bob.bob").findUnique();
assertNotNull(bob);
assertEquals("admin", bob.login);
}
#After
public void stopApp() {
Helpers.stop(app);
}
test-ebean.properties file :
ebean.ddl.generate=true
ebean.ddl.run=true
datasource.default=db
datasource.db.username="root"
datasource.db.password="root"
datasource.db.databaseUrl="jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8"
datasource.db.databaseDriver=com.mysql.jdbc.Driver
When running test I am getting this error:
[error] Test ModelsTest.createAndRetrieveUser failed:` play.api.Configuration$$anon$1: Configuration error[null], took 4.969 sec
[error] at play.api.Configuration$.configError(Configuration.scala:154)
[error] at play.api.Configuration.reportError(Configuration.scala:806)
[error] at play.Configuration.reportError(Configuration.java:366)
[error] at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.parse(DefaultEbeanConfig.java:81)
[error] at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.get(DefaultEbeanConfig.java:60)
[error] at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.get(DefaultEbeanConfig.java:44)
[error] at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
[error] at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72)
[error] at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
[error] at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62)
[error] at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
[error] at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
[error] at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
[error] at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
[error] at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
[error] at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
[error] at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
[error] at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104)
[error] at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
[error] at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
[error] at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
[error] at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
[error] at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
[error] at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
[error] at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
[error] at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56)
[error] at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
[error] at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
[error] at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
[error] at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
[error] at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
[error] at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205)
[error] at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199)
[error] at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
[error] at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)
[error] at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)
[error] at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
[error] at com.google.inject.Guice.createInjector(Guice.java:96)
[error] at com.google.inject.Guice.createInjector(Guice.java:84)
[error] at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:181)
[error] at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
[error] at play.api.test.FakeApplication.<init>(Fakes.scala:209)
[error] at play.test.FakeApplication.<init>(FakeApplication.java:51)
[error] at play.test.Helpers.fakeApplication(Helpers.java:124)
[error] at play.test.WithApplication.provideFakeApplication(WithApplication.java:46)
[error] at play.test.WithApplication.provideApplication(WithApplication.java:33)
[error] at play.test.WithApplication.startPlay(WithApplication.java:51)
[error] ...
[error] Caused by: java.lang.NullPointerException
[error] at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.parse(DefaultEbeanConfig.java:79)
[error] ... 78 more
[error] Test ModelsTest.createAndRetrieveUser failed: java.lang.NullPointerException: null, took 4.979 sec
[error] at play.test.Helpers.stop(Helpers.java:376)
[error] at ModelsTest.stopApp(ModelsTest.java:58)
[error] ...
[error] Failed: Total 1, Failed 1, Errors 0, Passed 0
[error] Failed tests:
[error] ModelsTest
[error] (test:testOnly) sbt.TestsFailedException: Tests unsuccessful
I just started learning play (but actually most of tutorials are outdated) and I have spent more time trying to configure it to run than actually coding. I guess I should look up another framework.
You don't need to set up a whole database just for testing (you are free to, of course). Play relies strongly on In-Memory databases (e.g. during development) and you can utilize this also in your tests:
#Test
public void findById() {
running(fakeApplication(inMemoryDatabase("test")), () -> {
User bob = User.findById(21l);
assertEquals("bob#bob.bob", bob.email);
assertEquals("admin", bob.login);
});
}
On the other hand if you really want to test the database access code you can go as far as creating a Database test object:
Database database = Databases.createFrom(
"com.mysql.jdbc.Driver",
"jdbc:mysql://localhost/test"
);
Which again can be in-memory:
Database database = Databases.inMemory(
"mydatabase",
ImmutableMap.of(
"MODE", "MYSQL"
),
ImmutableMap.of(
"logStatements", true
)
);
Just don't forget to release the resources after the test:
#After
public void shutdownDatabase() {
database.shutdown();
}
I'm running sonarRunner (Sonar Analysis) on Java project but getting the following error. I tried various options/settings as mentioned below but it's still failing. I even tried setting / passing -Dsonar.exclusions=src/java/com/thc/ids/biz/SomePlansvc/pvt/costestimate/datavalidation/Validators.java, it's still not ignoring the file.
12:51:38 12:51:38.426 INFO - Base dir: /rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc
12:51:38 12:51:38.426 INFO - Working dir: /rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/build/****
12:51:38 12:51:38.427 INFO - Source dirs: /rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/src/java
12:51:38 12:51:38.427 INFO - Test dirs: /rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/test/java, /rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/src/java-test
12:51:38 12:51:38.427 INFO - Binary dirs: /rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/build/classes/main
12:51:38 12:51:38.427 INFO - Source encoding: UTF-8, default locale: en_US
12:51:38 12:51:38.542 INFO - Sensor JavaSourceImporter...
12:51:39 12:51:39.910 INFO - Sensor JavaSourceImporter done: 1368 ms
12:51:39 12:51:39.910 INFO - Sensor JavaSquidSensor...
12:51:39 12:51:39.982 INFO - Java AST scan...
12:51:42 :****Runner FAILED
12:51:42
12:51:42 FAILURE: Build failed with an exception.
12:51:42
12:51:42 * What went wrong:
12:51:42 Execution failed for task ':****Runner'.
12:51:42 > org.****.squid.api.AnalysisException: SonarQube is unable to analyze file : '/rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/src/java/com/thc/ids/biz/SomePlansvc/pvt/costestimate/datavalidation/Validators.java'
12:51:42
12:51:42 * Try:
12:51:42 Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
12:51:42
12:51:42 BUILD FAILED
12:51:42
OR with property -Dsonar.verbose=true
12:46:00 12:46:00.208 DEBUG - Remove data measure from memory: ncloc_data, id=6508635
12:46:00 12:46:00.221 DEBUG - Release semaphore on project : org.****.api.resources.Project#3f1ea2e9[id=9200,key=com.company.shenzi:SomePlanSvc,qualifier=TRK], with key batch-com.company.shenzi:SomePlanSvc
12:46:00 12:46:00.248 DEBUG - To prevent a memory leak, the JDBC Driver [org.postgresql.Driver] has been forcibly deregistered
12:46:00 :****Runner FAILED
12:46:00
12:46:00 FAILURE: Build failed with an exception.
12:46:00
12:46:00 * What went wrong:
12:46:00 Execution failed for task ':****Runner'.
12:46:00 > org.****.squid.api.AnalysisException: SonarQube is unable to analyze file : '/rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/src/java/com/thc/ids/biz/SomePlansvc/pvt/costestimate/datavalidation/Validators.java'
12:46:00
12:46:00 * Try:
12:46:00 Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
12:46:00
12:46:00 BUILD FAILED
OR with --stacktrace --debug passed as arguments to Gradle while running sonarRunner task.
12:38:54 12:38:54.268 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader#7f1a8ee58 pairs: {null: HTTP/1.1 200 OK}{Server: Apache-Coyote/1.1}{X-Runtime: 12}{ETag: "791167fe40a105310f7617f6946dbf31"}{Cache-Control: private, max-age=0, must-revalidate}{Content-Type: application/json;charset=utf-8}{Content-Length: 484}{Date: Tue, 05 Aug 2014 16:38:54 GMT}
12:38:54 12:38:54.279 [QUIET] [system.out] 12:38:54.279 INFO - Apply project exclusions
12:38:54 12:38:54.408 [QUIET] [system.out] 12:38:54.408 INFO - ------------- Scan SomePlanSvc
12:38:54 12:38:54.412 [QUIET] [system.out] 12:38:54.412 INFO - Load module settings
12:38:54 12:38:54.416 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader#4d7b95636 pairs: {GET /batch_bootstrap/properties?project=com.company.shenzi:SomePlanSvc&dryRun=false HTTP/1.1: null}{Accept-Encoding: gzip}{User-Agent: Sonar Runner/2.0}{Host: cmSonar.main.company.com:9000}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
12:38:54 12:38:54.448 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader#6c8cbe528 pairs: {null: HTTP/1.1 200 OK}{Server: Apache-Coyote/1.1}{X-Runtime: 9}{ETag: "791167fe40a105310f7617f6946dbf31"}{Cache-Control: private, max-age=0, must-revalidate}{Content-Type: application/json;charset=utf-8}{Content-Length: 484}{Date: Tue, 05 Aug 2014 16:38:54 GMT}
12:38:54 12:38:55.271 [QUIET] [system.out] 12:38:55.270 INFO - Quality profile : [name=Sonar way with Findbugs,language=java]
12:38:54 12:38:55.286 [QUIET] [system.out] 12:38:55.286 INFO - Excluded tests:
12:38:55 12:38:55.286 [QUIET] [system.out] 12:38:55.286 INFO - **/package-info.java
12:38:55 12:38:55.371 [QUIET] [system.out] 12:38:55.371 INFO - Index files
12:38:55 12:38:55.903 [QUIET] [system.out] 12:38:55.903 INFO - 324 files indexed
12:38:55 12:38:55.916 [QUIET] [system.out] 12:38:55.915 INFO - Loading technical debt model...
12:38:55 12:38:56.645 [QUIET] [system.out] 12:38:56.645 INFO - Loading technical debt model done: 730 ms
12:38:55 12:38:56.668 [QUIET] [system.out] 12:38:56.668 INFO - Configure Maven plugins
12:38:56 12:38:57.214 [QUIET] [system.out] 12:38:57.214 INFO - Base dir: /rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc
12:38:56 12:38:57.214 [QUIET] [system.out] 12:38:57.214 INFO - Working dir: /rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/build/****
12:38:57 12:38:57.214 [QUIET] [system.out] 12:38:57.214 INFO - Source dirs: /rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/src/java
12:38:57 12:38:57.215 [QUIET] [system.out] 12:38:57.215 INFO - Test dirs: /rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/test/java, /rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/src/java-test
12:38:57 12:38:57.215 [QUIET] [system.out] 12:38:57.215 INFO - Binary dirs: /rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/build/classes/main
12:38:57 12:38:57.215 [QUIET] [system.out] 12:38:57.215 INFO - Source encoding: UTF-8, default locale: en_US
12:38:57 12:38:57.317 [QUIET] [system.out] 12:38:57.317 INFO - Sensor JavaSourceImporter...
12:38:57 12:38:58.663 [QUIET] [system.out] 12:38:58.663 INFO - Sensor JavaSourceImporter done: 1346 ms
12:38:57 12:38:58.663 [QUIET] [system.out] 12:38:58.663 INFO - Sensor JavaSquidSensor...
12:38:58 12:38:58.742 [QUIET] [system.out] 12:38:58.742 INFO - Java AST scan...
12:38:58 12:39:01.222 [DEBUG] [org.gradle.logging.internal.DefaultLoggingConfigurer] Finished configuring with level: DEBUG, configurers: [org.gradle.logging.internal.OutputEventRenderer#3cff8f2c, org.gradle.logging.internal.logback.LogbackLoggingConfigurer#2e10b0fd, org.gradle.logging.internal.JavaUtilLoggingConfigurer#49d3c9ab]
12:38:58 12:39:01.222 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on task artifact state cache (/rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/.gradle/1.6/taskArtifacts).
12:39:01 12:39:01.222 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
12:39:01 12:39:01.223 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':****Runner'
12:39:01 12:39:01.223 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :****Runner FAILED
12:39:01 12:39:01.228 [ERROR] [org.gradle.BuildExceptionReporter]
12:39:01 12:39:01.229 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
12:39:01 12:39:01.229 [ERROR] [org.gradle.BuildExceptionReporter]
12:39:01 12:39:01.229 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
12:39:01 12:39:01.230 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':****Runner'.
12:39:01 12:39:01.230 [ERROR] [org.gradle.BuildExceptionReporter] > org.****.squid.api.AnalysisException: SonarQube is unable to analyze file : '/rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/src/java/com/thc/ids/biz/SomePlansvc/pvt/costestimate/datavalidation/Validators.java'
12:39:01 12:39:01.232 [ERROR] [org.gradle.BuildExceptionReporter]
12:39:01 12:39:01.232 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
12:39:01 12:39:01.233 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':****Runner'.
12:39:01 12:39:01.234 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
12:39:01 12:39:01.234 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
12:39:01 12:39:01.234 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
12:39:01 12:39:01.234 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.state.CacheLockReleasingTaskExecuter$1.run(CacheLockReleasingTaskExecuter.java:35)
12:39:01 12:39:01.234 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.Factories$1.create(Factories.java:22)
12:39:01 12:39:01.234 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:179)
12:39:01 12:39:01.235 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:232)
12:39:01 12:39:01.235 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:142)
12:39:01 12:39:01.235 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83)
12:39:01 12:39:01.235 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.state.CacheLockReleasingTaskExecuter.execute(CacheLockReleasingTaskExecuter.java:33)
12:39:01 12:39:01.236 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:58)
12:39:01 12:39:01.236 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ContextualisingTaskExecuter.execute(ContextualisingTaskExecuter.java:34)
12:39:01 12:39:01.236 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.state.CacheLockAcquiringTaskExecuter$1.run(CacheLockAcquiringTaskExecuter.java:39)
12:39:01 12:39:01.236 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.Factories$1.create(Factories.java:22)
12:39:01 12:39:01.236 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:124)
12:39:01 12:39:01.236 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:112)
12:39:01 12:39:01.237 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:134)
12:39:01 12:39:01.237 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
12:39:01 12:39:01.237 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.state.CacheLockAcquiringTaskExecuter.execute(CacheLockAcquiringTaskExecuter.java:37)
12:39:01 12:39:01.237 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
12:39:01 12:39:01.238 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
12:39:01 12:39:01.238 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
12:39:01 12:39:01.238 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
12:39:01 12:39:01.238 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
12:39:01 12:39:01.238 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:282)
12:39:01 12:39:01.238 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.executeTask(DefaultTaskPlanExecutor.java:48)
12:39:01 12:39:01.239 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.processTask(DefaultTaskPlanExecutor.java:34)
12:39:01 12:39:01.239 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:27)
12:39:01 12:39:01.239 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:89)
12:39:01 12:39:01.239 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
12:39:01 12:39:01.239 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
12:39:01 12:39:01.240 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
12:39:01 12:39:01.240 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
12:39:01 12:39:01.240 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.state.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
12:39:01 12:39:01.240 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.Factories$1.create(Factories.java:22)
12:39:01 12:39:01.240 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:124)
12:39:01 12:39:01.241 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:112)
12:39:01 12:39:01.241 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:134)
12:39:01 12:39:01.241 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
12:39:01 12:39:01.241 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.changedetection.state.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
12:39:01 12:39:01.241 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
12:39:01 12:39:01.242 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
12:39:01 12:39:01.242 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
12:39:01 12:39:01.242 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
12:39:01 12:39:01.242 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
12:39:01 12:39:01.242 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
12:39:01 12:39:01.243 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
12:39:01 12:39:01.243 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
12:39:01 12:39:01.243 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
12:39:01 12:39:01.243 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
12:39:01 12:39:01.243 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
12:39:01 12:39:01.244 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
12:39:01 12:39:01.244 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
12:39:01 12:39:01.244 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
12:39:01 12:39:01.244 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
12:39:01 12:39:01.244 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
12:39:01 12:39:01.244 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
12:39:01 12:39:01.245 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
12:39:01 12:39:01.245 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
12:39:01 12:39:01.245 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
12:39:01 12:39:01.245 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
12:39:01 12:39:01.245 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
12:39:01 12:39:01.246 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.doAction(Main.java:48)
12:39:01 12:39:01.246 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
12:39:01 12:39:01.246 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.main(Main.java:39)
12:39:01 12:39:01.246 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
12:39:01 12:39:01.246 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
12:39:01 12:39:01.247 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
12:39:01 12:39:01.247 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.****.runner.RunnerException: org.****.squid.api.AnalysisException: SonarQube is unable to analyze file : '/rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/src/java/com/thc/ids/biz/SomePlansvc/pvt/costestimate/datavalidation/Validators.java'
12:39:01 12:39:01.247 [ERROR] [org.gradle.BuildExceptionReporter] at org.****.runner.Runner.delegateExecution(Runner.java:288)
12:39:01 12:39:01.247 [ERROR] [org.gradle.BuildExceptionReporter] at org.****.runner.Runner.execute(Runner.java:151)
12:39:01 12:39:01.247 [ERROR] [org.gradle.BuildExceptionReporter] at org.****.runner.Runner$execute.call(Unknown Source)
12:39:01 12:39:01.248 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.****.runner.SonarRunner.run(SonarRunner.groovy:52)
12:39:01 12:39:01.248 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:216)
12:39:01 12:39:01.248 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:122)
12:39:01 12:39:01.248 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
12:39:01 12:39:01.248 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.****.runner.SonarRunner_Decorated.invokeMethod(Unknown Source)
12:39:01 12:39:01.248 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
12:39:01 12:39:01.249 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:217)
12:39:01 12:39:01.249 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
12:39:01 12:39:01.249 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:199)
12:39:01 12:39:01.249 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:526)
12:39:01 12:39:01.249 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:509)
12:39:01 12:39:01.250 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
12:39:01 12:39:01.250 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
12:39:01 12:39:01.250 [ERROR] [org.gradle.BuildExceptionReporter] ... 67 more
12:39:01 12:39:01.250 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.****.squid.api.AnalysisException: SonarQube is unable to analyze file : '/rootddisk/ci-jenkins/var_loc2/workspace/SomePlanSvc/src/java/com/thc/ids/biz/SomePlansvc/pvt/costestimate/datavalidation/Validators.java'
12:39:01 12:39:01.250 [ERROR] [org.gradle.BuildExceptionReporter] at org.****.java.ast.AstScanner.scan(AstScanner.java:132)
12:39:01 12:39:01.251 [ERROR] [org.gradle.BuildExceptionReporter] at org.****.java.JavaSquid.scanSources(JavaSquid.java:113)
12:39:01 12:39:01.251 [ERROR] [org.gradle.BuildExceptionReporter] at org.****.java.JavaSquid.scan(JavaSquid.java:107)
12:39:01 12:39:01.251 [ERROR] [org.gradle.BuildExceptionReporter] at org.****.plugins.java.JavaSquidSensor.analyse(JavaSquidSensor.java:79)
12:39:01 12:39:01.251 [ERROR] [org.gradle.BuildExceptionReporter] at org.****.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:72)
12:39:01 12:39:01.251 [ERROR] [org.gradle.BuildExceptionReporter] at org.****.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:114)
12:39:01 12:39:01.255 [ERROR] [org.gradle.BuildExceptionReporter] at org.****.runner.Runner.delegateExecution(Runner.java:285)
12:39:01 12:39:01.256 [ERROR] [org.gradle.BuildExceptionReporter] ... 82 more
12:39:01 12:39:01.256 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.NullPointerException
12:39:01 12:39:01.256 [ERROR] [org.gradle.BuildExceptionReporter] at org.****.java.checks.EmptyMethodsCheck.isInAbstractClass(EmptyMethodsCheck.java:80)
12:39:01 12:39:01.256 [ERROR] [org.gradle.BuildExceptionReporter] at org.****.java.checks.EmptyMethodsCheck.visitNode(EmptyMethodsCheck.java:47)
12:39:01 12:39:01.260 [ERROR] [org.gradle.BuildExceptionReporter] at org.****.java.ast.AstScanner.scan(AstScanner.java:93)
12:39:01 12:39:01.260 [ERROR] [org.gradle.BuildExceptionReporter] ... 110 more
12:39:01 12:39:01.260 [ERROR] [org.gradle.BuildExceptionReporter]
12:39:01 12:39:01.260 [LIFECYCLE] [org.gradle.BuildResultLogger]
12:39:01 12:39:01.260 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
12:39:01 12:39:01.261 [LIFECYCLE] [org.gradle.BuildResultLogger]
Validators.java file's code is:
package com.thc.ids.biz.someplansvc.pvt.costestimate.datavalidation;
import java.math.BigDecimal;
import java.util.Map;
/**
* Validate data
* #author Trinley
*
* #param <T>
*/
public enum Validators
{
VAL_PERCENT_DECIMAL
{
public void validate(Object value)
{
BigDecimal val = (BigDecimal)value;
if (val.compareTo(BigDecimal.ZERO) < 0 || val.compareTo(BigDecimal.ONE) > 0)
{
throw new IllegalArgumentException("Value: " + value + " out of range for: " + this);
}
}
},
VAL_POSITIVE_DECIMAL
{
public void validate(Object value)
{
BigDecimal val = (BigDecimal)value;
if (val.compareTo(BigDecimal.ZERO) < 0)
{
throw new IllegalArgumentException("Value: " + value + " out of range for: " + this);
}
}
},
VAL_NOP_BOOLEAN
{
public void validate(Object value) {}
},
VAL_NOP_DECIMAL
{
public void validate(Object value) {}
},
VAL_NOP_STRING
{
public void validate(Object value) {}
},
VAL_REQ_BOOLEAN
{
public void validate(Object value)
{
if (value == null)
{
throw new NoDataFoundException("A required boolean field is missing");
}
}
},
VAL_REQ_DECIMAL
{
public void validate(Object value)
{
if (value == null)
{
throw new NoDataFoundException("A required double field is missing");
}
}
},
VAL_REQ_GigaType
{
public void validate(Object value)
{
if (value == null)
{
throw new NoDataFoundException("A required GigaType field is missing");
}
}
},
VAL_REQ_MAP
{
public void validate(Object value)
{
if (value instanceof Map)
{
throw new NoDataFoundException("A Map field is invalid");
}
}
};
public abstract void validate(Object val);
}