Hi Marco, Hayden,

The particular ingester used is selected by the use of both mime type
and the Packaging header in the deposit request.  If you take a look
at the config, you'll see different ingesters for different package
uris, such as the SimpleZip or the Binary formats (which are standard
SWORD types).  If you don't supply a Packaging header it will default
to Binary.

As long as the mime type is in the "accept" list, then you should be
able to use the correct mime type in the deposit (you could also set
your accepts config option to */*.

The particular exception that you are getting is difficult: I'm not
sure I could diagnose without getting a debugger onto it.  The
offending line in the BinaryContentIngester gets the InputStream from
the deposit object, so it's possible that that is the problem.  Can
you get a debugger onto it?

Cheers,

Richard

On 30 April 2012 13:55, Hayden Young <haydenyo...@wijiti.com> wrote:
> Hi Marco and Richard
>
> Closer still to a solution I think.
>
> Richard, I commented out the offending ingester:
>
> org.dspace.swordpackagers.SwordXifIngester = image/jpeg
>
> unfortunately, this did not solve the problem but I now get the same error
> as if I attempt to ingest a PDF (I.e. file not found) so at least now there
> is some consistency. I checked all permissions on my upload.tempdir; as
> bitstreams are being successfully associated with items if I set the
> mimetype to "application/zip" I am guessing my directory permissions are
> correct?
>
> Marco, thanks for the suggestion. I did set the mime type as application/zip
> and had some success with uploading the bitstreams; that is, the bitstream
> is appearing within the item). There are two issues:
>
> 1. The file type is not detected and so it is given the file type "Unknown"
>
> 2. No matter which type of file or how many files are uploaded, the first
> letter is always dropped from the file name. So, for example my_image.jpg
> will be renamed y_image.jpg or my_document.pdf will be y_document.pdf. I
> checked my mimetype settings and both image/jpeg and application/pdf are
> registered.
>
> Therefore, I'm thinking could this be a swordv2 config issue? I have
> attached in case it assists with diagnosis.
>
> Cheers
>
>
> Hayden
>
>
> On 30/04/12 19:54, Marco Fabiani wrote:
>
> Hi Hayden,
>
> when I add files to a resource in DSpace via Swordv2 (I use python), I
> always set the MIME type as "application/zip", and let the BinaryIngester do
> the ingestion. I tried setting jpeg and pdf types but never worked for me.
> In the end, if the type is known, it will appear in DSpace anyway as a
> recognised type (I think the ingester matches the extension with the types
> registry).
>
> Hope this helps!
>
> Cheers,
> Marco
>
> --------------------------------------------------
> Marco Fabiani
> Postdoctoral Research Assistant
> Centre for Digital Music
> School of Electronic Engineering and Computer Science
> Queen Mary, University of London
> Mile End Road, London E1 4NS, UK
>
> On 30 Apr 2012, at 12:46, Richard Jones wrote:
>
> Hi Hayden,
>
> Looks like the Xif Ingester (which is part of the sword packagers
> extension [1]) is configured in by default.  You can just remove this
> from the config, or you can install the packagers (which are pretty
> experimental at this point).
>
> [1] https://bitbucket.org/richardjones/sword-packagers
>
> Your second error I'm not sure about - looks like perhaps the temp
> file to be ingested isn't accessible; can you check the
> swordv2-server.cfg property upload.tmpdir and see if it is set,
> exists, is writable, is readable, etc.
>
> Cheers,
>
> Richard
>
>
> On 30 April 2012 12:39, Hayden Young <haydenyo...@wijiti.com> wrote:
>
> Thanks all.
>
>
> Stuart, taking your suggestion about adding the metadata then the
>
> bitstream, I'm a lot closer to a working solution.
>
>
> $response = $client->depositAtomEntry(self::URL, self::USERNAME,
>
> self::PASSWORD, self::USERNAME, './tmp/atom_multipart_package', true);
>
>
> where atom_multipart_package is my atom xml, successfully creates an
>
> item and populates the associated metadata fields.
>
>
> However,
>
>
> $response =
>
> $client->addExtraFileToMediaResource((string)$response->sac_edit_media_iri,
>
> self::USERNAME, self::PASSWORD, self::USERNAME, "./tmp/logo.jpg",
>
> 'image/jpeg', false);
>
>
> is throwing an error, although I suspect this may be more of a DSpace
>
> configuration issue rather than an issue between the sword client and
>
> server.
>
>
> The above will throw a DSpace error:
>
>
> 30/04/2012 10:53:38 AM org.apache.catalina.core.StandardWrapperValve invoke
>
> SEVERE: Servlet.service() for servlet mediaresource threw exception
>
> org.dspace.core.PluginInstantiationException: Cannot load plugin class:
>
> java.lang.ClassNotFoundException: org.dspace.swordpackagers.SwordXifIngester
>
>     at org.dspace.core.PluginManager.getNamedPlugin(PluginManager.java:459)
>
>     at
>
> org.dspace.sword2.SwordIngesterFactory.getContentInstance(SwordIngesterFactory.java:49)
>
>     at
>
> org.dspace.sword2.MediaResourceManagerDSpace.addContent(MediaResourceManagerDSpace.java:818)
>
>     at
>
> org.dspace.sword2.MediaResourceManagerDSpace.addResource(MediaResourceManagerDSpace.java:553)
>
>     at org.swordapp.server.MediaResourceAPI.post(MediaResourceAPI.java:239)
>
>     at
>
> org.swordapp.server.servlets.MediaResourceServletDefault.doPost(MediaResourceServletDefault.java:49)
>
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
>     at
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>
>     at
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>
>     at
>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>
>     at
>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>
>     at
>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>
>     at
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>
>     at
>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>
>     at
>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>
>     at
>
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
>
>     at
>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
>
>     at
>
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
>
>     at java.lang.Thread.run(Thread.java:679)
>
> Caused by: java.lang.ClassNotFoundException:
>
> org.dspace.swordpackagers.SwordXifIngester
>
>     at
>
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
>
>     at
>
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
>
>     at java.lang.Class.forName0(Native Method)
>
>     at java.lang.Class.forName(Class.java:186)
>
>     at org.dspace.core.PluginManager.getNamedPlugin(PluginManager.java:424)
>
>     ... 19 more
>
>
>
> Alternatively, if I try a PDF
>
>
> $response =
>
> $client->addExtraFileToMediaResource((string)$response->sac_edit_media_iri,
>
> self::USERNAME, self::PASSWORD, self::USERNAME, "./tmp/logo.pdf",
>
> 'application/pdf', false);
>
>
> DSpace throws the error:
>
>
> <html><head><title>Apache Tomcat/6.0.28 - Error
>
> report</title><style><!--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;}HR {color : #525D76;}--></style>
>
> </head><body><h1>HTTP Status 500 - </h1><HR size="1"
>
> noshade="noshade"><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> <pre>javax.servlet.ServletException:
>
> org.swordapp.server.SwordServerException: There was a problem depositing
>
> the item
>
>     org.swordapp.server.MediaResourceAPI.post(MediaResourceAPI.java:270)
>
>
> org.swordapp.server.servlets.MediaResourceServletDefault.doPost(MediaResourceServletDefault.java:49)
>
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
> </pre></p><p><b>root cause</b>
>
> <pre>org.swordapp.server.SwordServerException: There was a problem
>
> depositing the item
>
>
> org.dspace.sword2.MediaResourceManagerDSpace.addResource(MediaResourceManagerDSpace.java:633)
>
>     org.swordapp.server.MediaResourceAPI.post(MediaResourceAPI.java:239)
>
>
> org.swordapp.server.servlets.MediaResourceServletDefault.doPost(MediaResourceServletDefault.java:49)
>
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
> </pre></p><p><b>root cause</b>
>
> <pre>org.dspace.sword2.DSpaceSwordException: java.io.IOException: No
>
> such file or directory
>
>
> org.dspace.sword2.BinaryContentIngester.ingestToItem(BinaryContentIngester.java:183)
>
>
> org.dspace.sword2.BinaryContentIngester.ingest(BinaryContentIngester.java:46)
>
>
> org.dspace.sword2.BinaryContentIngester.ingest(BinaryContentIngester.java:34)
>
>
> org.dspace.sword2.MediaResourceManagerDSpace.addContent(MediaResourceManagerDSpace.java:822)
>
>
> org.dspace.sword2.MediaResourceManagerDSpace.addResource(MediaResourceManagerDSpace.java:553)
>
>     org.swordapp.server.MediaResourceAPI.post(MediaResourceAPI.java:239)
>
>
> org.swordapp.server.servlets.MediaResourceServletDefault.doPost(MediaResourceServletDefault.java:49)
>
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
> </pre></p><p><b>root cause</b> <pre>java.io.IOException: No such file or
>
> directory
>
>     java.io.UnixFileSystem.createFileExclusively(Native Method)
>
>     java.io.File.createNewFile(File.java:900)
>
>     edu.sdsc.grid.io.local.LocalFile.createNewFile(LocalFile.java:486)
>
>
> org.dspace.storage.bitstore.BitstreamStorageManager.store(BitstreamStorageManager.java:300)
>
>     org.dspace.content.Bitstream.create(Bitstream.java:205)
>
>     org.dspace.content.Bundle.createBitstream(Bundle.java:384)
>
>     org.dspace.content.Item.createSingleBitstream(Item.java:1345)
>
>     org.dspace.content.Item.createSingleBitstream(Item.java:1365)
>
>
> org.dspace.sword2.BinaryContentIngester.ingestToItem(BinaryContentIngester.java:148)
>
>
> org.dspace.sword2.BinaryContentIngester.ingest(BinaryContentIngester.java:46)
>
>
> org.dspace.sword2.BinaryContentIngester.ingest(BinaryContentIngester.java:34)
>
>
> org.dspace.sword2.MediaResourceManagerDSpace.addContent(MediaResourceManagerDSpace.java:822)
>
>
> org.dspace.sword2.MediaResourceManagerDSpace.addResource(MediaResourceManagerDSpace.java:553)
>
>     org.swordapp.server.MediaResourceAPI.post(MediaResourceAPI.java:239)
>
>
> org.swordapp.server.servlets.MediaResourceServletDefault.doPost(MediaResourceServletDefault.java:49)
>
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
> </pre></p><p><b>note</b> <u>The full stack trace of the root cause is
>
> available in the Apache Tomcat/6.0.28 logs.</u></p><HR size="1"
>
> noshade="noshade"><h3>Apache Tomcat/6.0.28</h3></body></html>
>
>
> Cheers
>
>
>
> Hayden
>
>
> On 30/04/12 16:20, Richard Jones wrote:
>
> Hi Guys,
>
>
> It looks like you are making progress.  Just to add that the existing
>
> SWORDv2 implementation in DSpace is pretty experimental, but I have
>
> been working through it in the last couple of weeks, finding and
>
> fixing all the oddities that I can find.  This is all happening in a
>
> fork I have made of the github repo, from the 1.8.2 release:
>
>
> https://github.com/nye-duo/DSpace/tree/duo
>
>
> I hope to have this stable in the next couple of weeks, but note that
>
> I'm not currently trying to get the multipart issues resolved, just
>
> all the other bits and bobs.
>
>
> Cheers,
>
>
> Richard
>
>
> On 30 April 2012 09:09, LEWIS Stuart<stuart.le...@ed.ac.uk>  wrote:
>
> Hi Hayden,
>
>
> The two options would be either:
>
>
> PackagerMetsSwap::create (to create a METS/SWAP package, which can be used
> in SWORD v1 or v2), followed by SWORDAppClient::deposit to deposit the
> package
>
>
> Or
>
>
> SWORDAppClient::depositAtomEntry to create the metadata-only object,
> followed by SWORDAppClient::addExtraFileToMediaResource
>
>
> (I think that should work - I've not got a computer set up with this code
> running right now).
>
>
> Thanks,
>
>
>
> Stuart
>
>
>
>
> --
>
> The University of Edinburgh is a charitable body, registered in
>
> Scotland, with registration number SC005336.
>
>
>
> -----Original Message-----
>
> From: Hayden Young [mailto:haydenyo...@wijiti.com]
>
> Sent: 30 April 2012 08:55
>
> To: LEWIS Stuart
>
> Cc: sword-app-tech@lists.sourceforge.net
>
> Subject: Re: [sword-app-tech] depositMultipart always results in a 500 error
>
>
> Hi Stuart
>
>
> Thanks for your assistance.
>
>
> So if I need to use a two step process to deposit an item to DSpace, am I
> using the correct methods to overcome DSpace's SWORDv2 limitations?
>
>
> I.e.
>
>
> SWORDAppClient::deposit to create the item
>
>
> SWORDAppClient::replaceMetadata or
>
> SWORDAppClient::replaceMetadataWithFile to update the item's metadata.
>
>
>
>
> On 30/04/12 15:32, LEWIS Stuart wrote:
>
> Hi Hayden,
>
>
> ===
>
> Okay I've tried a couple of methods for adding metadata and completing the
> deposit.
>
>
> Both:
>
>
> $response =
>
> $client->replaceMetadata((string)$response->sac_edit_media_iri,
>
> self::USERNAME, self::PASSWORD, self::USERNAME, './tmp/atom2', false);
>
>
> $response =
>
> $client->replaceMetadataAndFile((string)$response->sac_edit_media_iri,
>
> self::USERNAME, self::PASSWORD, self::USERNAME,
> './tmp/atom_multipart_package2.zip', false);
>
>
> result in the error:
>
>
> <atom:summary xmlns:atom="http://www.w3.org/2005/Atom";>Filename could not be
> extracted from
>
> Content-Disposition</atom:summary><sword:verboseDescription>org.swordapp.server.SwordError:
>
> Filename could not be extracted from Content-Disposition
>
>
> Looking at both these methods shows that they call depositAtomEntryByMethod
> and depositMultipartByMethod but from what I can see, neither of these
> methods sets the curl Content-Disposition header. Could this be what is
> causing this error?
>
> ===
>
>
> I don't think that is what should be causing it - when replacing metadata
> (the first case, depositing a new atom entry) no filename
> (content-disposition) is required.  See the example in the spec at "6.5.2.
> Replacing the Metadata of a Resource".
>
>
> In the second case, the problem might be that you're trying to deposit a
> package (zip file, SWORD v1-style, which requires the use of the deposit()
> function) using the depositMultipartByMethod function.  This requires a
> multipart file, which can be created using the packager_atom_multipart.php
> class.  For an example of this in use, see
> test/test-packager-atom_multipart.php
>
>
> Thanks,
>
>
>
> Stuart
>
>
> --
>
> Hayden Young
>
> Managing Director
>
> Wijiti Pty Ltd
>
> p. +61 (0) 08 6398 5010
>
> e. haydenyo...@wijiti.com
>
> w. www.wijiti.com
>
> vcard. www.wijiti.com/vcard/haydenyoung.vcf
>
>
> NOTICE
>
> This e-mail and any attachments are intended for the addressee(s) only and
> may be confidential. They may contain legally privileged or copyright
> material. You should not read, copy, use or disclose them without
> authorization. If you are not the intended recipient please contact the
> sender as soon as possible by return e-mail and then please delete both
> messages. This notice should not be removed.
>
>
>
> ------------------------------------------------------------------------------
>
> Live Security Virtual Conference
>
> Exclusive live event will cover all the ways today's security and
>
> threat landscape has changed and how IT managers can respond. Discussions
>
> will include endpoint security, mobile security and the latest in malware
>
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
> _______________________________________________
>
> sword-app-tech mailing list
>
> sword-app-tech@lists.sourceforge.net
>
> https://lists.sourceforge.net/lists/listinfo/sword-app-tech
>
>
>
>
> --
>
> Hayden Young
>
> Managing Director
>
> Wijiti Pty Ltd
>
> p. +61 (0) 08 6398 5010
>
> e. haydenyo...@wijiti.com
>
> w. www.wijiti.com
>
> vcard. www.wijiti.com/vcard/haydenyoung.vcf
>
>
> NOTICE
>
> This e-mail and any attachments are intended for the addressee(s) only and
> may be confidential. They may contain legally privileged or copyright
> material. You should not read, copy, use or disclose them without
> authorization. If you are not the intended recipient please contact the
> sender as soon as possible by return e-mail and then please delete both
> messages. This notice should not be removed.
>
>
>
> ------------------------------------------------------------------------------
>
> Live Security Virtual Conference
>
> Exclusive live event will cover all the ways today's security and
>
> threat landscape has changed and how IT managers can respond. Discussions
>
> will include endpoint security, mobile security and the latest in malware
>
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
> _______________________________________________
>
> sword-app-tech mailing list
>
> sword-app-tech@lists.sourceforge.net
>
> https://lists.sourceforge.net/lists/listinfo/sword-app-tech
>
>
>
>
> --
>
> Richard Jones,
>
> Founder, Cottage Labs
> t: @richard_d_jones, @cottagelabs
> w: http://cottagelabs.com
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> sword-app-tech mailing list
> sword-app-tech@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sword-app-tech
>
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
>
>
> _______________________________________________
> sword-app-tech mailing list
> sword-app-tech@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sword-app-tech
>
>
> --
> Hayden Young
> Managing Director
> Wijiti Pty Ltd
> p. +61 (0) 08 6398 5010
> e. haydenyo...@wijiti.com
> w. www.wijiti.com
> vcard. www.wijiti.com/vcard/haydenyoung.vcf
>
> NOTICE
> This e-mail and any attachments are intended for the addressee(s) only and
> may be confidential. They may contain legally privileged or copyright
> material. You should not read, copy, use or disclose them without
> authorization. If you are not the intended recipient please contact the
> sender as soon as possible by return e-mail and then please delete both
> messages. This notice should not be removed.
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> sword-app-tech mailing list
> sword-app-tech@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sword-app-tech
>



-- 

Richard Jones,

Founder, Cottage Labs
t: @richard_d_jones, @cottagelabs
w: http://cottagelabs.com

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
sword-app-tech mailing list
sword-app-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sword-app-tech

Reply via email to