1 2 Previous Next 15 Replies Latest reply on Jul 26, 2012 9:09 AM by deepavs

    JBoss 6 Virtual Directory-Virtual Path

    javigs82

      Hi,

       

      I need config my Jboss 6 Final Version for getting a virtual directory (or virtual path) from my file-system.

       

      My jsf file need include a series of images wich are not include in war file (web.war). They are in c:\images\

       

      I've read a Jboss Community Manual ( http://community.jboss.org/wiki/ExternalDirectories ) how get it, but, in this document not contemplate Jboss 6 and I have not been able to get.

       

      Can anybody help me?

       

      I've tried in server.xml :

       

      <Host name="localhost">

      <Context ..../>

      ...

      </Host>

       

      but Jboss doesn't work.


       

      Thanks a lot

        • 1. JBoss 6 Virtual Directory-Virtual Path
          jaikiran

          If I understand the question correctly, you want to deploy web.war in the JBOSS_HOME/server/<servername>/deploy/ folder and at the same time server some static content for this application from C:/images folder?

          • 2. JBoss 6 Virtual Directory-Virtual Path
            javigs82

            Yes, you understand the question correctly.

             

            Thanks

            • 3. JBoss 6 Virtual Directory-Virtual Path
              javigs82

              Hello,

              maybe  I am not explaining correctly. I'm going to attach an image which define what I would like to do.

              In my file.jsf , I have to include a xml file which is in Jboss data dir.

              I think I have to create a virtual/mapping directory and add it into Web Context

               

              Dibujo.JPG

              • 4. JBoss 6 Virtual Directory-Virtual Path
                jaikiran

                Actually, I understood your question. I'm just trying to recollect how this can be done in AS5 or AS6. i.e. the static data of a .war being deployed out of it and being accessible with the same web app context.

                • 5. JBoss 6 Virtual Directory-Virtual Path
                  javigs82

                  Hi,

                  In other projects with others servers i could add a file system dir into the web application contexts settings a different XML file like server.xml

                  Jaikiran, Is it impossible?

                  I have not been able to get.

                   

                  Please help me

                  • 6. Re: JBoss 6 Virtual Directory-Virtual Path
                    imranpariyani

                    hi javier,

                     

                    by any change did you figure out the solution for adding a context element to the server.xml for jbosweb 6 ?

                    • 7. JBoss 6 Virtual Directory-Virtual Path
                      javigs82

                      hi Imran,

                       

                      I have not been able to get it. I'm waiting for the solution.

                      I hope Jaikiran give us the solution.

                       

                      Thanks you all

                      • 8. JBoss 6 Virtual Directory-Virtual Path
                        gusfigueiredo

                        Hi guys,

                        Did anybody configured the virtual directory mapping on jboss 6?

                        • 9. JBoss 6 Virtual Directory-Virtual Path
                          imranpariyani

                          We did solve this problem ..

                           

                          here are the two links which helped us

                           

                          http://docs.jboss.org/jbossweb/3.0.x/config/resources.html

                           

                          https://issues.jboss.org/browse/JBAS-2290

                           

                          In brief

                           

                          In our main web app we added a context file in WEB-INF with the following

                           

                          <Resources allowLinking="true" className="PATH.TO.SourceResolverContext"/>

                           

                          And build and include a jar file with that class which extends FileDirContext

                           

                          and then within your web app u can get the file with

                           

                          request.getServletContext().getResourceAsStream(uri)

                           

                          Hope that helps ..

                           

                          Regards

                          Imran

                          • 10. JBoss 6 Virtual Directory-Virtual Path
                            javigs82

                            I think you are working with Jboss Web Server, but I am woriking with Jboss AS 6.

                            Also, I need declare:

                             

                            <img src="/images/image1.jpg" />

                             

                            where /images must be mapping from a filesystem like (c:/images), out of the Web Context

                            • 11. JBoss 6 Virtual Directory-Virtual Path
                              imranpariyani

                              Jboss Web Server is a part of Jboss application server .. before jboss AS 6 they were using tomcat .. and from jboss 6 onwards they have switched to jboss web server which is again based on tomcat ...

                               

                              For our application we using the application server as we are using EJB's ..

                               

                              Go through those links .. all you have to do is override the default FileDirContext .. and in the web-inf add a resource which points to that class ..

                               

                              One thing i forgot to mention .. the jar file which u create with that resourceresolvercontext has to be placed inside the jbossweb.sar in order to access it within your webapplication..

                               

                              And for your case u could just have a servlet in front which filters all the requests .. tries to fetch them form the resource if not availble dispatches it further ..

                              • 12. JBoss 6 Virtual Directory-Virtual Path
                                charly.hurtado

                                somebody know why they changed about Virtual Directory.

                                 

                                For example on jboss-4.0.5 this is posible with a simple lines on serverl.xml

                                 

                                but know on jboss 6 this is not posible.. mean i cant do it. yet

                                • 13. Re: JBoss 6 Virtual Directory-Virtual Path
                                  khichar.anil

                                  I am deadly waiting for your answer.

                                   

                                  • When i am trying to add the context into C:\jboss-6.0.0.Final\server\default\deploy\jbossweb.sar\server.xml, it's blurting with the error :-->

                                   

                                  DEPLOYMENTS IN ERROR:

                                    Deployment "WebServer" is in error due to the following reason(s): **ERROR**, org.jboss.xb.binding.JBossXBRuntimeException: Context not found as a child of Host in unordered_sequence: Listener* Valve* Alias* Realm? attributes?

                                    Deployment "jboss.web:service=WebServer" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.web:service=WebServer' **

                                   

                                      at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1228) [:2.2.0.GA]

                                      at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:905) [:2.2.0.GA]

                                      at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:87) [:6.0.0.Final]

                                      at org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry.checkAllComplete(ProfileDeployerPluginRegistry.java:107) [:0.2.2]

                                      at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:135) [:6.0.0.Final]

                                      at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.Final]

                                      at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]

                                      at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]

                                      at java.lang.Thread.run(Thread.java:662) [:1.6.0_25]

                                   

                                  • It means the context element is invalid at this position for the server.xml.
                                  • I also tried one more trial with C:\jboss-6.0.0.Final\server\default\deploy\jbossweb.sar\context.xml as:-->

                                   

                                   

                                  <!-- The contents of this file will be loaded for each web application -->

                                  <Context cookies="true" crossContext="true" path="/contents" appBase="" docBase="C:/content" debug="99" reloadable="true">

                                     <!-- Session persistence is disable by default. To enable for all web

                                     apps set the pathname to a non-empty value:

                                     <Manager pathname="SESSIONS.ser" />

                                   

                                     To enable session persistence for a single web app, add a

                                     WEB-INF/context.xml

                                     -->

                                     <Manager pathname="" />

                                   

                                     <!-- Install an InstanceListener to handle the establishment of the run-as

                                     role for servlet init/destroy events.

                                     -->

                                     <InstanceListener>org.jboss.web.tomcat.security.RunAsListener</InstanceListener>

                                     <!-- Install an InstanceListener to handle the establishment of the naming

                                     context.

                                     -->

                                     <InstanceListener>org.jboss.web.tomcat.service.NamingListener</InstanceListener>

                                    

                                  </Context>

                                   

                                  • But all in vain.
                                  • I don't know why this is changed in jboss6. Even there is no any information regarding this functionality throughout the jboss6 documentations.
                                  • I am totally stucked with this one. Though i don't wana chage any changement in code. I needs it into some configuration file within jboss only.
                                  • 14. Re: JBoss 6 Virtual Directory-Virtual Path
                                    khichar.anil

                                    Hi all , i get it rsolved by doing the following stuff :

                                    1. Configure JBoss to follow symbolic links
                                    • Go to <JBOSS_HOME>/server/default/deploy/jbossweb.sar/content.xml
                                    • Add allowLinking="true" as:
                                    • <Context cookies="true" crossContext="true" allowLinking="true">

                                    2.  Create symbolic link as (i assume you are working on windows, symlink will work same as on Linux also.)

                                    • go to command prompt -> Run as administrator ->
                                    • C:\Windows\system32>mklink /D C:\jboss-6.0.0.Final\server\default\deploy\ROOT.war\contents C:\content

                                     

                                    Please leave the respose if it helps anybody else also.

                                    1 2 Previous Next