You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Jacques Granduel <jg...@gmail.com> on 2010/03/16 12:48:11 UTC

Accessing workspace other than default ?

Hi all,

I'm new to Jackrabbit, and I'm exploring JCR specs with it.
I've been able to create a new workspace

//org.apache.jackrabbit.core.XAWorkspace
W = session.getWorkspace()
org.apache.jackrabbit.core.WorkspaceImpl(W).createWorkspace("W2")
session.save()

The W2 workspace is created in Jackrabbit/repository/workspaces/W2 as
expected.
I cannot access this workspace with a url :
http://localhost:8080/server
Available Workspace Resources:
    * default
    * security
http://localhost:8080/server/W2
<dcr:class>javax.jcr.NoSuchWorkspaceException</dcr:class>
<dcr:message>W2</dcr:message>

idem with http://localhost:8080/repository/W3

Could you tell what I should do to make it accessible from a URL ?

BTW, I don't understand why a workspace is needed in WorkspaceImpl
constructor.

Thanks in advance,
Best regards
jgr

Re: Accessing workspace other than default ?

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Tue, Mar 16, 2010 at 2:52 PM, Joseph Ottinger <dr...@gmail.com> wrote:
> I was thinking something like a "howto" with sample code.

The Jackrabbit wiki at http://wiki.apache.org/jackrabbit/ is open for
anyone to add such howto material.

BR,

Jukka Zitting

Re: Accessing workspace other than default ?

Posted by Justin Edelson <ju...@gmail.com>.
> @Justin
> Could you tell your all process, as I'm now confused with the paths and
> locks ;-)!!

I'm using Sling with an embedded Jackrabbit 2 repository. The code which
calls createWorkspace() is running in-process.

>From JCR-2003, you can see that createWorkspace() isn't supported when
remoting via DavEx. It might over RMI. In any case, I would recommend
finding a way to execute code in the Jackrabbit JVM.

As for locks... the Jackrabbit home directory
(file:///Path/to/Jackrabbit/Test/jackrabbit) can only be used by one JVM
at a time.

But you got the workspace.xml file to be created, so you're obviously
able to get the workspace created. What persistence manager are you using?

Justin


On 3/16/10 1:50 PM, Jacques Granduel wrote:
> Thanks for fixing the FAQ...
> 
> Could you tell me how you created the workspace :
> I put jackrabbit-standalone-2.0.0.jar in folder Tests. So there's only the
> java in the folder
> 
> --repo path/to/jackrabbit //<< what is the repository to make it accessible
> as URL?
> 
>> java -Xmx256m -jar jackrabbit-standalone-2.0.0.jar
> -> creates jackrabbit/...
> 
> 1. connection thru url
> rep = JcrUtils.getRepository("http://localhost:8080/server")
> ssn = rep.login(creds)
> root = ssn.getRootNode()
> root.addNode("N1")
> ssn.save()
> -> OK
> ssn.getWorkspace().createWorkspace("W2")
> -> java.lang.UnsupportedOperationException: JCR-2003. Implementation
> missing.This is OK
> 
> 2. connection thru file pseudo-protocol:
> r = JcrUtils.getRepository("file:///Path/to/Jackrabbit/Test/jackrabbit")
> ssn = r.login(creds)
> javax.jcr.RepositoryException: The repository home
> Path\to\Jackrabbit\Test\jackrabbit appears to be in use since the file named
> .lock is lo
> cked by another process.
> ??
> 
> 3. Stopping Jackrabbit server and redoing 2. is OK
> r = JcrUtils.getRepository("file:///Path/to/Jackrabbit/Test/jackrabbit")
> ssn = r.login(creds)
> ssn.getWorkspace().createWorkspace("W3") //good W3 is available with
> http://localhost:8080/server/W3
> But I have to stop Jackrabbit because of the .lock file
> 
> 4.jackrabbit running
>> java -Xmx256m -jar jackrabbit-standalone-2.0.0.jar
> 
> in the same folder as jackrabbit
> r = JcrUtils.getRepository()
> ssn = r.login(creds)
> --> creates a new "repository" folder!
> ssn.getWorkspace().createWorkspace("W3")
> -> is created in repository/workspaces/W3 instead of
> jackrabbit/repository/workspaces/W3
> 
> Hope I'm clear in this simple use cases and that I reported everything
> correctly!
> 
> @Justin
> Could you tell your all process, as I'm now confused with the paths and
> locks ;-)!!
> 
> Cheers, jgr
> 
> 
> 
> 
> 
> 2010/3/16 Alexander Klimetschek <ak...@day.com>
> 
>> On Tue, Mar 16, 2010 at 15:43, Justin Edelson <ju...@gmail.com>
>> wrote:
>>> I created JCR-2571 for this.
>>
>> Thanks, I fixed it. (Note that we have a separate JCRSITE project in
>> the ASF jira for jackrabbit website related stuff).
>>
>>> I would still recommend referring to the spec first.
>>
>> My usual advise: download the spec pdf, print it and read most parts
>> before doing major coding or design decisions. It's a good read.
>>
>> Regards,
>> Alex
>>
>> --
>> Alexander Klimetschek
>> alexander.klimetschek@day.com
>>
> 


Re: Accessing workspace other than default ?

Posted by Jacques Granduel <jg...@gmail.com>.
Thanks for fixing the FAQ...

Could you tell me how you created the workspace :
I put jackrabbit-standalone-2.0.0.jar in folder Tests. So there's only the
java in the folder

--repo path/to/jackrabbit //<< what is the repository to make it accessible
as URL?

>java -Xmx256m -jar jackrabbit-standalone-2.0.0.jar
-> creates jackrabbit/...

1. connection thru url
rep = JcrUtils.getRepository("http://localhost:8080/server")
ssn = rep.login(creds)
root = ssn.getRootNode()
root.addNode("N1")
ssn.save()
-> OK
ssn.getWorkspace().createWorkspace("W2")
-> java.lang.UnsupportedOperationException: JCR-2003. Implementation
missing.This is OK

2. connection thru file pseudo-protocol:
r = JcrUtils.getRepository("file:///Path/to/Jackrabbit/Test/jackrabbit")
ssn = r.login(creds)
javax.jcr.RepositoryException: The repository home
Path\to\Jackrabbit\Test\jackrabbit appears to be in use since the file named
.lock is lo
cked by another process.
??

3. Stopping Jackrabbit server and redoing 2. is OK
r = JcrUtils.getRepository("file:///Path/to/Jackrabbit/Test/jackrabbit")
ssn = r.login(creds)
ssn.getWorkspace().createWorkspace("W3") //good W3 is available with
http://localhost:8080/server/W3
But I have to stop Jackrabbit because of the .lock file

4.jackrabbit running
>java -Xmx256m -jar jackrabbit-standalone-2.0.0.jar

in the same folder as jackrabbit
r = JcrUtils.getRepository()
ssn = r.login(creds)
--> creates a new "repository" folder!
ssn.getWorkspace().createWorkspace("W3")
-> is created in repository/workspaces/W3 instead of
jackrabbit/repository/workspaces/W3

Hope I'm clear in this simple use cases and that I reported everything
correctly!

@Justin
Could you tell your all process, as I'm now confused with the paths and
locks ;-)!!

Cheers, jgr





2010/3/16 Alexander Klimetschek <ak...@day.com>

> On Tue, Mar 16, 2010 at 15:43, Justin Edelson <ju...@gmail.com>
> wrote:
> > I created JCR-2571 for this.
>
> Thanks, I fixed it. (Note that we have a separate JCRSITE project in
> the ASF jira for jackrabbit website related stuff).
>
> > I would still recommend referring to the spec first.
>
> My usual advise: download the spec pdf, print it and read most parts
> before doing major coding or design decisions. It's a good read.
>
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com
>

Re: Accessing workspace other than default ?

Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, Mar 16, 2010 at 15:43, Justin Edelson <ju...@gmail.com> wrote:
> I created JCR-2571 for this.

Thanks, I fixed it. (Note that we have a separate JCRSITE project in
the ASF jira for jackrabbit website related stuff).

> I would still recommend referring to the spec first.

My usual advise: download the spec pdf, print it and read most parts
before doing major coding or design decisions. It's a good read.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: Accessing workspace other than default ?

Posted by Justin Edelson <ju...@gmail.com>.
I created JCR-2571 for this. I would still recommend referring to the
spec first. I sent you some additional questions about this problem
earlier. As I said in that email, I am using this API and it is working
fine for me.

Justin

On 3/16/10 10:32 AM, Jacques Granduel wrote:
> Hi all,
> 
> tried on another configuration with no success!
> 
> I tried to remember why I ended up using the
> org.apache.jackrabbit.core.WorkspaceImpl(W).createWorkspace("W2") method
> so went back to google "JCR create workspace"
> first link :
> <http://jackrabbit.apache.org/frequently-asked-questions.html>The *JCR* API
> does not contain features for *creating* or managing *workspaces*, so you
> need to use Jackrabbit-specific functionality for *creating* new *workspaces
> *. *...*
> jackrabbit.apache.org/frequently-asked-questions.html
> 
> following the link...
> 
> How do I create new workspaces in Jackrabbit?
> 
> The JCR API does not contain features for creating or managing workspaces,
> so you need to use Jackrabbit-specific functionality for creating new
> workspaces. You can create a new workspace either manually or
> programmatically.
> 
> The manual way is to create a new workspace directory within the repository
> home directory and to place a new workspace.xml configuration file in that
> folder. You can use the configuration file of an existing workspace as an
> example, just remember to change the name of the workspace in the Workspace
> name="..." tag. See the Jackrabbit
> Configuration<http://jackrabbit.apache.org/jackrabbit-configuration.html>page
> for configuration details. Note also that you need to restart the
> repository instance to access the new workspace.
> 
> The programmatic way is to acquire a Workspace instance using the normal JCR
> API and to cast the instance to the JackrabbitWorkspace interface. You can
> then use the createWorkspace(String) method to create new workspaces.
> I was misguided by the first paragraph... Who could update the FAQ?
> thx
> jgr
> 
> 
> 
> 
> 2010/3/16 Joseph Ottinger <dr...@gmail.com>
> 
>> The only issue I have with the primer so far: no code! (That's not to say
>> Jochen didn't do a really, really good job, because it's an excellent
>> primer
>> on concepts.)
>>
>> I was thinking something like a "howto" with sample code. The first hops
>> are
>> okay, but they're so light that they're not workable in practice. No
>> locking, and they're JSR170 rather than the JCR 2.0 spec...
>>
>> On Tue, Mar 16, 2010 at 9:00 AM, Joseph Ottinger <dreamreal@gmail.com
>>> wrote:
>>
>>> Thanks, Rakesh. Reading further now.
>>>
>>>
>>> On Tue, Mar 16, 2010 at 8:42 AM, Rakesh Vidyadharan <rakesh@sptci.com
>>> wrote:
>>>
>>>>
>>>> On 16 Mar 2010, at 07:35, Joseph Ottinger wrote:
>>>>
>>>>> Is there a wiki that's collecting the "right way" to do all this
>> stuff?
>>>>
>>>> The "right way" is usually to try and use only the JCR API (similar to
>>>> using JDBC for instance).  Google for JCR tutorials and you will get
>> some
>>>> good links.
>>>>
>>>> http://jtoee.com/jsr-170/the_jcr_primer/
>>>>
>>>> Rakesh
>>>
>>>
>>>
>>>
>>> --
>>> Joseph B. Ottinger
>>> http://enigmastation.com
>>>
>>
>>
>>
>> --
>> Joseph B. Ottinger
>> http://enigmastation.com
>>
> 


Re: Accessing workspace other than default ?

Posted by Jacques Granduel <jg...@gmail.com>.
Hi all,

tried on another configuration with no success!

I tried to remember why I ended up using the
org.apache.jackrabbit.core.WorkspaceImpl(W).createWorkspace("W2") method
so went back to google "JCR create workspace"
first link :
<http://jackrabbit.apache.org/frequently-asked-questions.html>The *JCR* API
does not contain features for *creating* or managing *workspaces*, so you
need to use Jackrabbit-specific functionality for *creating* new *workspaces
*. *...*
jackrabbit.apache.org/frequently-asked-questions.html

following the link...

How do I create new workspaces in Jackrabbit?

The JCR API does not contain features for creating or managing workspaces,
so you need to use Jackrabbit-specific functionality for creating new
workspaces. You can create a new workspace either manually or
programmatically.

The manual way is to create a new workspace directory within the repository
home directory and to place a new workspace.xml configuration file in that
folder. You can use the configuration file of an existing workspace as an
example, just remember to change the name of the workspace in the Workspace
name="..." tag. See the Jackrabbit
Configuration<http://jackrabbit.apache.org/jackrabbit-configuration.html>page
for configuration details. Note also that you need to restart the
repository instance to access the new workspace.

The programmatic way is to acquire a Workspace instance using the normal JCR
API and to cast the instance to the JackrabbitWorkspace interface. You can
then use the createWorkspace(String) method to create new workspaces.
I was misguided by the first paragraph... Who could update the FAQ?
thx
jgr




2010/3/16 Joseph Ottinger <dr...@gmail.com>

> The only issue I have with the primer so far: no code! (That's not to say
> Jochen didn't do a really, really good job, because it's an excellent
> primer
> on concepts.)
>
> I was thinking something like a "howto" with sample code. The first hops
> are
> okay, but they're so light that they're not workable in practice. No
> locking, and they're JSR170 rather than the JCR 2.0 spec...
>
> On Tue, Mar 16, 2010 at 9:00 AM, Joseph Ottinger <dreamreal@gmail.com
> >wrote:
>
> > Thanks, Rakesh. Reading further now.
> >
> >
> > On Tue, Mar 16, 2010 at 8:42 AM, Rakesh Vidyadharan <rakesh@sptci.com
> >wrote:
> >
> >>
> >> On 16 Mar 2010, at 07:35, Joseph Ottinger wrote:
> >>
> >> > Is there a wiki that's collecting the "right way" to do all this
> stuff?
> >>
> >> The "right way" is usually to try and use only the JCR API (similar to
> >> using JDBC for instance).  Google for JCR tutorials and you will get
> some
> >> good links.
> >>
> >> http://jtoee.com/jsr-170/the_jcr_primer/
> >>
> >> Rakesh
> >
> >
> >
> >
> > --
> > Joseph B. Ottinger
> > http://enigmastation.com
> >
>
>
>
> --
> Joseph B. Ottinger
> http://enigmastation.com
>

Re: Accessing workspace other than default ?

Posted by Joseph Ottinger <dr...@gmail.com>.
The only issue I have with the primer so far: no code! (That's not to say
Jochen didn't do a really, really good job, because it's an excellent primer
on concepts.)

I was thinking something like a "howto" with sample code. The first hops are
okay, but they're so light that they're not workable in practice. No
locking, and they're JSR170 rather than the JCR 2.0 spec...

On Tue, Mar 16, 2010 at 9:00 AM, Joseph Ottinger <dr...@gmail.com>wrote:

> Thanks, Rakesh. Reading further now.
>
>
> On Tue, Mar 16, 2010 at 8:42 AM, Rakesh Vidyadharan <ra...@sptci.com>wrote:
>
>>
>> On 16 Mar 2010, at 07:35, Joseph Ottinger wrote:
>>
>> > Is there a wiki that's collecting the "right way" to do all this stuff?
>>
>> The "right way" is usually to try and use only the JCR API (similar to
>> using JDBC for instance).  Google for JCR tutorials and you will get some
>> good links.
>>
>> http://jtoee.com/jsr-170/the_jcr_primer/
>>
>> Rakesh
>
>
>
>
> --
> Joseph B. Ottinger
> http://enigmastation.com
>



-- 
Joseph B. Ottinger
http://enigmastation.com

Re: Accessing workspace other than default ?

Posted by Joseph Ottinger <dr...@gmail.com>.
Thanks, Rakesh. Reading further now.

On Tue, Mar 16, 2010 at 8:42 AM, Rakesh Vidyadharan <ra...@sptci.com>wrote:

>
> On 16 Mar 2010, at 07:35, Joseph Ottinger wrote:
>
> > Is there a wiki that's collecting the "right way" to do all this stuff?
>
> The "right way" is usually to try and use only the JCR API (similar to
> using JDBC for instance).  Google for JCR tutorials and you will get some
> good links.
>
> http://jtoee.com/jsr-170/the_jcr_primer/
>
> Rakesh




-- 
Joseph B. Ottinger
http://enigmastation.com

Re: Accessing workspace other than default ?

Posted by Rakesh Vidyadharan <ra...@sptci.com>.
On 16 Mar 2010, at 07:35, Joseph Ottinger wrote:

> Is there a wiki that's collecting the "right way" to do all this stuff?

The "right way" is usually to try and use only the JCR API (similar to using JDBC for instance).  Google for JCR tutorials and you will get some good links.

http://jtoee.com/jsr-170/the_jcr_primer/

Rakesh

Re: Accessing workspace other than default ?

Posted by Joseph Ottinger <dr...@gmail.com>.
Is there a wiki that's collecting the "right way" to do all this stuff?

On Tue, Mar 16, 2010 at 8:32 AM, Jacques Granduel <jg...@gmail.com>wrote:

> Hi Justin,
>
> thank you for your answer.
>
> 2010/3/16 Justin Edelson <ju...@gmail.com>
>
> > Why are you using the Jackrabbit implementation classes? The *only* way
> you
> > should be creating a workspace is via the JCR API:
> > session.getWorkspace().createWorkspace("W2"). Using internal APIs for
> > something which can be done through the JCR API is unnecessarily
> > complicated
> > and will get you into trouble (as well as being non-portable FWIW).
> >
> > Do it the correct way and if you still don't see your newly created
> > workspace via WebDav, repost to the mailing list.
> >
> Well, I do it this way... because I'm learning and the first solution I've
> found is just a wrong one...
>
> That said, I tried out the solution you provided :
> session.getWorkspace().createWorkspace("W2").
> which of course created the workspace folder in the right repository
> folder.
> But it's still invisible in the browser through
> http://localhost:8080/serveror
> http://localhost:8080/repository...
>
> Thanks for your help,
> jgr
>
> >
> > Justin
> >
> > On Tue, Mar 16, 2010 at 7:48 AM, Jacques Granduel <jgranduel@gmail.com
> > >wrote:
> >
> > > Hi all,
> > >
> > > I'm new to Jackrabbit, and I'm exploring JCR specs with it.
> > > I've been able to create a new workspace
> > >
> > > //org.apache.jackrabbit.core.XAWorkspace
> > > W = session.getWorkspace()
> > > org.apache.jackrabbit.core.WorkspaceImpl(W).createWorkspace("W2")
> > > session.save()
> > >
> > > The W2 workspace is created in Jackrabbit/repository/workspaces/W2 as
> > > expected.
> > > I cannot access this workspace with a url :
> > > http://localhost:8080/server
> > > Available Workspace Resources:
> > >    * default
> > >    * security
> > > http://localhost:8080/server/W2
> > > <dcr:class>javax.jcr.NoSuchWorkspaceException</dcr:class>
> > > <dcr:message>W2</dcr:message>
> > >
> > > idem with http://localhost:8080/repository/W3
> > >
> > > Could you tell what I should do to make it accessible from a URL ?
> > >
> > > BTW, I don't understand why a workspace is needed in WorkspaceImpl
> > > constructor.
> > >
> > > Thanks in advance,
> > > Best regards
> > > jgr
> > >
> >
>



-- 
Joseph B. Ottinger
http://enigmastation.com

Re: Accessing workspace other than default ?

Posted by Joseph Ottinger <dr...@gmail.com>.
Speaking from personal experience, MOST JCR information is hard to find. :(

On Tue, Mar 16, 2010 at 10:26 AM, Justin Edelson <ju...@gmail.com>wrote:

> On 3/16/10 8:32 AM, Jacques Granduel wrote:
> > Hi Justin,
> >
> > thank you for your answer.
> >
> > 2010/3/16 Justin Edelson <ju...@gmail.com>
> >
> >> Why are you using the Jackrabbit implementation classes? The *only* way
> you
> >> should be creating a workspace is via the JCR API:
> >> session.getWorkspace().createWorkspace("W2"). Using internal APIs for
> >> something which can be done through the JCR API is unnecessarily
> >> complicated
> >> and will get you into trouble (as well as being non-portable FWIW).
> >>
> >> Do it the correct way and if you still don't see your newly created
> >> workspace via WebDav, repost to the mailing list.
> >>
> > Well, I do it this way... because I'm learning and the first solution
> I've
> > found is just a wrong one...
> I'm just unsure how the first solution was an internal API and not a
> line of code from the spec. It's an interesting result from a
> findability perspective.
>
> >
> > That said, I tried out the solution you provided :
> > session.getWorkspace().createWorkspace("W2").
> > which of course created the workspace folder in the right repository
> folder.
> > But it's still invisible in the browser through
> http://localhost:8080/serveror
> > http://localhost:8080/repository...
>
> What version of Jackrabbit are you using?
> What persistence manager?
> Is there anything relevant in the log files?
>
> I'm using this same API call on a bit of code I'm working on now and
> it's working for me with JR 2.0.0.
>
> Justin
>
> >
> > Thanks for your help,
> > jgr
> >
> >>
> >> Justin
> >>
> >> On Tue, Mar 16, 2010 at 7:48 AM, Jacques Granduel <jgranduel@gmail.com
> >>> wrote:
> >>
> >>> Hi all,
> >>>
> >>> I'm new to Jackrabbit, and I'm exploring JCR specs with it.
> >>> I've been able to create a new workspace
> >>>
> >>> //org.apache.jackrabbit.core.XAWorkspace
> >>> W = session.getWorkspace()
> >>> org.apache.jackrabbit.core.WorkspaceImpl(W).createWorkspace("W2")
> >>> session.save()
> >>>
> >>> The W2 workspace is created in Jackrabbit/repository/workspaces/W2 as
> >>> expected.
> >>> I cannot access this workspace with a url :
> >>> http://localhost:8080/server
> >>> Available Workspace Resources:
> >>>    * default
> >>>    * security
> >>> http://localhost:8080/server/W2
> >>> <dcr:class>javax.jcr.NoSuchWorkspaceException</dcr:class>
> >>> <dcr:message>W2</dcr:message>
> >>>
> >>> idem with http://localhost:8080/repository/W3
> >>>
> >>> Could you tell what I should do to make it accessible from a URL ?
> >>>
> >>> BTW, I don't understand why a workspace is needed in WorkspaceImpl
> >>> constructor.
> >>>
> >>> Thanks in advance,
> >>> Best regards
> >>> jgr
> >>>
> >>
> >
>
>


-- 
Joseph B. Ottinger
http://enigmastation.com

Re: Accessing workspace other than default ?

Posted by Justin Edelson <ju...@gmail.com>.
On 3/16/10 8:32 AM, Jacques Granduel wrote:
> Hi Justin,
> 
> thank you for your answer.
> 
> 2010/3/16 Justin Edelson <ju...@gmail.com>
> 
>> Why are you using the Jackrabbit implementation classes? The *only* way you
>> should be creating a workspace is via the JCR API:
>> session.getWorkspace().createWorkspace("W2"). Using internal APIs for
>> something which can be done through the JCR API is unnecessarily
>> complicated
>> and will get you into trouble (as well as being non-portable FWIW).
>>
>> Do it the correct way and if you still don't see your newly created
>> workspace via WebDav, repost to the mailing list.
>>
> Well, I do it this way... because I'm learning and the first solution I've
> found is just a wrong one...
I'm just unsure how the first solution was an internal API and not a
line of code from the spec. It's an interesting result from a
findability perspective.

> 
> That said, I tried out the solution you provided :
> session.getWorkspace().createWorkspace("W2").
> which of course created the workspace folder in the right repository folder.
> But it's still invisible in the browser through http://localhost:8080/serveror
> http://localhost:8080/repository...

What version of Jackrabbit are you using?
What persistence manager?
Is there anything relevant in the log files?

I'm using this same API call on a bit of code I'm working on now and
it's working for me with JR 2.0.0.

Justin

> 
> Thanks for your help,
> jgr
> 
>>
>> Justin
>>
>> On Tue, Mar 16, 2010 at 7:48 AM, Jacques Granduel <jgranduel@gmail.com
>>> wrote:
>>
>>> Hi all,
>>>
>>> I'm new to Jackrabbit, and I'm exploring JCR specs with it.
>>> I've been able to create a new workspace
>>>
>>> //org.apache.jackrabbit.core.XAWorkspace
>>> W = session.getWorkspace()
>>> org.apache.jackrabbit.core.WorkspaceImpl(W).createWorkspace("W2")
>>> session.save()
>>>
>>> The W2 workspace is created in Jackrabbit/repository/workspaces/W2 as
>>> expected.
>>> I cannot access this workspace with a url :
>>> http://localhost:8080/server
>>> Available Workspace Resources:
>>>    * default
>>>    * security
>>> http://localhost:8080/server/W2
>>> <dcr:class>javax.jcr.NoSuchWorkspaceException</dcr:class>
>>> <dcr:message>W2</dcr:message>
>>>
>>> idem with http://localhost:8080/repository/W3
>>>
>>> Could you tell what I should do to make it accessible from a URL ?
>>>
>>> BTW, I don't understand why a workspace is needed in WorkspaceImpl
>>> constructor.
>>>
>>> Thanks in advance,
>>> Best regards
>>> jgr
>>>
>>
> 


Re: Accessing workspace other than default ?

Posted by Jacques Granduel <jg...@gmail.com>.
Hi Justin,

thank you for your answer.

2010/3/16 Justin Edelson <ju...@gmail.com>

> Why are you using the Jackrabbit implementation classes? The *only* way you
> should be creating a workspace is via the JCR API:
> session.getWorkspace().createWorkspace("W2"). Using internal APIs for
> something which can be done through the JCR API is unnecessarily
> complicated
> and will get you into trouble (as well as being non-portable FWIW).
>
> Do it the correct way and if you still don't see your newly created
> workspace via WebDav, repost to the mailing list.
>
Well, I do it this way... because I'm learning and the first solution I've
found is just a wrong one...

That said, I tried out the solution you provided :
session.getWorkspace().createWorkspace("W2").
which of course created the workspace folder in the right repository folder.
But it's still invisible in the browser through http://localhost:8080/serveror
http://localhost:8080/repository...

Thanks for your help,
jgr

>
> Justin
>
> On Tue, Mar 16, 2010 at 7:48 AM, Jacques Granduel <jgranduel@gmail.com
> >wrote:
>
> > Hi all,
> >
> > I'm new to Jackrabbit, and I'm exploring JCR specs with it.
> > I've been able to create a new workspace
> >
> > //org.apache.jackrabbit.core.XAWorkspace
> > W = session.getWorkspace()
> > org.apache.jackrabbit.core.WorkspaceImpl(W).createWorkspace("W2")
> > session.save()
> >
> > The W2 workspace is created in Jackrabbit/repository/workspaces/W2 as
> > expected.
> > I cannot access this workspace with a url :
> > http://localhost:8080/server
> > Available Workspace Resources:
> >    * default
> >    * security
> > http://localhost:8080/server/W2
> > <dcr:class>javax.jcr.NoSuchWorkspaceException</dcr:class>
> > <dcr:message>W2</dcr:message>
> >
> > idem with http://localhost:8080/repository/W3
> >
> > Could you tell what I should do to make it accessible from a URL ?
> >
> > BTW, I don't understand why a workspace is needed in WorkspaceImpl
> > constructor.
> >
> > Thanks in advance,
> > Best regards
> > jgr
> >
>

Re: Accessing workspace other than default ?

Posted by Justin Edelson <ju...@gmail.com>.
Why are you using the Jackrabbit implementation classes? The *only* way you
should be creating a workspace is via the JCR API:
session.getWorkspace().createWorkspace("W2"). Using internal APIs for
something which can be done through the JCR API is unnecessarily complicated
and will get you into trouble (as well as being non-portable FWIW).

Do it the correct way and if you still don't see your newly created
workspace via WebDav, repost to the mailing list.

Justin

On Tue, Mar 16, 2010 at 7:48 AM, Jacques Granduel <jg...@gmail.com>wrote:

> Hi all,
>
> I'm new to Jackrabbit, and I'm exploring JCR specs with it.
> I've been able to create a new workspace
>
> //org.apache.jackrabbit.core.XAWorkspace
> W = session.getWorkspace()
> org.apache.jackrabbit.core.WorkspaceImpl(W).createWorkspace("W2")
> session.save()
>
> The W2 workspace is created in Jackrabbit/repository/workspaces/W2 as
> expected.
> I cannot access this workspace with a url :
> http://localhost:8080/server
> Available Workspace Resources:
>    * default
>    * security
> http://localhost:8080/server/W2
> <dcr:class>javax.jcr.NoSuchWorkspaceException</dcr:class>
> <dcr:message>W2</dcr:message>
>
> idem with http://localhost:8080/repository/W3
>
> Could you tell what I should do to make it accessible from a URL ?
>
> BTW, I don't understand why a workspace is needed in WorkspaceImpl
> constructor.
>
> Thanks in advance,
> Best regards
> jgr
>