LogAnalysis Example failed unit test

44 views
Skip to first unread message

Liang Chen

unread,
Jul 1, 2016, 11:57:27 AM7/1/16
to CDAP User
Hi, I was trying the LogAnalysis example from the cdap standalone vm. This example works in 3.3.0 but after I am getting 3.4.1 and 3.4.2, it is giving error when running mvn clean package:



cdap@cdap-standalone-vm-3:~/cdap/examples/LogAnalysis$ mvn package
[INFO] Scanning for projects...
[INFO]                                                                        
[INFO] ------------------------------------------------------------------------
[INFO] Building LogAnalysis 3.4.2
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- scala-maven-plugin:3.2.2:add-source (scala-add-source) @ LogAnalysis ---
[INFO] Add Source directory: /opt/cdap/sdk-3.4.2/examples/LogAnalysis/src/main/scala
[INFO] Add Test Source directory: /opt/cdap/sdk-3.4.2/examples/LogAnalysis/src/test/scala
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ LogAnalysis ---
[WARNING] Using platform encoding (ISO-8859-1 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /opt/cdap/sdk-3.4.2/examples/LogAnalysis/src/main/resources
[INFO]
[INFO] --- scala-maven-plugin:3.2.2:compile (scala-compile) @ LogAnalysis ---
[WARNING]  Expected all dependencies to require Scala version: 2.10.4
[WARNING]  co.cask.cdap:LogAnalysis:3.4.2 requires scala version: 2.10.4
[WARNING]  com.twitter:chill_2.10:0.5.0 requires scala version: 2.10.4
[WARNING]  com.typesafe.akka:akka-remote_2.10:2.3.11 requires scala version: 2.10.4
[WARNING]  com.typesafe.akka:akka-actor_2.10:2.3.11 requires scala version: 2.10.4
[WARNING]  com.typesafe.akka:akka-slf4j_2.10:2.3.11 requires scala version: 2.10.4
[WARNING]  org.apache.spark:spark-core_2.10:1.6.1 requires scala version: 2.10.4
[WARNING]  org.json4s:json4s-jackson_2.10:3.2.10 requires scala version: 2.10.4
[WARNING]  org.json4s:json4s-core_2.10:3.2.10 requires scala version: 2.10.4
[WARNING]  org.json4s:json4s-ast_2.10:3.2.10 requires scala version: 2.10.4
[WARNING]  org.json4s:json4s-core_2.10:3.2.10 requires scala version: 2.10.0
[WARNING] Multiple versions of scala libraries detected!
[INFO] /opt/cdap/sdk-3.4.2/examples/LogAnalysis/src/main/java:-1: info: compiling
[INFO] /opt/cdap/sdk-3.4.2/examples/LogAnalysis/src/main/scala:-1: info: compiling
[INFO] Compiling 4 source files to /opt/cdap/sdk-3.4.2/examples/LogAnalysis/target/classes at 1467387752393
[INFO] prepare-compile in 0 s
[INFO] compile in 5 s
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ LogAnalysis ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding ISO-8859-1, i.e. build is platform dependent!
[INFO] Compiling 3 source files to /opt/cdap/sdk-3.4.2/examples/LogAnalysis/target/classes
[WARNING] /opt/cdap/sdk-3.4.2/examples/LogAnalysis/src/main/java/co/cask/cdap/examples/loganalysis/HitCounterProgram.java: /opt/cdap/sdk-3.4.2/examples/LogAnalysis/src/main/java/co/cask/cdap/examples/loganalysis/HitCounterProgram.java uses or overrides a deprecated API.
[WARNING] /opt/cdap/sdk-3.4.2/examples/LogAnalysis/src/main/java/co/cask/cdap/examples/loganalysis/HitCounterProgram.java: Recompile with -Xlint:deprecation for details.
[WARNING] /opt/cdap/sdk-3.4.2/examples/LogAnalysis/src/main/java/co/cask/cdap/examples/loganalysis/LogAnalysisApp.java: /opt/cdap/sdk-3.4.2/examples/LogAnalysis/src/main/java/co/cask/cdap/examples/loganalysis/LogAnalysisApp.java uses unchecked or unsafe operations.
[WARNING] /opt/cdap/sdk-3.4.2/examples/LogAnalysis/src/main/java/co/cask/cdap/examples/loganalysis/LogAnalysisApp.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ LogAnalysis ---
[WARNING] Using platform encoding (ISO-8859-1 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /opt/cdap/sdk-3.4.2/examples/LogAnalysis/src/test/resources
[INFO]
[INFO] --- scala-maven-plugin:3.2.2:testCompile (scala-test-compile) @ LogAnalysis ---
[WARNING]  Expected all dependencies to require Scala version: 2.10.4
[WARNING]  co.cask.cdap:LogAnalysis:3.4.2 requires scala version: 2.10.4
[WARNING]  com.twitter:chill_2.10:0.5.0 requires scala version: 2.10.4
[WARNING]  com.typesafe.akka:akka-remote_2.10:2.3.11 requires scala version: 2.10.4
[WARNING]  com.typesafe.akka:akka-actor_2.10:2.3.11 requires scala version: 2.10.4
[WARNING]  com.typesafe.akka:akka-slf4j_2.10:2.3.11 requires scala version: 2.10.4
[WARNING]  org.apache.spark:spark-core_2.10:1.6.1 requires scala version: 2.10.4
[WARNING]  org.json4s:json4s-jackson_2.10:3.2.10 requires scala version: 2.10.4
[WARNING]  org.json4s:json4s-core_2.10:3.2.10 requires scala version: 2.10.4
[WARNING]  org.json4s:json4s-ast_2.10:3.2.10 requires scala version: 2.10.4
[WARNING]  org.json4s:json4s-core_2.10:3.2.10 requires scala version: 2.10.0
[WARNING] Multiple versions of scala libraries detected!
[INFO] /opt/cdap/sdk-3.4.2/examples/LogAnalysis/src/test/java:-1: info: compiling
[INFO] Compiling 1 source files to /opt/cdap/sdk-3.4.2/examples/LogAnalysis/target/test-classes at 1467387760724
[INFO] prepare-compile in 0 s
[INFO] compile in 2 s
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ LogAnalysis ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding ISO-8859-1, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /opt/cdap/sdk-3.4.2/examples/LogAnalysis/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.14.1:test (default-test) @ LogAnalysis ---
[INFO] Surefire report directory: /opt/cdap/sdk-3.4.2/examples/LogAnalysis/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running co.cask.cdap.examples.loganalysis.LogAnalysisAppTest
2016-07-01 15:42:44,420 - INFO  [main:c.c.c.t.TestBase@337] - Custom configuration set: cdap.unit.test.explore.enabled = false
2016-07-01 15:42:46,029 - INFO  [DatasetOpExecutorService STARTING:c.c.c.d.d.d.s.e.DatasetOpExecutorService@81] - Starting DatasetOpExecutorService...
2016-07-01 15:42:46,098 - INFO  [DatasetOpExecutorService STARTING:c.c.c.d.d.d.s.e.DatasetOpExecutorService@96] - DatasetOpExecutorService started successfully on /127.0.0.1:55476
2016-07-01 15:42:46,201 - WARN  [main:c.c.c.e.c.ExploreFacade@52] - Explore functionality for datasets is disabled. All calls to enable explore will be no-ops
2016-07-01 15:42:46,207 - WARN  [main:c.c.c.e.c.ExploreFacade@52] - Explore functionality for datasets is disabled. All calls to enable explore will be no-ops
2016-07-01 15:42:46,231 - INFO  [DatasetService:c.c.c.d.d.d.s.DatasetService@123] - Starting DatasetService...
2016-07-01 15:42:46,238 - INFO  [DatasetTypeManager STARTING:c.c.c.d.d.InMemoryDatasetFramework@247] - Created dataset dataset:system.datasets.instance of type co.cask.cdap.data2.datafabric.dataset.service.mds.DatasetInstanceMDS
2016-07-01 15:42:46,257 - INFO  [DatasetTypeManager STARTING:c.c.c.d.d.InMemoryDatasetFramework@247] - Created dataset dataset:system.datasets.type of type co.cask.cdap.data2.datafabric.dataset.service.mds.DatasetTypeMDS
2016-07-01 15:42:46,338 - INFO  [NettyHttpService STARTING:c.c.c.d.d.d.s.DatasetTypeHandler@83] - Starting DatasetTypeHandler
2016-07-01 15:42:46,343 - INFO  [DatasetService:c.c.c.d.d.d.s.DatasetService$1@138] - Discovered dataset.executor service
2016-07-01 15:42:46,344 - INFO  [DatasetService:c.c.c.d.d.d.s.DatasetService@185] - Waiting for dataset.executor service to be discoverable
2016-07-01 15:42:46,345 - INFO  [DatasetService:c.c.c.d.d.d.s.DatasetService@158] - Announcing DatasetService for discovery...
2016-07-01 15:42:46,345 - INFO  [DatasetService:c.c.c.d.d.d.s.DatasetService@172] - DatasetService started successfully on /127.0.0.1:60808
2016-07-01 15:42:46,514 - INFO  [main:c.c.c.m.q.MetricsQueryService@80] - Configuring MetricsService , address: 127.0.0.1, backlog connections: 20000, execthreads: 20, bossthreads: 1, workerthreads: 10
2016-07-01 15:42:46,514 - INFO  [MetricsQueryService STARTING:c.c.c.m.q.MetricsQueryService@94] - Starting Metrics Service...
2016-07-01 15:42:46,521 - INFO  [MetricsQueryService STARTING:c.c.c.m.q.MetricsQueryService@96] - Started Metrics HTTP Service...
2016-07-01 15:42:46,522 - INFO  [MetricsQueryService STARTING:c.c.c.m.q.MetricsQueryService@110] - Metrics Service started successfully on /127.0.0.1:34599
2016-07-01 15:42:46,602 - WARN  [main:c.c.c.i.a.r.a.ArtifactRepository@104] - Ignoring /opt/cdap/master/artifacts because it is not a directory.
2016-07-01 15:42:46,664 - INFO  [LocalSchedulerService STARTING:o.q.s.RAMJobStore@155] - RAMJobStore initialized.
2016-07-01 15:42:46,819 - INFO  [netty-executor-9:c.c.c.d.d.d.s.DatasetInstanceService@208] - Creating dataset system.schedulestore, type name: co.cask.cdap.api.dataset.table.Table, properties: {}
2016-07-01 15:42:46,825 - INFO  [netty-executor-2:c.c.c.d.d.d.s.e.DatasetAdminService@86] - Creating dataset instance dataset:system.schedulestore, type meta: DatasetTypeMeta{name='co.cask.cdap.api.dataset.table.Table', modules=[DatasetModuleMeta{name='orderedTable-memory', className='co.cask.cdap.data2.dataset2.module.lib.inmemory.InMemoryTableModule', jarLocation=null, types=[table, co.cask.cdap.api.dataset.table.Table], usesModules=[], usedByModules=[core, objectMappedTable, cube, usage, lineage]}]}, props: DatasetProperties{properties={}}
2016-07-01 15:42:46,855 - WARN  [netty-executor-9:c.c.c.d.a.AuditPublishers@120] - Audit publisher is null, audit information will not be published
2016-07-01 15:42:46,898 - INFO  [LocalSchedulerService STARTING:c.c.c.i.a.r.s.AbstractSchedulerService@67] - Started time scheduler
2016-07-01 15:42:46,928 - INFO  [LocalSchedulerService STARTING:c.c.c.i.a.r.s.AbstractSchedulerService@76] - Started stream size scheduler
2016-07-01 15:42:46,940 - WARN  [main:c.c.c.e.c.ExploreFacade@52] - Explore functionality for datasets is disabled. All calls to enable explore will be no-ops
2016-07-01 15:42:46,945 - WARN  [main:c.c.c.e.c.ExploreFacade@52] - Explore functionality for datasets is disabled. All calls to enable explore will be no-ops
2016-07-01 15:42:46,946 - WARN  [main:c.c.c.i.a.r.a.ArtifactRepository@104] - Ignoring /opt/cdap/master/artifacts because it is not a directory.
2016-07-01 15:42:46,947 - WARN  [main:c.c.c.i.a.r.a.ArtifactRepository@104] - Ignoring /opt/cdap/master/artifacts because it is not a directory.
2016-07-01 15:42:46,947 - WARN  [main:c.c.c.i.a.r.a.ArtifactRepository@104] - Ignoring /opt/cdap/master/artifacts because it is not a directory.
2016-07-01 15:42:47,016 - WARN  [main:c.c.c.i.a.r.a.ArtifactRepository@104] - Ignoring /opt/cdap/master/artifacts because it is not a directory.
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 3.167 sec <<< FAILURE!
co.cask.cdap.examples.loganalysis.LogAnalysisAppTest  Time elapsed: 3.166 sec  <<< ERROR!
java.lang.IncompatibleClassChangeError: class org.apache.twill.internal.utils.Dependencies$DependencyClassVisitor has interface org.objectweb.asm.ClassVisitor as super class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at org.apache.twill.internal.utils.Dependencies.findClassDependencies(Dependencies.java:86)
    at co.cask.cdap.common.lang.ClassPathResources.findClassDependencies(ClassPathResources.java:129)
    at co.cask.cdap.common.lang.ClassPathResources.getResourcesWithDependencies(ClassPathResources.java:74)
    at co.cask.cdap.common.lang.ProgramResources.createBaseResources(ProgramResources.java:87)
    at co.cask.cdap.common.lang.ProgramResources.getVisibleResources(ProgramResources.java:67)
    at co.cask.cdap.test.UnitTestManager$1.<init>(UnitTestManager.java:95)
    at co.cask.cdap.test.UnitTestManager.<clinit>(UnitTestManager.java:94)
    at co.cask.cdap.test.UnitTestManager$$FastClassByGuice$$d2956503.newInstance(<generated>)
    at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
    at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:60)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
    at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1013)
    at co.cask.cdap.test.TestBase.initialize(TestBase.java:275)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
    at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:159)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:87)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)

co.cask.cdap.examples.loganalysis.LogAnalysisAppTest  Time elapsed: 3.167 sec  <<< ERROR!
java.lang.NullPointerException: null
    at co.cask.cdap.test.TestBase.finish(TestBase.java:396)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
    at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
    at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:159)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:87)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)


Results :

Tests in error:
  LogAnalysisAppTest>TestBase.initialize:275 » IncompatibleClassChange class org...
  LogAnalysisAppTest>TestBase.finish:396 » NullPointer

Tests run: 2, Failures: 0, Errors: 2, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26.305 s
[INFO] Finished at: 2016-07-01T15:42:47+00:00
[INFO] Final Memory: 61M/201M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.14.1:test (default-test) on project LogAnalysis: There are test failures.
[ERROR]
[ERROR] Please refer to /opt/cdap/sdk-3.4.2/examples/LogAnalysis/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

Sreevatsan Raman

unread,
Jul 1, 2016, 4:40:55 PM7/1/16
to Liang Chen, CDAP User
Hi Liang,

The problem happens because the asm dependencies are not excluded in the pom.xml correctly. I have created a JIRA to fix this issue: https://issues.cask.co/browse/CDAP-6337

In the meantime, you can update the pom.xml in your sdk : examples/pom.xml
And exclude the asm dependency in spark-core to fix this issue.

      <dependency> <!-- Spark dependency -->
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-core_2.10</artifactId>
        <version>${spark.version}</version>
        <scope>provided</scope>
        <exclusions>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
          </exclusion>
          <exclusion>
            <groupId>asm</groupId>
            <artifactId>asm</artifactId>
          </exclusion>
        </exclusions>
      </dependency>

Thanks,
Sree

--
You received this message because you are subscribed to the Google Groups "CDAP User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cdap-user+...@googlegroups.com.
To post to this group, send email to cdap...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cdap-user/fc9a1522-295d-4ba5-9770-ba8d09910ce8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages