9 Replies Latest reply on Jan 14, 2007 10:17 PM by None None

    Multiple WARs in one Seam application?

    None None Master

      Simple question: I have a Seam app that goes into a .ear file. Within that EAR file there is a WAR file with all the web pages. If I want the same application (EAR) to serve more than one domain name with different content (ie, two virtual hosts within the EAR) can I do that just by putting more than one WAR in my EAR file and in my application.xml? Both these WAR files have the virtual host mapping defined in the jboss-web.xml files. If this is possible it would be very cool and would simplify what I'm doing quite a lot.

        • 1. Re: Multiple WARs in one Seam application?
          None None Master

          I just now tried it simply by moving the WAR file into the EAR file and modifying the application.xml of the EAR and it worked. Of course the virt. hosts need to be all configured in JBoss' server.xml too.

          • 2. Re: Multiple WARs in one Seam application?
            None None Master

            Actually it appears that it is not working. Hmm. It is just giving me "no host matches .... name".

            • 3. Re: Multiple WARs in one Seam application?
              Norman Richards Master

              Have you configured the hosts in the tomcat jboss-service.xml?

              • 4. Re: Multiple WARs in one Seam application?
                None None Master

                Yes I configured them in the jboss-tomcat.sar/server.xml. I also split the application up into two totally separate ear files. Now nothing is working. This is a nightmare. JBoss + Seam offers great promise but literally I have spent 1/4 of my time in this project tracking down configuration problems. I know that if I knew how to do it all it would be easy but the learning curve is steep and given the dozen or so config files in play, tracking down problems is far from trivial.

                The other problem I'm having right now is logging. For some reason my application isn't giving any log messages at all on my live server. On my desktop system I get plenty of informational log messages. And now I'm getting even more problems with entities not being mapped and I have no idea what's causing that.

                • 5. Re: Multiple WARs in one Seam application?
                  None None Master

                  Ok, I assume that the way I do this is:

                  1. In jboss-web-tomcat.sar/server.xml, I add "host" sections. I should use a symbolic name, like "foo", not a full hostname, like "foo.com". I put in entries for these with real DNS hostnames.

                  2. In each of the war files jboss-web.xml, I put <virtual-host>foo</virtual-host>, <virtual-host>bar</virtual-host>, corresponding to each of the symboilc names in server.xml.

                  Is that the right way to do that?

                  I may have gotten it wrong, but I'm now getting all kinds of deployment problems with entities not being mapped.

                  • 6. Re: Multiple WARs in one Seam application?
                    None None Master

                    (forgot to add) I'm almost thinking of just moving one of my apps to a different IP address and just running two totally isolated JBosses, but this seems absurd. Web servers could already do multiple virtual hosts over ten years ago so surely this is a stable capability within JBoss.

                    • 7. Re: Multiple WARs in one Seam application?
                      None None Master

                      Ok, I now have two separate EAR files. I have fixed it so that I have "foo.com" and "bar.com" in both the jboss-web.xml files and in the jboss web server.xml file. Strangely enough the apps seem to work, EXCEPT some entities are now not mapping. and I get exceptions like:

                      Exception during INVOKE_APPLICATION(5): java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Admin is not mapped [from Admin where name = :name and password = :password]


                      What is totally strange here is that servlets do seem to work. I think that that bean is not working because it is using a Seam-managed persistence context which is somehow not working within this virtual host setup. I am stumped. Any ideas of how this could be happening?


                      • 8. Re: Multiple WARs in one Seam application?
                        None None Master

                        Waitaminute I think I'm seeing what the problem must be.... the SMPC is somehow acting globally. I should try to change the names of my various SMPC references in one or the other of the apps. I have a feeling this may be a bug within SMPC, where it is not properly isolating.

                        And I should / could try to put both war files in the seam EAR and use the correct virtual-host setting in the jboss-web.xml files.

                        • 9. Re: Multiple WARs in one Seam application?
                          None None Master

                          And... that was indeed the problem. I had two SMPCs that had the same config data. I think this must be an SMPC bug. It sure made me have a most interesting Sunday afternoon. It is now fixed. I understand that SMPC names are going to go through some change when Seam 1.1.1 (?) is out. I would suggest to the Seam crew, figure out why there is interaction between SMPC and virt. hosts because this was a nightmare and I almost feel that I figure it out through sheer lucky inspiration.