jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From philipp_s <psalzge...@qpass.com>
Subject client access to jackrabbit resource adapter in weblogic
Date Thu, 15 Jan 2009 10:01:37 GMT

We are using jackrabbit deployed as a resource adapter inside an ear file. We
want to change that, to be able to deploy the rar alone, and also access the
resource adapter from a command line app using jndi. We ran into an issue
with that approach, using the jackrabbit-jca-1.5.rar file with the
weblogic-ra.xml file from the source, I was able to reproduce the issue.

1.) the weblogic-ra.xml file is added to jackrabbit-jca-1.5.0.rar
2.) the jackrabbit-jca-1.5.0.rar file is deployed to weblogic, this is how
it looks when browsing the JNDI tree in weblogic: 

Settings for jackrabbit
		
Overview	 	Security	 	 

This page displays details about this bound object.

	Binding Name:	jackrabbit	 
	Class:	org.apache.jackrabbit.jca.JCARepositoryHandle	 
	Hash Code:	24515953	 
	toString Results:	org.apache.jackrabbit.jca.JCARepositoryHandle@1761571

We have created a command line client which also browses the jndi tree and
prints out the name and classname for every jndi object. We see the
configured datasources and messagequeues, and also the rar and the
repository:
root context: = weblogic.jndi.internal.WLContextImpl
	aaaDataSource = weblogic.jdbc.common.internal.RmiDataSource
	bbbDataSource = weblogic.jdbc.common.internal.RmiDataSource
	cccSyncQueue = weblogic.jms.common.DistributedDestinationImpl
	jackrabbit = javax.naming.Reference
context: WLContext ()
	ddddDataSource = weblogic.jdbc.common.internal.RmiDataSource
	eeeeConnectionFactory = weblogic.jms.client.JMSConnectionFactory
	...
	jackrabbitRA = org.apache.jackrabbit.jca.JCAResourceAdapter
	...
	ejb = weblogic.jndi.internal.WLEventContextImpl
 		mgmt = weblogic.jndi.internal.WLEventContextImpl
			MEJB = weblogic.management.j2ee.mejb.Mejb_dj5nps_HomeImpl
	mejbmejb_jarMejb_EO = weblogic.management.j2ee.mejb.Mejb_dj5nps_EOImpl
	...
	javax = weblogic.jndi.internal.WLEventContextImpl
        ...
	weblogic = weblogic.jndi.internal.WLEventContextImpl
        ...

The issue is when I want to lookup the repository, I get the error "No
Object found: jackrabbit|null". Please note this is not the same error you
get when you try to look up a jndi object that doesn´t exist (which would
give you an "unable to resolve"). I think the problem is, that the
jackrabbit in the jndi tree is visible only as a javax.naming.reference and
not as the JCARepositoryHandle. I didn´t find concrete information around
this issue, but it might be a classloading issue, the question is what am I
missing on the client side to be able to lookup the object? Adding
jackrabbit-jca-1.5.jar to the client classpath didn't help. I also tried
iiop as protocol, but that was even worse.

This is the code I am using to list the jndi tree and try to look up the
repository:

import java.io.PrintStream;
import java.util.Arrays;
import java.util.Hashtable;

import javax.naming.Binding;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingEnumeration;

public class RepositoryAdmin {
  
    public static void main(String[] args) throws Exception {
        RepositoryAdmin admin = new RepositoryAdmin();
        admin.listBindings();
    }

    public void listBindings() throws Exception {
        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
        env.put(Context.PROVIDER_URL, "t3://servername:7001");

        InitialContext ictx = new InitialContext(env);
        Context ctx = (Context) ictx.lookup("");
        System.out.println("root context: = " + ctx.getClass().getName() +
ctx.getNameInNamespace());
        printContext(ctx, 1);
    }

    private void printContext(Context ctx, int indent) throws Exception {
        try {
            NamingEnumeration<Binding> en = ctx.listBindings("");
            while (en.hasMore()) {
                Binding b = en.next();
                char[] tabs = new char[indent];
                Arrays.fill(tabs, '\t');                
                System.out.println( new String(tabs) + b.getName() + " = " +
b.getClassName());

                if (b.getObject() instanceof Context) {
                    System.out.print("context: ");
                    printContext((Context) b.getObject(), indent + 1);
                }

                if (b.getName().equals("jackrabbit")) {
                    System.out.println("context: " + ctx);
                    Object repository =  ctx.lookup("jackrabbit");                   
                }

            }
        } catch (Exception e) {
           System.out.println("error: " + e.getMessage());
        }
    }

}





-- 
View this message in context: http://www.nabble.com/client-access-to-jackrabbit-resource-adapter-in-weblogic-tp21474573p21474573.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message