You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Nicolas Modrzyk <ni...@macnica.com> on 2007/01/30 08:33:33 UTC

Jackrabbit + Jboss + remote JNDI

Hi list,

I can't seem to be able to get a remote jboss JNDI Repository object  
as described in the following wiki entry:
http://wiki.apache.org/jackrabbit/JackrabbitOnJBoss

I don't get any "javax.naming.NameNotFoundException" but the  
resulting javax.jcr.Repository object is null.

Any idea ?

Niko,

Re: Jackrabbit + Jboss + remote JNDI

Posted by Nicolas Modrzyk <ni...@macnica.com>.
Hi Dave,

Thank you for your help and fast answer.

My code has all the default properties for the initial context and is  
a copy of the wiki page.
I set use-java-context in the configuration file jcr-ds.xml, which  
brought me one step forward, in the sense that I can find the name in  
the registry, but I cannot get anything else than a null object  
reference to that name.

it works when in the same JVM though ...

Any other hints or ideas ?

Niko,



On Jan 30, 2007, at 8:44 PM, David Johnson wrote:

> Do you have a short code sample?  I remember having the same/similar
> problem.  Take a look at the code below, this is how I have  
> retrieved a
> remote repository from JBoss.  I also have code to retrieve a  
> repository
> through JNDI - say from a StatelessSessionBean.
>
> -Dave
>
>    private Repository repository ;
>    private Session session ;
>    private Node root ;
>    private NodeBrowser browser ;
>
>    /** Creates a new instance of NodeBrowserController */
>    public NodeBrowserController() throws Exception {
>        Properties env = new Properties();
>        env.put(Context.INITIAL_CONTEXT_FACTORY, "
> org.jnp.interfaces.NamingContextFactory");
>        env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
>        env.put(Context.URL_PKG_PREFIXES, "
> org.jboss.naming:org.jnp.interfaces");
>
>        try {
>            InitialContext ctx = new InitialContext(env);
>            ClientAdapterFactory adapter = new ClientAdapterFactory();
>
>            RemoteRepository rr =
> (RemoteRepository)ctx.lookup("jnp://localhost:1099/jcrServer");
>
>            repository = adapter.getRepository(rr);
>
>            session = repository.login(new SimpleCredentials("admin",
>                    "admin".toCharArray()));
>
>            root = session.getRootNode();
>        } catch(Exception ex) {
>            ex.printStackTrace();
>        }
>    }
>
>
> On 1/29/07, Nicolas Modrzyk <ni...@macnica.com> wrote:
>>
>> Hi list,
>>
>> I can't seem to be able to get a remote jboss JNDI Repository object
>> as described in the following wiki entry:
>> http://wiki.apache.org/jackrabbit/JackrabbitOnJBoss
>>
>> I don't get any "javax.naming.NameNotFoundException" but the
>> resulting javax.jcr.Repository object is null.
>>
>> Any idea ?
>>
>> Niko,
>>


Re: Jackrabbit + Jboss + remote JNDI

Posted by David Johnson <db...@gmail.com>.
Do you have a short code sample?  I remember having the same/similar
problem.  Take a look at the code below, this is how I have retrieved a
remote repository from JBoss.  I also have code to retrieve a repository
through JNDI - say from a StatelessSessionBean.

-Dave

    private Repository repository ;
    private Session session ;
    private Node root ;
    private NodeBrowser browser ;

    /** Creates a new instance of NodeBrowserController */
    public NodeBrowserController() throws Exception {
        Properties env = new Properties();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "
org.jnp.interfaces.NamingContextFactory");
        env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
        env.put(Context.URL_PKG_PREFIXES, "
org.jboss.naming:org.jnp.interfaces");

        try {
            InitialContext ctx = new InitialContext(env);
            ClientAdapterFactory adapter = new ClientAdapterFactory();

            RemoteRepository rr =
(RemoteRepository)ctx.lookup("jnp://localhost:1099/jcrServer");

            repository = adapter.getRepository(rr);

            session = repository.login(new SimpleCredentials("admin",
                    "admin".toCharArray()));

            root = session.getRootNode();
        } catch(Exception ex) {
            ex.printStackTrace();
        }
    }


On 1/29/07, Nicolas Modrzyk <ni...@macnica.com> wrote:
>
> Hi list,
>
> I can't seem to be able to get a remote jboss JNDI Repository object
> as described in the following wiki entry:
> http://wiki.apache.org/jackrabbit/JackrabbitOnJBoss
>
> I don't get any "javax.naming.NameNotFoundException" but the
> resulting javax.jcr.Repository object is null.
>
> Any idea ?
>
> Niko,
>