Return-Path: Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 53883 invoked by uid 500); 6 Jun 2003 18:59:33 -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: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 53834 invoked from network); 6 Jun 2003 18:59:32 -0000 Message-Id: <5.0.0.25.0.20030606115918.00bb20d8@mail.itmedicine.net> X-Sender: barretta@mail.itmedicine.net X-Mailer: QUALCOMM Windows Eudora Version 5.0 Date: Fri, 06 Jun 2003 12:00:55 -0700 To: , From: Susan Barretta Subject: RE: Trying to find resource directory location In-Reply-To: <001d01c32c5d$72ed97a0$6403a8c0@MIKELAPTOP> References: <5.0.0.25.0.20030606105706.00b9add8@mail.itmedicine.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N That's true, I did discover where the servlet was, but that is not where my service is. Rather than do something convoluted and strip \bin off of $CATALINA_HOME\bin and appending webapps\axis\web-inf\lib, I was hoping for a better way to locate my service. Thanks anyhow, Susan At 02:57 PM 6/6/2003 -0400, mser wrote: >I had a similar problem loading some configuration files from my web >service. The answer is $CATALINA_HOME/bin. After all it is a servlet. > >Somewhere in Axis land I found this code which revealed the mystery: > >MessageContext msgContext = MessageContext.getCurrentContext(); >String rootDir = >msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETLOCATI >ON).toString(); > >Michael Ser >Netweave Integrated Solutions, Inc. > > >-----Original Message----- >From: Susan Barretta [mailto:barretta@itmedicine.net] >Sent: Friday, June 06, 2003 2:13 PM >To: axis-user@ws.apache.org >Subject: Trying to find resource directory location > >Hi all, > >I have Axis services all zipped up in a jar under axis\web-inf\lib and >the >services run fine. This is Axis 1.1 under Tomcat 4.1.24. > >One service is deployed as follows (from my server-config.wsdd): > > > > value="DICOMSoapServices.dicomPacsProvider.DICOMPacsProvider"/> > languageSpecificType="java:DICOMObjects.services.DICOMPacsNode" >qname="ns1:DICOMPacsNode" xmlns:ns1="urn:DICOMPacsProvider"/> > > >My services use xml config files that up to now I had zipped up in the >jar, >and which I had been accessing with getResourceAsStream(). However we >want >those xml config files to be external to the jar so that we can easily >modify them without having to modify the service jar. > >However, I now need to get the directory path to those xml files and I >cannot figure out how to communicate to my service any Axis context >information. I was hoping to do something like getRealPath("/web-inf"). > >I have tried the following in order to get context information, however >I >seem to blow up with a NullPointerException when I try to >getServletContext(): > > try { > Class axisClass >= >Class.forName("org.apache.axis.transport.http.AxisServletBase",false,thi >s.getClass().getClassLoader()); > if (axisClass == null) { > System.out.println ("DOES NOT WORK - returned class is >null.") ; > } else { > System.out.println ("IT WORKS - found a class!") ; // >YES > } > > AxisServletBase asb = >(AxisServletBase)axisClass.newInstance(); > > if (asb == null) { > System.out.println ("CANNOT find AXIS BASE.") ; > } else { > System.out.println("IT WORKS - found Axis base.") ; // YES > System.out.println ("LOAD COUNTER is " + >asb.getLoadCounter()); // RETURNS 2 > } > > System.out.println ("ABOUT to try getting CONTEXT...") ; // >YES >I SEE THIS > ServletContext sc = asb.getServletContext(); // BLOWS >UP HERE > System.out.println ("GOT context...") ; // >NEVER >GET TO HERE > > if (sc == null) { > System.out.println ("WHYYYY is SERVLET CONTEXT NULL?") ; >// >I NEVER SEE THIS > } else { > System.out.println ("FOUND Servlet Context!") ; // NEVER >SEE >THIS EITHER > String home = sc.getRealPath("/") ; > System.out.println ("HOME DIRECTORY for applet is " + >home) ; > } > > >My service classes are not subclassed from anything in the Axis API. > >Any ideas????? > >Thanks, >Susan -- Susan