cancel
Showing results for 
Search instead for 
Did you mean: 

JCR to JNDI

mh
Champ in-the-making
Champ in-the-making
Hallo,

I have downloaded and installed Russ Danners JCR to JNDI adapter
(http://issues.alfresco.com/browse/AR-1131)
but when running the Web-test-application the following error occurs:
>>>
error during JNDI lookup for [jcr/baseRepository] [javax.naming.NameNotFoundException: Name jcr is not bound in this Context]
<<<

Has anyone experience with this adapter?

My environment:
Windows XP
Tomcat 5.5
Alfresco 1.4
Java 6

Regards
Markus
9 REPLIES 9

rdanner
Champ in-the-making
Champ in-the-making
Hallo,

I have downloaded and installed Russ Danners JCR to JNDI adapter
(http://issues.alfresco.com/browse/AR-1131)
but when running the Web-test-application the following error occurs:
>>>
error during JNDI lookup for [jcr/baseRepository] [javax.naming.NameNotFoundException: Name jcr is not bound in this Context]
<<<

Has anyone experience with this adapter?

My environment:
Windows XP
Tomcat 5.5
Alfresco 1.4
Java 6

Regards
Markus

I can help with this.

You need to do some additional configuration at the server level.

in your server XML (tomcat\conf):

inside the following tag:
  <GlobalNamingResources>
       .
       .
       .
  </GlobalNamingResources>

add the following:
<Resource name="jcr/baseRepository"
           scope="Shareable"
           auth="Container"
           type="javax.jcr.Repository"
           factory="org.alfresco.jcr.jndi.JndiJcrObjectFactory"
           jcrRepositoryName="baseAlfrescoRepository"/>


In the context XML of your application (not your web XML… but at tomcat\conf\Catalina\localhost\yourContextName.xml)

you should have a file that looks something atleast like:

<Context crossContext="true">

<ResourceLink global="jcr/baseRepository"
                      name="jcr/baseRepository"
                      type="javax.jcr.Repository"/>              
</Context>


I don't think your application needs to be crossContext… although my example is. 

Hope this helps if not you can IM me or we can work the issue out here

YAHOO / SKYPE : dannerr617

mh
Champ in-the-making
Champ in-the-making
Hallo,

thank you for you help. My problem was not to know where
to store 'context…xml' file. Now it works.


Kind regards
Markus

carnby
Champ in-the-making
Champ in-the-making
I've tried the JCR-JNDI test app and it works fine, but when I try to do the same from a portlet, I get a nullpointer exception…
[STDOUT] error during JNDI lookup for [jcr/baseRepository] [java.lang.NullPointerException]
Is there any reason why this shouldn't work from a portlet context?

code that returns null (pName is "jcr/baseRepository"):
vRetComponent = NonSerializableFactory.lookup(pName);


I'm running it on JBoss, WinXP…

rdanner
Champ in-the-making
Champ in-the-making
I've tried the JCR-JNDI test app and it works fine, but when I try to do the same from a portlet, I get a nullpointer exception…
[STDOUT] error during JNDI lookup for [jcr/baseRepository] [java.lang.NullPointerException]
Is there any reason why this shouldn't work from a portlet context?

code that returns null (pName is "jcr/baseRepository"):
vRetComponent = NonSerializableFactory.lookup(pName);


I'm running it on JBoss, WinXP…

I'm note sure how JBoss Portal Deploys and accesses it's portlets but you hace to make sure the JNDI context is available to whatever application is calling for the reference.  Null Pointer? It shouldnt give that even if it cant find the reference. 

You are saying you are using JBoss Portal correct?

carnby
Champ in-the-making
Champ in-the-making
Sorry for being imprecise… I'm using JBoss application server, but the portlet is deployed in Liferay.
Like you said I'm having trouble making the JNDI context available to the portlet.

What I have done is:
added mbean in jboss-service.xml
added jcr-api-jndi-context.xml in alfresco.war
moved jcr.1.0.jar and alfresco-jcr-jndi-bridge.jar from alfresco to jboss/server/default/lib

What I'm not sure about is where to put the <Resource> and <ResourceLink>, and whether I need to include a context.xml and/or jboss-web.xml file with my portlet. I seem to find conflicting instructions depending on where I look, and I've tried different combinations but with no luck so far…

nikkijuk
Champ in-the-making
Champ in-the-making
:!: Advice: Do not use JNDI-JCR bridges current version (Version 5 from Jira) with JBoss. With solutions attached test application you can see that it throws exceptions and rolls back operations. Also, even if test application fetches data from Alfresco I didn't manage to get handle of JCR repository adapter with JBoss from JNDI even if it worked just fine with Tomcat. If you want to see when Mbean is run please change JBoss logging level. It is run, and works somehow, as you can see with test app, but there must be issues on it since in addtion to exceptions it seems to hang after setup through spring is failed.

:?: What would be working way of integrating Tomcat (Development) & JBoss (Production) + Liferay + Alfresco? Everything should be running within same virtual machine.

Does anyone have complete Maven2 script for embedding Alfresco 2.0 SDK or is there any put to public? This is the thing I am wanting to try next.

- Jukkis

rdanner
Champ in-the-making
Champ in-the-making
:!: Advice: Do not use JNDI-JCR bridges current version (Version 5 from Jira) with JBoss. With solutions attached test application you can see that it throws exceptions and rolls back operations. Also, even if test application fetches data from Alfresco I didn't manage to get handle of JCR repository adapter with JBoss from JNDI even if it worked just fine with Tomcat. If you want to see when Mbean is run please change JBoss logging level. It is run, and works somehow, as you can see with test app, but there must be issues on it since in addtion to exceptions it seems to hang after setup through spring is failed.

:?: What would be working way of integrating Tomcat (Development) & JBoss (Production) + Liferay + Alfresco? Everything should be running within same virtual machine.

Does anyone have complete Maven2 script for embedding Alfresco 2.0 SDK or is there any put to public? This is the thing I am wanting to try next.

- Jukkis

Where are you getting the exceptions from?  The JCR calls?  We don't have any issues pulling JCR from JNDI and using in tomcat or jboss.

-R

nikkijuk
Champ in-the-making
Champ in-the-making
With Tomcat everything went really fine using this spring configuration, but with JBoss we just gave up at the end.

   <jee:jndi-lookup id="repository" jndi-name="jcrlocal"
      resource-ref="true" proxy-interface="javax.jcr.Repository"/>

I got exception messages with JBoss + test client, when reading root node from Alfresco. Information was actually read, and returned to screen, but somewhere deep down there user transaction was rolled back after every read operation. This made me felt that everything wasn't quite right.

This won't help you a lot, so I need to put it all up again for you and give more details. We would be really delighted to see this work at Jboss, even if customer has already decided to put it to hold for some time.

There is slight possibility that there is anyway some configuration issue on our environment, that made this happen, but I feel that we managed to put them in order.

- Jukkis

nikkijuk
Champ in-the-making
Champ in-the-making
This is printout after selecting "Test JBoss" button. No more and no less.

**

11:48:18,812 INFO  [Server] JBoss (MX MicroKernel) [4.0.5.GA (build: CVSTag=Bran
ch_4_0 date=200610162339)] Started in 2m:25s:453ms
11:52:38,484 DEBUG [SpringAwareUserTransaction] Getting transaction for UserTran
saction
11:52:39,218 DEBUG [SpringAwareUserTransaction] Invoking rollback for transactio
n on UserTransaction due to throwable [java.lang.Exception]

**

- Jukkis