Comments (9)
I fixed the .classpath and fixed a couple of URIs to point to datahub.io now
Please try it and let me know if it works
from grefine-ckan-storage-extension.
Thanks for updating.
no more
package with id {package id} doest not exist on http://localhost/api/rest/package
error, BUT still get
failed to upload file to CKAN Storage. A wrong API key maybe?
error message.
I guess the problem is, your extension try to upload every files to datahub.io, even if the user change the api base URL in the extension's pop-up window
That's what I mention before 'the hard coding' issue.
from grefine-ckan-storage-extension.
for example, in the file
/src/com/google/refine/net/ckan/StorageApiProxy.java
the line 87, 88
private static final String CKAN_STORAGE_BASE_URI = "http://ckan.net/api/storage";
private static final String CKAN_STORAGE_FILES_BASE_URI = "http://ckan.net/storage/f/";
why declare CKAN_STORAGE_BASE_URI and CKAN_STORAGE_FILES_BASE_URI as final variables?
I guess maybe there is some relationship between the bug I met and these codes
from grefine-ckan-storage-extension.
Are you using your own deployment of CKAN Storage? If so, try changing the URIs in the source code and see if it works.
from grefine-ckan-storage-extension.
yes, I install a local CKAN server at http://localhost/
that's why I want to change the URL in the extension's pop-up window.
I have tried to modify
the line 87, 88
private static final String CKAN_STORAGE_BASE_URI = "http://ckan.net/api/storage";
private static final String CKAN_STORAGE_FILES_BASE_URI = "http://ckan.net/storage/f/";
to
private static final String CKAN_STORAGE_BASE_URI = "http://localhost/api/storage";
private static final String CKAN_STORAGE_FILES_BASE_URI = "http://localhost/storage/f/";
but I still get the error message:
failed to upload file to CKAN Storage. A wrong API key maybe?
and then I check my local CKAN server, this extension can only create a new empty dataset, but not upload the data to the server. That's the problem
from grefine-ckan-storage-extension.
the error log as following
09:47:14.205 [ refine] POST /command/ckan-storage-extension/upload-to-ckan (45226ms)
09:47:14.933 [ command] Exception caught (728ms)
java.lang.RuntimeException: failed to upload file to CKAN Storage. A wrong API key maybe?
at com.google.refine.net.ckan.StorageApiProxy.uploadFile(StorageApiProxy.java:81)
at com.google.refine.net.ckan.CkanApiProxy.addGroupOfResources(CkanApiProxy.java:141)
at com.google.refine.net.ckan.storage.commands.UploadToCKANCommand.doPost(UploadToCKANCommand.java:87)
at com.google.refine.RefineServlet.service(RefineServlet.java:179)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at org.mortbay.servlet.UserAgentFilter.doFilter(UserAgentFilter.java:81)
at org.mortbay.servlet.GzipFilter.doFilter(GzipFilter.java:132)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.json.JSONException: A JSONObject text must begin with '{' at 6 [character 5 line 2]
at org.json.JSONTokener.syntaxError(JSONTokener.java:423)
at org.json.JSONObject.<init>(JSONObject.java:184)
at org.json.JSONObject.<init>(JSONObject.java:311)
at com.google.refine.net.ckan.StorageApiProxy.uploadFile(StorageApiProxy.java:40)
... 25 more
from grefine-ckan-storage-extension.
since the exception is localtion at
storgageApiProxy.java
catch(JSONException je){
throw new RuntimeException("failed to upload file to CKAN Storage. A wrong API key maybe? ",je);
the JSON parse part in this file is
//now parse JSON
JSONObject obj = new JSONObject(os.toString());
//post the file now
String uploadFileUrl = obj.getString("action");
HttpPost postFile = new HttpPost(uploadFileUrl);
postFile.setHeader("Authorization", apikey);
MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.STRICT);
JSONArray fields = obj.getJSONArray("fields");
for(int i=0;i<fields.length();i++){
JSONObject fieldObj = fields.getJSONObject(i);
String fieldName = fieldObj.getString("name");
String fieldValue = fieldObj.getString("value");
if(fieldName.equals("key")){
filekey = fieldValue;
}
mpEntity.addPart(fieldName, new StringBody(fieldValue,"multipart/form-data",Charset.forName("UTF-8")));
}
so I think the error maybe is related with this part.
Well, maybe your find it is not easy to install CKAN on local machine to test.
My suggestion is use VMware and install ubuntu and then follow this instruction
http://docs.ckan.org/en/latest/install-from-package.html
I have successfully installed CKAN on ubuntu 13.04, if you have any problem when you install CKAN, please contact me
from grefine-ckan-storage-extension.
any update?
from grefine-ckan-storage-extension.
late update am afraid but better than none... updated the extension, it'd be great if you can test it
from grefine-ckan-storage-extension.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grefine-ckan-storage-extension.