Does this also apply to a community, not just an item?  We have some 
communities that are also added for some reason.

Jake

--
Jake Cameron, BCS(UNB)
Systems Support Specialist III
Information Systems and Technical Services University of Lethbridge Library
Phone:(403)329-2756
This e-mail, including any and all attachments, is only for the use of the 
intended recipient(s) and may contain information that is confidential or 
privileged. If you are not the intended recipient, you are advised that any 
dissemination, copying or other use of this e-mail is prohibited. Please notify 
the sender of the error in communication by return e-mail and destroy all 
copies of this e-mail. Thank you.

-----Original Message-----
From: Mark H. Wood,UL 0115A,+1 317 274 0749, <[email protected]> On Behalf Of 
Mark H. Wood
Sent: February 23, 2023 6:41 AM
To: [email protected]
Subject: Re: [dspace-tech] Creating Submission Workflows

On Thu, Feb 23, 2023 at 08:29:49AM -0500, Mark H. Wood wrote:
> On Wed, Feb 22, 2023 at 05:55:05PM +0000, Cameron, Jacob wrote:
> > Hello,
> > 
> > DSpace 7.4, Tomcat 9.6, Postgres 13.
> > 
> > I've created 5 new workflows.  4 of the 5 work fine.  The 5th one seems to 
> > throw an error in the DSpace log.  It's setup the same as the other new 
> > workflows.
> > 
> > It gives me a "You have not the privilege to make a new submission." error. 
> >  However, everything is named properly and showing up the way I would 
> > expect.  I've verified things, checked things over, and even tried using 
> > the traditional input form with no changes and it still throws the error.
> > 
> > The error in the dspace.log is: 
> > 
> > 2023-02-22 09:45:17,632 INFO  586a38e2-042e-4f50-b051-1c80b6adff77 
> > e1fe0995-92e8-4ab3-a934-ae60dea3bb91 
> > org.dspace.content.WorkspaceItemServiceImpl @ 
> > [email protected]::create_workspace_item:workspace_item_i
> > d=8975item_id=d1cc3391-444a-4b8e-a022-3ea108640ebbcollection_id=3493
> > 47e2-4e50-43f1-9bec-df5f77b1972f
> > 2023-02-22 09:45:17,883 ERROR 586a38e2-042e-4f50-b051-1c80b6adff77 
> > e1fe0995-92e8-4ab3-a934-ae60dea3bb91 
> > org.dspace.app.rest.exception.DSpaceApiExceptionControllerAdvice @ 
> > An exception has occurred (status:500)
> > java.lang.ClassCastException: class org.dspace.content.Item cannot 
> > be cast to class org.dspace.content.Collection 
> > (org.dspace.content.Item and org.dspace.content.Collection are in 
> > unnamed module of loader 
> > org.apache.catalina.loader.ParallelWebappClassLoader @25cc7470)
> 
> This happened to me as well.  You have mapped that submission-name to 
> the Handle of an Item, not a Collection, in 'config/item-submission.xml'.

A patch that causes SubmissionConfigReader to reject the unusable mapping with 
a log message, instead of crashing:

diff --git 
a/dspace-api/src/main/java/org/dspace/app/util/SubmissionConfigReader.java 
b/dspace-api/src/main/java/org/dspace/app/util/SubmissionConfigReader.java
index 2120848358..35399fba4e 100644
--- a/dspace-api/src/main/java/org/dspace/app/util/SubmissionConfigReader.java
+++ b/dspace-api/src/main/java/org/dspace/app/util/SubmissionConfigReade
+++ r.java
@@ -22,6 +22,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.logging.log4j.Logger;  import org.dspace.content.Collection; 
 import org.dspace.content.DSpaceObject;
+import org.dspace.core.Constants;
 import org.dspace.core.Context;
 import org.dspace.handle.factory.HandleServiceFactory;
 import org.dspace.services.factory.DSpaceServicesFactory;
@@ -628,7 +629,12 @@ public class SubmissionConfigReader {
                     DSpaceObject result = 
HandleServiceFactory.getInstance().getHandleService()
                                                               
.resolveToObject(context, handle);
                     if (result != null) {
-                        results.add((Collection) result);
+                        if (!(result instanceof Collection)) {
+                            log.error("{} is a {}, not a Collection",
+                                    handle, 
Constants.typeText[result.getType()]);
+                        } else {
+                            results.add((Collection) result);
+                        }
                     }
                 }
             }

--
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu

--
All messages to this mailing list should adhere to the Code of Conduct: 
https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
---
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/Y/ds85yhkkcKiVl7%40IUPUI.Edu.

-- 
All messages to this mailing list should adhere to the Code of Conduct: 
https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
--- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/YQBPR0101MB50319FB24ECA7C5C041C2E9F84AB9%40YQBPR0101MB5031.CANPRD01.PROD.OUTLOOK.COM.

Reply via email to