You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Ista Pouss <is...@gmail.com> on 2011/12/28 11:41:32 UTC
namespace session or worspace ?
Hi,
I have this code :
try
{
session.getNamespaceURI("xyz");
}
catch (NamespaceException notexist)
{
session.getWorkspace().getNamespaceRegistry(). // BING !
registerNamespace(
"xyz", "http://www.foo.com");
}
... but, at line BING, I get this exception :
javax.jcr.NamespaceException: failed to register namespace xyz ->
http://www.foo.com: mapping already exists
at
org.apache.jackrabbit.core.NamespaceRegistryImpl.registerNamespace(NamespaceRegistryImpl.java:406)
at
org.apache.jackrabbit.core.session.SessionContext$PermissionAwareNamespaceRegistry.registerNamespace(SessionContext.java:375)
How is it possilbe ? What is the good thing to do to register a namespace ?
Thanks.
Re: namespace session or worspace ?
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On Wed, Dec 28, 2011 at 12:41 PM, Ista Pouss <is...@gmail.com> wrote:
> How is it possilbe ? What is the good thing to do to register a namespace ?
You probably already have the namespace registered with another prefix.
When conditionally registering a namespace like you're doing, it's
usually best to use the getNamespacePrefix() method to check for the
existence of a mapping of a given namespace URI.
BR,
Jukka Zitting