You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by José Blas Camacho Taboada <jo...@gmail.com> on 2007/03/28 18:49:27 UTC

Problem with Jackrabbit, RMI and JBoss

Hi,

 I hava a problem with my Jboss. I use jackrabbit 1.2.3

1. I deploy jackrabbit with JCA
2. I deploy RMI service in JBoss
3. I deploy jackrabbit-webapp.war in another computer (JBoss as well)

It doesnt work,
java.lang.ClassCastException: org.apache.jackrabbit.jca.JCARepositoryHandle

Repository r = (Repository) jndiContext.lookup(repositoryName);


but, JCARepositoryHandle implements javax.jca.Repository. I dont know what
is the problem.

But I have change

    RepositoryAccessServlet.java

I use my own code and it works,

              //env looking at my jboss with jcr-server.
             InitialContext iCtx = new InitialContext(env);
            ClientAdapterFactory adapter = new ClientAdapterFactory();
            RemoteRepository remote = (RemoteRepository) iCtx.lookup( rmiUri
);
            Repository repo = adapter.getRepository(remote);


I do not know it is a bug or jackrabbit doesn't support my architecture.

Regards, José Blas.








-- 

José B. Camacho Taboada

Re: Problem with Jackrabbit, RMI and JBoss

Posted by José Blas Camacho Taboada <jo...@gmail.com>.
the same jboss.

With that code everything is right. The problem is with
jackrabbit-webapp.war. I cannt connet to my jackrabit. I have put rhis code
into a Servlet in jackrabbit-webapp to get connected. IMO, i think it is a
bug in the webapp.

regards, jose blas

2007/3/29, David Johnson <db...@gmail.com>:
>
> What version of JBoss are you using?
>
> I have set up the same environment with JBoss 4.0.4 and everything is
> working fine.
>
> I put the jackrabbit-jca.rar file and the jackrabbit-rmi.jar in the JBoss
> server deploy directory.  You also will need a jcr-ds.xml - or equivalent
> in
> the deploy directory.
>
> The code that I use to grab a session is below - this was the one area
> that
> I had some issues with:
>
>     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;
>     }
>
>
> On 3/29/07, José Blas Camacho Taboada <jo...@gmail.com> wrote:
> >
> > Hi Claus,
> >
> > Have you done the same ? And it worked ? If you got it, would send me
> your
> > configuration ?
> >
> > Thanks in advance, josé blas.
> >
> > 2007/3/29, KÖLL Claus <C....@tirol.gv.at>:
> > >
> > > hi Jose,
> > >
> > > i had the same problem,
> > > in my case the problem was that the jackrabbit-jca-1.2.3.jar wasn't in
> > the
> > > classpath of the project that
> > > trys to get the repository handle through the jndi.
> > > in your case its the webapp on the other rcomputer.
> > >
> > > ensure that you have it in your classpath ..
> > >
> > > greeds
> > > claus
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: José Blas Camacho Taboada [mailto:joseblas@gmail.com]
> > > Gesendet: Mittwoch, 28. März 2007 18:49
> > > An: users@jackrabbit.apache.org
> > > Betreff: Problem with Jackrabbit, RMI and JBoss
> > >
> > > Hi,
> > >
> > > I hava a problem with my Jboss. I use jackrabbit 1.2.3
> > >
> > > 1. I deploy jackrabbit with JCA
> > > 2. I deploy RMI service in JBoss
> > > 3. I deploy jackrabbit-webapp.war in another computer (JBoss as well)
> > >
> > > It doesnt work,
> > > java.lang.ClassCastException:
> > > org.apache.jackrabbit.jca.JCARepositoryHandle
> > >
> > > Repository r = (Repository) jndiContext.lookup(repositoryName);
> > >
> > >
> > > but, JCARepositoryHandle implements javax.jca.Repository. I dont know
> > what
> > > is the problem.
> > >
> > > But I have change
> > >
> > >     RepositoryAccessServlet.java
> > >
> > > I use my own code and it works,
> > >
> > >               //env looking at my jboss with jcr-server.
> > >              InitialContext iCtx = new InitialContext(env);
> > >             ClientAdapterFactory adapter = new ClientAdapterFactory();
> > >             RemoteRepository remote = (RemoteRepository) iCtx.lookup(
> > > rmiUri
> > > );
> > >             Repository repo = adapter.getRepository(remote);
> > >
> > >
> > > I do not know it is a bug or jackrabbit doesn't support my
> architecture.
> > >
> > > Regards, José Blas.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > >
> > > José B. Camacho Taboada
> > >
> >
> >
> >
> > --
> >
> > José B. Camacho Taboada
> >
>



-- 

José B. Camacho Taboada

Re: Problem with Jackrabbit, RMI and JBoss

Posted by David Johnson <db...@gmail.com>.
What version of JBoss are you using?

I have set up the same environment with JBoss 4.0.4 and everything is
working fine.

I put the jackrabbit-jca.rar file and the jackrabbit-rmi.jar in the JBoss
server deploy directory.  You also will need a jcr-ds.xml - or equivalent in
the deploy directory.

The code that I use to grab a session is below - this was the one area that
I had some issues with:

    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;
    }


On 3/29/07, José Blas Camacho Taboada <jo...@gmail.com> wrote:
>
> Hi Claus,
>
> Have you done the same ? And it worked ? If you got it, would send me your
> configuration ?
>
> Thanks in advance, josé blas.
>
> 2007/3/29, KÖLL Claus <C....@tirol.gv.at>:
> >
> > hi Jose,
> >
> > i had the same problem,
> > in my case the problem was that the jackrabbit-jca-1.2.3.jar wasn't in
> the
> > classpath of the project that
> > trys to get the repository handle through the jndi.
> > in your case its the webapp on the other rcomputer.
> >
> > ensure that you have it in your classpath ..
> >
> > greeds
> > claus
> >
> > -----Ursprüngliche Nachricht-----
> > Von: José Blas Camacho Taboada [mailto:joseblas@gmail.com]
> > Gesendet: Mittwoch, 28. März 2007 18:49
> > An: users@jackrabbit.apache.org
> > Betreff: Problem with Jackrabbit, RMI and JBoss
> >
> > Hi,
> >
> > I hava a problem with my Jboss. I use jackrabbit 1.2.3
> >
> > 1. I deploy jackrabbit with JCA
> > 2. I deploy RMI service in JBoss
> > 3. I deploy jackrabbit-webapp.war in another computer (JBoss as well)
> >
> > It doesnt work,
> > java.lang.ClassCastException:
> > org.apache.jackrabbit.jca.JCARepositoryHandle
> >
> > Repository r = (Repository) jndiContext.lookup(repositoryName);
> >
> >
> > but, JCARepositoryHandle implements javax.jca.Repository. I dont know
> what
> > is the problem.
> >
> > But I have change
> >
> >     RepositoryAccessServlet.java
> >
> > I use my own code and it works,
> >
> >               //env looking at my jboss with jcr-server.
> >              InitialContext iCtx = new InitialContext(env);
> >             ClientAdapterFactory adapter = new ClientAdapterFactory();
> >             RemoteRepository remote = (RemoteRepository) iCtx.lookup(
> > rmiUri
> > );
> >             Repository repo = adapter.getRepository(remote);
> >
> >
> > I do not know it is a bug or jackrabbit doesn't support my architecture.
> >
> > Regards, José Blas.
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> >
> > José B. Camacho Taboada
> >
>
>
>
> --
>
> José B. Camacho Taboada
>

Re: Problem with Jackrabbit, RMI and JBoss

Posted by José Blas Camacho Taboada <jo...@gmail.com>.
Hi Claus,

 Have you done the same ? And it worked ? If you got it, would send me your
configuration ?

 Thanks in advance, josé blas.

2007/3/29, KÖLL Claus <C....@tirol.gv.at>:
>
> hi Jose,
>
> i had the same problem,
> in my case the problem was that the jackrabbit-jca-1.2.3.jar wasn't in the
> classpath of the project that
> trys to get the repository handle through the jndi.
> in your case its the webapp on the other rcomputer.
>
> ensure that you have it in your classpath ..
>
> greeds
> claus
>
> -----Ursprüngliche Nachricht-----
> Von: José Blas Camacho Taboada [mailto:joseblas@gmail.com]
> Gesendet: Mittwoch, 28. März 2007 18:49
> An: users@jackrabbit.apache.org
> Betreff: Problem with Jackrabbit, RMI and JBoss
>
> Hi,
>
> I hava a problem with my Jboss. I use jackrabbit 1.2.3
>
> 1. I deploy jackrabbit with JCA
> 2. I deploy RMI service in JBoss
> 3. I deploy jackrabbit-webapp.war in another computer (JBoss as well)
>
> It doesnt work,
> java.lang.ClassCastException:
> org.apache.jackrabbit.jca.JCARepositoryHandle
>
> Repository r = (Repository) jndiContext.lookup(repositoryName);
>
>
> but, JCARepositoryHandle implements javax.jca.Repository. I dont know what
> is the problem.
>
> But I have change
>
>     RepositoryAccessServlet.java
>
> I use my own code and it works,
>
>               //env looking at my jboss with jcr-server.
>              InitialContext iCtx = new InitialContext(env);
>             ClientAdapterFactory adapter = new ClientAdapterFactory();
>             RemoteRepository remote = (RemoteRepository) iCtx.lookup(
> rmiUri
> );
>             Repository repo = adapter.getRepository(remote);
>
>
> I do not know it is a bug or jackrabbit doesn't support my architecture.
>
> Regards, José Blas.
>
>
>
>
>
>
>
>
> --
>
> José B. Camacho Taboada
>



-- 

José B. Camacho Taboada

Re: Problem with Jackrabbit, RMI and JBoss

Posted by José Blas Camacho Taboada <jo...@gmail.com>.
Hi Claus,

I have it. Both servers have jackrabbit. But now we want both of them access
just to one of them.

Regards, jose

2007/3/29, KÖLL Claus <C....@tirol.gv.at>:
>
> hi Jose,
>
> i had the same problem,
> in my case the problem was that the jackrabbit-jca-1.2.3.jar wasn't in the
> classpath of the project that
> trys to get the repository handle through the jndi.
> in your case its the webapp on the other rcomputer.
>
> ensure that you have it in your classpath ..
>
> greeds
> claus
>
> -----Ursprüngliche Nachricht-----
> Von: José Blas Camacho Taboada [mailto:joseblas@gmail.com]
> Gesendet: Mittwoch, 28. März 2007 18:49
> An: users@jackrabbit.apache.org
> Betreff: Problem with Jackrabbit, RMI and JBoss
>
> Hi,
>
> I hava a problem with my Jboss. I use jackrabbit 1.2.3
>
> 1. I deploy jackrabbit with JCA
> 2. I deploy RMI service in JBoss
> 3. I deploy jackrabbit-webapp.war in another computer (JBoss as well)
>
> It doesnt work,
> java.lang.ClassCastException:
> org.apache.jackrabbit.jca.JCARepositoryHandle
>
> Repository r = (Repository) jndiContext.lookup(repositoryName);
>
>
> but, JCARepositoryHandle implements javax.jca.Repository. I dont know what
> is the problem.
>
> But I have change
>
>     RepositoryAccessServlet.java
>
> I use my own code and it works,
>
>               //env looking at my jboss with jcr-server.
>              InitialContext iCtx = new InitialContext(env);
>             ClientAdapterFactory adapter = new ClientAdapterFactory();
>             RemoteRepository remote = (RemoteRepository) iCtx.lookup(
> rmiUri
> );
>             Repository repo = adapter.getRepository(remote);
>
>
> I do not know it is a bug or jackrabbit doesn't support my architecture.
>
> Regards, José Blas.
>
>
>
>
>
>
>
>
> --
>
> José B. Camacho Taboada
>



-- 

José B. Camacho Taboada

AW: Problem with Jackrabbit, RMI and JBoss

Posted by KÖLL Claus <C....@TIROL.GV.AT>.
hi Jose,

i had the same problem,
in my case the problem was that the jackrabbit-jca-1.2.3.jar wasn't in the classpath of the project that 
trys to get the repository handle through the jndi.
in your case its the webapp on the other rcomputer.

ensure that you have it in your classpath ..

greeds
claus

-----Ursprüngliche Nachricht-----
Von: José Blas Camacho Taboada [mailto:joseblas@gmail.com] 
Gesendet: Mittwoch, 28. März 2007 18:49
An: users@jackrabbit.apache.org
Betreff: Problem with Jackrabbit, RMI and JBoss

Hi,

 I hava a problem with my Jboss. I use jackrabbit 1.2.3

1. I deploy jackrabbit with JCA
2. I deploy RMI service in JBoss
3. I deploy jackrabbit-webapp.war in another computer (JBoss as well)

It doesnt work,
java.lang.ClassCastException: org.apache.jackrabbit.jca.JCARepositoryHandle

Repository r = (Repository) jndiContext.lookup(repositoryName);


but, JCARepositoryHandle implements javax.jca.Repository. I dont know what
is the problem.

But I have change

    RepositoryAccessServlet.java

I use my own code and it works,

              //env looking at my jboss with jcr-server.
             InitialContext iCtx = new InitialContext(env);
            ClientAdapterFactory adapter = new ClientAdapterFactory();
            RemoteRepository remote = (RemoteRepository) iCtx.lookup( rmiUri
);
            Repository repo = adapter.getRepository(remote);


I do not know it is a bug or jackrabbit doesn't support my architecture.

Regards, José Blas.








-- 

José B. Camacho Taboada