Setting up VirtualHosts
germandev Jun 7, 2009 8:21 AMHi!
I have a Debian Lenny root server running JBoss 4.2.3.GA default installation.
I have a few Seam applications (currently only two) that I want to deploy to the server. Both applications should be deployed as http://app1.my-domain.com and http://app2.my-domain.com. I first thought about using a transparent Proxy but then heard about the VirtualHost feature of JBoss. I tried to figure it out on my own but currently am stuck and so hope you can help me:
I first want to deploy one Seam application. The application is deployed as an EAR and currently accessible using http://serverip:8080/myApp.
Before changing this application I changed the /../jboss/server/default/deploy/jboss-web.deployer/server.xml and added another section just below the existing one (server localhost).
<Host name="app1.my-domain.com" autoDeploy="false" deployOnStartup="true" deployXML="true"> <Alias>app1.my-domain.com</Alias> <Valve className="org.apache.catalina.valves.AccessLogValve" prefix="vhost1" suffix=".log" pattern="common" directory="${jboss.server.home.dir}/log"/> <DefaultContext cookies="true" crossContext="true" override="true"/> </Host>
Then I edited the jboss-web.xml file under myApp.ear/myApp.war/WEB-INF/ and changed it from
<jboss-web> <class-loading java2ClassLoadingCompliance="false"> <loader-repository> seam.jboss.org:loader=myApp <loader-repository-config>java2ParentDelegation=false</loader-repository-config> </loader-repository> </class-loading> </jboss-web>
to
<jboss-web> <context-root>/</context-root> <virtual-host>app1.my-domain.com</virtual-host> </jboss-web>
The application is nevertheless deployed to http://app1.my-domain.com/myApp/ but doesn't work even there properly. When trying to access the application the following error is thrown and I am redirected to my applications error page:
14:14:56,676 WARN [SeamPhaseListener] uncaught exception, passing to exception handler java.lang.IllegalStateException: No active application scope
Additionally the whole RichFaces theming (on the error page) doesn't work.
What was my mistake? What can I do to correctly deploy the application to the second host 'app1.my-domain.com'?
Thank you in advance!