I installed titan-cassandra-0.4.4, and I can run cassandra and gremlin perfectly (The local node).
I want to test an algorithm in Java, so I need to connect Java to titan.
My pom is:
<dependency>
<groupId>com.thinkaurelius.titan</groupId>
<artifactId>titan-core</artifactId>
<version>0.4.4</version>
</dependency>
My codes are:
BaseConfiguration baseConfiguration = new BaseConfiguration();
baseConfiguration.setProperty("storage.backend", "cassandra");
baseConfiguration.setProperty("storage.hostname", "127.0.0.1");
baseConfiguration.setProperty("storage.tablename","test");
TitanGraph titanGraph = TitanFactory.open(baseConfiguration);
In the last line, the error is:
Exception in thread "main" java.lang.NoClassDefFoundError: com/netflix/astyanax/connectionpool/exceptions/ConnectionException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.thinkaurelius.titan.diskstorage.Backend.getStorageManager(Backend.java:202)
at com.thinkaurelius.titan.diskstorage.Backend.<init>(Backend.java:97)
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.getBackend(GraphDatabaseConfiguration.java:398)
at com.thinkaurelius.titan.graphdb.database.StandardTitanGraph.<init>(StandardTitanGraph.java:78)
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:60)
at Connecting.main(Connecting.java:20)
Caused by: java.lang.ClassNotFoundException: com.netflix.astyanax.connectionpool.exceptions.ConnectionException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 8 more
I first start the cassandra, then titan gremlin.sh, and run the java code at last. I do not know if I was missing something?
Thanks in advance!
You should include a dependency for titan-casssandra.
<dependency>
<groupId>com.thinkaurelius.titan</groupId>
<artifactId>titan-casssandra</artifactId>
<version>0.4.4</version>
</dependency>
Also note if you're just getting started with Titan, version 0.4.4 is far out of date. Titan 1.0 was released in September 2015. You can find more information at http://titandb.io
Related
I am trying to fetch some data from Google Analytics using Google Analytics reporting v4 API.
I am using maven so included all the 9 modules in maven dependency.
However while running the sample java code from https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/service-java
I am getting NoClassDefFoundError. On debugging further the actual line which was failing is
Utils.getDefaultJsonFactory();
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/json/async/NonBlockingJsonParser
at com.google.api.client.json.jackson2.JacksonFactory.<init>(JacksonFactory.java:41)
at com.google.api.client.googleapis.util.Utils$JsonFactoryInstanceHolder.<clinit>(Utils.java:44)
at com.google.api.client.googleapis.util.Utils.getDefaultJsonFactory(Utils.java:36)
at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.fromStream(GoogleCredential.java:232)
at com.dropbox.aem.common.services.GoogleAnalyticsReporting.initializeAnalyticsReporting(GoogleAnalyticsReporting.java:58)
at com.dropbox.aem.common.services.GoogleAnalyticsReporting.main(GoogleAnalyticsReporting.java:38)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 6 more
You are missing Jackson core. From here
https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
I am trying to connect to my DocumentNodeStore in a postgresql database.
Following the instruction from here https://jackrabbit.apache.org/oak/docs/features/oak-run-nodestore-connection-options.html
export CLASSPATH=postgresql-42.2.5.jar:oak-run-1.9.9.jar
java org.apache.jackrabbit.oak.run.Main console jdbc:postgresql://localhost/mydb --rdbjdbcuser myuser --rdbjdbcpasswd mypassword
I am getting the following error:
Apache Jackrabbit Oak 1.9.9
Exception in thread "main" org.apache.jackrabbit.oak.plugins.document.DocumentStoreException: trying to create datasource org.apache.tomcat.jdbc.pool.DataSource
at org.apache.jackrabbit.oak.plugins.document.rdb.RDBDataSourceFactory.forJdbcUrl(RDBDataSourceFactory.java:90)
at org.apache.jackrabbit.oak.plugins.document.rdb.RDBDataSourceFactory.forJdbcUrl(RDBDataSourceFactory.java:100)
at org.apache.jackrabbit.oak.run.cli.DocumentFixtureProvider.configureDocumentMk(DocumentFixtureProvider.java:117)
at org.apache.jackrabbit.oak.run.cli.NodeStoreFixtureProvider.create(NodeStoreFixtureProvider.java:70)
at org.apache.jackrabbit.oak.run.cli.NodeStoreFixtureProvider.create(NodeStoreFixtureProvider.java:49)
at org.apache.jackrabbit.oak.console.Console.main(Console.java:49)
at org.apache.jackrabbit.oak.run.ConsoleCommand.execute(ConsoleCommand.java:27)
at org.apache.jackrabbit.oak.run.Main.main(Main.java:49)
Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool.DataSource
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.jackrabbit.oak.plugins.document.rdb.RDBDataSourceFactory.forJdbcUrl(RDBDataSourceFactory.java:74)
... 7 more
Am I missing anything?
As mentioned in the link:
Note that the oak-run JAR file lacks several RDB specific JAR files that need to be added to the classpath:
1. tomcat-jdbc-8.5.*.jar (Apache Tomcat JDBC connection pool)
2. juli-6.0.*.jar (Apache Tomcat Logger)
3. Whatever JDBC driver is needed to connect to the database
I missed out the first 2 jars
Exception in thread "main" java.lang.NoClassDefFoundError:
org/springframework/jdbc/core/JdbcTemplate
at com.citi.cate.svn.eers.SVNEERSFeeder.loadEmpInfoFromDB(SVNEERSFeeder.java:117)
at com.citi.cate.svn.eers.SVNEERSFeeder.process(SVNEERSFeeder.java:523)
at com.citi.cate.svn.eers.SVNEERSFeeder.main(SVNEERSFeeder.java:631)
at resources.TheApp.main(TheApp.java:39) Caused by: java.lang.ClassNotFoundException:
org.springframework.jdbc.core.JdbcTemplate
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
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)
... 4 more
I am unable to find the solution for the above error. lately there was change in the spring-framework version and i changed all the jars related to the new version of spring-framework. i see the above error. tried to reload all the jars.still the error exists. please help me on this.
SVNEERSFeeder.java
line 117: JdbcTemplate jt = new JdbcTemplate(_utility.getDBConnection("csi", ""))
The exception is caused due to misconfiguration of appropriate spring jdbc jars related to the spring version. To resolve dependencies easily, you could use maven:
For example, if you are using spring 4.2.5, add spring jdbc dependencies in maven as follows:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.2.5.RELEASE</version>
</dependency>
Apache Ivy Dependencies:
<dependency org="org.springframework" name="spring-jdbc" rev="4.2.5.RELEASE"/>
NoClassDefFoundError Exception
This exception is thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found. This is caused when there is a class file that your code depends on and it is present at compile time but not found at runtime.
Look for differences in your build time and runtime classpaths.
In your case though, it appears that the root cause is:
resources.TheApp.main(TheApp.java:39) Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.core.JdbcTemplate at
ClassNotFoundException
It may be caused when you are trying to make a reflective call to classes at runtime, but the classes the program is trying to call does not exist.
I am investigating the jsprit library. For this I just created a new project in Eclipse and copied-pasted the demo example class. Then I added all jars to the path, including log4j-1.2.17.jar. Nevrtheless I cannot execute the demo code due to the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager
at jsprit.core.problem.vehicle.VehicleImpl$Builder.<clinit>(VehicleImpl.java:108)
at com.test.jsprit.main(jsprit.java:49)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.LogManager
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more
What does it actually mean and how to solve this issue? Does it mean that some other *.jar file is missed?
UPDATE:
The error occurs at the following line:
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
You are using the wrong version of the log4j lib. You need the 2.x version.
See:
LogManager (Version 1.x)
LogManager (Version 2.x)
log4j-1.2.17.jar implements log4j version 1 and its pretty old. What you need is implementation of log4j 2 - add this as the dependency: link
I am using hadoop 2.4.1 version. I am trying to run a mapreduce job which moves data from local system to hdfs cluster(output directory). If I set the output directory as my local system path, the program is running fine. But when I set the output directory as a path in hdfs cluster I am getting the below error
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/protobuf/ServiceException
at org.apache.hadoop.ipc.ProtobufRpcEngine.<clinit>(ProtobufRpcEngine.java:69)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.hadoop.conf.Configuration.getClassByNameOrNull(Configuration.java:1834)
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1799)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1893)
at org.apache.hadoop.ipc.RPC.getProtocolEngine(RPC.java:203)
at org.apache.hadoop.ipc.RPC.getProtocolProxy(RPC.java:537)
at org.apache.hadoop.hdfs.NameNodeProxies.createNNProxyWithClientProtocol(NameNodeProxies.java:328)
at org.apache.hadoop.hdfs.NameNodeProxies.createNonHAProxy(NameNodeProxies.java:235)
at org.apache.hadoop.hdfs.NameNodeProxies.createProxy(NameNodeProxies.java:139)
at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:510)
at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:453)
at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:136)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2397)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:89)
at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2431)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2413)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:368)
at org.apache.hadoop.fs.Path.getFileSystem(Path.java:296)
at org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.setOutputPath(FileOutputFormat.java:160)
at s1.run(s1.java:66)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)
at s1.main(s1.java:75)
Caused by: java.lang.ClassNotFoundException: com.google.protobuf.ServiceException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 25 more
I saw some posts which stated the issue could be related to protobuf dependecy.
Hadoop 2.2.0 mapreduce job not running after upgrading from hadoop 1.0.4
I am using hadoop commons jar 2.5.2 which has the protobuf. Any help to solve this would be appreciated.
Made it working ! Found that there were some jars of 2.2 version which were incompatible with the current version. When i updated those, the program works fine.
if you compile zhe *.java use default java CLASSPATH is ok.
Edit the hadoop_env.sh
export HADOOP_CLASSPATH=${CLASSPATH}
restart the hadoop server
NoClassDefFoundError is thrown by jvm at runtime when a class is not present in classpath.
Check your classpath.
Check also this answer. Could be useful if you solved the NoClassDefFoundError link