Hi David,

Looks like direct OSGi Service JNDI is not working/supported in GF. Has to
do this using resource injection through annotations (Not sure though).

Anyways, Thanks for your help. Looking like some tough road ahead for me to
get started with OSGi.

Thanks and Regards,

Rakesh Goyal




On Fri, Oct 18, 2013 at 5:31 PM, David Bosschaert <
[email protected]> wrote:

> Hi Rakesh,
>
> I don't know how this is configured in Glassfish, but the following
> message:
>
> > javax.naming.NameNotFoundException: osgi:service]
>
> seems to indicate that the OSGi JNDI integration isn't operational,
> because one of the things it should do is register osgi:service/ and
> osgi:servicelist/ contexts with the JNDI provider...
>
> Best regards,
>
> David
>
> On 18 October 2013 12:57, rakesh goyal <[email protected]> wrote:
> > Thanks Felix and David.
> >
> > I am very new to OSGi. Initially I did not deploy Aries JNDI and I
> thought
> > it should work with GF Osgi JNDI. I got the same error saying:
> >
> > javax.naming.NamingException: Lookup failed for
> > 'osgi:service/org.apache.aries.samples.blog.api.BloggingService' in
> >
> SerialContext[myEnv={java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl,
> > java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception
> is
> > javax.naming.NameNotFoundException: osgi:service]
> >
> > Am I missing some configuration ? Kindly help.
> >
> > Thanks and Regards,
> >
> > Rakesh Goyal
> >
> >
> > On Fri, Oct 18, 2013 at 11:51 AM, David Bosschaert
> > <[email protected]> wrote:
> >>
> >> Ah, yes. I did misread the original question. I now see that it says
> >> that Glassfish has its 'own OSGi JNDI' where I read it to be its 'own
> >> JNDI'.
> >> Felix, you are right. If GF has its own OSGi JNDI then you don't need
> >> to deploy Aries JNDI at all and the osgi:service context should work.
> >> What I described is only useful if you have an existing plain JNDI
> >> implementation and want to make that OSGi/JNDI compliant using Aries
> >> JNDI...
> >>
> >> Cheers,
> >>
> >> David
> >>
> >> On 18 October 2013 06:52, Felix Meschberger <[email protected]> wrote:
> >> > Hi
> >> >
> >> > I am confused ;-)
> >> >
> >> > If Glassfish is implementing the OSGi JNDI service, why can Aries not
> >> > just leverage that without having to deploy Aries JDNI
> implementaitons ? Or
> >> > am I missing something ?
> >> >
> >> > Regards
> >> > Felix
> >> >
> >> > Am 17.10.2013 um 21:34 schrieb David Bosschaert:
> >> >
> >> >> Hi rakesh,
> >> >>
> >> >> You really want to make the integration two-way. You want the Aries
> >> >> JNDI code to use the underlying glassfish JNDI implementation, and
> >> >> similarly you want the underlying glassfish implementation to see the
> >> >> services/objects added by Aries JNDI (which start with the
> >> >> osgi:service prefix).
> >> >>
> >> >> You can do that as follows (it's a while since I did this, so I might
> >> >> have forgotten a thing or two):
> >> >> * You need to tell Aries about the underlying JNDI implementation by
> >> >> registering its implementation of the
> >> >> javax.naming.spi.InitialContextFactoryBuilder interface an OSGi
> >> >> service. See section 126.5.1 of the OSGi/JNDI spec [1].
> >> >> * You need to write some glue code that listens to OSGi services
> >> >> registered under the javax.naming.spi.ObjectFactory objectClass. You
> >> >> then need to add these ObjectFactories to your JNDI implementation to
> >> >> make it aware of the osgi: naming scheme. I'm not sure whether there
> >> >> is a standard API for this, in JBoss I think we used an internal
> JBoss
> >> >> method to achieve this...
> >> >>
> >> >> The above can be done in a separate bundle with a little bit of glue
> >> >> code.
> >> >>
> >> >> Hope this helps,
> >> >>
> >> >> David
> >> >>
> >> >> [1] http://www.osgi.org/Download/Release5
> >> >>
> >> >> On 17 October 2013 19:55, rakesh goyal <[email protected]> wrote:
> >> >>> Since Glassfish has got its own osgi jndi, I am not sure how to make
> >> >>> apache
> >> >>> aries JNDI work in glassfish server.
> >> >>>
> >> >>> I am trying to deploy apache aries blog example with Glassfish v4
> but
> >> >>> getting following exception:
> >> >>>
> >> >>> [2013-10-18T00:03:59.949+0530] [glassfish 4.0] [SEVERE] [] [] [tid:
> >> >>> _ThreadID=27 _ThreadName=Thread-5] [timeMillis: 1382034839949]
> >> >>> [levelValue:
> >> >>> 1000] [[
> >> >>>  javax.naming.NamingException: Lookup failed for
> >> >>> 'osgi:service/org.apache.aries.samples.blog.api.BloggingService' in
> >> >>>
> >> >>>
> SerialContext[myEnv={java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl,
> >> >>> java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root
> >> >>> exception is
> >> >>> javax.naming.NameNotFoundException: osgi:service]
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:491)
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438)
> >> >>>    at javax.naming.InitialContext.lookup(InitialContext.java:411)
> >> >>>    at javax.naming.InitialContext.lookup(InitialContext.java:411)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.aries.samples.blog.web.util.JNDIHelper.getBloggingService(JNDIHelper.java:33)
> >> >>>    at
> >> >>> org.apache.aries.samples.blog.web.ViewBlog.doGet(ViewBlog.java:53)
> >> >>>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
> >> >>>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
> >> >>>    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
> >> >>>    at java.lang.Thread.run(Thread.java:744)
> >> >>> Caused by: javax.naming.NameNotFoundException: osgi:service
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.naming.impl.TransientContext.resolveContext(TransientContext.java:299)
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:207)
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.naming.impl.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:66)
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.naming.impl.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:114)
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:478)
> >> >>>    ... 34 more]]
> >> >>>
> >> >>> [2013-10-18T00:03:59.958+0530] [glassfish 4.0] [WARNING] []
> >> >>> [javax.enterprise.web] [tid: _ThreadID=27
> >> >>> _ThreadName=http-listener-1(4)]
> >> >>> [timeMillis: 1382034839958] [levelValue: 900] [[
> >> >>>  StandardWrapperValve[View Blog]: Servlet.service() for servlet View
> >> >>> Blog
> >> >>> threw exception
> >> >>> java.io.IOException: Blogging service resolution failed
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.aries.samples.blog.web.util.JNDIHelper.getBloggingService(JNDIHelper.java:37)
> >> >>>    at
> >> >>> org.apache.aries.samples.blog.web.ViewBlog.doGet(ViewBlog.java:53)
> >> >>>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
> >> >>>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
> >> >>>    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
> >> >>>    at
> >> >>>
> >> >>>
> org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
> >> >>>    at java.lang.Thread.run(Thread.java:744)
> >> >>> Caused by: javax.naming.NamingException: Lookup failed for
> >> >>> 'osgi:service/org.apache.aries.samples.blog.api.BloggingService' in
> >> >>>
> >> >>>
> SerialContext[myEnv={java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl,
> >> >>> java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root
> >> >>> exception is
> >> >>> javax.naming.NameNotFoundException: osgi:service]
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:491)
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438)
> >> >>>    at javax.naming.InitialContext.lookup(InitialContext.java:411)
> >> >>>    at javax.naming.InitialContext.lookup(InitialContext.java:411)
> >> >>>    at
> >> >>>
> >> >>>
> org.apache.aries.samples.blog.web.util.JNDIHelper.getBloggingService(JNDIHelper.java:33)
> >> >>>    ... 30 more
> >> >>> Caused by: javax.naming.NameNotFoundException: osgi:service
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.naming.impl.TransientContext.resolveContext(TransientContext.java:299)
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:207)
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.naming.impl.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:66)
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.naming.impl.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:114)
> >> >>>    at
> >> >>>
> >> >>>
> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:478)
> >> >>>    ... 34 more
> >> >>> ]]
> >> >
> >
> >
>

Reply via email to