13 Replies Latest reply on Dec 17, 2002 7:46 PM by Didi

    getRealPath returns null in JBoss 3 beta

    Per Nyfelt Newbie

      I'm trying to use the Java webstart servlet with JBoss 3 with Tomcat 4.0.2 but it relies heavily on getRealPath() to create a File that is used to get resources and handle versioning etc.

      Here's an example

      String realPath = _servletContext.getRealPath( path ); // path is /app/lib
      File file = new File( realPath ); // this throws a null pointer exception
      if( file.exists() && file.isDirectory() ) {
      File afile[] = file.listFiles();
      ...

      The documentation on ServletContext says "This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive" and this is definitely the case here since I'm deploying everything in an EAR file but on the other hand this worked without problems in JBoss-2.4.0_Tomcat-3.2.3

      Any suggestions would be most appreciated.