0

Note: There are already similar questions, but the solutions do not work for the jqassistant-maven-plugin.

I am facing an issue on a new client site, where I would like to view the Neo4j contents which have been scanned by JQAssistant, by using the jqassistant-maven-plugin (1.10.0).

Running mvn jqassistant:scan jqassistant:analyze jqassistant:server will spin up and embedded Neo4j, scan the contents of my Maven project, and keep the embedded instance open so I can access it via http://localhost:7474/

When trying to login in the browser (using the bolt protocol) I am facing a connection issue.

ServiceUnavailable: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. 
Please use your browsers development console to determine the root cause of the failure. 
Common reasons include the database being unavailable, using the wrong connection URL or temporary network problems. If you have enabled encryption, ensure your browser is configured to trust the certificate Neo4j is configured to use. 
WebSocket `readyState` is: 3

I've never seen anything like this before with this tool. The only ressource I've found was this documentation saying that the listenAddress should be changed.

Basically JQAssistant is configured as always, with the exception of the embeddedListenAddress:

<plugin>
  <groupId>com.buschmais.jqassistant</groupId>
  <artifactId>jqassistant-maven-plugin</artifactId>
  <version>${jqassistant.version}</version>
  <executions>
    <execution>
      <id>default-cli</id>
      <goals>
        <goal>scan</goal>
        <goal>analyze</goal>
      </goals>
      <configuration>
        <warnOnSeverity>INFO</warnOnSeverity>
        <failOnSeverity>MAJOR</failOnSeverity>
        <embeddedListenAddress>0.0.0.0</embeddedListenAddress>
      </configuration>
    </execution>
  </executions>
</plugin>

Does anyone had a similar experience? It seems to me that some corporate setting in the browsers (all which are available) are blocking websockets. Is there a way around this. My only workaround in the moment is using an dedicated Neo4j instance, which complicates the dev-setup and I would like to avoid this.

Further analysis:

Checking the browser-port, shows that it is listening

netstat -a | findstr 7474
  TCP    0.0.0.0:7474    
  TCP    [::]:7474

The bolt-port on the other hand is not available

netstat -a | findstr 7687
lostiniceland
  • 3,729
  • 6
  • 38
  • 50
  • Does the problem only occur if the embeddedListenAddress is set? And: what's your environment: Windows/Linux, maybe any firewalls in the game? – Dirk Mahler Jul 17 '21 at 09:47
  • Nope. Its always happening. I tried setting this value as it was mentioned in the Neo4j docs for this particular problem. – lostiniceland Jul 17 '21 at 09:48
  • Environment is Windows. There probably is a local Firewall in place. I will probably need to check with the clients admin. – lostiniceland Jul 17 '21 at 10:09
  • Please check this. Another option: Are you able to access the browser from a non-localhost address (e.g. LAN/Wireless IP address) assigned to the developer PC if the embeddedListenAddress is set to 0.0.0.0? – Dirk Mahler Jul 19 '21 at 07:45
  • No, no access. I added further analysis to the question. The bolt-port is not listening, but there are no errors in the log when starting. – lostiniceland Jul 19 '21 at 08:14
  • Are you able using a different program (e.g. configure Tomcat) to open a port on 7687? Maybe its listening only on IPv6? – Jens Nerche Jul 23 '21 at 13:33
  • I have to check the IPv6 thing. At least I was able to receive the Neo4j Docker Image in an internal registry after some days now, and connecting with the neo4j protocol works in the browser. The Maven plugin can connect via bolt with the container. – lostiniceland Jul 28 '21 at 12:45
  • Some more debugging. I have two Neo4J instances up and running. One from the official Neo5j Docker images, and the second is started by jqasstant-maven-plugin. When doing a login against bolt-protocol on the Docker-Neo4j I receive a 101 protocol-switch for websocket. BUT when testing the jqassistant-instance, I get a simple 404. I really seems the Java process doesnt start the bolt port at all. – lostiniceland Jul 29 '21 at 13:14

1 Answers1

0

After setting <embeddedBoltPort>45856</embeddedBoltPort> (an arbitrary high number) I can finally connect. For some reason the port was not allowed to come up, even changing it to something commonly used like 8080 did not work.

I do not understand why this happened, because the port was not used. When testing a used port the correct exception appears that it is already in use. I can only assume some weird security setting at the client.

My only suggestion for the jqassistant-maven-plugin would be to test if all required ports are up and running even when no exception occured during startup.

Thanks anyone for sharing ideas to track this down.

lostiniceland
  • 3,729
  • 6
  • 38
  • 50