Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 87996 invoked from network); 25 Jan 2010 20:58:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Jan 2010 20:58:23 -0000 Received: (qmail 89650 invoked by uid 500); 25 Jan 2010 20:58:20 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 89552 invoked by uid 500); 25 Jan 2010 20:58:20 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 89543 invoked by uid 99); 25 Jan 2010 20:58:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jan 2010 20:58:20 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of andreas.veithen@gmail.com designates 209.85.220.215 as permitted sender) Received: from [209.85.220.215] (HELO mail-fx0-f215.google.com) (209.85.220.215) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jan 2010 20:58:11 +0000 Received: by fxm7 with SMTP id 7so515491fxm.8 for ; Mon, 25 Jan 2010 12:57:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=dPlHw7qzkELJz5KO8Jh1Chv7TBX97bs7xTyonzeOhUs=; b=uLNCXAuqJt/QUKGRdTgXI2ZtSXHOWW8sCZ0BaLokV/VjRt7NWq/Us4W7pP0LziuU31 SfPuL2PW0HpzliK9FdrleqCRf8FbGSjJcJlvR2iOvAHoOIuNH+7gIO1Jcpa81S2xE+Bt obn6sNIKYEt/6Fas0Uaw0Xw0GYxxru+x/4BEE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=I6qlUw8QPLt6ccZec2aUR41KoMzY7GaeoOmksKKxjq3lUs1CWTHBf4MvUiz06AWVbg yDqQq6h/3TGUkHuRI4Nn/ocy8cUiyBS5kXu0Bpjl+cnUkOxPt/MdIQlh9RY1yfnKCdZe IgOwb8r7a74ZclqQm7l3odSZTLpy85zMlSAAk= MIME-Version: 1.0 Received: by 10.239.150.4 with SMTP id l4mr751495hbb.6.1264453069146; Mon, 25 Jan 2010 12:57:49 -0800 (PST) In-Reply-To: References: <802C4597-45D1-460E-BD29-14FD778EAD7C@lhsw.com> <4f5c8bd80912010947m4b05e907vd2909d1925a33138@mail.gmail.com> <14E13364-872D-4068-B596-32574AFF8ABE@lhsw.com> <4f5c8bd80912011028p5a674bbekb040883be34f1155@mail.gmail.com> <7DBAA95E-BEE8-4B2E-B4F6-F1B9D763125B@lhsw.com> From: Andreas Veithen Date: Mon, 25 Jan 2010 21:57:29 +0100 Message-ID: Subject: Re: archive lib directory and 3rd party libraries (axis2/tomcat 6) To: axis-user@ws.apache.org Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Charles, That might actually explain the issue. Here is some additional info: * ORB.init looks up classes from the thread context class loader (I checked that in the JRE sources). * ServiceTCCL=3Dcomposite means that Axis2 sets the TCCL to the service class loader when entering a service method and resets it after the method exits. * A new thread that is being created inherits the TCCL from its parent thread (see Javadoc of java.lang.Thread). However, it is possible that Axis2 doesn't take the ServiceTCCL property into account when executing a lifecycle method (maybe that should be considered as a bug). This would mean that your thread ends up with the TCCL set to the Web app class loader. Since the thread is managed by your service, you can obviously set the TCCL for that thread to whatever you want (It will have no impact on Axis2 nor on the servlet container). I would try to set it to the service class loader (You should be able to get a reference to that class loader from the parameters passed to the lifecycle method). Andreas On Mon, Jan 25, 2010 at 21:28, Charles Galpin wrote: > It's just a thread spawned from the lifecycle init method using new Threa= d()=85 The general idea is we have an existing code base that used to be la= unched as commandline apps. I am now launching them in a thread from my web= services, and "web enabling" them. =A0Admittedly there were not designed o= r built to be used this way, but I don't think there should be anything sto= pping me from doing this. > > The Corba initialization occurs in the client.corba.* packages, but they = are just calling org.omg.CORBA.ORB.init which is doing the class loading an= d thats from rt.jar in the java distro afaik. The ORB loaded is a configura= ble option which is why it uses the class loader (IE not in my control). > > I got past this one by putting the corba.jar into WEB-INF/lib. > > The SQLException I describe below occurs when a call is made to DriveMana= ger.getConnection(..) and works fine loading a single service/.aar > > charles > > On Jan 25, 2010, at 3:12 PM, Andreas Veithen wrote: > >> Charles, >> >> According to the stack trace you posted, the error occurs inside a >> thread that is neither managed by the servlet container, nor by Axis2: >> >> 13:38:58 DEBUG- Stack trace: org.omg.CORBA.INITIALIZE: can't >> instantiate default ORB implementation org.jacorb.orb.ORB =A0vmcid: 0x0 >> minor code: 0 =A0completed: No >> =A0 =A0 =A0 =A0at org.omg.CORBA.ORB.create_impl(ORB.java:297) >> =A0 =A0 =A0 =A0at org.omg.CORBA.ORB.init(ORB.java:336) >> =A0 =A0 =A0 =A0at client.corba.BaseCORBAApp.initCORBA(BaseCORBAApp.java:= 134) >> =A0 =A0 =A0 =A0at client.corba.BaseCORBAService.startService(BaseCORBASe= rvice.java:100) >> =A0 =A0 =A0 =A0at client.project.dcol.publish.corba.WebServiceDataCollec= tionService.webInit(WebServiceDataCollectionService.java:170) >> =A0 =A0 =A0 =A0at client.project.dcol.GDPI.ServiceBase$ServiceThread.run= (ServiceBase.java:318) >> =A0 =A0 =A0 =A0at java.lang.Thread.run(Thread.java:619) >> >> How and where is this thread created? >> >> Andreas >> >> On Mon, Jan 25, 2010 at 20:23, Charles Galpin wrote: >>> Thanks Andreas >>> >>> I added this to both services being loaded, rebuilt and ran, but no cha= nge. >>> >>> The composite class loader was one of the options described in Amil's b= log and as I understand it, it is supposed to use both the TCCL and the ser= vice class loader. But I guess I still don't understand the class loading b= ecause this jar is in all the places the class loaders should be looking so= I don't see how it matters which one it uses. >>> >>> I also tried the "EnableChildFirstClassLoading" parameter as well but n= o help. >>> >>> Thanks, >>> charles >>> >>> On Jan 25, 2010, at 1:53 PM, Andreas Veithen wrote: >>> >>>> Try adding the following parameter on the service: >>>> >>>> composite >>>> >>>> Andreas >>>> >>>> On Mon, Jan 25, 2010 at 18:22, Charles Galpin wrote= : >>>>> Hi All >>>>> I am still running into problems with this. =A0I previously moved all= the jars >>>>> I needed into the WEB-INF/lib directory and was able to continue work= ing. >>>>> But as I add more services (more .aar files) I am now running into st= range >>>>> unpredictable differences that I do not understand. >>>>> For example, I have two services packaged in their own .aar files and= if >>>>> deployed independently they run just fine. Simply deploying both toge= ther >>>>> causes the second one loaded to have mysterious problems like a >>>>> java.sql.SQLException "no suitable driver found for jdbc:sqlserver://= .." >>>>> when the sql3jdbc jar file is in both the .aar and WEB-INF/lib direct= ory and >>>>> (and as I said works fine standalone). >>>>> Does anyone have any advice on how to get my services to run together >>>>> happily? Assume I am not concerned with isolating each service from e= ach >>>>> other in terms of security. =A0I read on Amila's blog that some class= loading >>>>> settings can be modified but it's not clear exactly what ramification= s it >>>>> will have or if it will even help my problems. >>>>> I am not sure if this is causing my problems, but due to wanting to b= e able >>>>> to override the properties file in the .aar file when deployed in dif= ferent >>>>> environments, in the service lifecycle init method I attempt to find = the >>>>> properties file in the axis classpath before trying the .arr, using f= irst >>>>> axisService.getClass().getClassLoader(0.gerResourceAsStream(propsFile= name); >>>>> and if not found then using >>>>> this.getClass().getClassLoader(0.gerResourceAsStream(propsFilename); >>>>> Could this be messing up the class loading sequence, and if yes, how = can I >>>>> achieve the same effect without using the axis class loader first? >>>>> thanks, >>>>> charles >>>>> On Dec 1, 2009, at 2:29 PM, Charles Galpin wrote: >>>>> >>>>> Hi Sameera >>>>> Ok, this is starting to make a little more sense. I was not aware the >>>>> WebappClassLoader could not see classes in the .aar. Can this be chan= ged? >>>>> I have access to the source of the client.corba.* packages, but they = are >>>>> just calling org.omg.CORBA.ORB.init which is doing the class loading = and >>>>> thats from rt.jar in the java distro afaik. The ORB loaded is a confi= gurable >>>>> option which is why it uses the class loader. >>>>> Here is another exception stack you may find useful. I had run into t= his >>>>> problem as well as various other classes not loading a while ago and = made a >>>>> few changes until getting my service working, and one of them was to = pass >>>>> -Djava.library.path=3D"%PATH%;blahblah" in on the commandline when st= arting >>>>> tomcat. Removing this changes the error to a perhaps little more reve= aling >>>>> message (after understanding about the TCCL limitation) >>>>> 13:38:58 ERROR- Error initializing CORBA ORB. Unexpected CORBA error. >>>>> org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementatio= n >>>>> org.jacorb.orb.ORB =A0vmcid: 0x0 =A0minor code: 0 =A0completed: No >>>>> 13:38:58 DEBUG- Stack trace: org.omg.CORBA.INITIALIZE: can't instanti= ate >>>>> default ORB implementation org.jacorb.orb.ORB =A0vmcid: 0x0 =A0minor = code: 0 >>>>> =A0completed: No >>>>> =A0 =A0 =A0 =A0 at org.omg.CORBA.ORB.create_impl(ORB.java:297) >>>>> =A0 =A0 =A0 =A0 at org.omg.CORBA.ORB.init(ORB.java:336) >>>>> =A0 =A0 =A0 =A0 at client.corba.BaseCORBAApp.initCORBA(BaseCORBAApp.j= ava:134) >>>>> =A0 =A0 =A0 =A0 at >>>>> client.corba.BaseCORBAService.startService(BaseCORBAService.java:100) >>>>> =A0 =A0 =A0 =A0 at >>>>> client.project.dcol.publish.corba.WebServiceDataCollectionService.web= Init(WebServiceDataCollectionService.java:170) >>>>> =A0 =A0 =A0 =A0 at >>>>> client.project.dcol.GDPI.ServiceBase$ServiceThread.run(ServiceBase.ja= va:318) >>>>> =A0 =A0 =A0 =A0 at java.lang.Thread.run(Thread.java:619) >>>>> Caused by: java.lang.ClassNotFoundException: org.jacorb.orb.ORB >>>>> =A0 =A0 =A0 =A0 at >>>>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa= der.java:1387) >>>>> =A0 =A0 =A0 =A0 at >>>>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa= der.java:1233) >>>>> =A0 =A0 =A0 =A0 at java.lang.ClassLoader.loadClassInternal(ClassLoade= r.java:320) >>>>> =A0 =A0 =A0 =A0 at java.lang.Class.forName0(Native Method) >>>>> =A0 =A0 =A0 =A0 at java.lang.Class.forName(Class.java:247) >>>>> =A0 =A0 =A0 =A0 at org.omg.CORBA.ORB.create_impl(ORB.java:295) >>>>> =A0 =A0 =A0 =A0 ... 6 more >>>>> 13:38:58 ERROR- Aborted due to startup failure. >>>>> Aborted due to startup failure: Error initializing CORBA ORB. Unexpec= ted >>>>> CORBA error. >>>>> Is there any other way to work around this other than putting the lib= raries >>>>> in the axis2/WEB-INF/lib directory? To be clear I have other problems= beside >>>>> this. A good example is we have a custom log4j appender we use which = is in >>>>> Shared.jar. This cannot be found either unless it's in axis2/WEB-INF/= lib but >>>>> your description explains that one too. >>>>> thanks, >>>>> charles >>>>> On Dec 1, 2009, at 1:28 PM, Sameera Jayasoma wrote: >>>>> >>>>> Hi Charles >>>>> >>>>> On Tue, Dec 1, 2009 at 11:27 PM, Charles Galpin wr= ote: >>>>>> >>>>>> Hi Sameera >>>>>> >>>>>> Yes this is what is happening and what is expected. The >>>>>> org.omg.CosNotifyFilter.InvalidGrammar class is in jacorb.jar which = is in >>>>>> the .aar lib directory. What am I missing? Are you saying it should = not be >>>>>> in the thread context class loader? >>>>> >>>>> The class BaseCORBAApp is trying to loadInvalidGrammar class from the= TCCL >>>>> and in this scenario TCCL is set to the WebappClassLoader. Classes in= your >>>>> aar lib folder cannot be seen by the WebappClassLoader. It can only s= ee the >>>>> classes in axis2/WEB-INF/lib folder or in the application classpath >>>>> tomcat/lib. That is things work nicely when you put jacob.jar to >>>>> axis2/WEB-INF/lib. >>>>> >>>>> Do you have access to sources of the classes in client.corba.* packag= es. >>>>> >>>>> Thanks >>>>> sameera >>>>> >>>>>> >>>>>> On Dec 1, 2009, at 12:47 PM, Sameera Jayasoma wrote: >>>>>> >>>>>>> It seems that "BaseCORBAApp" class is trying to load >>>>>>> "org.omg.CosNotifyFilter.InvalidGrammar" from the thread context cl= ass >>>>>>> loader. That is why you see following lines in the exception log. >>>>>>> >>>>>>> =A0at >>>>>>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassL= oader.java:1387) >>>>>>> =A0at >>>>>>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassL= oader.java:1233) >>>>>>> >>>>>>> =A0This is a usual practice of loading application libraries. If yo= u have >>>>>>> access to the source code of client.corba classes, you can verify t= his. >>>>>>> >>>>>>> Thanks >>>>>>> Sameera >>>>>> >>>>>> >>>>>> Thanks Olindo, but the first error (see the bottom of the trace) is >>>>>> java.lang.ClassNotFoundException which I believe is the root cause. = I have >>>>>> checked and jacorb.jar is not in the path or classpath. >>>>>> >>>>>> On Dec 1, 2009, at 11:55 AM, Olindo Pindaro wrote: >>>>>> >>>>>>> The exception =A0isn't "ClassNotFound" but "NoClassDefFoundError", = that in >>>>>>> my experience is caused by conflit in differente version of library= present >>>>>>> in compiler path and classloaderpath. >>>>>> >>>>>> thanks, >>>>>> charles >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Sameera Jayasoma >>>>> Software Engineer >>>>> WSO2 Inc. >>>>> Oxygenating the Web Service Platform. >>>>> http://wso2.org/ >>>>> >>>>> blog: http://tech.jayasoma.org >>>>> >>>>> >>>>> >>> >>> > >