jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davidjgonzalez <davidjgonza...@gmail.com>
Subject Re: How to get a Repository objector jcrSession from a Java Class
Date Fri, 20 May 2011 17:56:09 GMT
Any thoughts on why:

Repository repository =
JcrUtils.getRepository("jndi://com.day.util.jndi.provider.MemoryInitialContextFactory/crx");

and

SlingRepository repository = (SlingRepository)
JcrUtils.getRepository("jndi://com.day.util.jndi.provider.MemoryInitialContextFactory/crx");


both return a null repository object? I am running a standard CQ 5.4
(CRX 2.2) install.

Thanks


On Fri, May 20, 2011 at 10:05 AM, Rajesh Muguda [via Jackrabbit]
<ml-node+3539058-1068151332-229197@n4.nabble.com> wrote:
> No, thats not required.
>
> On Thu, May 19, 2011 at 10:59 PM, davidjgonzalez <[hidden email]> wrote:
>>
>> Do i have to do anything in Felix to register my CRX as JNDI accessible?
>>
>> On Wed, May 18, 2011 at 2:07 PM, Rajesh Muguda [via Jackrabbit]
>> <[hidden email]> wrote:
>> > Well you could use the JCR API's by having those libraries in your path.
>> >
>> >  Repository repository =
>> >
>> > JcrUtils.getRepository("jndi://com.day.util.jndi.provider.MemoryInitialContextFactory/crx");
>> >     SimpleCredentials creds =
>> >    new SimpleCredentials("admin", "admin".toCharArray());
>> >    Session slingsession = repository.login(creds, "crx.default");
>> >
>> > you can refer the jackrabbit api for more details.
>> >
>> > Thanks
>> > Rajesh
>> >
>> > On Wed, May 18, 2011 at 12:51 PM, Alexander Klimetschek <[hidden email]>
>> > wrote:
>> >>
>> >> On 18.05.11 20:55, "davidjgonzalez" <[hidden email]> wrote:
>> >> >http://pastie.org/1923026
>> >>
>> >> > new RepoTest().isNull()
>> >>
>> >>
>> >> SCR handled components are created by the framework, you can't use a
>> >> normal constructor. To get it, either reference from another component
>> >> (such as a servlet for example) using @Reference / @scr.reference, or
>> >> use
>> >> sling.getService() in JSPs for example. But that depends on the context
>> >> -
>> >> if it's a true background service (you are using immediate=true,
>> >> indicating that), it might just run for itself.
>> >>
>> >> Regards,
>> >> Alex
>> >>
>> >> --
>> >> Alexander Klimetschek
>> >> Developer // Adobe (Day) // Berlin - Basel
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>> >
>> > ________________________________
>> > If you reply to this email, your message will be added to the discussion
>> > below:
>> >
>> > http://jackrabbit.510166.n4.nabble.com/How-to-get-a-Repository-objector-jcrSession-from-a-Java-Class-tp3533401p3533949.html
>> > To unsubscribe from How to get a Repository objector jcrSession from a
>> > Java
>> > Class, click here.
>>
>> ________________________________
>> View this message in context: Re: How to get a Repository objector
>> jcrSession from a Java Class
>> Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.
>
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://jackrabbit.510166.n4.nabble.com/How-to-get-a-Repository-objector-jcrSession-from-a-Java-Class-tp3533401p3539058.html
> To unsubscribe from How to get a Repository objector jcrSession from a Java
> Class, click here.


--
View this message in context: http://jackrabbit.510166.n4.nabble.com/How-to-get-a-Repository-objector-jcrSession-from-a-Java-Class-tp3533401p3539176.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.
Mime
View raw message