From users-return-13916-apmail-tomee-users-archive=tomee.apache.org@tomee.apache.org Sat Oct 19 17:22:16 2013 Return-Path: X-Original-To: apmail-tomee-users-archive@www.apache.org Delivered-To: apmail-tomee-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D4AC210257 for ; Sat, 19 Oct 2013 17:22:16 +0000 (UTC) Received: (qmail 37454 invoked by uid 500); 19 Oct 2013 17:19:23 -0000 Delivered-To: apmail-tomee-users-archive@tomee.apache.org Received: (qmail 36912 invoked by uid 500); 19 Oct 2013 17:19:08 -0000 Mailing-List: contact users-help@tomee.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@tomee.apache.org Delivered-To: mailing list users@tomee.apache.org Received: (qmail 36842 invoked by uid 99); 19 Oct 2013 17:19:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Oct 2013 17:19:05 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of rmannibucau@gmail.com designates 209.85.128.46 as permitted sender) Received: from [209.85.128.46] (HELO mail-qe0-f46.google.com) (209.85.128.46) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Oct 2013 17:18:59 +0000 Received: by mail-qe0-f46.google.com with SMTP id s14so2768024qeb.19 for ; Sat, 19 Oct 2013 10:18:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=YRa+2GrnddmFgLOGhYkq+oOt38+0RIflQv5V2WkjT+g=; b=Qnrkz659oJNLXBbp8HXDX2BsH4OznSXvry12SA2gObpTUWkW8f+H13nv9Jdya8/sY7 3yxgtGqRjZRdFuRLoZGUlTQGkgAwyelS1YzBHsaOfqAR1DF7cLf/U3/Pio5VadXcyohz ZGTLp3GRr3gCSMjLArAp/HrM4yUP0GUauFzDDa347igpnk2YPH+SCAnBs5QqEbxhpp5B URXlAeAOGC/YswATFJq/LfFW9ZU5Yl1LvQTHq7/gYwOTHLxhzlJ+XzDHXz7nM9lz/8DG 5YUq/kXLeF1Sai09n3QedjJD9640yWRVBsj8qzlhvdpP2u1oRTCRF4mGeIKj0+ANiyae YpLw== MIME-Version: 1.0 X-Received: by 10.224.16.8 with SMTP id m8mr12855929qaa.28.1382203117775; Sat, 19 Oct 2013 10:18:37 -0700 (PDT) Received: by 10.96.41.99 with HTTP; Sat, 19 Oct 2013 10:18:37 -0700 (PDT) Received: by 10.96.41.99 with HTTP; Sat, 19 Oct 2013 10:18:37 -0700 (PDT) In-Reply-To: References: Date: Sat, 19 Oct 2013 19:18:37 +0200 Message-ID: Subject: Re: OpenEJB in JavaSE(Need help) From: Romain Manni-Bucau To: users@tomee.apache.org Content-Type: multipart/alternative; boundary=001a11c2a41cd7b35b04e91b3d4f X-Virus-Checked: Checked by ClamAV on apache.org --001a11c2a41cd7b35b04e91b3d4f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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" a =E9cri= t : > 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 > wrote: > > > If you really want jersey set a context factory or start openejb before > > Le 19 oct. 2013 18:10, "Radhakrishna Kalyan" a > > =E9crit : > > > > > Hi Romain, > > > > > > Sorry I didn't get you. If you closely look at the code, I am using t= he > > > 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 > > > wrote: > > > > > > > Hi > > > > > > > > Why not using EJBContainer? > > > > > > > > Note: openejb embedded supports jaxrs through openejb-cxf-rs > dependency > > > > Le 19 oct. 2013 16:55, "Radhakrishna Kalyan" = a > > > > =E9crit : > > > > > > > > > Hi > > > > > > > > > > Iam looking to develop a REST based webservice but I don't want t= o > > 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 an= d > > > 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=3D new MyBootStrap(); > > > > > Properties p =3D new Properties(); > > > > > p.setProperty(Context.INITIAL_CONTEXT_FACTORY, > > > > > "org.apache.openejb.client.LocalInitialContextFactory"); > > > > > > > > > > > > > > > > > > > > p.setProperty("com.sun.jersey.server.impl.cdi.lookupExtensionInBeanManage= r", > > > > > "true"); > > > > > > > EJBContainer.createEJBContainer(p).getContext().bind("inject", > > > > > bootStrap); > > > > > > > > > > HttpServer server =3D HttpServer.create(new > > > > InetSocketAddress(9998), > > > > > 0); > > > > > HttpHandler sf =3D > > > 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.NoInitialContextExceptio= n: > > > 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(CDIExtens= ion.java:297) > > > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method= ) > > > > > at > > > > > > > > > > > > > > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java= :39) > > > > > at > > > > > > > > > > > > > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI= mpl.java:25) > > > > > at java.lang.reflect.Method.invoke(Method.java:597) > > > > > at > > > > > > > > > > > > > > > org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.ja= va:295) > > > > > at > > > > > > > > > > > > > > > org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManag= er.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 shou= ld > > use > > > > > any thing more. > > > > > > > > > > Thanks in advance. > > > > > -- > > > > > Thanks and Regards > > > > > N Radhakrishna Kalyan > > > > > > > > > > P: +46 733 312 584 > > > > > http://about.me/nrkkalyan > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Thanks and Regards > > > N Radhakrishna Kalyan > > > > > > P: +46 733 312 584 > > > http://about.me/nrkkalyan > > > > > > > > > > > > -- > Thanks and Regards > N Radhakrishna Kalyan > > P: +46 733 312 584 > http://about.me/nrkkalyan > > --001a11c2a41cd7b35b04e91b3d4f--