Support #10206
closedError calling WorkspaceFolder.exists function
100%
Description
I get the following exception when I call the WorkspaceFolder.exists function.
17:06:14.595 [catalina-exec-10] DEBUG TwCrawler: createResFolder
17:06:14.595 [catalina-exec-10] DEBUG TwCrawler: root folder for user salvam = /Workspace
17:06:14.595 [catalina-exec-10] DEBUG TwCrawler: Checking for folder TwitterMonitor
17:06:14.601 [DefaultQuartzScheduler_Worker-10] ERROR TwCrawler: Internal error
org.gcube.common.homelibrary.home.exceptions.InternalErrorException: org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException: html
at org.gcube.common.homelibrary.jcr.workspace.JCRWorkspace.exists(JCRWorkspace.java:1781)
at org.gcube.common.homelibrary.jcr.workspace.JCRAbstractWorkspaceFolder.exists(JCRAbstractWorkspaceFolder.java:106)
at it.cnr.iit.wafi.gcube.twmon.crawler.TwCrawler.createResFolder(TwCrawler.java:373)
at it.cnr.iit.wafi.gcube.twmon.crawler.TwCrawler.transferFiles(TwCrawler.java:290)
at it.cnr.iit.wafi.gcube.twmon.crawler.TwCrawler.onStop(TwCrawler.java:451)
at it.cnr.iit.wafi.gcube.twmon.crawler.TwCrawler.runCrawler(TwCrawler.java:201)
at it.cnr.iit.wafi.gcube.twmon.crawler.TwCrawler.launch(TwCrawler.java:168)
at org.gcube.vremanagement.executor.pluginmanager.RunnablePlugin.run(RunnablePlugin.java:124)
at org.gcube.vremanagement.executor.scheduler.SmartExecutorTask.execute(SmartExecutorTask.java:251)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException: html
at org.gcube.common.homelibrary.jcr.workspace.servlet.JCRSession.getItemById(JCRSession.java:308)
at org.gcube.common.homelibrary.jcr.workspace.JCRWorkspace.exists(JCRWorkspace.java:1769)
... 10 common frames omitted
The code in which I get the error is:
logger.debug("Checking for folder " + folderName);
path = path + "/" + folderName;
if(!currFolder.exists(folderName))
{
logger.debug("Creating folder " + folderName);
WorkspaceFolder newFolder = currFolder.createFolder(folderName, "descr");
I check if a folder exists before I try to create it.
currFolder contains a reference to "/Workspace" of user "salvam".
The first time I ran this code, when the TwitterMonitor (no blanks) folder did not exist, it gave no error but I don't see the folder in the Workspace.
The Home libraries loaded by maven are:
home-library-jcr-2.11.1-SNAPSHOT.jar
home-library-2.10.0-SNAPSHOT.jar
home-library-model-1.7.1-SNAPSHOT.jar
The plugin in which I get the error is TwMonCrawler installed on node19.d4science.org.
Files
Updated by Andrea Dell'Amico about 8 years ago
- Assignee changed from _InfraScience Systems Engineer to Roberto Cirillo
Updated by Roberto Cirillo about 8 years ago
- Assignee changed from Roberto Cirillo to Costantino Perciante
Please, @costantino.perciante@isti.cnr.it could you check this issue?
Updated by Costantino Perciante about 8 years ago
This code works for me
// you have already set token and context...
Workspace ws = HomeLibrary
.getHomeManagerFactory()
.getHomeManager()
.getHome().getWorkspace();
// get your workspace home by path, then check if under it a folder named TwitterMonitor exists
JCRWorkspaceFolder folder = ((JCRWorkspaceFolder)ws.getItemByPath("/Workspace"));
System.out.println("Folder is " + folder.exists("TwitterMonitor"));
Let me know if it helps
Updated by Salvatore Minutoli almost 8 years ago
I updated the code using the code you suggested and I'm going to test the plugin. Note however that the plugin uses a gcube key instead of token and context.
I updated the plugin in my Workspace.
Can you restart the node19 VM, please?
Updated by Roberto Cirillo almost 8 years ago
- Status changed from New to Feedback
- Assignee changed from Costantino Perciante to Salvatore Minutoli
The plugins have been reinstalled as requested.
Updated by Salvatore Minutoli almost 8 years ago
- Assignee changed from Salvatore Minutoli to Costantino Perciante
Sorry, there was an error in my previous code.
I updated the TwMonCrawler plugin.
Can you reinstall the plugin on node19 VM?
I saw that the plugins launched on twittermon1.d4science.org are still running (the SmartExecutor.stop did not work in that version) and are unnecessarily keeping some Twitter connections open.
Can you restart also the twittermon1 VM?
Updated by Costantino Perciante almost 8 years ago
- Assignee changed from Costantino Perciante to Roberto Cirillo
@roberto.cirillo@isti.cnr.it could you check it? Thanks
Updated by Roberto Cirillo almost 8 years ago
- Assignee changed from Roberto Cirillo to Salvatore Minutoli
I've reinstalled the plugins on node19 and twittermon1 VMs.
Updated by Salvatore Minutoli almost 8 years ago
- Assignee changed from Salvatore Minutoli to Roberto Cirillo
I need to reload the TwMonCrawler plugin on node19 VM.
Updated by Roberto Cirillo almost 8 years ago
Salvatore Minutoli wrote:
I need to reload the TwMonCrawler plugin on node19 VM.
Done
Updated by Salvatore Minutoli almost 8 years ago
- Assignee changed from Roberto Cirillo to Costantino Perciante
I used the code suggested by @costantino.perciante@isti.cnr.it in which I substituted 'getHome()' with 'getHome('username')' since the plugin needs to use the workspace of the user that requested the task (that is not the user who runs the plugin).
The code seems to work correctly but I can't see the folders in my workspace (I'm using my account for these tests). However after I created the folders and wrote a file I get a link that contains the file.
The result is that I try to create the files, for the user 'salvam',
/Workspace/TwitterMonitor/TempData/Crawler_94/out_94.res
corresponding to the link
http://data-d.d4science.org/SEFwRFlPOThtektzSjRKT2orZ3RaVUI3d2s5Mjd2MUpHbWJQNStIS0N6Yz0
and
/Workspace/TwitterMonitor/TempData/Crawler_95/out_95.res
corresponding to the link
http://data-d.d4science.org/SmNVcEp0aHZORG1zSjRKT2orZ3RaZjdJTzc5OHNuQzZHbWJQNStIS0N6Yz0
Using the links I can download the files but I don't see the files and folders in my workspace.
Can you find where are the files created?
Is the workspace for a user unique across the different scopes?
Updated by Costantino Perciante almost 8 years ago
Salvatore Minutoli wrote:
I used the code suggested by @costantino.perciante@isti.cnr.it in which I substituted 'getHome()' with 'getHome('username')' since the plugin needs to use the workspace of the user that requested the task (that is not the user who runs the plugin).
The code seems to work correctly but I can't see the folders in my workspace (I'm using my account for these tests). However after I created the folders and wrote a file I get a link that contains the file.The result is that I try to create the files, for the user 'salvam',
/Workspace/TwitterMonitor/TempData/Crawler_94/out_94.res
corresponding to the link
http://data-d.d4science.org/SEFwRFlPOThtektzSjRKT2orZ3RaVUI3d2s5Mjd2MUpHbWJQNStIS0N6Yz0and
/Workspace/TwitterMonitor/TempData/Crawler_95/out_95.res
corresponding to the link
http://data-d.d4science.org/SmNVcEp0aHZORG1zSjRKT2orZ3RaZjdJTzc5OHNuQzZHbWJQNStIS0N6Yz0Using the links I can download the files but I don't see the files and folders in my workspace.
The links you provided point to these files:
/Workspace/TwitterMonitor/TempData/Crawler_94/out_000.res
http://data-d.d4science.org/SEFwRFlPOThtektzSjRKT2orZ3RaVUI3d2s5Mjd2MUpHbWJQNStIS0N6Yz0
and
/Workspace/TwitterMonitor/TempData/Crawler_95/out_000.res
http://data-d.d4science.org/SmNVcEp0aHZORG1zSjRKT2orZ3RaZjdJTzc5OHNuQzZHbWJQNStIS0N6Yz0
which actually exist in your workspace. Moreover, I don't see any kind of rename operation. Are you sure you created the files with names out_94.res and out_95.res?
Is the workspace for a user unique across the different scopes?
Yes, it is
Updated by Salvatore Minutoli almost 8 years ago
- File Screenshot.png Screenshot.png added
You are right about the file names. They are both out_000.res .
However I don't see them in the workspace.
Am I looking in the wrong place?
This is the page I see (at https://sobigdata.d4science.org/group/sobigdata-gateway/workspace): see the Screenshot.png picture.
Note that there is a directory called 'Twitter Monitor' with the space after 'Twitter' that is not the name I am using (TwitterMonitor without spaces).
Updated by Costantino Perciante almost 8 years ago
Yep, but the files were created in the development infrastructure (https://next.d4science.org/group/next/workspace)
I can see them there... where did you want to create them?
Updated by Salvatore Minutoli almost 8 years ago
Ok. So each user can have more than one workspace depending on the infrastructure and the scope.
Can you confirm that when the plugin will be launched from the development SoBigData.eu scope the files will be created at the page I was looking?
If yes, you can close the ticket.
Updated by Costantino Perciante almost 8 years ago
- Status changed from Feedback to Closed
Salvatore Minutoli wrote:
Ok. So each user can have more than one workspace depending on the infrastructure and the scope.
Can you confirm that when the plugin will be launched from the development SoBigData.eu scope the files will be created at the page I was looking?
If yes, you can close the ticket.
Sure, they will be there when the plugin will run in "production".
Let me be clear: we have 2 different workspaces (actually 3, we have one also for preprod, but no worries), one is for production and the other one for development.
The workspace in production is accessible by every scope you have access in production. The same applies in development.
Hope this clarifies a bit its behaviour.