tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john S <email2jo...@gmail.com>
Subject Re: Problem Reading Property files
Date Wed, 27 May 2009 02:39:57 GMT
Thanks for your response, Actually we dont have the source code for that
because it is very old code, but i m using decompiler in which i can get
some informtaion.

OS used for *iPlanet* is *Unix* but now I need to deploy this application in
*tomcat* in *windows server 2003*.

Servlet clss:
*SERVLET CLASS*:
Class com.ijk.abc implements extends *HttpServlet*  implements *PropertyKeys
*
**{
private IClickManager m_im;
public void init(ServletConfig paramServletConfig)
    throws ServletException
  {
    Utils.info("Servlet initialization");
    try {
      super.init(paramServletConfig);
      Utils.info("ServerInfo: " + getServletContext().getServerInfo());
      PGroup localPGroup = this.m_im.claimPG();
      Utils.trace("Got " + localProcessorGroup + " for initialization");
    *  this.m_im.gatherProperties(localProcessorGroup);-----------this is
where it is calling the property files.*
      this.m_im.freePG(localPGroup);
      Utils.trace("Released " + localPGroup + " for new Properties");
      localPGroup = this.m_im.claimPG();
      Utils.trace("Got " + localPGroup + " for new Properties");
      try
      {
        ConHandler localDBHandler =
(ConHandler)localPGroup.getDBHandler("config.dbhandler");
        this.m_im.setNumPGs(localDBHandler.getNumPGroups());
      }
      catch (Exception localException1) {
        Utils.info("NON FATAL ERROR: failed to set number of PGs",
localException1);
      }
      try
      {
        Session.createAndStartSessionTask(localPGroup);
        localPGroup.resumeAllTasks();
      }
      catch (Exception localException2) {
        Utils.info("NON FATAL ERROR: failed to start tasks",
localException2);
      }
      this.m_im.freePG(localPGroup);
      Utils.trace("Released " + localPGroup + " for initialization");
      Utils.info("Servlet initialization finished");
    }
    catch (FatalServletError localFatalServletError) {
      Utils.error("FatalServletError: ", localFatalServletError);
      throw new UnavailableException(this,
localFatalServletError.toString());
    }
    catch (Error localError) {
      Utils.error("Error: ", localError);
      throw localError;
    }
  }
}
==========================================================

 *public void gatherProperties(ProcessorGroup paramProcessorGroup)*
  {
    Object localObject;
    this.m_props.clear();
    String str1 = this.m_servlet.getInitParameter(*"loan.dir"*);
    if (str1 == null) {
      str1 = System.getProperty("server.root",
System.getProperty("user.dir", "."));
    }
    this.m_props.put("loan.dir", str1);
    String str2 = this.m_servlet.getInitParameter("abc.log");
    setLogFile(str2);
    try
    {
      String str3 = this.m_servlet.getInitParameter("abc.props");
      if (str3 == null)
        str3 = "abc.props";
      localObject = str1 + File.separator + str3;
      Utils.info("Reading properties from file: " + ((String)localObject));
      Utils.loadProperties(this.m_props, new BufferedInputStream(new
FileInputStream((String)localObject)));
    }
    catch (IOException localIOException) {
     * Utils.info("NON FATAL WARNING: Could not read props file",
localIOException);--while running i m getting this error
*    }
    Utils.info("Reading properties from Servlet Parameters");
    Enumeration localEnumeration = this.m_servlet.getInitParameterNames();
    while (localEnumeration.hasMoreElements()) {
      localObject = (String)localEnumeration.nextElement();
      this.m_props.put(localObject,
this.m_servlet.getInitParameter((String)localObject));
    }
    Utils.info("Reading properties from DB");
    try {
      localObject =
(ConDBHandler)paramProcessorGroup.getDBHandler("config.dbhandler");
      String str5 = ((ConDBHandler)localObject).getPropertiesFile();
      Utils.loadProperties(this.m_props, new
ByteArrayInputStream(str5.getBytes()));
    }
    catch (Exception localException) {
      *Utils.info("NON FATAL WARNING: Could not read props file",
localIOException);--while running i m getting this error*
    }
    String str4 = this.m_props.getProperty("smtp.host");
    if (str4 != null) MailUtils.setSMTPHost(str4.trim());
    if (str2 == null) {
      str2 = this.m_props.getProperty("*abc.log");*
      setLogFile(str2);
    }
     runInitializers(paramPGroup);
    Utils.info("New Properties:", this.m_props);
    this.m_rroots =
StringUtils.getPathsFromList(this.m_props.getProperty("resource.path",
"/com/loan/resources/:/"));
    clearAllPGs();
  }
=================================================================
the above is the servlet class and the method which is using to read the
property files from root directory in Unix.
ie..*/opt/mywebapp/loan/abc.props,abc.lo*g
loan is the directory in which two property files are placed.

i just want to where to place property files in tomcat so that its going to
read the property files.
Right now, i placing it in the
WEBAPPS/MYWEBAPPLICATION/WEB-INF/LOAN/abc.props,abc.logs.

Its giving me errors such as FILENOTFOUNDEXCEPTION or cannot read the
property files.


The main problem is ...I donot have the complete source code. while
decompiling i m not able view complete source code.

Please help me regarding this.........


Thanks in advance.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message