Zeppelin does not load maven jar - maven

Apache Zeppelin Version 0.7.1
%dep
z.reset() // clean up previously added artifact and repository
// add maven repository
z.addRepo("Spark Cassandra Connector 2.0.10").url("https://mvnrepository.com/artifact/com.datastax.spark/spark-cassandra-connector")
// add artifact recursively
// z.load("groupId:artifactId:version")
z.load("com.datastax.spark:spark-cassandra-connector_2.11:2.0.10")
java.lang.NullPointerException
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:352)
at org.apache.zeppelin.spark.dep.SparkDependencyContext.fetchArtifactWithDep(SparkDependencyContext.java:171)
at org.apache.zeppelin.spark.dep.SparkDependencyContext.fetch(SparkDependencyContext.java:121)
at org.apache.zeppelin.spark.DepInterpreter.interpret(DepInterpreter.java:245)
at org.apache.zeppelin.interpreter.LazyOpenInterpreter.interpret(LazyOpenInterpreter.java:95)
at org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer$InterpretJob.jobRun(RemoteInterpreterServer.java:490)
at org.apache.zeppelin.scheduler.Job.run(Job.java:175)
at org.apache.zeppelin.scheduler.FIFOScheduler$1.run(FIFOScheduler.java:139)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
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)
The following doesn't seem to be helpful:
apache zeppelin additional repository import
In https://zeppelin.apache.org/docs/0.7.1/interpreter/spark.html, it gives an example of setting zeppelin.dep.additionalRemoteRepository to http://dl.bintray.com/spark-packages/maven, but this repo doesn't have the version of jar I need.
https://zeppelin.apache.org/docs/0.7.1/interpreter/spark.html#3-dynamic-dependency-loading-via-sparkdep-interpreter
Zeppelin dynamic dependency loading fails on os-maven-plugin
Now I'm getting
%dep
z.load("com.datastax.spark:spark-cassandra-connector_2.11:2.0.10")
org.sonatype.aether.resolution.DependencyResolutionException: Could not find artifact com.datastax.spark:spark-cassandra-connector_2.11:jar:2.0.10 in central (https://repo1.maven.org/maven2/)

I need to update the maven reposition url from http to https in zeppelin-env.sh
export ZEPPELIN_INTERPRETER_DEP_MVNREPO="https://repo1.maven.org/maven2/"
There are also other non-generic changes specific to our build system (Jenkins pipeline)
If you have control over the server, it would be much easier to just download the jar you need (i.e. "groupArtifactVersion": "com.datastax.spark:spark-cassandra-connector_2.11:2.0.10",), then load the dependency from disk, like:
%dep
z.load("/opt/zeppelin/spark-cassandra-connector-assembly/spark-cassandra-connector-assembly.jar")

Related

vertex jar not found exception even after the jar is present

org.vertx.java.platform.PlatformManagerException: Module io.vertx~lang-groovy~2.0.0-final not found in any repositories
at org.vertx.java.platform.impl.DefaultPlatformManager.getModule(DefaultPlatformManager.java:985)
at org.vertx.java.platform.impl.DefaultPlatformManager.doInstallMod(DefaultPlatformManager.java:974)
at org.vertx.java.platform.impl.DefaultPlatformManager.loadIncludedModules(DefaultPlatformManager.java:858)
at org.vertx.java.platform.impl.DefaultPlatformManager.doDeploy(DefaultPlatformManager.java:1219)
at org.vertx.java.platform.impl.DefaultPlatformManager.deployModuleFromModJson(DefaultPlatformManager.java:742)
at org.vertx.java.platform.impl.DefaultPlatformManager.deployModuleFromFileSystem(DefaultPlatformManager.java:812)
at org.vertx.java.platform.impl.DefaultPlatformManager.access$100(DefaultPlatformManager.java:55)
at org.vertx.java.platform.impl.DefaultPlatformManager$1.run(DefaultPlatformManager.java:151)
at org.vertx.java.platform.impl.DefaultPlatformManager$11.run(DefaultPlatformManager.java:359)
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)
The issue was io.vertx~lang-groovy~2.0.0-final folder was missing after compiling of project.
It was missing because the vertx was not able to fetch the jar from maven as maven has stopped support to http from january 15 2020.

Failed to copy resources: java.nio.file.NoSuchFileException

I'm trying to compile and run my Quarkus servlet application. But it keeps getting the following error with quarkus-maven-plugin 0.24.0 and 0.25.0. But it works fine with quarkus-maven-plugin 0.23.2
ERROR [io.qua.dev] (vert.x-worker-thread-0) Failed to copy resources: java.nio.file.NoSuchFileException: D:\quarkus-sample\rest\target\classes\myproperties.properties
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
at java.nio.file.Files.delete(Files.java:1126)
at io.quarkus.dev.RuntimeUpdatesProcessor.checkForFileChange(RuntimeUpdatesProcessor.java:332)
at io.quarkus.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:121)
at io.quarkus.vertx.http.deployment.devmode.VertxHotReplacementSetup$1.handle(VertxHotReplacementSetup.java:52)
at io.quarkus.vertx.http.deployment.devmode.VertxHotReplacementSetup$1.handle(VertxHotReplacementSetup.java:44)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
If it worked with a previous version, there's a good chance it's a bug.
Could you create a GitHub issue in our tracker and provide a reproducer (simple Quarkus app reproducing the issue) and the steps to reproduce it?
This was fixed by Quarkus release 0.26.0.
Related git hub issue can be found in https://github.com/quarkusio/quarkus/issues/4697

ignore jar packaging inside war maven tomcat plugin?

I am using maven Maven Tomcat 8 plugin to start up my tomcat server locally and deploy a war file with the intellij IDE.
For some reason when I try to start it with maven tomcat 8 plugin, it shows following stack trace and not getting up.
n.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.sun.xml.ws.api.server.AbstractInstanceResolver$1.run(AbstractInstanceResolver.java:84)
at com.sun.xml.ws.api.server.AbstractInstanceResolver$1.run(AbstractInstanceResolver.java:78)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.ws.api.server.AbstractInstanceResolver.invokeMethod(AbstractInstanceResolver.java:78)
at com.sun.xml.ws.server.SingletonResolver.start(SingletonResolver.java:72)
at com.sun.xml.ws.api.server.InstanceResolver$1.start(InstanceResolver.java:238)
at com.sun.xml.ws.server.InvokerTube.setEndpoint(InvokerTube.java:83)
at com.sun.xml.ws.server.WSEndpointImpl.<init>(WSEndpointImpl.java:205)
at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:320)
at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:315)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:158)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:577)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:303)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:179)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(WSServletContextListener.java:131)
at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(WSServletContainerInitializer.java:65)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5210)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:919)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1703)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
But when I try to do it with a separate tomcat container (without using maven tomcat 8 plugin or support of IDE), it starts all ok.
I investigated that this happens because of a library (spring-jersey3.jar) that bundles inside my war file. When I remove that from war and try with maven tomcat plugin, it is all ok too. As I found this error happens because it tries to init a spring application context at the start up. But it only happens when I try to do with maven tomcat plugin.
Anyhow I need that lib for my work. I can't exclude it from war.
Does any one know any work around to get rid of this? It may be
configure disabling init the spring application context at start up.
configure maven tomcat 8 plugin to ignore that lib or init process.
Or any other way to do without excluding the lib.

Unable to find data for class 'org/springframework/boot/context/web/SpringBootServletInitializer'

I am getting this strange error while trying to start Spring Boot application in Servlet container.
The same WAR starts normally in standalone Tomcat server, but gives the error seen below if started using Gretty Gradle plugin
Any ideas that it means?
Spring-boot 1.3.3, Gradle 2.12, Gretty 1.2.4, Tomcat 8
java.lang.RuntimeException: Reloading agent exited via exception, please raise a jira
at org.springsource.loaded.agent.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:104)
at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
...
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5066)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springsource.loaded.UnableToLoadClassException: Unable to find data for class 'org/springframework/boot/context/web/SpringBootServletInitializer'
at org.springsource.loaded.Utils.loadSlashedClassAsBytes(Utils.java:787)
at org.springsource.loaded.TypeRegistry.getDescriptorFor(TypeRegistry.java:311)
at org.springsource.loaded.TypeDescriptorExtractor$ExtractionVisitor.getTypeDescriptorFor(TypeDescriptorExtractor.java:124)
at org.springsource.loaded.TypeDescriptorExtractor$ExtractionVisitor.findTypeDescriptor(TypeDescriptorExtractor.java:140)
at org.springsource.loaded.TypeDescriptorExtractor$ExtractionVisitor.walkHierarchyForCatchersAndSuperDispatchers(TypeDescriptorExtractor.java:152)
at org.springsource.loaded.TypeDescriptorExtractor$ExtractionVisitor.computeCatchersAndSuperdispatchers(TypeDescriptorExtractor.java:219)
at org.springsource.loaded.TypeDescriptorExtractor$ExtractionVisitor.getTypeDescriptor(TypeDescriptorExtractor.java:81)
at org.sprce.loaded.TypeDescriptorExtractor.extract(TypeDescriptorExtractor.java:51)
at org.springsource.loaded.TypeRegistry.addType(TypeRegistry.java:912)
at org.springsource.loaded.agent.SpringLoadedPreProcessor.preProcess(SpringLoadedPreProcessor.java:302)
at org.springsource.loaded.agent.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:102)
... 42 more
Apparently there is a bug in Gretty related to classloading.
Starting Gretty with WAR e.g. gradlew appRunWar allows to work around it.
There are multiple bugs opened for it:
https://github.com/akhikhl/gretty/issues/199
https://github.com/akhikhl/gretty/issues/209
https://github.com/akhikhl/gretty/issues/148

error when running apache hector-example

I am new in apache Cassandra.
I have installed Apache Cassandra 1.2.5 and Apache Maven. Right now I just want to run the hector-examples posted by zznate in github.com. I am using Mac iOS.
I cloned the hector-examples folder into my local folder, and used the command
mvn -e exec:java -Dexec.mainClass="com.riptano.cassandra.hector.example.InsertSingleColumn"
Built failure.
Is there any steps that I am missing? Thank you very much.
ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1:java (default-cli) on project hector-examples: An exception occured while executing the Java class. com.riptano.cassandra.hector.example.InsertSingleColumn -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1:java (default-cli) on project hector-examples: An exception occured while executing the Java class. com.riptano.cassandra.hector.example.InsertSingleColumn
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)...
Caused by: java.lang.ClassNotFoundException: com.riptano.cassandra.hector.example.InsertSingleColumn
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:283)
at java.lang.Thread.run(Thread.java:680)
I think this has something to do with Maven build.
Can you try these steps:
mvn clean install
mvn -e exec:java -Dexec.mainClass="com.riptano.cassandra.hector.example.InsertSingleColumn"
If you are willing to look for other options, astyanax is an excellent choice for querying/ working with cassandra cluster. You can look for examples here.
Just add the maven dependency or jars in your project and it should be pretty straightforward from there on.
Another option is Datastax java driver. If you've worked with SQL, cassandra has similar querying language called CQL which is amazingly simple and good to use.
Examples available here.
And this is how you insert dataINSERT INTO users
(user_name, password)
VALUES ('jsmith', 'ch#ngem3a');

Resources