6 Replies Latest reply on Dec 10, 2002 4:41 PM by didi

    Get real path problem

    samsonov

      Hi folks,

      I'm trying to use Jboss-3.0.1RC1-tomcat4.0.4 and I can't get real path of my application.

      So, ...getServletContext().getRealPath("/") in the my servlet returns null.
      Any idea?

      P.S. But this calls works fine on the jboss3.0.0-tomcat4.0.3

        • 1. Re: Get real path problem
          minamoto

          same here.
          I cannot use 3.0.1RC1-tomcat4.0.4 because of this.

          Miki

          • 2. Re: Get real path problem
            jburnett

            I have not found the solutions for this.
            Any know what to do?
            It works fine with Jetty but I cannot get getRealPath("/")
            to return a non-null value with any version of Jboss 3.X with Tomcat4.X

            • 3. Re: Get real path problem
              sdixit

              I have the same problem. Any solution/suggestions?

              Sandeep

              • 4. Re: Get real path problem
                zeroshot

                ive been thinking about this and i may be a mile of but in the web.xml or the tomcat-service.xml or what ever havent really invested really does it say anything about unpacking the war on deployment cos i think the web apps aint unpacked and maybe that is making the null exception

                thats just a thought havent done anything about it really i may do when i get back to programming

                • 5. Re: Get real path problem
                  sdixit

                  I tried to do this:-

                  In the web.xml of the .war, I created
                  <context-param>
                  <param-name>ContextRoot_docBase</param-name>
                  <param-value>/jboss-3.0.3_tomcat-4.1.12/tomcat-4.1.x/work/MainEngine/localhost/MyApplContextRoot5/</param-value>
                  </context-param>

                  and inside the .jsp that's calling getRealPath(), I used getServletContext().getInitParameter("ContextRoot_docBase");

                  This seems to work atleast for the creation of file at /MyApplContextRoot/newlycreated.jsp (I am creating a dynamic .jsp).

                  However, JBoss does't seem to find 'newlycreated.jsp' at root context????

                  Sandeep

                  • 6. Re: Get real path problem
                    didi

                    I experienced the same with Tomcat. I tried to build a upload-ejb but I can not getRealPath(). Could that be a permission issue? (I am using linux)