OpenTreeOfLife / treemachine

Source tree graph database
Other
16 stars 6 forks source link

Problem connecting to server (jersey) #69

Closed josephwb closed 10 years ago

josephwb commented 10 years ago

When trying to "fixNamesFromTrees", we are getting a "PROBLEM CONNECTING TO SERVER" error:

PROBLEM CONNECTING TO SERVER
com.sun.jersey.api.client.ClientHandlerException: com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class java.lang.String, and MIME media type, application/json, was not found
    at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:151)
    at com.sun.jersey.api.client.Client.handle(Client.java:648)
    at com.sun.jersey.api.client.WebResource.handle(WebResource.java:680)
    at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
    at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:568)
    at opentree.PhylografterConnector.fixNamesFromTrees(PhylografterConnector.java:228)
    at opentree.MainRunner.loadPhylografterStudy(MainRunner.java:1400)
    at opentree.MainRunner.pg_loading_ind_studies(MainRunner.java:1529)
    at opentree.MainRunner.main(MainRunner.java:1884)
Caused by: com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class java.lang.String, and MIME media type, application/json, was not found
    at com.sun.jersey.api.client.RequestWriter.writeRequestEntity(RequestWriter.java:288)
    at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:213)
    at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:149)
    ... 8 more

As far as I know, the relevant code (https://github.com/OpenTreeOfLife/treemachine/blob/master/src/main/java/opentree/PhylografterConnector.java#L185-229) has not changed recently.

We were able to determine that the service itself is working through using curl:

curl -X POST http://ec2-54-203-194-13.us-west-2.compute.amazonaws.com/taxomachine/ext/TNRS/graphdb/getContextForNames -H "content-type:application/json" -d '{"names":["Barnardius barnardi","Barnardius zonarius","Platycercus adscitus","Platycercus elegans","Psephotus dissimilis","Psephotus varius","Purpureicephalus spurius","Northiella haematogaster","Psephotus haematonotus","Cyanoramphus auriceps","Cyanoramphus novaezelandiae","Eunymphicus uvaeensis","Prosopeia tabuensis","Lathamus discolor","Pezoporus flaviventris","Pezoporus wallicus","Pezoporus occidentalis","Neophema elegans","Neopsephotus bourkii","Agapornis roseicollis","Loriculus galgulus","Bolbopsittacus lunulatus","Chalcopsitta duivenbodei","Melopsittacus undulatus","Cyclopsitta diophthalma","Psittaculirostris edwardsii","Psittacella brehmii","Psittacella picta","Aprosmictus erythropterus","Polytelis alexandrae","Alisterus amboinensis","Polytelis anthopeplus","Micropsitta finschii","Psittacula columboides","Tanygnathus lucionensis","Geoffroyus heteroclitus","Eclectus roratus","Prioniturus luconensis","Poicephalus robustus","Psittacus erithacus","Coracopsis vasa","Myiopsitta monachus","Psittrichas fulgidus","Calyptorhynchus banksii","Calyptorhynchus funereus","Eolophus roseicapillus","Nestor notabilis","Strigops habroptilus"]}'
chinchliff commented 10 years ago

There are some changes in progress on a different branch to try and use the httpurlconnection class to access the TNRS. I didn't get it to work. However, if the problems that I was experiencing with that approach are not because of the neo4-server dependency, then that might still be a viable option. It would be worth deactivating that dependency in the httpurlconnection branch and trying it to see if it works. If it does, that doesn't help us. If it doesn't, then if we can just figure out how to get httpurlconnection to work then we should be able to have both the tnrs and the neo4j-server dependency.

On Fri, Mar 28, 2014 at 10:38 AM, Joseph W. Brown notifications@github.comwrote:

I made the suggested changes from @jar398 https://github.com/jar398, and things appear to work on the example. I am closing this, but @jar398https://github.com/jar398might want to open a separate issue to get opentree.plugins.TreemachineSecurityFilter working again.

Reply to this email directly or view it on GitHubhttps://github.com/OpenTreeOfLife/treemachine/issues/69#issuecomment-38925485 .

jar398 commented 10 years ago

I have no confidence now that adding the neo4j-dependency doesn't break any number of other things. So I wasn't planning on doing that.

The approach I was considering was to create a sister source tree to 'main' and to teach maven to create a second .jar file for just those classes requiring neo4j-server. The second .jar file would go in the neo4j lib/ directory. Then we would be certain that neo4j-server wasn't polluting the command line version, and hopefully separating the two would make the server work just as well if not better.

I don't know how difficult this will be. I've been looking at the neo4j sources, which provide examples of multiple source trees each with its own pom.xml, where there are dependencies between them.

Cursing every step of the way.

On Fri, Mar 28, 2014 at 2:39 PM, chinchliff notifications@github.comwrote:

There are some changes in progress on a different branch to try and use the httpurlconnection class to access the TNRS. I didn't get it to work. However, if the problems that I was experiencing with that approach are not because of the neo4-server dependency, then that might still be a viable option. It would be worth deactivating that dependency in the httpurlconnection branch and trying it to see if it works. If it does, that doesn't help us. If it doesn't, then if we can just figure out how to get httpurlconnection to work then we should be able to have both the tnrs and the neo4j-server dependency.

On Fri, Mar 28, 2014 at 10:38 AM, Joseph W. Brown notifications@github.comwrote:

I made the suggested changes from @jar398 https://github.com/jar398, and things appear to work on the example. I am closing this, but @jar398< https://github.com/jar398>might want to open a separate issue to get opentree.plugins.TreemachineSecurityFilter working again.

Reply to this email directly or view it on GitHub< https://github.com/OpenTreeOfLife/treemachine/issues/69#issuecomment-38925485

.

— Reply to this email directly or view it on GitHubhttps://github.com/OpenTreeOfLife/treemachine/issues/69#issuecomment-38953867 .