flexjson: Could not load class - java

I'm new to flexjson.
I tried the following java code for my test: "FlexjsonTest.zip".
The result of running the program is in "Protocol.txt".
I ran the code from the command line:
javac FlexjsonTest.java
java Flexjson
I use flexjson 2.1 .
Using Java 6 or Java 7 doesn't make any difference.
The result is always:
Exception in thread "main" flexjson.JSONException: [ _address ]: Could not load Address
at flexjson.ObjectBinder.findClassInMap(ObjectBinder.java:235)
at flexjson.ObjectBinder.findClassName(ObjectBinder.java:202)
at flexjson.ObjectBinder.bind(ObjectBinder.java:83)
at flexjson.ObjectBinder.bindIntoObject(ObjectBinder.java:139)
at flexjson.factories.ClassLocatorObjectFactory.instantiate(ClassLocatorObjectFactory.java:38)
at flexjson.ObjectBinder.bind(ObjectBinder.java:86)
at flexjson.ObjectBinder.bind(ObjectBinder.java:65)
at flexjson.JSONDeserializer.deserialize(JSONDeserializer.java:158)
at FlexjsonTest.<init>(FlexjsonTest.java:22)
at FlexjsonTest.main(FlexjsonTest.java:32)
Caused by: java.lang.ClassNotFoundException: Address
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:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:188)
at flexjson.ObjectBinder.findClassInMap(ObjectBinder.java:230)
... 9 more
So, what am I doing wrong?
igel

it seems that you're trying to deserialize a JSON into an object called Address but the class Address seems not to be in your classpath
at flexjson.JSONDeserializer.deserialize(JSONDeserializer.java:158)
at FlexjsonTest.<init>(FlexjsonTest.java:22)
at FlexjsonTest.main(FlexjsonTest.java:32)
Caused by: java.lang.ClassNotFoundException: Address
also, you should post the code that actually throws this stacktrace in your question

Related

RNetlogo / NLstart doesn't do anything

I am trying to use Netlogo via R using the following code:
library(RNetLogo)
my.netlogo1 <- "my.netlogo1"
nl.path <- "C:/Program Files/NetLogo 6.1.1/app"
NLStart(nl.path, gui = FALSE,
nl.obj = my.netlogo1, nl.jarname='netlogo-6.1.1.jar')
And I get the following message:
java.lang.NoClassDefFoundError: org/nlogo/workspace/Controllable
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:416)
Caused by: java.lang.ClassNotFoundException
at RJavaClassLoader.findClass(RJavaClassLoader.java:383)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 2 more
I heard it was because of a compatibility issue with Netlogo6 but that it had now been solved. Could someone say what I'm doing wrong?

Neo4j Error: Error starting org.neo4j.kernel.impl.factory.CommunityFacadeFactory

I am trying to build and consume a neo4j DB. Below, is the code which Im using to create a DB.
String graphDbPath = "C:/Users/abcd/parseJSON2GraphDB";
GraphDatabaseFactory dbFactory = new GraphDatabaseFactory();
GraphDatabaseService graphDb = dbFactory.newEmbeddedDatabase(graphDbPath);
try (Transaction tx = graphDb.beginTx()) {
// Perform DB operations
Node javaNode = graphDb.createNode();
javaNode.setProperty( "name", "Duane" );
Node scalaNode = graphDb.createNode();
scalaNode.setProperty( "name", "Nickull" );
tx.success();
}
graphDb.shutdown();
System.out.println("Created Successfully");
The error which I get when running it is :
Exception in thread "main" java.lang.RuntimeException: Error starting org.neo4j.kernel.impl.factory.CommunityFacadeFactory, C:/Users/abcd/parseJSON2GraphDB
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:144)
at org.neo4j.kernel.impl.factory.CommunityFacadeFactory.newFacade(CommunityFacadeFactory.java:40)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:108)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newDatabase(GraphDatabaseFactory.java:100)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.lambda$createDatabaseCreator$0(GraphDatabaseFactory.java:89)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:183)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(GraphDatabaseFactory.java:65)
at com.idml.synquesgen.Test.createDb(Test.java:48)
at com.idml.synquesgen.Test.main(Test.java:38)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.extension.KernelExtensions#4a622941' failed to initialize. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:416)
at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:62)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:98)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:140)
... 8 more
Caused by: java.lang.BootstrapMethodError: java.lang.IllegalAccessError: no such method: org.neo4j.kernel.api.impl.index.IndexWriterConfigs.standard()IndexWriterConfig/invokeStatic
at org.neo4j.kernel.api.impl.labelscan.WritableDatabaseLabelScanIndex.<init>(WritableDatabaseLabelScanIndex.java:40)
at org.neo4j.kernel.api.impl.labelscan.LuceneLabelScanIndexBuilder.build(LuceneLabelScanIndexBuilder.java:72)
at org.neo4j.kernel.api.impl.labelscan.LuceneLabelScanStoreExtension.getLuceneIndex(LuceneLabelScanStoreExtension.java:94)
at org.neo4j.kernel.api.impl.labelscan.LuceneLabelScanStoreExtension.newInstance(LuceneLabelScanStoreExtension.java:79)
at org.neo4j.kernel.api.impl.labelscan.LuceneLabelScanStoreExtension.newInstance(LuceneLabelScanStoreExtension.java:40)
at org.neo4j.kernel.extension.KernelExtensions.init(KernelExtensions.java:69)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:406)
... 11 more
Caused by: java.lang.IllegalAccessError: no such method: org.neo4j.kernel.api.impl.index.IndexWriterConfigs.standard()IndexWriterConfig/invokeStatic
at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:483)
... 18 more
Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/codecs/lucene54/Lucene54Codec
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
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)
at java.lang.invoke.MethodHandleNatives.resolve(Native Method)
at java.lang.invoke.MemberName$Factory.resolve(MemberName.java:962)
at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:987)
at java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:1390)
at java.lang.invoke.MethodHandles$Lookup.linkMethodHandleConstant(MethodHandles.java:1746)
at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:477)
... 18 more
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.codecs.lucene54.Lucene54Codec
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)
Any pointers as to what is causing it?
From quick searches, I tried few solutions:
1) Check if any instances of Neo4J already running.
2) Changed the neo4j version (via maven)
Nothing has worked until now.
The stacktrace clearly mentions
java.lang.ClassNotFoundException: org.apache.lucene.codecs.lucene54.Lucene54Codec
So be sure to have lucene-analyzers-common-5.5.0.jar, lucene-codecs-5.5.0.jar and lucene-core-5.5.0.jar on your classpath. (assuming you're on Neo4j 3.0.x)
Or, as a more easy one use http://mvnrepository.com/artifact/org.neo4j/neo4j/3.0.6 as your single dependency which should pull in all other required dependencies transitively.

Running query from Amplab-shark to cassandra on hdfs

Please help needed for Amplab-Shark query on cassandra in hdfs.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/mapreduce/task/JobContextImpl
I can successfully run:
use database
show tables;
etc.
But can not run any select statement i.e:
select * from table;
I get the following error:
shark> select * from call limit 1;
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/mapreduce /task/JobContextImpl
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at org.apache.hadoop.hive.ql.metadata.Table.getInputFormatClass(Table.java:302)
at org.apache.hadoop.hive.ql.metadata.Table.<init>(Table.java:99)
at org.apache.hadoop.hive.ql.metadata.Hive.getTable(Hive.java:989)
at org.apache.hadoop.hive.ql.metadata.Hive.getTable(Hive.java:892)
at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.getMetaData(SemanticAnalyzer.java:1083)
at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.getMetaData(SemanticAnalyzer.java:1059)
at shark.parse.SharkSemanticAnalyzer.analyzeInternal(SharkSemanticAnalyzer.scala:139)
at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:279)
at shark.SharkDriver.compile(SharkDriver.scala:210)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:337)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:909)
at shark.SharkCliDriver.processCmd(SharkCliDriver.scala:328)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:413)
at shark.SharkCliDriver$.main(SharkCliDriver.scala:233)
at shark.SharkCliDriver.main(SharkCliDriver.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.mapreduce.task.JobContextImpl
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)
... 17 more
Thank you
I would need to see the full config and how you set up the tables for a better answer. Just looking at the error it seems like you are missing some hadoop jars on your classpath

Exception in thread "main" java.lang.NoClassDefFoundError with NetBeans

Im getting this Exception with my project,after I run the project X times, I get it, but it is not always in the same class, sometimes it happens with other classes, or being more especific, with other frames, as far as I have seen, I have got it only with my frames.
when I get this error, I only retype the package of the frame that throws the exception and done!, but of course, that is not a solution.
Exception in thread "main" java.lang.NoClassDefFoundError: xoxo/Vistas/VistaLogin$1
at xoxo.Vistas.VistaLogin.initComponents(VistaLogin.java:49)
at xoxo.Vistas.VistaLogin.<init>(VistaLogin.java:19)
at xoxo.Controlador.ControladorLogin.<clinit>(ControladorLogin.java:17)
at xoxo.princ.Principal.main(Principal.java:7)
Caused by: java.lang.ClassNotFoundException: xoxo.Vistas.VistaLogin$1
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:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 4 more
thanks for the help.
See my answer of this i am sure that is Desired Solution. and if You sure 100% that there is exist same class which is shown in error.
This is my ans
Try it that will be helpful.

Calling web services from simple java client

In Eclipse I am writing this code on the client side, generated from a wsdl file...
TravelAssistServicesStub t = new TravelAssistServicesStub();
ConversionRateByCountry c = new ConversionRateByCountry();
c.setCountry("India");
c.setUser_Id("satya");
ConversionRateByCountryResponse ccy = t.conversionRateByCountry(c);
System.out.println("Conversion: " + ccy.get_return());
...and I get the following exception:
java.lang.NoClassDefFoundError: org/apache/http/HttpResponseFactory
at org.apache.axis2.transport.http.SimpleHTTPServer.init(SimpleHTTPServer.java:113)
at org.apache.axis2.engine.ListenerManager.init(ListenerManager.java:74)
at org.apache.axis2.context.ConfigurationContext.getListenerManager(ConfigurationContext.java:692)
at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:163)
at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:143)
at com.travelassist.services.TravelAssistServicesStub.<init>(TravelAssistServicesStub.java:159)
at com.travelassist.services.TravelAssistServicesStub.<init>(TravelAssistServicesStub.java:145)
at com.travelassist.services.TravelAssistServicesStub.<init>(TravelAssistServicesStub.java:196)
at com.travelassist.services.TravelAssistServicesStub.<init>(TravelAssistServicesStub.java:188)
at com.tcs.client.login.LoginClient.main(LoginClient.java:37)
Caused by: java.lang.ClassNotFoundException: org.apache.http.HttpResponseFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
You are missing the apache httpcomponents jar. Make sure it is in your classpath at runtime.
Add jar file axis2-transport-http-1.5.jar on your class path

Categories

Resources