Neo4j + JavaEE + Java 7 + Glassfish + Netbeans 8.0 CONFIGURATION

463 Views Asked by At

I need a project that use all this. I can't connect Neo4j in Server Mode with JavaEE on Glassfish. Only in Embedded mode. I use https://github.com/neo4j-contrib/neo4j-jdbc specifications. The Error is:

**

Advertencia: Unable to start the Restlet java.lang.RuntimeException: Unable to create SSLContext. at org.restlet.ext.httpclient.HttpClientHelper.configure(HttpClientHelper.java:277) at org.restlet.ext.httpclient.HttpClientHelper.start(HttpClientHelper.java:478) at org.restlet.Client.start(Client.java:217) at org.restlet.Restlet.handle(Restlet.java:315) at org.restlet.Client.handle(Client.java:177) at org.restlet.resource.ClientResource.handle(ClientResource.java:1136) at org.restlet.resource.ClientResource.handleOutbound(ClientResource.java:1225) at org.restlet.resource.ClientResource.handle(ClientResource.java:1068) at org.restlet.resource.ClientResource.handle(ClientResource.java:1044) at org.restlet.resource.ClientResource.handle(ClientResource.java:950) at org.restlet.resource.ClientResource.get(ClientResource.java:658) at org.neo4j.jdbc.internal.rest.Resources$DiscoveryClientResource.readInformation(Resources.java:143) at org.neo4j.jdbc.internal.rest.Resources.getDiscoveryResource(Resources.java:61) at org.neo4j.jdbc.internal.Neo4jConnection.createExecutor(Neo4jConnection.java:109) at org.neo4j.jdbc.internal.Neo4jConnection.(Neo4jConnection.java:79) at org.neo4j.jdbc.internal.Connections$4.doCreate(Connections.java:65) at org.neo4j.jdbc.internal.Connections.create(Connections.java:80) at org.neo4j.jdbc.Driver.connect(Driver.java:80) at org.neo4j.jdbc.Driver.connect(Driver.java:42) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:270) at otrasclases.NeoServer.raiz(NeoServer.java:40) at otrasclases.OtroMainNoLoToquen.main(OtroMainNoLoToquen.java:13) at managebeans.mbPrueba.mb(mbPrueba.java:55) at sun.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 javax.el.ELUtil.invokeMethod(ELUtil.java:332) at javax.el.BeanELResolver.invoke(BeanELResolver.java:537) at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256) at com.sun.el.parser.AstValue.getValue(AstValue.java:136) at com.sun.el.parser.AstValue.getValue(AstValue.java:204) at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226) at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50) at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) at org.primefaces.component.filedownload.FileDownloadActionListener.processAction(FileDownloadActionListener.java:55) at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88) at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:813) at javax.faces.component.UICommand.broadcast(UICommand.java:300) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282) at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: Keystore was tampered with, or password was incorrect at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:772) at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:55) at java.security.KeyStore.load(KeyStore.java:1433) at org.restlet.ext.ssl.DefaultSslContextFactory.createSslContext(DefaultSslContextFactory.java:317) at org.restlet.ext.httpclient.HttpClientHelper.configure(HttpClientHelper.java:274) ... 73 more Caused by: java.security.UnrecoverableKeyException: Password verification failed at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:770) ... 77 more

**

My SessionBeans is:

@Override
public int raiz() throws Exception {   
  if (raiz != -1) {      
   return raiz;
  } else {    
    Class.forName("org.neo4j.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:neo4j://localhost:7474/");
    try (Statement stmt = con.createStatement()) {
        ResultSet rs = stmt.executeQuery("MATCH (n) WHERE NOT (n)<-[:FATHER]-() RETURN n.accession");
        rs.next();
        this.setRaiz(Integer.parseInt(rs.getString("n.accession")));
    }
    return raiz;
  }
}

**

Connection con = DriverManager.getConnection("jdbc:neo4j://localhost:7474/");

Here run fail.

1

There are 1 best solutions below

0
On

This error (Unable to create SSL context) usually relates to a bad certificate that you have in place. I don't think it's related to glassfish or neo4j.

See this thread for more information.

In essence, you need to make sure that you have a valid SSL cert set up for your server here, or otherwise configure restlet to ignore that.