11 Replies Latest reply on Jan 7, 2010 3:13 PM by ryanhos

    virtual directories in Jboss 5

    david.bennett

      Hi,
      I am trying to upgrade to jboss 5 and cant a virtual directory to work. I serve static content from a directory outside of jboss. This was working fine up to 4.2.3 by specifying a context in deploy/jboss-web.deployer/server.xml inside the host tag : -



      I tried duplicating this in jboss 5 in the

      deploy\jbossweb.sar\server.xml

      however it fails on bootup with (Partial only)
      10:55:10,539 ERROR [AbstractKernelController] Error installing to Start: name=WebServer state=Create
      org.jboss.xb.binding.JBossXBException: Failed to parse source: Context not found as a child of Host
      at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:203)

      which indicates you cant specify a context tag here any more. The server does start, but it fails to load the webserver because of this problem and nothing works.

      Anyone have a solution to this?

      thanks,
      dave.

        • 1. Re: virtual directories in Jboss 5
          peterj

          Please post the changes you made to server.xml. Also, please indicate where you made those changes (including some of the tags before before and after your changes should be sufficient).

          I am pretty certain this was working in CR2, at least I think that is the last time I tried it. I haven't tried GA yet.

          • 2. Re: virtual directories in Jboss 5
            iksrazal

            Anyone have a fix for this? I have the same problem. Here's my server.xml config:

            <Host name="localhost">
             <Valve className="org.jboss.web.tomcat.service.jca.CachedConnectionValve"
             cachedConnectionManagerObjectName="jboss.jca:service=CachedConnectionManager"
             transactionManagerObjectName="jboss:service=TransactionManager" />
            
            <Context path="/dev" docBase="/programs/myDev" reloadable="true"/>
            
             </Host>
            



            This config worked on at least 4.0.5 and 4.2.2 . I searched the release notes and the jboss 5 docs and I see nothing about this change. Please help.


            • 3. Re: virtual directories in Jboss 5
              peterj

              I went back and tried this on various releases. The results:

              4.2.3: works
              5.0.0.Beta4: works
              5.0.0.CR1 & CR2: does not work
              5.0.0.GA: generates this error:

              11:48:18,994 ERROR [AbstractKernelController] Error installing to Start: name=WebServer state=Create
              org.jboss.xb.binding.JBossXBException: Failed to parse source: Context not found as a child of Host
               at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:203)
               at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:183)
               at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:133)
               at org.jboss.web.tomcat.service.deployers.TomcatService.startService(TomcatService.java:171)
               at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:376)
               ...


              I would open a JIRA issue, but for some reason I do not have update access to JIRA...

              • 4. Re: virtual directories in Jboss 5
                iksrazal

                Thanks for the reply. I created this jira:

                https://jira.jboss.org/jira/browse/JBAS-6368

                • 5. Re: virtual directories in Jboss 5
                  iksrazal

                  BTW, as a workaround I looked at the context.xml file, as that seems to now be the preferred way to add a Context in tomcat. However, the jbossweb.sar/context.xml is seeming global, and only allows one Context defined. I need to add four contexts. Anyone know how to do userland context.xml files in jboss 5? I looked in the jboss docs and I couldn't find the equivalent as explained in the tomcat docs.

                  • 6. Re: virtual directories in Jboss 5
                    janv

                    I'm using JBoss 5.0.0.GA with JDK 6.

                    I expand the war file in the deploy directory. I then create a symbolic link in the expanded directory. It looks like JBoss does not follow the symbolic link and there is not "Context path" like in JBoss 4 where "allowLinking=true" could be set.

                    Any ideas?

                    • 7. Re: virtual directories in Jboss 5
                      formica

                      Did you manage to get JBoss 5 web server to access static content in the file system ?
                      I have exactly the same problem that you are mentioning in this topics and
                      I did not found any solution for the moment.

                      Thanks in advance
                      Andrea

                      • 8. Re: virtual directories in Jboss 5
                        peterj

                        According to the JIRA, this feature has been dropped (the JIRA was rejected). The only option you have is to add a new deploy directory in profile-service.xml. Of course, doing so means that you will have to rename the directory that contains the static content to xxx.war.

                        • 9. Re: virtual directories in Jboss 5
                          huntp

                          Was there ever a solution posted for this? I am also having the problem - "Context not found as a child of Host".

                          • 10. Re: virtual directories in Jboss 5
                            chernandeznet

                            here's a solution for adding virtual directory:
                            http://www.coderanch.com/t/436452/JBoss/JBoss-virtual-directory-jboss

                            • 11. Re: virtual directories in Jboss 5
                              ryanhos

                              If you are running Windows, and have little control over where your content lives, a symlink can ease your pain.

                               

                              Static content is placed here, and here only by a third-party application with no configuration options:

                              %CONTENT_HOME% = d:\inflexible-corp\inflexible-app\output\images

                               

                              create a dummy WEB-INF directory with a web.xml

                              <web-app></web-app>
                              

                               

                              and a jboss-web.xml, and copy it to %CONTENT_HOME%

                              <jboss-web>
                                  <context-root>/staticimages</context-root>
                              </jboss-web>
                              

                               

                              in a command prompt:

                              d:
                              cd %JBOSS_HOME%\server\all\deploy
                              mklink /D staticimages.war %CONTENT_HOME%
                              

                               

                              Boot JBoss.  Your fake war will deploy nicely.

                               

                              WARNING

                              Note that most programs are not aware of symlinks and will delete the contents of %CONTENT_HOME% if turned loose on the symlink. For example, deleting %JBOSS_HOME% on a development box with Ant's <delete> task will clean out %CONTENT_HOME%, which I expect is NOT what you desire.  As an aside, I tried this prior to actually symlinking to the directory with the valuable content, so I got off easy.

                               

                              Bonus

                              This works with UNC paths also.

                              mklink /D staticimages.war \\networkserver\dir1\images
                              

                               

                              Rant

                              Why on earth would a product manager consider it reasonable to remove a long-standing and well-used feature from a product?  As the primary JBoss integrator on my DoD project, I feel like I'm beginning to spend more time working against JBoss and JBossESB than I am working with it.

                               

                              Message was edited by: Ryan Hochstetler.  Changed slashes to backslashes.  I use a Mac at home, Cygwin at work, and am in the habit of using unix-style directory separators.