Hi Steve!

I always get: service.properties file not found. Will use defaults
with no further error message.

What should I do now?


Thanks for help!
Chris


-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Gesendet: Samstag, 20. März 2004 15:37
An: [EMAIL PROTECTED]
Betreff: Re: How I get the <AxisServlet URL> within Axis?

Hi Chris,

Here is some code I use from within my WebSevice to access a property file 
within the Web Context.

Hope this helps....


                org.apache.axis.MessageContext axisContext = 
org.apache.axis.MessageContext.getCurrentContext();
                javax.servlet.ServletContext sc = 
((javax.servlet.http.HttpServlet)axisContext.getProperty
(org.apache.axis.transport.http.HTTPConstants.MC_HTTP_SERVLET)).getServletCo
ntex
t();

                String path = sc.getRealPath("/WEB-INF/service.properties");
                // now get the properties for the server and EJB location 
information
                java.util.Properties props = new java.util.Properties();
                
                try {
                        props.load(new java.io.FileInputStream(path));
                }
                catch(java.io.FileNotFoundException fnfe) {
                        sc.log("service.properties file not found. Will use 
defaults." + fnfe.getMessage());
                        System.out.println("service.properties file not
found. 
Will use defaults");
                }

                catch(java.io.IOException ioe) {
                        sc.log("service.properties file not loaded. Will use

defaults." + ioe.getMessage());
                        System.out.println("service.properties file not
loaded. 
Will use defaults");
                }

                String server = props.getProperty("EJBServer", "127.0.0.1");
                String port= props.getProperty("EJBServerPort", "7001");
                String ejb= props.getProperty("EJBJNDIName", "SoapBean");

Regards

Steve


Quoting Chris Aiken <[EMAIL PROTECTED]>:

> Hi together!
> 
> How I get the current <AxisServlet host>, <AxisServlet port> and <path to
> the AxisServlet> or the <AxisServlet URL> within Axis???
> 
> I had no success with <msgContext.getProperty("I_have_tried_all_keys")>.
> 
> 
> Thanks a lot for help,
> Chris
> 
> 
> 
> 




---------------------------------------------------
This message was sent using Spansurf Web Mail
Internet access in Spain - http://www.spansurf.com/

Reply via email to