jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Johnson" <dbjohnso...@gmail.com>
Subject Re: RMI connection
Date Fri, 20 Apr 2007 16:58:15 GMT
Hi Marcel,

I am connecting to a Jackrabbit instance running inside JBoss using jca and
the RMI jar file.  I had some initial trouble getting my RMI client code
too.  As a start, here is the "lookup" code that I use:

    static public Session getJackrabbitSession() throws RepositoryException
{
        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;
            rr = (RemoteRepository) ctx.lookup
("jnp://localhost:1099/jcrServer");
            Repository repository = adapter.getRepository(rr);
            Credentials credJBoss = new SimpleCredentials("username",
"password"
                    .toCharArray());
            return repository.login(credJBoss);
        } catch (NamingException ex) {
            ex.printStackTrace();
        }
        return null;
    }

Let me know if that helps at all.

-Dave

On 4/20/07, Marcel Dullaart <marcel.dullaart@gmail.com> wrote:
>
> Thank you David, I know for sure that is it not a JDK version issue, I
> am currently testing this on my dev machine running teh same JDK/JVM,
> but I think your other remark could make sense, so I'll investigate
> what service is bound to 1099 port on my JBoss instance.
>
> One question comes to mind though is why the JNDI connect does work. I
> suppose the connection uses RMI/JRMP as well.
>
> Enjoy the weekend,
> Marcel
>
> On 4/20/07, David Nuescheler <david.nuescheler@gmail.com> wrote:
> > hi marcel,
> >
> > not being an rmi expert at all, i would guess that there is
> > some incompatibility between what your rmi protocol that the
> > client expects (apparently jrmp) and what the process bound
> > to 1099 responds with.
> >
> > i could envision that there is for example another process
> > bound to port 1099 already that is not even an rmi (jrmp) listener,
> > or that there maybe a disconnect between different jdk's that you
> > are using on the client vs. the server (ibm vs. sun).
> >
> > these are all wild guesses but i think it is safe to say that
> > it is probably an issue with rmi and not with jackrabbit per se.
> >
> > regards,
> > david
> >
> > On 4/20/07, Marcel Dullaart <marcel.dullaart@gmail.com> wrote:
> > > Hi,
> > >
> > > Isn't there anyone at all that knows the answer? Or am I a complete
> > > idiot that should have known this?
> > > In that case please let me know, I am stuck with this.
> > >
> > > Thanks again,
> > > Marcel
> > >
> > > On 4/20/07, Marcel Dullaart <marcel.dullaart@gmail.com> wrote:
> > > > Hi all,
> > > >
> > > > I have setup a JBoss server instance and placed the
> > > > jackrabbit-jca-1.2.3.rar and jackrabbit-jcr-rmi-1.2.3.jar in its
> > > > deploy directory. From the, I removed the jcr-1.0.jar from
> > > > jackrabbit-jca-1.2.3.rar and placed it in the server's lib diretory,
> > > > also have I created a datasource connector (*-ds.xml) file and
> placed
> > > > that in the deploy directory as well.
> > > > JBoss start fine without errors.
> > > >
> > > > Then I tried to connect to it using the jcrClient (contrib), using
> > > > jndi jcrServer, which succeeded.
> > > > But I need an RMI connection so in the jcrClient I tried connect
> > > > rmi://localhost:1099/jcrServer. This failed with the message:
> > > > exception: java.rmi.ConnectIOException
> > > > message: non-JRMP server at remote endpoint
> > > >
> > > > When using the jcrBrowser plugin from eclipse I get the same
> results.
> > > >
> > > > Can someone please explain to me what is wrong here?
> > > >
> > > >
> > > > Thanks in advance,
> > > > Marcel
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message