From user-return-16067-apmail-geronimo-user-archive=geronimo.apache.org@geronimo.apache.org Mon Apr 23 01:39:50 2012 Return-Path: X-Original-To: apmail-geronimo-user-archive@www.apache.org Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C2FCA97D7 for ; Mon, 23 Apr 2012 01:39:50 +0000 (UTC) Received: (qmail 60575 invoked by uid 500); 23 Apr 2012 01:39:50 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 60548 invoked by uid 500); 23 Apr 2012 01:39:50 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 60541 invoked by uid 99); 23 Apr 2012 01:39:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Apr 2012 01:39:50 +0000 X-ASF-Spam-Status: No, hits=0.2 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [98.138.91.73] (HELO nm25-vm0.bullet.mail.ne1.yahoo.com) (98.138.91.73) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 23 Apr 2012 01:39:43 +0000 Received: from [98.138.90.49] by nm25.bullet.mail.ne1.yahoo.com with NNFMP; 23 Apr 2012 01:39:22 -0000 Received: from [98.138.226.129] by tm2.bullet.mail.ne1.yahoo.com with NNFMP; 23 Apr 2012 01:39:22 -0000 Received: from [127.0.0.1] by smtp216.mail.ne1.yahoo.com with NNFMP; 23 Apr 2012 01:39:22 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1335145162; bh=t1ijznXn1xwn1nl8IVD5mZ6tO2CVIOGXAJHoozwqhS4=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Content-Transfer-Encoding:Message-Id:References:To:X-Mailer; b=rv8rBxjYJVleXkRcyH2XHj+t+4r4279OGeNK3w49QxfLZg6a8X1nvo0FoQ03FjeOqvQg5JEgyr5m7KoBQV1tdtsUmJ0cc45zelQtu8LBvXYEo1tnDkAd5lFBii0oDO9tA2C6cTtkZKQywjiZSZF835vAS5cpSWoT8Hw5glvKavc= X-Yahoo-Newman-Id: 183798.68650.bm@smtp216.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: UauFLvkVM1mRYHgasFJtDo1WT3Oq.hwdUedJmiedDfqEAbc nyY4eAT7pBVGVvBGpGJuEH3pX_KW3kNe3epmKmOYmdeM8oyJzvBzW5SZkIaV exN2WxlhcUxDG9pCm5KwzyUCA_IscgTHMJJOyeoI34Ohay3TcYZXkZiJRVqf z1TD2pxBWukK3R0xImkd7.NQX91_.HUMCQ7iQchggqfnga7m_3JHl1UyOo7_ tvybPfc2_vC2J5lO56MaZCx75L0YY2LVNcQFiPJbXA6sFmY0TzXh7lb9VHFA hJZxbDFsDXYikq6Fy3hXoh0mvdQ4FiwQrsRhKyIe0ohdpMNPC71FpXuIgJ8c 3eAYN0CeuDU2erF7qnsaO1U6MbCE9LqPJwWWEdBhcpkoAGRy1QnmLfKS30NG CGa2AoDb03FrIUw6yNMtFa9lb6iHv9iIAv6Dgkvv0aKEoW_fQ51wbZspdgeM O9AyC0EKqCEND19cDlQXGGSkCgEwQvWARRL9HafhNwHUOKzFpuYKs3TJo3It o5IG70EFs._oLzDqdKoZJZIVOaVdM4kF_vE4mCelmqzhs9GrL59nP9uGCOs7 IDg5Y1M9Obn2AUuKMGMRtbtKkT1e9XUpdcXo.pDwWHf8IFUaRVCnpp879rI6 OlbhW_drdWr_iBHUU.KNa_w4cTsfMsvnwZfM.0j8HkBCXSFozoN7oEqD._2x XizelZKteUPb70ef6mrYlNlQazSo08E6lLxt.CHPSr5cq2SJy96zdHJWAHRY Gzy1W7HrP85kjBzwHprlxvZTU_StQ1a.0_TVcTxl3hbKgTgqWpZwjpOQHDh0 1AHy8LQ9x54Zvcw.IG8mr2f6934tvhOrIxg-- X-Yahoo-SMTP: 0L8ifISswBAIAfMcfL1K7RTues02 Received: from [10.168.0.104] (mtqc2000@71.134.227.217 with plain) by smtp216.mail.ne1.yahoo.com with SMTP; 22 Apr 2012 18:39:21 -0700 PDT Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Apple Message framework v1257) Subject: Re: Geronino 3 beta Servlet issue From: Michael Chau In-Reply-To: Date: Sun, 22 Apr 2012 18:39:20 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <4B5C2DA7-FD7E-48D0-B93F-CB4726019416@gmail.com> <608E0BDF-6A80-4193-8B33-56B9C770D00A@yahoo.com> <715A7C8C-AB44-4D31-8A5A-49C8135435D3@yahoo.com> <9AD00066-02F7-433F-B9B6-168952F41650@yahoo.com> To: user@geronimo.apache.org X-Mailer: Apple Mail (2.1257) X-Virus-Checked: Checked by ClamAV on apache.org Thank you for all the help. I will take a look at both of them. On Apr 22, 2012, at 6:24 PM, li yanli wrote: > Please also take geronimo-5879 as a reference : > https://issues.apache.org/jira/browse/GERONIMO-5879 >=20 > On Sat, Apr 21, 2012 at 9:39 AM, Forrest Xia = wrote: >> I don't know postgres much, but I know there is a sample called = daytrader >> which support multiple databases, which includes postgres, you can = refer to >> a released one for example. >>=20 >> = http://svn.apache.org/repos/asf/geronimo/daytrader/tags/daytrader-3.0-beta= -1/ >>=20 >>=20 >> On Fri, Apr 20, 2012 at 3:17 PM, Michael Chau = wrote: >>>=20 >>> Thanks, Forrest. I am using the Ration OSGi tool. I somehow forgot = to >>> check the box to compile the servlet class into the WEB-INF/classes = folder. >>>=20 >>> Now, I'm trying to figure out how to write to a Postgres db using = jdbc. I >>> haven't been able to find any good examples. Can you point me to = one or >>> give me some tips on how to go about it? >>>=20 >>> Once again, thanks for the help. >>>=20 >>> michael >>>=20 >>> On Apr 19, 2012, at 9:24 PM, Forrest Xia wrote: >>>=20 >>> Two points here: >>> 1. What tools you used to genereate this eba? if using eclipse, = sugguest >>> you use Rational development tools for OSGi application[1] >>> 2. Your sample's web module sample-web_xxx.jar file structure is not >>> correct, you should put your servlet class into WEB-INF/classes = folder >>>=20 >>> [1] >>> = http://www.ibm.com/developerworks/rational/downloads/10/rationaldevtoolsfo= rosgiapplications.html >>>=20 >>> Attached an updated sample for your reference. >>>=20 >>> On Thu, Apr 19, 2012 at 12:42 PM, Michael Chau = wrote: >>>>=20 >>>> Sorry, I misunderstood you. Here it is: >>>>=20 >>>>=20 >>>>=20 >>>> On Apr 19, 2012, at 12:41 AM, Forrest Xia wrote: >>>>=20 >>>> Finding the potential error via "SEE" through the text is hard work = for >>>> me :) >>>>=20 >>>> Can you just attach your eba here? so that I can quickly have a = local try >>>> with your eba. >>>>=20 >>>> On Thu, Apr 19, 2012 at 1:07 PM, Michael Chau = wrote: >>>>>=20 >>>>> Thanks for helping me. I'm new to OSGi. Here are my configs and = code. >>>>>=20 >>>>> SampleApp >>>>> APPLICATION.MF >>>>>=20 >>>>> Application-Name: sample-app >>>>> Application-SymbolicName: sample-app >>>>> Application-ManifestVersion: 1.0 >>>>> Application-Version: 1.0.0.qualifier >>>>> Application-Content: sample-api;version=3D"1.0.0", >>>>> sample-server;version=3D"1.0.0", >>>>> sample-web;version=3D"1.0.0" >>>>> Manifest-Version: 1.0 >>>>>=20 >>>>> SampleApi >>>>>=20 >>>>> Manifest-Version: 1.0 >>>>> Bundle-ManifestVersion: 2 >>>>> Bundle-Name: sample-api >>>>> Bundle-SymbolicName: sample-api >>>>> Bundle-Version: 1.0.0.qualifier >>>>> Bundle-RequiredExecutionEnvironment: JavaSE-1.6 >>>>> Export-Package: com.sample.api >>>>>=20 >>>>>=20 >>>>> package com.sample.api; >>>>>=20 >>>>> public interface SampleService { >>>>> public String sayHello(String name); >>>>> } >>>>>=20 >>>>>=20 >>>>> SampleServer >>>>>=20 >>>>> Manifest-Version: 1.0 >>>>> Bundle-Blueprint: OSGI-INF/blueprint/*.xml >>>>> Bundle-Version: 1.0.0.qualifier >>>>> Bundle-Name: sample-server >>>>> Bundle-ManifestVersion: 2 >>>>> Import-Package: com.sample.api >>>>> Bundle-SymbolicName: sample-server >>>>> Bundle-RequiredExecutionEnvironment: JavaSE-1.6 >>>>> Export-Package: com.sample.server >>>>>=20 >>>>> Source: >>>>> package com.sample.server; >>>>>=20 >>>>> import com.sample.api.SampleService; >>>>>=20 >>>>> public class SampleServiceImpl implements SampleService { >>>>>=20 >>>>> public String sayHello(String name) { >>>>> // TODO Auto-generated method stub >>>>> return "Hello "+name; >>>>> } >>>>>=20 >>>>> } >>>>>=20 >>>>> **** Blueprint.xml >>>>>=20 >>>>> >>>>> >>>>> >>>>>=20 >>>>> >>>> interface=3D"com.sample.api.SampleService"/> >>>>>=20 >>>>> >>>>>=20 >>>>> SampleWeb >>>>>=20 >>>>> Manifest-Version: 1.0 >>>>> Bundle-ManifestVersion: 2 >>>>> Bundle-Name: sample-web >>>>> Bundle-SymbolicName: sample-web >>>>> Bundle-Version: 1.0.0.qualifier >>>>> Bundle-ClassPath: WEB-INF/classes >>>>> Web-ContextPath: /sample-web >>>>> Import-Package: com.sample.api, >>>>> javax.naming, >>>>> javax.servlet;version=3D"2.5", >>>>> javax.servlet.http;version=3D"2.5" >>>>> Bundle-RequiredExecutionEnvironment: JavaSE-1.6 >>>>> Export-Package: com.sample.client.web >>>>>=20 >>>>>=20 >>>>> package com.sample.client.web; >>>>>=20 >>>>> import java.io.IOException; >>>>>=20 >>>>> import javax.naming.InitialContext; >>>>> import javax.naming.NamingException; >>>>> import javax.servlet.ServletException; >>>>> import javax.servlet.http.HttpServlet; >>>>> import javax.servlet.http.HttpServletRequest; >>>>> import javax.servlet.http.HttpServletResponse; >>>>>=20 >>>>> import com.sample.api.SampleService; >>>>>=20 >>>>> /** >>>>> * Servlet implementation class SampleServlet >>>>> */ >>>>> public class SampleServlet extends HttpServlet { >>>>> private static final long serialVersionUID =3D 1L; >>>>>=20 >>>>> /** >>>>> * @see HttpServlet#HttpServlet() >>>>> */ >>>>> public SampleServlet() { >>>>> super(); >>>>> // TODO Auto-generated constructor stub >>>>> } >>>>>=20 >>>>> /** >>>>> * @see HttpServlet#doGet(HttpServletRequest request, = HttpServletResponse >>>>> response) >>>>> */ >>>>> protected void doGet(HttpServletRequest request, = HttpServletResponse >>>>> response) throws ServletException, IOException { >>>>> // TODO Auto-generated method stub >>>>> SampleService sample =3D null; >>>>> try { >>>>> InitialContext ic =3D new InitialContext(); >>>>> sample =3D (SampleService) ic.lookup("osgi:service/" + >>>>> SampleService.class.getName()); >>>>> response.getOutputStream().println("**** " + = sample.sayHello("Sample >>>>> Service")); >>>>> } >>>>> catch (NamingException e) { >>>>> e.printStackTrace(System.out); >>>>> } >>>>> } >>>>>=20 >>>>> /** >>>>> * @see HttpServlet#doPost(HttpServletRequest request, >>>>> HttpServletResponse response) >>>>> */ >>>>> protected void doPost(HttpServletRequest request, = HttpServletResponse >>>>> response) throws ServletException, IOException { >>>>> // TODO Auto-generated method stub >>>>> } >>>>>=20 >>>>> } >>>>>=20 >>>>> **** web.xml >>>>>=20 >>>>> >>>>> >>>> xmlns=3D"http://java.sun.com/xml/ns/javaee" >>>>> xmlns:web=3D"http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" >>>>> xsi:schemaLocation=3D"http://java.sun.com/xml/ns/javaee >>>>> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id=3D"WebApp_ID" >>>>> version=3D"3.0"> >>>>> sample-web >>>>> >>>>> SampleServlet >>>>> SampleServlet >>>>> com.sample.client.web.SampleServlet >>>>> >>>>> >>>>> SampleServlet >>>>> /sample >>>>> >>>>> >>>>> index.html >>>>> index.htm >>>>> index.jsp >>>>> default.html >>>>> default.htm >>>>> default.jsp >>>>> >>>>> >>>>>=20 >>>>>=20 >>>>>=20 >>>>> On Apr 18, 2012, at 8:44 PM, Forrest Xia wrote: >>>>>=20 >>>>> Can you attach your sample here for a check? >>>>>=20 >>>>> On Thu, Apr 19, 2012 at 12:43 AM, Michael Chau = >>>>> wrote: >>>>>>=20 >>>>>> I have my SampleApi (interface) exported it. I don't believe I'm >>>>>> suppose to export the implementation (SampleServer) and web = bundle(Sample >>>>>> Web). But, i just tried exporting them both just to see if it = will work and >>>>>> I'm still getting the same error. I'm somewhat following the = CounterApp >>>>>> example. My web bundle is pretty much the same as the = CounterWebBundle >>>>>> (same required import packages and no exports). >>>>>>=20 >>>>>>=20 >>>>>> On Apr 18, 2012, at 12:55 AM, Forrest Xia wrote: >>>>>>=20 >>>>>> Have you exported your application classes in Export-Package of >>>>>> MANIFEST.MF? >>>>>>=20 >>>>>> On Wed, Apr 18, 2012 at 3:42 AM, Michael Chau = >>>>>> wrote: >>>>>>>=20 >>>>>>> Thanks, Ivan. >>>>>>>=20 >>>>>>> I added the javax.naming to the import and now getting this = error: >>>>>>>=20 >>>>>>> 2012-04-18 00:40:53,484 ERROR [WebApplication] Unable to start = web >>>>>>> application for bundle sample-web >>>>>>> org.apache.geronimo.common.DeploymentException: Fail to load = servlet >>>>>>> class >>>>>>> at >>>>>>> = org.apache.geronimo.web25.deployment.merge.annotation.ServletSecurityAnnot= ationMergeHandler.postProcessWebXmlElement(ServletSecurityAnnotationMergeH= andler.java:79) >>>>>>> at >>>>>>> = org.apache.geronimo.web25.deployment.merge.MergeHelper.processWebFragments= AndAnnotations(MergeHelper.java:418) >>>>>>> at >>>>>>> = org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.basicInitCon= text(AbstractWebModuleBuilder.java:493) >>>>>>> at >>>>>>> = org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.initContext(= AbstractWebModuleBuilder.java:436) >>>>>>> at >>>>>>> = org.apache.geronimo.osgi.web.extender.WebApplication.doRun(WebApplication.= java:213) >>>>>>> at >>>>>>> = org.apache.geronimo.osgi.web.extender.WebApplication.run(WebApplication.ja= va:125) >>>>>>> at >>>>>>> = java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) >>>>>>> at = java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) >>>>>>> at java.util.concurrent.FutureTask.run(FutureTask.java:138) >>>>>>> at >>>>>>> = java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.= java:886) >>>>>>> at >>>>>>> = java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java= :908) >>>>>>> at java.lang.Thread.run(Thread.java:680) >>>>>>> Caused by: java.lang.ClassNotFoundException: >>>>>>> com.sample.client.web.SampleServlet >>>>>>> at >>>>>>> = org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoad= er.java:513) >>>>>>> at >>>>>>> = org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:= 429) >>>>>>> at >>>>>>> = org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:= 417) >>>>>>> at >>>>>>> = org.apache.geronimo.hook.equinox.GeronimoClassLoader.loadClass(GeronimoCla= ssLoader.java:85) >>>>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:247) >>>>>>> at >>>>>>> = org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:= 345) >>>>>>> at >>>>>>> = org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.j= ava:229) >>>>>>> at >>>>>>> = org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(Abstract= Bundle.java:1207) >>>>>>> at >>>>>>> = org.apache.geronimo.web25.deployment.merge.annotation.ServletSecurityAnnot= ationMergeHandler.postProcessWebXmlElement(ServletSecurityAnnotationMergeH= andler.java:52) >>>>>>> ... 11 more >>>>>>>=20 >>>>>>>=20 >>>>>>> On Apr 17, 2012, at 11:09 PM, Ivan wrote: >>>>>>>=20 >>>>>>> =46rom the log files, it seems that javax.naming should be added = in the >>>>>>> import-package list for the wab ? >>>>>>>=20 >>>>>>> 2012/4/18 Michael Chau >>>>>>>>=20 >>>>>>>> I've created a SampleApi(interface), = SampleServer(implementation) and >>>>>>>> SampleWeb(servlet) bundles. It's using Blueprint. I ran it in = the Apache >>>>>>>> Aries container and it was fine. I tried to run it in Geronimo = and got >>>>>>>>=20 >>>>>>>> 2012-04-17 14:44:52,759 ERROR [WebApplication] Unable to start = web >>>>>>>> application for bundle sample-web >>>>>>>> java.lang.NoClassDefFoundError: Could not fully load class: >>>>>>>> com.sample.client.web.SampleServlet >>>>>>>> due to:javax/naming/NamingException >>>>>>>> in classLoader: >>>>>>>> org.apache.geronimo.hook.equinox.GeronimoClassLoader@10993991 >>>>>>>> at = org.apache.xbean.finder.ClassFinder.(ClassFinder.java:136) >>>>>>>> at >>>>>>>> = org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.createWebApp= ClassFinder(AbstractWebModuleBuilder.java:663) >>>>>>>> at >>>>>>>> = org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.configureBas= icWebModuleAttributes(AbstractWebModuleBuilder.java:698) >>>>>>>> at >>>>>>>> = org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder.addGBeans(Tomcat= ModuleBuilder.java:483) >>>>>>>> at >>>>>>>> = org.apache.geronimo.osgi.web.extender.WebApplication.doRun(WebApplication.= java:218) >>>>>>>> at >>>>>>>> = org.apache.geronimo.osgi.web.extender.WebApplication.run(WebApplication.ja= va:125) >>>>>>>> at >>>>>>>> = java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) >>>>>>>> at = java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) >>>>>>>> at java.util.concurrent.FutureTask.run(FutureTask.java:138) >>>>>>>> at >>>>>>>> = java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.= java:886) >>>>>>>> at >>>>>>>> = java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java= :908) >>>>>>>> at java.lang.Thread.run(Thread.java:680) >>>>>>>>=20 >>>>>>>> Any help is appreciated. >>>>>>>>=20 >>>>>>>> Michael >>>>>>>=20 >>>>>>>=20 >>>>>>>=20 >>>>>>>=20 >>>>>>> -- >>>>>>> Ivan >>>>>>>=20 >>>>>>>=20 >>>>>>=20 >>>>>>=20 >>>>>>=20 >>>>>> -- >>>>>> Thanks! >>>>>>=20 >>>>>> Regards, Forrest >>>>>>=20 >>>>>>=20 >>>>>=20 >>>>>=20 >>>>>=20 >>>>> -- >>>>> Thanks! >>>>>=20 >>>>> Regards, Forrest >>>>>=20 >>>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>> -- >>>> Thanks! >>>>=20 >>>> Regards, Forrest >>>>=20 >>>>=20 >>>>=20 >>>=20 >>>=20 >>>=20 >>> -- >>> Thanks! >>>=20 >>> Regards, Forrest >>>=20 >>> >>>=20 >>>=20 >>=20 >>=20 >>=20 >> -- >> Thanks! >>=20 >> Regards, Forrest >>=20 >=20 >=20 >=20 > --=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 > Best Wishes! > Tina Li