1 Reply Latest reply on Mar 20, 2003 7:27 AM by Adrian Brock

    Problem with getRealPath ?

    Johann DUPUIS Newbie

      I'm running jboss-3.2.0beta2_tomcat-4.0.6 with
      jdk 1.4.1_02 on win32.

      It seems that getRealPath send me back 'null' value.

      It leads to unsuccessful loading of some file properties used by velocity and probably jportal/jetspeed.

      Something I misunderstand?

      Johann

      ------------------------------------------------------
      Part of the source code of the servlet see velocity servlet samples for full source....

      protected Properties loadConfiguration(ServletConfig config )
      throws IOException, FileNotFoundException
      {
      /*
      * get our properties file and load it
      */

      String propsFile = config.getInitParameter(INIT_PROPS_KEY);

      Properties p = new Properties();

      if ( propsFile != null )
      {
      System.out.println("propsFile is "+propsFile);
      String realPath = getServletContext().getRealPath(propsFile);

      System.out.println("realPath is "+realPath);

      if ( realPath != null )
      {
      propsFile = realPath;
      }

      p.load( new FileInputStream(propsFile) );
      }

      return p;

      }

      Résultat:

      -------------------------------------------------------
      Jboss Log Output:
      11:35:18,236 INFO [STDOUT] propsFile is /velocity.properties
      11:35:18,236 INFO [STDOUT] realPath is null