- This topic has 3 replies, 2 voices, and was last updated 18 years, 5 months ago by Riyad Kalla.
-
AuthorPosts
-
RenenMemberI have, for some time, been grappling with the problem of deploying multiple, virtual hosts onto on Jboss 3.2.7, Tomcat based server.
For example, I would like to deploy:
• http://www.alpha.com
• http://www.beta.com
• http://www.delta.comIn my experimenting, I had war files (alpha.war, beta.war etc) that contained the jsp pages for each site. The kicker is that all three (or more) war files depend on db.jar (and a couple of others) and the ejbs therein.
To get things to work, I eventually deployed each site in its own ear, and set up a jboss-web.xml file as follows:
<jboss-web>
<context-root>/</context-root>
<virtual-host>www.alpha.co.za</virtual-host>
</jboss-web>And, using the myEclipse IDE, I the context root to be “/” for each site.
I eventually got everything to work by including the jar files in alpha.ear only.
So, my questions:
1: Why could I not deploy multiple war files inside one ear? This would have made most sense to me.
2: How the hell code beta.jsp in beta.ear see, access or use db.jar in alpha.ear? Equally, why couldn’t I include db.jar in each ear? Shouldn’t each ear get its own class loader space? So to speak.
3: Beta.ear, delta.ear etc now have a dependency on alpha.ear (it contains the jar files). This strikes me as a problem as I presume things now need to load in the right sequence. At the moment things seem to be working – but it feels a bit flakey.I think I’ve worked out enough answer’s to solve my problems (until things load in a different sequence). Part of my motivation is simply to put this outline of roughly what I did into the public domain where other people can find it. But, in the interests of improving my very limited understanding of how things work, I would be very interested in answers to my questions!
Thanks in advance.
Renen.
Riyad KallaMember1: Why could I not deploy multiple war files inside one ear? This would have made most sense to me.
You should be able to, right click on the EAR and go to MyEclipse > Add/Remove modules. The only conflict I can see occuring is that all your root dirs are the same ‘/’, MyEclipse doesn’t like that.
2: How the hell code beta.jsp in beta.ear see, access or use db.jar in alpha.ear? Equally, why couldn’t I include db.jar in each ear? Shouldn’t each ear get its own class loader space? So to speak.
Yes, db.jar needs to go into the root of the EAR, this will expose it to the Web and EJB projects that may need it that are modules of the EAR. That is covered in our Enterprise Development Guide, in Section 9 I believe.
3: Beta.ear, delta.ear etc now have a dependency on alpha.ear (it contains the jar files). This strikes me as a problem as I presume things now need to load in the right sequence. At the moment things seem to be working – but it feels a bit flakey.
You will need to duplicate the JAR, having EARs depend on eachother is not a support construct, even if it does work (I’m surprised it does).
RenenMemberHey Riyad,
Thanks for the reply.
I will hunt down the Enterprise Development Guide.
You will need to duplicate the JAR, having EARs depend on eachother is not a support construct, even if it does work (I’m surprised it does).
Maybe I jumped to conclusions – JBoss kicked out millions of errors that essentially related to the db.jar being in two packages. I presumed that this implied that alpha and beta both had access to the same namespace.
I think section 9 will cast a whole lot of light on this.
Again, thank you!
Riyad KallaMemberI suppose I could be wrong about that, if you run into issues let me know and I’ll ask around the office.
-
AuthorPosts