1 2 Previous Next 18 Replies Latest reply: Dec 27, 2007 9:12 AM by Michael Diamant RSS

Is Virtual Directory mapping supported in JBoss?

dan2000 Newbie

Is there a way to create Virtual Directory that reside outside the JBoss Home directory. In other words ,, how do i map a web virtual path to a directory path.

e.g. C:\Storage
accessible from: http://localhost:8080/Storage

  • 1. Re: Is Virtual Directory mapping supported in JBoss?
    Scott Stark Master

    By adding a Context entry to the jbossweb-tomcat41.sar/META-INF/jboss-service.xml descriptor:

    <server>
    
     <mbean code="org.jboss.web.tomcat.tc4.EmbeddedTomcatService"
     name="jboss.web:service=WebServer">
    ...
     <attribute name="Config">
     <Server>
     <Service name="JBoss-Tomcat">
     <Engine name="MainEngine" defaultHost="localhost">
     <Logger className="org.jboss.web.tomcat.Log4jLogger"
     verbosityLevel="debug" category="org.jboss.web.localhost.Engine"/>
    ...
     <Host name="localhost">
    ...
     <!-- Default context parameters -->
     <DefaultContext cookies="true" crossContext="true" override="true"/>
    
     <!-- Add a static context /Storage using directory /tmp/images -->
     <Context docBase='C:/Storage' path='/Storage' />
    ...
    


  • 2. Re: Is Virtual Directory mapping supported in JBoss?
    dan2000 Newbie

    Thanks. it works now.

  • 3. Re: Is Virtual Directory mapping supported in JBoss?
    Prasad Pimplaskar Newbie

    I have simmilar requirement and could not get the suggestion working in my case. I am trying to access images located at
    localhost:8080/MyWeb/images from my jsps.

    I have c:/images mapped to it. I modified the
    C:\jboss-3.2.5\server\default\deploy\jbossweb-tomcat50.sar\META-INF\jboss-service .xml
    as follows:





    <!-- Default context parameters -->

    <!-- Add a static context /Storage using directory /tmp/images -->







    any help is appreciated.
    thanks
    P

  • 4. Re: Is Virtual Directory mapping supported in JBoss?
    Prasad Pimplaskar Newbie

    the xml changes missing in my earlier post.

    <attribute name="Config">
     <Server>
     <Service name="JBoss-Tomcat">
     <Engine name="MainEngine" defaultHost="localhost">
     <Host name="localhost">
     <!-- Default context parameters -->
     <DefaultContext cookies="true" crossContext="true" override="true"/>
     <!-- Add a static context /Storage using directory /tmp/images -->
     <Context docBase="C:/images" path="/cmpe275/images"/>
     </Host>
     </Engine>
     </Service>
     </Server>
     </attribute>
    


  • 5. Re: Is Virtual Directory mapping supported in JBoss?
    Prasad Pimplaskar Newbie

     

    "prasadmp" wrote:
    the xml changes missing in my earlier post.

    <attribute name="Config">
     <Server>
     <Service name="JBoss-Tomcat">
     <Engine name="MainEngine" defaultHost="localhost">
     <Host name="localhost">
     <!-- Default context parameters -->
     <DefaultContext cookies="true" crossContext="true" override="true"/>
     <!-- Add a static context /Storage using directory /tmp/images -->
     <Context docBase="C:/images" path="/images"/>
     </Host>
     </Engine>
     </Service>
     </Server>
     </attribute>
    


  • 6. Re: Is Virtual Directory mapping supported in JBoss?
    christina ku Newbie

    Hi there,

    i am also trying to create a virtual directory for the purpose of integrating jboss with Report Application Server (RAS). However, when i try the code given in the forum, it doesn't work... i am using jboss 3.2.5 and tomcat 5.0.
    Is there any difference with the code given in the forum with different versions? and wat should i include in the ... field? i guess there must be some other codes that i need to add by myself base on the version that i am using isn't it?

    thanx =)
    chris

  • 7. Re: Is Virtual Directory mapping supported in JBoss?
    Prasad Pimplaskar Newbie

    I made the following changes. Not all of them may be required. You can try one at a time.
    1. jboss/server/default/conf/jboss-service.xml

    <server>
     <!-- Load all jars from the JBOSS_DIST/server/<config>/lib directory. This
     can be restricted to specific jars by specifying them in the archives
     attribute.
     -->
     <classpath codebase="lib" archives="*"/>
     <!-- Set the virtual directory to be used by the application
     Ref: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=48300 -->
     <attribute name="Config">
     <Server>
     <Service name="JBoss-Tomcat">
     <Engine name="MainEngine" defaultHost="localhost">
     <Host name="localhost">
     <!-- Default context parameters -->
     <DefaultContext cookies="true" crossContext="true" override="true"/>
     <!-- Add a static context /Storage using directory /tmp/images -->
     <Context docBase="C:/images" appBase="/cmpe275" path="/images"/>
     </Host>
     </Engine>
     </Service>
     </Server>
     </attribute>
     <!-- Virtual directory setting - END -->
    

    one more place
    <!-- ==================================================================== -->
     <!-- Deployment Scanning -->
     <!-- ==================================================================== -->
     <!-- An mbean for hot deployment/undeployment of archives.
     -->
     <mbean code="org.jboss.deployment.scanner.URLDeploymentScanner" name="jboss.deployment:type=DeploymentScanner,flavor=URL">
     <attribute name="URLs">
     deploy/cmpe275, file:///C:/images/
     </attribute>
    


    2. jboss/server/default/deploy/jbossweb-tomcat50.sar/META-INF/jboss-service.xml
    <server>
     <mbean code="org.jboss.web.tomcat.tc5.Tomcat5" name="jboss.web:service=WebServer">
     <!-- Get the flag indicating if the normal Java2 parent first class
     loading model should be used over the servlet 2.3 web container first
     model.
     -->
     <attribute name="Java2ClassLoadingCompliance">true</attribute>
     <attribute name="LenientEjbLink">true</attribute>
     <!-- A flag indicating if the JBoss Loader should be used. This loader
     uses a unified class loader as the class loader rather than the tomcat
     specific class loader.
     -->
     <!-- Set the virtual directory to be used by the application
     Ref: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=48300 -->
     <attribute name="Config">
     <Server>
     <Service name="JBoss-Tomcat">
     <Engine name="MainEngine" defaultHost="localhost">
     <Host name="localhost">
     <!-- Default context parameters -->
     <DefaultContext cookies="true" crossContext="true" override="true"/>
     <!-- Add a static context /Storage using directory /tmp/images -->
     <Context docBase="C:/images" appBase="/cmpe275" path="/images"/>
     </Host>
     </Engine>
     </Service>
     </Server>
     </attribute>
     <!-- Virtual directory setting - END -->
     <attribute name="UseJBossWebLoader">true</attribute>
    


    3. jboss/server/default/deploy/jbossweb-tomcat50.sar/server.xml
    <Host name="localhost" autoDeploy="false" deployOnStartup="false" deployXML="false">
     <!-- Default context parameters -->
     <DefaultContext cookies="true" crossContext="true" override="true"/>
     <!-- Add a static context /Storage using directory /tmp/images -->
     <Context docBase="C:/images" path="/cmpe275/images"/>
    


    4. copy web.xml to
    jboss/server/default/conf

    This has worked for me. Hope this helps you.
    There has to be easier way to solve this.
    - PP

  • 8. Re: Is Virtual Directory mapping supported in JBoss?
    christina ku Newbie

    btw, if i successfully created the virtual directory, does it mean that if i go to http://localhost:8080/images, i will be able to see the content of the images folder on my web browser? i was hoping i could see something, but there isn't anything there except for http status 404..

    and i have another question. i was hoping to create 2 virtual directories.. is it as simple as adding another line to another path?

    thank you so much.. =) prasadmp

    regards,
    chris

  • 9. Re: Is Virtual Directory mapping supported in JBoss?
    Prasad Pimplaskar Newbie

    Yes, http://localhost:8080/images should show directory listing. Notice in my case above the web module is cmpe275. so When i do
    http://localhost:8080/cmpe275/images
    it lists all the files in c:\imgaes directory.

    - PP

  • 10. Re: Is Virtual Directory mapping supported in JBoss?
    christina ku Newbie

    it's so amazing what jboss can do with just those few lines.. i am really new to this.. so i was hoping to get a tutorial or something which can explain what prasadmp say in his guide.. hehehe.. thanks prasadmp.. i was stuck on that for days...

    anyone knows where i can find more guide and explaination on what's a context docbase for eg..??

    chris

  • 11. Re: Is Virtual Directory mapping supported in JBoss?
    Iraj Entezarjou Newbie

    I tried the above suggested solution on JBoss 3.2.4 without success. I tried it also with 3.2.6 and after removing one of the steps in the above suggested solution it worked. I expected though this to be a one line configuration issue and not to put same/diferent elements in three different files.

    Do not put the following in the file {$JBOSS_HOME}/server/default/conf/jboss-service.xml file

    <attribute name="URLs">
     deploy/cmpe275, file:///C:/images/
    </attribute>
    




  • 12. Re: Is Virtual Directory mapping supported in JBoss?
    Anton Hughes Newbie

     

    "prasadmp" wrote:

    There has to be easier way to solve this.
    - PP


    That is so true! I've tried the above examples but still nothing is working.

    Surely this must be a common task but I cant seem to see an easy way to do it, not is it clearly documented. I certainly dont wont to promote microsoft but in IIS its so easy to add a virtual directory because its a common task so they make it easy.

    if you do a google search for "vitual directory" site:docs.jboss.org it returns nothing.

    Can someone PLEASE reply with the correct way to add a virtual directory - PLEASE!



  • 13. Re: Is Virtual Directory mapping supported in JBoss?
    Tania Venegas Newbie

    Hi,
    I tried this case and it does very good, but it doesn't work when my server is Linux. In this case, in examples, I can't to use docBase="C:\Storage".
    I have to try with docBase="/deploy/tmp", but it doesn't work.

    In file jboss-service.xml of /server/all/conf I define attribute:

    deploy/mbreporting2, /temporal.war/


    It doesn't work. How I can to configurate this files for to use in Linux?.

    Thank you.

  • 14. Re: Is Virtual Directory mapping supported in JBoss?
    frank sun Newbie

    can anybody summarize the total solution for what prasadmp mentioned? that is, how to access the images , which is in the different location from the web application, from jsp?

1 2 Previous Next