I'm looking for an updated answer to this question. Previously, a minimal Neo4j "Hello World" app required two jars. Now it apparently requires some other jars, but I don't know which ones.
If I include neo4j-kernel-2.1.2 and geronimo-jta_1.1_spec-1.1.1 as suggested in that other question, I get this error:
java.lang.ClassNotFoundException: org.neo4j.collection.primitive.PrimitiveLongIterator
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)
If I add neo4j-primitive-collections-2.1.2, I then get an error with this root cause:
Caused by: java.lang.IllegalArgumentException: No schema index provider org.neo4j.kernel.api.index.SchemaIndexProvider found.
Answers on this question suggest I need neo4j-lucene-index. When I add that jar, I get this error:
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.store.Directory
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)
Finally, when I add lucene-core, I get this error:
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.document.Fieldable
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)
What do I need to add to get past that?
I believe I've found the minimal set of dependencies for Neo4j 2.x. I was originally trying to use lucene-core-4.9.0, but the org.apache.lucene.document.Fieldable interface was removed from that library sometime after version 3.6.2. The minimal set of jars is thus:
neo4j-kernel (2.1.2)
neo4j-primitive-collections (2.1.2)
neo4j-lucene-index (2.1.2)
lucene-core (3.6.2)
jta (1.1)
These weigh in at about 4.5 MB, which is larger than I'd like, but I guess I can live with it. I've also been told that neo4j-lucene-index (which is what requires lucene-core) is not strictly required. Like jta, it's actually only one possible implementation of a required interface. But I don't know of any other implementation.
As the other answer correctly mention the most easy way is use a build tool featuring a dependency manager. Most widely these days used are Maven and Gradle. Both use Maven Central repository by default to pull dependencies and transitive dependencies.
Depending whether your embedded application uses cypher or not you should add the following dependencies your pom.xml:
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-lucene-index</artifactId>
<version>2.1.2</version>
</dependency>
or (when cypher is used):
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher</artifactId>
<version>2.1.2</version>
</dependency>
Both of them transitively include all necessary libraries.
Related
Currently I use spring boot 1.5.8 and I want to use rabbitmq with my websocket.
The following code is my configuration of websocket
#Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config
.enableStompBrokerRelay("/topic", "/queue", "/exchange")
.setRelayHost("localhost")
.setRelayPort(5672)
.setClientLogin("guest")
.setClientPasscode("guest")
.setSystemHeartbeatSendInterval(5000);
}
I add to my gradle config the following dependencies
compile "org.springframework.boot:spring-boot-starter-websocket"
compile("io.projectreactor:reactor-net:2.0.5.RELEASE")
compile("io.projectreactor:reactor-core:2.0.5.RELEASE")
compile("io.netty:netty-all:4.0.33.Final")
Spring boot generate the following stack error
Caused by: java.lang.NoClassDefFoundError: reactor/io/codec/Codec
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
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:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler.startInternal(StompBrokerRelayMessageHandler.java:388)
at org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler.start(AbstractBrokerMessageHandler.java:164)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:175)
... 17 common frames omitted
Caused by: java.lang.ClassNotFoundException: reactor.io.codec.Codec
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 32 common frames omitted
I don't know what I'm doing wrong. Any ideas?
I follow the ideas given by http://djeison.me/2017/11/04/spring-websocket-rabbitmq/
And also have the same problem as Spring security 4.0.1 and Spring 4.2.0.RC1 stompBrokerRelayMessageHandler bean error with RabbitMQ
Similar issue resolved on GitHub: https://github.com/zyro23/grails-spring-websocket/issues/26
I have a very rare situation. I will explain it.
I use IntelliJ as my principal IDE for java development. When I configure the gradle plugin with the right panel, I always use the button for refresh dependencies. The strange situation here was that when I run spring boot with bootRun inside IntelliJ, it always generate the same error as the question said. I tried the last resource that was to bootRepackage the jar. Incredible, that was the solution. After the bootRepackage, IntelliJ recognize the new class reactor.io.codec.Codec.
So if you use IntelliJ as your main IDE, try to repackage and after that maybe the error was gone.
I have been using Solr version 4.10.2. I added solrj version 4.10.2 by using maven (pom.xml)
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>4.10.2</version>
<scope>compile</scope>
</dependency>
These are maven dependencies that are installed:
solr-solrj-4.10.2.jar
httpclient-4.3.1.jar
httpcore-4.3.jar
httpmime-4.3.1.jar
wstx-asl-3.2.7.jar
wstx-asl-3.2.7.jar
noggit-0.5.jar
When I define solr http path, l get and exception:
Exception in thread "main" java.lang.VerifyError: Cannot inherit from final 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.http.impl.client.DefaultHttpClient.createHttpParams(DefaultHttpClient.java:157)
at org.apache.http.impl.client.AbstractHttpClient.getParams(AbstractHttpClient.java:447)
at org.apache.solr.client.solrj.impl.HttpClientUtil.setFollowRedirects(HttpClientUtil.java:260)
at org.apache.solr.client.solrj.impl.HttpClientConfigurer.configure(HttpClientConfigurer.java:60)
at org.apache.solr.client.solrj.impl.HttpClientUtil.configureClient(HttpClientUtil.java:142)
at org.apache.solr.client.solrj.impl.HttpClientUtil.createClient(HttpClientUtil.java:118)
at org.apache.solr.client.solrj.impl.HttpSolrServer.<init>(HttpSolrServer.java:168)
at org.apache.solr.client.solrj.impl.HttpSolrServer.<init>(HttpSolrServer.java:141)
at addIndex.main(addIndex.java:10)
This is how I define solr path:
HttpSolrServer server = new HttpSolrServer("http://localhost:8983/solr"); or
HttpSolrServer server = new HttpSolrServer("http://localhost:8983/solr/#/collection1");
Is there another way to make a connection with java project? What is the reason that I get this exception?
If you're connecting to Solr (and using SolrJ as the client library), you're supposed to instantiate HttpSolrClient:
String urlString = "http://localhost:8983/solr/collection1";
SolrClient solr = new HttpSolrClient(urlString);
BTW: Anchors in URLs (such as #foo) is meant for clients only (such as browsers), and are not meant to be (and thus, isn't, usually) transmitted as part of the request.
There is my following problem :
java.lang.ClassNotFoundException: javax.vecmath.Point3f
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)
at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:244)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Caused: java.lang.NoClassDefFoundError: javax/vecmath/Point3f
I don't really understand why it can't find this class. I have the latest version of Java 1.7. Any ideas ?
Best regards.
If you are using Maven, try to add this dependency please :
<dependency>
<groupId>java3d</groupId>
<artifactId>vecmath</artifactId>
<version>1.3.1</version>
</dependency>
Otherwise, download the latest java3d library : https://java3d.java.net/binary-builds.html
After imported, update your imports in your Java class and it should be fine to compile.
Point3f is part of the Java3D API, which is a separate download. Read more here.
Cheers,
I've made JAR file from a project I made, however when I try to execute it, it gives:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/netty/channel/socket/ServerSocketChannelFactory
at org.ddosdefense.httpfilter.HTTPInterceptor.main(HTTPInterceptor.java:66)
Caused by: java.lang.ClassNotFoundException: org.jboss.netty.channel.socket.ServerSocketChannelFactory
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)
... 1 more
Inside the jar file all the libraries are present.
In the .classpath file the netty jar library is present:
<classpathentry kind="lib" path="ddos2_lib/netty-3.6.2.Final.jar"/>
When I execute the project in eclipse it works perfectly. Anyone has an idea how to solve this problem?
Thanks in advance!
Most likely you don't have the jar packaged into the jar you produce or missed to specify the netty jar via the -cp option.
I've been trying to send information from Java to Java script using the JSObject but i keep receiving a java.lang.ClassNotFoundException: com.sun.deploy.appcontext.AppContext exception i'm using netbeans 7.1.
Here is the full stack trace
java.lang.NoClassDefFoundError: com/sun/deploy/appcontext/AppContext
at MapTest.MapApplet.init(MapApplet.java:23)
at sun.applet.AppletPanel.run(AppletPanel.java:434)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: com.sun.deploy.appcontext.AppContext
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)
... 3 more
It is referring to this line of code
win = JSObject.getWindow(this);
These are all my imports
import netscape.javascript.JSObject;
import java.lang.*;
import java.applet.*;
import java.awt.Graphics;
I really need help with this can't seem to find solutions anywhere.
Thanks.
I came across a similar error and was able to solve it by adding deploy.jar found in the local Java install to the project build path. Not sure how to do this in netbeans but for others using maven you can try adding the folowing dependency:
<dependency>
<groupId>sun</groupId>
<artifactId>deploy</artifactId>
<version>7.0</version>
<scope>system</scope>
<systemPath>${java.home}/lib/deploy.jar</systemPath>
</dependency>