You mean it should work with CXF if I use EJB annotations instead of
@Inject and @Named annotations.
I had beans.xml in the META-INF folder in src/main/resources


On Sat, Oct 19, 2013 at 7:18 PM, Romain Manni-Bucau
<[email protected]>wrote:

> Hmm should work fine if rest services are ejb in embedded mode but pojo are
> maybe not deployed depending your version. Think to add a beans.xml too if
> not already done
> Le 19 oct. 2013 18:49, "Radhakrishna Kalyan" <[email protected]> a
> écrit :
>
> > Actually I tried both. But in either case I was getting the exception.
> > Then I tried to remove all Jersey dependencies and used CXF instead, with
> > CXF the exceptions are gone but didn't able to get CDI.
> >
> >
> >
> > On Sat, Oct 19, 2013 at 6:17 PM, Romain Manni-Bucau
> > <[email protected]>wrote:
> >
> > > If you really want jersey set a context factory or start openejb before
> > > Le 19 oct. 2013 18:10, "Radhakrishna Kalyan" <[email protected]> a
> > > écrit :
> > >
> > > > Hi Romain,
> > > >
> > > > Sorry I didn't get you. If you closely look at the code, I am using
> the
> > > > EJBContainer. But I am getting an exception while running with
> Jersey.
> > > > If your question was something else. Please let me know.
> > > >
> > > >
> > > > On Sat, Oct 19, 2013 at 5:51 PM, Romain Manni-Bucau
> > > > <[email protected]>wrote:
> > > >
> > > > > Hi
> > > > >
> > > > > Why not using EJBContainer?
> > > > >
> > > > > Note: openejb embedded supports jaxrs through openejb-cxf-rs
> > dependency
> > > > > Le 19 oct. 2013 16:55, "Radhakrishna Kalyan" <[email protected]>
> a
> > > > > écrit :
> > > > >
> > > > > > Hi
> > > > > >
> > > > > > Iam looking to develop a REST based webservice but I don't want
> to
> > > use
> > > > > any
> > > > > > application server. All I am looking is to start my application
> > which
> > > > in
> > > > > > turn should start the http server with CDI along with Jax-RS.  I
> > felt
> > > > > > OpenEJB is the right tool for this.
> > > > > >
> > > > > > I have used "com.sun.net.httpserver.HttpServer" as http server
> and
> > > > Jersey
> > > > > > for my Jax-RS implementation and now I would like to use OpenEJB
> > for
> > > > CDI.
> > > > > >
> > > > > > When I tried to write something like
> > > > > >
> > > > > > public static void main(String[] args) throws Exception {
> > > > > >         MyBootStrap bootStrap= new MyBootStrap();
> > > > > >         Properties p = new Properties();
> > > > > >         p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> > > > > > "org.apache.openejb.client.LocalInitialContextFactory");
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> p.setProperty("com.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager",
> > > > > > "true");
> > > > > >
> > > EJBContainer.createEJBContainer(p).getContext().bind("inject",
> > > > > > bootStrap);
> > > > > >
> > > > > >         HttpServer server = HttpServer.create(new
> > > > > InetSocketAddress(9998),
> > > > > > 0);
> > > > > >         HttpHandler sf =
> > > > RuntimeDelegate.getInstance().createEndpoint(new
> > > > > > ApplicationConfig(), HttpHandler.class);
> > > > > >         server.createContext("/", sf);
> > > > > >         server.start();
> > > > > >     }
> > > > > >
> > > > > >
> > > > > > But when I start my application then I am getting exception.
> > > > > > java.lang.RuntimeException:
> javax.naming.NoInitialContextException:
> > > > Need
> > > > > > to specify class name in environment or system property, or as an
> > > > applet
> > > > > > parameter, or in an application resource file:
> > > > >  java.naming.factory.initial
> > > > > >     at
> > > > > >
> > > > >
> > > >
> > >
> >
> com.sun.jersey.server.impl.cdi.CDIExtension.initialize(CDIExtension.java:196)
> > > > > >     at
> > > > > >
> > > > >
> > > >
> > >
> >
> com.sun.jersey.server.impl.cdi.CDIExtension.beforeBeanDiscovery(CDIExtension.java:297)
> > > > > >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> > > > > >     at
> > > > > >
> > > > >
> > > >
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > > > > >     at
> > > > > >
> > > > >
> > > >
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > > > > >     at java.lang.reflect.Method.invoke(Method.java:597)
> > > > > >     at
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:295)
> > > > > >     at
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:429)
> > > > > > ...More
> > > > > >
> > > > > >  Detail exception is attached as attachment.
> > > > > >
> > > > > >
> > > > > > I am not understanding how to trigger the CDI while starting http
> > > > server.
> > > > > >
> > > > > > Please give me some pointers if I am doing any wrong or if I
> should
> > > use
> > > > > > any thing more.
> > > > > >
> > > > > > Thanks in advance.
> > > > > > --
> > > > > > Thanks and Regards
> > > > > > N Radhakrishna Kalyan
> > > > > >
> > > > > > P:  +46 733 312 584
> > > > > > http://about.me/nrkkalyan
> > > > > >  <http://about.me/nrkkalyan>
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Thanks and Regards
> > > > N Radhakrishna Kalyan
> > > >
> > > > P:  +46 733 312 584
> > > > http://about.me/nrkkalyan
> > > >  <http://about.me/nrkkalyan>
> > > >
> > >
> >
> >
> >
> > --
> > Thanks and Regards
> > N Radhakrishna Kalyan
> >
> > P:  +46 733 312 584
> > http://about.me/nrkkalyan
> >  <http://about.me/nrkkalyan>
> >
>



-- 
Thanks and Regards
N Radhakrishna Kalyan

P:  +46 733 312 584
http://about.me/nrkkalyan
 <http://about.me/nrkkalyan>

Reply via email to