Frage

I'm having a problem with the following setup:

  • Neo4j 1.9.4 database with REST service
  • Web-app connecting to the said REST service, built on top of Spring Data Neo4j 2.3.1.RELEASE. Other technologies are not noteworthy, worth to note that the transitive dependency of SDN is at 1.9. See below.
  • The said web-app is deployed to WebLogic for production, Tomcat used for local development

Excerpt from Maven dependency tree

    [INFO] +- org.springframework.data:spring-data-neo4j-rest:jar:2.3.1.RELEASE:compile
    [INFO] |  +- org.neo4j:neo4j-rest-graphdb:jar:1.9:compile
    [INFO] |  |  \- org.neo4j:server-api:jar:1.9:compile
    [INFO] |  |     +- org.neo4j.3rdparty.javax.ws.rs:jsr311-api:jar:1.1.2.r612:compile
    [INFO] |  |     +- commons-configuration:commons-configuration:jar:1.6:compile
    [INFO] |  |     |  \- commons-beanutils:commons-beanutils-core:jar:1.8.0:compile
    [INFO] |  |     \- commons-digester:commons-digester:jar:1.8.1:compile
    [INFO] |  |        \- commons-beanutils:commons-beanutils:jar:1.8.0:compile

The problem is: SDN's save API doesn't work when deployed to WebLogic. The web-app still has no problem when trying to retrieve any @NodeEntity. But when the app tries to do a save (list of APIs I've tried, below), it always throws an error.

What I've tried (both yield the same result, error):

    repository.save(U entity);
    neo4jTemplate.save(T entity);

The weird things that I noticed are:

  • When my app connects to Neo4j server via
    GraphDatabaseFactory.databaseFor(url) it works, I can operate a save on a Node (@NodeEntity of SDN still doesn't work). When connected via new SpringRestGraphDatabase(restUri) both Node and @NodeEntity doesn't work. Both APIs are returning descendants of org.neo4j.graphdb.GraphDatabaseService
  • This is easily replicable even in local environment. I had assumed it to be a network problem, but when I tried to have both the Neo4j server and WebLogic server in my local, the problem still exhibits itself.
  • I had thought this is a transactional problem since retrieval is has no problem, but as mentioned by Michael Hunger here, there is no real transactions in Neo4j Server. So it shouldn't cause the problem.

Stacktrace:

    ]] Root cause of ServletException.
    com.sun.jersey.api.client.ClientHandlerException: java.net.SocketTimeoutException: Read timed out
            at com.sun.jersey.api.client.ClientResponse.close(ClientResponse.java:603)
            at org.neo4j.rest.graphdb.RequestResult.extractFrom(RequestResult.java:83)
            at org.neo4j.rest.graphdb.ExecutingRestRequest.put(ExecutingRestRequest.java:151)
            at org.neo4j.rest.graphdb.ExecutingRestAPI.setPropertyOnEntity(ExecutingRestAPI.java:340)
            at org.neo4j.rest.graphdb.RestAPIFacade.setPropertyOnEntity(RestAPIFacade.java:135)
            Truncated. see log file for complete stacktrace
    Caused By: java.net.SocketTimeoutException: Read timed out
            at java.net.SocketInputStream.socketRead0(Native Method)
            at java.net.SocketInputStream.read(SocketInputStream.java:129)
            at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
            at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
            at weblogic.net.http.KeepAliveStream.close(KeepAliveStream.java:115)
            Truncated. see log file for complete stacktrace
    >

Everything works fine in Tomcat (both REST and Embedded).
Everything works fine in Embedded db (even in WebLogic).

Any help is greatly appreciated.

War es hilfreich?

Lösung

That exception throw in com.sun.jersey.api.client.ClientResponse

/**
     * Close the response.
     * <p>
     * The entity input stream is closed.
     *
     * @throws ClientHandlerException if there is an error closing the response.
     */
    public void close() throws ClientHandlerException {
        try {
            entity.close();
        } catch (IOException e) {
            throw new ClientHandlerException(e);
        }
    }

The InputStream implementation in Weblogic 12 by this time is weblogic.net.http.KeepAliveStream
The code 204 return No Content then weblogic mark it as not complete downloading the content.

The solution here is use -DUseSunHttpHandler=true when start your weblogic (bin/startWebLogic.cmd)

set JAVA_OPTIONS=%JAVA_OPTIONS% -DUseSunHttpHandler=true

Regards,
Tung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top