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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>:
>
> 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:[EMAIL PROTECTED]
> 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

Reply via email to