cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing Aflresco from Different VM using JNDI

sanatmastan
Champ in-the-making
Champ in-the-making
Hi

I want alfresco repository to access from different java program which is running different vm, here is what i did.

1) In stalled Alfresco 3.2Ent trail version and it is up and running,
2) I downloaded 3.2Community sdk set it up in eclipse, without starting tomcat from step 1 i am able to run sample program provided by sdk through eclipse.
3) Now i downloaded jcr-jndi adaptor and configured it in Alfresco 3.2Ent setup and the test webapp is running perfectly. Since testwebapp jcrJndiTest and alfresco are in same jvm (under tomcat) JNDI worked perfectly.

now what i am trying is to access the repository present in Alfresco 3.2 Ent into Alfresci 3.2 sdk from eclipse using JNDI. I included alfresco-jcr-jndi-bridge.jar in "SDK AlfrescoEmbedded" project and trying to access jcr repository "jcr/baseRepository " using the factory "org.alfresco.jcr.jndi.JndiJcrObjectFactory" as follows, i also tried removing jcr api from "SDK AlfrescoEmbedded" (ofcourse which is dump thing). I didnt succeed.

Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.alfresco.jcr.jndi.JndiJcrObjectFactory");

//Context ctx = new InitialContext(env);
vNamingContext = new InitialContext(env);
vNamingContext = (Context)vNamingContext.lookup("java:comp/env");

i am getting following exception

error during JNDI lookup for [jcr/baseRepository] [javax.naming.NoInitialContextException: Cannot instantiate class: org.alfresco.jcr.jndi.JndiJcrObjectFactory [Root exception is java.lang.ClassCastException: org.alfresco.jcr.jndi.JndiJcrObjectFactory]]
javax.naming.NoInitialContextException: Cannot instantiate class: org.alfresco.jcr.jndi.JndiJcrObjectFactory [Root exception is java.lang.ClassCastException: org.alfresco.jcr.jndi.JndiJcrObjectFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at org.alfresco.sample.jcr.JNDITest.lookupJndiJcr(JNDITest.java:118)
at org.alfresco.sample.jcr.JNDITest.main(JNDITest.java:61)
Caused by: java.lang.ClassCastException: org.alfresco.jcr.jndi.JndiJcrObjectFactory
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
… 5 more
Exception in thread "main" java.lang.NullPointerException
at org.alfresco.sample.jcr.JNDITest.main(JNDITest.java:69)

Please help…

Thanks
Sanat.
3 REPLIES 3

sanatmastan
Champ in-the-making
Champ in-the-making
Please reply for this????

Thanks in advance.

sanatmastan
Champ in-the-making
Champ in-the-making
guys any update???????

hiteshlad
Champ in-the-making
Champ in-the-making
As far as i can tell, JCR over JNDI was only supported up to 2.0.  I never got it working in 2.2.  There doesn't seem to be much momentum in the industry behind the JCR api, so i would integrate new apps using CMIS api, or if you're still on an older alfresco a custom webscript closely following the CMIS standard.

- hitesh