You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by exabrial <ex...@gmail.com> on 2012/09/04 08:24:38 UTC

All sorts of problems deploying using multiple virtualhosts

TomEE v1.0.0 has some issues with virtual hosts in your Server.xml

If you have two different virtualhosts, you cannot have to WAR files named
with the same name. This is bad if you need a root.war in each virtualhost.

Injection of EJBs simply doesn't work on any virtualhosts not named
"webapps"

There's a few more minor glitches that I've forgot of... but basically it
looks like no virtual hosts for now :(



--
View this message in context: http://openejb.979440.n4.nabble.com/All-sorts-of-problems-deploying-using-multiple-virtualhosts-tp4657267.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: All sorts of problems deploying using multiple virtualhosts

Posted by Romain Manni-Bucau <rm...@gmail.com>.
i updated some misusage of context (used directly without host)

not sure it was the only ones but you could give it a try

*Romain Manni-Bucau*
*Twitter: @rmannibucau*
*Blog: http://rmannibucau.wordpress.com*




2012/9/5 David Blevins <da...@gmail.com>

>
> On Sep 4, 2012, at 10:32 PM, exabrial wrote:
>
> > Any suggestions where to look? I'd like to log a bug on this, but I don't
> > even know where to start looking in the code.
>
> Check out TomcatWebAppBuilder.  There are a few maps of String->Something
> were String is the name of the StandardContext.
>
> We have a method 'private String getId(final StandardContext
> standardContext)' which is clearly intended to be the one place someone
> would need to fix something like this, but just as clearly we aren't using
> it.
>
> Might be smart to create some sort of "ID" class that has some validation
> in the constructor and only use that instead of the String in those maps.
>
>
> -David
>
>

Re: All sorts of problems deploying using multiple virtualhosts

Posted by David Blevins <da...@gmail.com>.
On Sep 4, 2012, at 10:32 PM, exabrial wrote:

> Any suggestions where to look? I'd like to log a bug on this, but I don't
> even know where to start looking in the code.

Check out TomcatWebAppBuilder.  There are a few maps of String->Something were String is the name of the StandardContext.

We have a method 'private String getId(final StandardContext standardContext)' which is clearly intended to be the one place someone would need to fix something like this, but just as clearly we aren't using it.

Might be smart to create some sort of "ID" class that has some validation in the constructor and only use that instead of the String in those maps.


-David


Re: All sorts of problems deploying using multiple virtualhosts

Posted by exabrial <ex...@gmail.com>.
Any suggestions where to look? I'd like to log a bug on this, but I don't
even know where to start looking in the code.



--
View this message in context: http://openejb.979440.n4.nabble.com/All-sorts-of-problems-deploying-using-multiple-virtualhosts-tp4657267p4657280.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: All sorts of problems deploying using multiple virtualhosts

Posted by Romain Manni-Bucau <rm...@gmail.com>.
I think currently the context czn be used as key in a map
Le 4 sept. 2012 17:13, "exabrial" <ex...@gmail.com> a écrit :

> Actually, it's even stranger... but I've really narrowed down the problem.
> Let me start again:
>
> I didn't post my full server.xml:
>
>       <Host name="localhost"  appBase="webapps"
>             unpackWARs="true" autoDeploy="true">
>         <Alias>dev.beyondvital.com</Alias>
>         <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs"
>                prefix="localhost_access_log." suffix=".txt"
>                pattern="%h %l %u %t &quot;%r&quot; %s %b" />
>       </Host>
>         <Host name="beyondvital.com"  appBase="static_host"
>             unpackWARs="true" autoDeploy="true">
>         <Alias>beyondvital.com</Alias>
>         <Alias>www.beyondvital.com</Alias>
>
>         <Context docBase="beyondvital-static-web" path="/"
> reloadable="false" />
>         <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs"
>                prefix="localhost_access_log." suffix=".txt"
>                pattern="%h %l %u %t &quot;%r&quot; %s %b" />
>
>       </Host>
>
> I have two wars, beyondvital-jsf which uses EJB and goes into webapps.
> beyondvital-static-web goes into static_host and has no EJBs. Notice how I
> use a context directive to route any traffic going to "/" to
> beyondvital-static-web on the static_host virtualhost.
>
> So, in the state I just described: Two wars, with different names, on
> different virtual hosts, everything runs just fine.
>
> If you rename beyondvital-jsf to ROOT.war and toss it to webapps, EJB
> injection starts failing completely.
>
> It's like TomEE uses the context root to figure out the scope of
> injections,
> but isn't taking into account the virtual host where the app is running.
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/All-sorts-of-problems-deploying-using-multiple-virtualhosts-tp4657267p4657274.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: All sorts of problems deploying using multiple virtualhosts

Posted by exabrial <ex...@gmail.com>.
Actually, it's even stranger... but I've really narrowed down the problem.
Let me start again:

I didn't post my full server.xml:

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
	<Alias>dev.beyondvital.com</Alias>
        <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
      </Host>
	<Host name="beyondvital.com"  appBase="static_host"
            unpackWARs="true" autoDeploy="true">
        <Alias>beyondvital.com</Alias>
        <Alias>www.beyondvital.com</Alias>

        <Context docBase="beyondvital-static-web" path="/"
reloadable="false" />
        <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>

I have two wars, beyondvital-jsf which uses EJB and goes into webapps.
beyondvital-static-web goes into static_host and has no EJBs. Notice how I
use a context directive to route any traffic going to "/" to
beyondvital-static-web on the static_host virtualhost.

So, in the state I just described: Two wars, with different names, on
different virtual hosts, everything runs just fine.

If you rename beyondvital-jsf to ROOT.war and toss it to webapps, EJB
injection starts failing completely.

It's like TomEE uses the context root to figure out the scope of injections,
but isn't taking into account the virtual host where the app is running.




--
View this message in context: http://openejb.979440.n4.nabble.com/All-sorts-of-problems-deploying-using-multiple-virtualhosts-tp4657267p4657274.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: All sorts of problems deploying using multiple virtualhosts

Posted by exabrial <ex...@gmail.com>.
Ok, now it's morning and I'm awake, here's the relavent part of my
conf/server.xml:

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
	<Alias>dev.beyondvital.com</Alias>
      </Host>
	<Host name="beyondvital.com"  appBase="static_host"
            unpackWARs="true" autoDeploy="true">
        <Alias>beyondvital.com</Alias>
        <Alias>www.beyondvital.com</Alias>
      </Host>

I have war A which uses EJBs going into webapps. War B which is just JSPs is
going to static_host. War A will run as long as I don't have the static_host
container enabled in XML.



--
View this message in context: http://openejb.979440.n4.nabble.com/All-sorts-of-problems-deploying-using-multiple-virtualhosts-tp4657267p4657272.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: All sorts of problems deploying using multiple virtualhosts

Posted by Romain Manni-Bucau <rm...@gmail.com>.
The fact you cannot have twice apps with the same name sounds possible
(with current code) but injections shouldnt depend on webapps folder. Maybe
give it a try on the snapshot.

Note: since we can provide a server.xml to our arquillian adapters it
should be easy to test. If anyone wants to propose a patch it will be
welcomed ;)

- Romain
Le 4 sept. 2012 09:02, "exabrial" <ex...@gmail.com> a écrit :

> Actually, it appears that if I have two virtual hosts <Host> entries, the
> problem manifests itself.
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/All-sorts-of-problems-deploying-using-multiple-virtualhosts-tp4657267p4657269.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: All sorts of problems deploying using multiple virtualhosts

Posted by exabrial <ex...@gmail.com>.
Actually, it appears that if I have two virtual hosts <Host> entries, the
problem manifests itself.



--
View this message in context: http://openejb.979440.n4.nabble.com/All-sorts-of-problems-deploying-using-multiple-virtualhosts-tp4657267p4657269.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: All sorts of problems deploying using multiple virtualhosts

Posted by Jean-Louis MONTEIRO <je...@gmail.com>.
Good to know and definitely something we have to test.
To be honest, never try virtualhost using tomcat. I'm used to use Apache
HTTPD for that.

JLouis

2012/9/4 exabrial <ex...@gmail.com>

> TomEE v1.0.0 has some issues with virtual hosts in your Server.xml
>
> If you have two different virtualhosts, you cannot have to WAR files named
> with the same name. This is bad if you need a root.war in each virtualhost.
>
> Injection of EJBs simply doesn't work on any virtualhosts not named
> "webapps"
>
> There's a few more minor glitches that I've forgot of... but basically it
> looks like no virtual hosts for now :(
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/All-sorts-of-problems-deploying-using-multiple-virtualhosts-tp4657267.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>