You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by philipp_s <ps...@qpass.com> on 2009/01/15 11:01:37 UTC

client access to jackrabbit resource adapter in weblogic

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.


Re: client access to jackrabbit resource adapter in weblogic

Posted by Michael Xue <ye...@yahoo.com>.
Philipp and Alex,

I have been experiencing the exact same issue with Jackrabbit-JCA-1.4 on
Weblogic 10.0 on a cluster environment.  I just filed the Jira issue, 
https://issues.apache.org/jira/browse/JCR-1946.  I agree, it is a fairly
easy to implement Serializable, which is a given in any cluster environment.    

Best,
Michael

Alexander Klimetschek wrote:
> 
> On Thu, Jan 15, 2009 at 11:45 AM, philipp_s <ps...@qpass.com> wrote:
>> The ra.xml <resourceadapter-class> class
>> 'org.apache.jackrabbit.jca.JCAResourceAdapter' should implement
>> java.io.Serializable but does not.>
>>
>> Is this to be expected? Since serialization plays a role in remote
>> access,
>> could this be related to the issue I am having?
> 
> Maybe. I am not an expert in JCA, but the JCAResourceAdapter does not
> implement Serializable, which is rather easy to fix. Would you mind to
> file a Jira issue [1]?
> 
> [1] http://jackrabbit.apache.org/issue-tracker.html
> 
> Regards,
> Alex
> 
> -- 
> Alexander Klimetschek
> alexander.klimetschek@day.com
> 
> 

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


Re: client access to jackrabbit resource adapter in weblogic

Posted by Alexander Klimetschek <ak...@day.com>.
On Thu, Jan 15, 2009 at 11:45 AM, philipp_s <ps...@qpass.com> wrote:
> The ra.xml <resourceadapter-class> class
> 'org.apache.jackrabbit.jca.JCAResourceAdapter' should implement
> java.io.Serializable but does not.>
>
> Is this to be expected? Since serialization plays a role in remote access,
> could this be related to the issue I am having?

Maybe. I am not an expert in JCA, but the JCAResourceAdapter does not
implement Serializable, which is rather easy to fix. Would you mind to
file a Jira issue [1]?

[1] http://jackrabbit.apache.org/issue-tracker.html

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: client access to jackrabbit resource adapter in weblogic

Posted by philipp_s <ps...@qpass.com>.
some additional information, when deploying the rar we always get this
warning: 

<Jan 15, 2009 2:42:10 AM PST> <Warning> <Connector> <BEA-190155> <Compliance
checking/validation of the resource adapter
/home/user/jackrabbit_rar/jackrabbit-jca-1.5.0.rar resulted in the following
warnings:
The ra.xml <resourceadapter-class> class
'org.apache.jackrabbit.jca.JCAResourceAdapter' should implement
java.io.Serializable but does not.>

Is this to be expected? Since serialization plays a role in remote access,
could this be related to the issue I am having?

thx

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