Hi,everyone
I'am freshmen in DSpace development. My library has done development based on
DSpace 1.8 for three years ( our institute repository: http://ir.pku.edu.cn).
Recently we want to migrate to a higher version and I join this activity.
Now, I have a problem with the sword version 2 submission. ( I can submit
package with sword version 1 succussfully, but fail for version 2 no matter
whether I use DSpace 1.8 or higher version such as 4.2).
Following is the code (the example.zip is download from
http://sword-app.svn.sourceforge.net/viewvc/sword-app/dspace/trunk/example/example.zip
) :
----------------------------------------------------------------------------------------------
String sdIRI = "http://162.105.134.229:8080/swordv2/servicedocument";
String userName = "xxxxxxxxxxx"; //I hide the user name
String password = "xxxxxxxxxxx"; //I hide the password
String file = "C:/Users/luopc/Desktop/dspace/example.zip";
Deposit deposit = new Deposit();
deposit.setFile(new FileInputStream(file));
deposit.setMimeType("application/zip");
deposit.setFilename("example.zip");
deposit.setPackaging("http://purl.org/net/sword/package/METSDSpaceSIP");
deposit.setMd5(Test2.getMd5ByFile(new File(file)));
deposit.setInProgress(true);
deposit.setSuggestedIdentifier("abcdefg");
AuthCredentials auth = new AuthCredentials(userName, password);
SWORDClient client = new SWORDClient();
ServiceDocument sd = client.getServiceDocument(sdIRI, auth);
SWORDCollection col = sd.getWorkspaces().get(0).getCollections().get(0);
DepositReceipt receipt = client.deposit(col, deposit,new
AuthCredentials(userName, password));
----------------------------------------------------------------------------------------------
However, I always get the following exception:
----------------------------------------------------------------------------------------------
INFO [main] (SWORDClient.java:400) - Deposit request on
http://162.105.134.229:8080/swordv2/collection/123456789/2 returned Error HTTP
status 500
Exception in thread "main" <!DOCTYPE html><html><head><title>Apache
Tomcat/8.0.15 - Error report</title><style type="text/css">H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
{color : black;}A.name {color : black;}.line {height: 1px; background-color:
#525D76; border: none;}</style> </head><body><h1>HTTP Status 500 - </h1><div
class="line"></div><p><b>type</b> Exception report</p><p><b>message</b>
<u></u></p><p><b>description</b> <u>The server encountered an internal error
that prevented it from fulfilling this
request.</u></p><p><b>exception</b></p><pre>java.lang.NullPointerException
org.dspace.content.packager.PackageUtils.addDepositLicense(PackageUtils.java:156)
org.dspace.content.packager.DSpaceMETSIngester.addLicense(DSpaceMETSIngester.java:178)
org.dspace.content.packager.AbstractMETSIngester.replaceObject(AbstractMETSIngester.java:663)
org.dspace.content.packager.AbstractMETSIngester.replace(AbstractMETSIngester.java:1191)
org.dspace.sword2.SwordMETSContentIngester.ingestToCollection(SwordMETSContentIngester.java:108)
org.dspace.sword2.AbstractSwordContentIngester.ingest(AbstractSwordContentIngester.java:45)
org.dspace.sword2.SwordMETSContentIngester.ingest(SwordMETSContentIngester.java:44)
org.dspace.sword2.CollectionDepositManagerDSpace.createNewFromBinary(CollectionDepositManagerDSpace.java:229)
org.dspace.sword2.CollectionDepositManagerDSpace.createNew(CollectionDepositManagerDSpace.java:116)
org.swordapp.server.CollectionAPI.post(CollectionAPI.java:165)
org.swordapp.server.servlets.CollectionServletDefault.doPost(CollectionServletDefault.java:48)
javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
</pre><p><b>note</b> <u>The full stack trace of the root cause is available in
the Apache Tomcat/8.0.15 logs.</u></p><hr class="line"><h3>Apache
Tomcat/8.0.15</h3></body></html>
at org.swordapp.client.ErrorHandler.handleError(ErrorHandler.java:39)
at org.swordapp.client.SWORDClient.deposit(SWORDClient.java:402)
at org.swordapp.client.SWORDClient.deposit(SWORDClient.java:273)
at lib.pku.edu.cn.Test.main(Test.java:66)
----------------------------------------------------------------------------------------------
Can somebody help us? We have been puzzled by this problem for a long time.
--
罗鹏程
Pengcheng Luo
System Department
Library of Peking University
Beijing, China, 100871
Tel:010-62751062(22)
Email: lu...@lib.pku.edu.cn ; 1406189...@pku.edu.cn
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Dspace-devel mailing list
Dspace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-devel