tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael D. Spence" <spe...@panix.com>
Subject RE: Where should I put properties files
Date Fri, 19 Sep 2003 16:05:13 GMT
> -----Original Message-----
> From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com]
> Sent: Friday, September 19, 2003 9:14 AM
> To: spence@panix.com
> Subject: RE: Where should I put properties files
>
>
>
> Don't do this in the constructor of your servlet, as it's not
> initialized yet.  Do it in the init method (after calling
> super.init) or
> later.
>
> Put just one copy of your properties file in the WEB-INF directory of
> your webapp.  Then do
>
> Properties p = new Properties();
> InputStream is =
> getServletContext().getResourceAsStream("/WEB-INF/NCNWebSvc.pr
> operties")
> ;
> p.load(is);
>

Ok, that makes sense.  I changed it to this:

public class NCNWebSvc  extends AxisServletBase {
  public NCNWebSvc() {
  }

  public String NoOperation(String xxx) {
    log.info("In noop" + xxx);
    return "noop was called successfully with arg " + xxx;
  }

    public void init() {
      log.info("Calling super.init");
      super.init();
      try {
        log.info("getResourceAsStream");
        InputStream Str = getServletContext().getResourceAsStream(
            "/WEB-INF/NCNWebSvc.properties");
        Properties P = new Properties();
        P.load(Str);
        passphrase = P.getProperty("Passphrase");
        hostname = P.getProperty("Hostname");
        portnum = P.getProperty("Portnum");
      }
      catch (Exception ex) {
        log.info("Error reading properties file: " + ex.getMessage());
      }

    }

}

But now Java2WSDL says:

D:\cvstree\ncnss\NCNWebSvc\classes>java org.apache.axis.wsdl.Java2WSDL -o
../NCNWebSvc.wsdl -l"http://164.179.157.7
3:8080/axis/services/NCNWebSvc" -n
 "urn:NCNWebSvc" -p"com.echo.NCNSS.NCNWebSvc"="urn:NCNWebSvc"
com.echo.NCNSS.NCNWebS
vc


- The class javax.servlet.ServletContext is defined in a java or javax
package and cannot be converted into an xml schem
a type.  An xml schema anyType will be used to define this class in the wsdl
file.
- The class javax.servlet.http.HttpServlet is defined in a java or javax
package and cannot be converted into an xml sch
ema type.  An xml schema anyType will be used to define this class in the
wsdl file.
- The class org.apache.axis.server.AxisServer extends non-bean class
org.apache.axis.AxisEngine.  An xml schema anyType
will be used to define org.apache.axis.server.AxisServer in the wsdl file.
WSDLException: faultCode=OTHER_ERROR: Can't find prefix for
'http://server.axis.apache.org'. Namespace prefixes must be
set on the Definition object using the addNamespace(...) method.:
        at com.ibm.wsdl.util.xml.DOMUtils.getPrefix(Unknown Source)
        at com.ibm.wsdl.util.xml.DOMUtils.getQualifiedValue(Unknown Source)
        at com.ibm.wsdl.util.xml.DOMUtils.printQualifiedAttribute(Unknown
Source)
        at com.ibm.wsdl.xml.WSDLWriterImpl.printParts(Unknown Source)
        at com.ibm.wsdl.xml.WSDLWriterImpl.printMessages(Unknown Source)
        at com.ibm.wsdl.xml.WSDLWriterImpl.printDefinition(Unknown Source)
        at com.ibm.wsdl.xml.WSDLWriterImpl.writeWSDL(Unknown Source)
        at com.ibm.wsdl.xml.WSDLWriterImpl.getDocument(Unknown Source)
        at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:267)
        at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:334)
        at org.apache.axis.wsdl.Java2WSDL.run(Java2WSDL.java:504)
        at org.apache.axis.wsdl.Java2WSDL.main(Java2WSDL.java:542)

This reminded me why it was that I changed my class to not extend
AxisServlet in the first place.  Is there a way around this?

Michael D. Spence
Mockingbird Data Systems, Inc.


Mime
View raw message