Hi,
I got this error as well, but as far as i can tell it's exactly what it
says, there is no eperson or group and this exception is explicitly thrown.
At least when the harvest is invoked by the scheduler, not the command
line, or from UI scenarios.
My previous issue was that the HARVESTED_COLLECTION entity was not updated,
and was stuck with a status of QUEUED even though the harvest completed
without error, should have been put back into status of READY.
So I checked if the error was still in DSpace 6.3, checked out repo for tag
dspace-6.3, compiled installed etc.
First the exception trace line numbers were wrong, this was because the
build doubled up on DSpace JARs in the dspace lib directory, and for my
XMLUI webapp lib dir. So I removed the older 6.0 versions to get the
correct line numbers in the trace.
2018-11-02 11:36:37,490 ERROR org.dspace.harvest.OAIHarvester @ Error
occurred while generating an OAI response: We need at least an eperson or a
group in order to create a resource policy. null
java.lang.IllegalArgumentException: We need at least an eperson or a group
in order to create a resource policy.
at
org.dspace.authorize.AuthorizeServiceImpl.createResourcePolicy(AuthorizeServiceImpl.java:777)
at
org.dspace.authorize.AuthorizeServiceImpl.addPolicy(AuthorizeServiceImpl.java:533)
at
org.dspace.content.WorkspaceItemServiceImpl.create(WorkspaceItemServiceImpl.java:99)
at org.dspace.harvest.OAIHarvester.processRecord(OAIHarvester.java:539)
at org.dspace.harvest.OAIHarvester.runHarvest(OAIHarvester.java:367)
at org.dspace.harvest.HarvestThread.runHarvest(HarvestThread.java:57)
at org.dspace.harvest.HarvestThread.run(HarvestThread.java:41)
at java.lang.Thread.run(Unknown Source)
which leads you here.
@Override
public ResourcePolicy createResourcePolicy(Context context, DSpaceObject dso,
Group group, EPerson eperson, int type, String rpType) throws SQLException,
AuthorizeException {
if(group == null && eperson == null)
{
throw new IllegalArgumentException("We need at least an eperson or a
group in order to create a resource policy.");
}
ResourcePolicy myPolicy = resourcePolicyService.create(context);
myPolicy.setdSpaceObject(dso);
myPolicy.setAction(type);
myPolicy.setGroup(group);
myPolicy.setEPerson(eperson);
myPolicy.setRpType(rpType);
resourcePolicyService.update(context, myPolicy);
return myPolicy;
}
For a scheduled harvest, there is no session, so no current user in the
context? Or is there some default? Think previously it might have been the
system admin created by 'dspace create-administrator' command.
...
// Create an item
Item item = itemService.create(context, workspaceItem);
item.setSubmitter(context.getCurrentUser());
...
and group is passed as null, so both eperson and group are null.
This is a brand new fresh install, and i didn't explicitly create any
polices for the collection i created. I can't see any config option for an
eperson to use for the scheduled scenario.
I'll keep digging, but I'm not familiar with DSpace, does KevinVdV still
work on this project, he seems to have written much of this code?
Cheers
KevinG
On Wednesday, 12 September 2018 16:42:34 UTC+10, euler wrote:
>
> Dear All,
>
> I'm having trouble using the automatic harvest scheduler both in the XMLUI
> and in the command line. The version of DSpace the server is running on is
> 6.3. When I use the command line (dspace harvest -S), the command line
> returned the following error:
>
> Starting harvest loop... running.
> org.dspace.core.exception.DatabaseSchemaValidationException: The schema
> validator returned: null
> at org.dspace.core.Context.init(Context.java:170)
> at org.dspace.core.Context.<init>(Context.java:126)
> at
> org.dspace.harvest.HarvestScheduler.scheduleLoop(HarvestScheduler.java:149)
> at
> org.dspace.harvest.HarvestScheduler.run(HarvestScheduler.java:140)
> at java.lang.Thread.run(Unknown Source)
> Exception in thread "Thread-4"
> org.dspace.core.exception.DatabaseSchemaValidationException: The schema
> validator returned: null
> at org.dspace.core.Context.init(Context.java:170)
> at org.dspace.core.Context.<init>(Context.java:126)
> at
> org.dspace.harvest.HarvestScheduler.scheduleLoop(HarvestScheduler.java:234)
> at
> org.dspace.harvest.HarvestScheduler.run(HarvestScheduler.java:140)
> at java.lang.Thread.run(Unknown Source)
>
>
> The log showed the message below after running the command dspace harvest
> -S:
>
> 2018-09-12 13:14:57,708 FATAL org.dspace.core.Context @ Cannot obtain the
> bean which provides a database connection. Check previous entries in the
> dspace.log to find why the db failed to initialize. The schema validator
> returned: null
> 2018-09-12 13:14:57,709 ERROR org.dspace.harvest.HarvestScheduler @
> Exception on iteration: 0
> 2018-09-12 13:14:57,713 FATAL org.dspace.core.Context @ Cannot obtain the
> bean which provides a database connection. Check previous entries in the
> dspace.log to find why the db failed to initialize. The schema validator
> returned: null
>
> When using the Harvesting tab in the XMLUI control panel, after clicking
> Start Harvester, the page returned this message:
>
> failed to lazily initialize a collection of role:
> org.dspace.content.DSpaceObject.metadata, could not initialize proxy - no
> Session
>
> Although when I press the back button of the browser, the status says that
> the scheduler is waiting for collections to harvest. It seems that the
> automatic scheduler from the UI is now running although it didn't harvest
> any new items from the collections that I've set up for harvesting because
> I have been receiving email messages from the server informing me of a
> Harvest error. Below is the content of the harvest error message:
>
> Collection 5bee1194-648c-4136-8671-ddc43fc3f85f failed on harvest:
>
> Date: 9/11/18 6:25 PM
> Status Flag: -1
>
> We need at least an eperson or a group in order to create a resource
> policy.
>
> Exception:
> java.lang.IllegalArgumentException: We need at least an eperson or a
> group in order to create a resource policy.
> at org.dspace.authorize.AuthorizeServiceImpl.createResourcePolicy(
> AuthorizeServiceImpl.java:777)
> at org.dspace.authorize.AuthorizeServiceImpl.addPolicy(
> AuthorizeServiceImpl.java:533)
> at org.dspace.content.WorkspaceItemServiceImpl.create(
> WorkspaceItemServiceImpl.java:99)
> at org.dspace.harvest.OAIHarvester.processRecord(
> OAIHarvester.java:539)
> at org.dspace.harvest.OAIHarvester.runHarvest(
> OAIHarvester.java:367)
> at org.dspace.harvest.HarvestThread.runHarvest(
> HarvestThread.java:57)
> at org.dspace.harvest.HarvestThread.run(HarvestThread.java:41)
> at java.lang.Thread.run(Unknown Source)
>
> So I would like to ask for help if anyone have ever encountered the errors
> above and how did you resolve it? I tried to harvest the collection that is
> giving me these errors in the dspace demo site using the same harvest_type
> and metadata_format and the harvest is successful. I just want to harvest
> automatically so that I don't have to run the harvest manually.
>
> Thanks in advance,
> euler
>
--
All messages to this mailing list should adhere to the DuraSpace Code of
Conduct: https://duraspace.org/about/policies/code-of-conduct/
---
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.