You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by ant elder <an...@gmail.com> on 2007/11/13 17:06:15 UTC

Starting a domain manager on a url including a path?

Trying to run a domain manager node within a webapp and it fails as right
now you can only use a domain manager url without a path, eg
http://localhost:8080 not http://localhost:8080/tuscany/domainManager. I'd
like to try to fix this so a path if supported if no one has any objections,
also if there are any pointers to where in the node and domain code this is
handled that would be great too!

   ...ant

Re: Starting a domain manager on a url including a path?

Posted by ant elder <an...@gmail.com>.
On Nov 16, 2007 11:41 AM, Simon Laws <si...@googlemail.com> wrote:

>
>
> On Nov 16, 2007 11:25 AM, Simon Laws <si...@googlemail.com> wrote:
>
> >
> >
> > On Nov 16, 2007 10:58 AM, ant elder <an...@apache.org> wrote:
> >
> > > On Nov 13, 2007 4:25 PM, Simon Laws <si...@googlemail.com> wrote:
> > >
> > > > On Nov 13, 2007 4:06 PM, ant elder < ant.elder@gmail.com> wrote:
> > > >
> > > > > Trying to run a domain manager node within a webapp and it fails
> > > as
> > > > right
> > > > > now you can only use a domain manager url without a path, eg
> > > > > http://localhost:8080 not
> > > http://localhost:8080/tuscany/domainManager.
> > > > I'd
> > > > > like to try to fix this so a path if supported if no one has any
> > > > > objections,
> > > > > also if there are any pointers to where in the node and domain
> > > code this
> > > >
> > > > > is
> > > > > handled that would be great too!
> > > > >
> > > > >   ...ant
> > > > >
> > > > No objections from me. It's dealt with in three places..
> > > >
> > > > SCADomainImpl.init() - sets up the domain runtime
> > > > SCANodeImpl.init() - sets up the node runtime
> > > > SCADomainProxy.start() - sets up a local runtime if no node is
> > > provided
> > > >
> > > > The code you are looking for is something like...
> > > >
> > > >            // Configure the default server port
> > > >            int port = URI.create(domainModel.getDomainURI
> > > ()).getPort();
> > > >            if (port != -1) {
> > > >                ServletHostExtensionPoint servletHosts =
> > > > domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(
> > > > ServletHostExtensionPoint.class);
> > > >                for (ServletHost servletHost:
> > > servletHosts.getServletHosts
> > > > ())
> > > > {
> > > >                    servletHost.setDefaultPort(port);
> > > >                }
> > > >            }
> > > >
> > > > This is stripping the port out of the provided URL and putting it
> > > into the
> > > > servlet host. I think we would need to change this interface to
> > > allow the
> > > > whole base URL to be set on the servlet host.
> > > >
> > > > External web app container - The web app container controls the
> > > actual
> > > > endpoint and the NodeURL simply tells the tuscany runtime what
> > > endpoints
> > > > to
> > > > register. It's seems awkward that we have to provide the URL here
> > > but
> > > > there
> > > > doesn't appear to be an easy way round it.
> > > > Embedded web app container - The NodeURL should instruct the
> > > embedded
> > > > container what base URL to use for services.
> > > >
> > > > For the Node URL you must either provide a valid URL or nothing. If
> > > > nothing
> > > > then one will be chosen for you.
> > > > For Domain URL (at the node) you must either provide the URL of the
> > > domain
> > > > or nothing.If nothing then the node will run standalone.
> > > >
> > > > Regards
> > > >
> > > > Simon
> > > >
> > >
> > > This is working now for the standalone strawman testcase with both the
> > > domain and node running at a url including a path. There's a problem
> > > though
> > > with running it within the same webapp or same Tomcat container (and
> > > probably the Tuscany Geronimo integration) in that the nodes try to
> > > talk to
> > > the domain when they're started but the domain doesn't accept
> > > connections
> > > until after the container is completely up and started, so the node
> > > sends
> > > the register request to the domain and hangs waiting for the domain to
> > > answer. Not sure whats the best way to get around this, anyone have
> > > any good
> > > ideas?
> > >
> > >   ...ant
> > >
> >  In trying to understand the problem here I see two scenarios.
> >
> > - I want to run my webapp as a standalone SCA application in which case
> > I don't specify a domain URL and the node doesn't try to connect to the
> > domain.
> > - I want to run my webapp as part of an SCA domain. The SCADomain could
> > include many nodes using different runtimes in different hosting
> > environments so I think we should expect that it is already available when
> > the webapp is started.
> >
> > I accept that it's possible to start the domain manager within the same
> > webapp but I'm not sure why you would want to. I'm a little more convinced
> > by wanting to start the domain manager in the same Tomcat container.
> > Currently the domain and node SCA applications assume remote connections
> > between each other, hence the problem you are seeing. There are some
> > solutions of increasing complexity...
> >
> > - Advise users not to do it. It's very easy to start the domain using
> > the inbuilt HTTP server. In reality you are likely to want to deploy it as a
> > Web App to some clustered app server so you need to be careful how this is
> > done w.r.t the nodes that are started.
> > - Change the binding used to wire nodes to the domain to be something
> > other than binding.ws that relies on HTTP
> > - Enhance the way that nodes register such that they try again when
> > other API operations are called if they were unsuccessful the first time.
> > Would fail altogether if it can't connect when you start() the node.
> > - Change the domain model to be decentralized so that nodes only contact
> > other nodes. This may still show the problem when more than one node is in
> > the same container.
> >
> > Regards
> >
> > Simon
> >
> > Hi Ant
>
> Am just trying the changes to the node implementation and I seem to be
> getting a problem with jetty..
>
> org.apache.tuscany.sca.node.NodeException:
> org.apache.tuscany.sca.domain.DomainException :
> org.apache.tuscany.sca.host.http.ServletMappingException:
> java.lang.IllegalArgumentException: ends with /
>
> It's happening at line 188 in JettyServer.java where it does...
>
>   contextHandler.setContextPath (contextPath);
>
> Where contextPath in my case is "/nodeA/".
>
> I notice that the node puts "/" on the end of the node URL if the user
> have proved a URI without one. I expect it's doing this so that the service
> URLs appear correctly with a "/" between context name and service name. Do
> you know Jetty well enough to know why it's complaining. The obvious
> solution is to remove it in the specific jetty case which I'll try now to
> see if that causes other problems.
>
>
OK, I've only tried with Tomcat so far.  I think not adding in the trailing
slash will cause a problem later on when the full path is built up but maybe
the better way to fix that is to make sure the slash is included when the
rest of the path is concatenated.

   ...ant

Re: Starting a domain manager on a url including a path?

Posted by Simon Laws <si...@googlemail.com>.
On Nov 16, 2007 11:52 AM, Simon Laws <si...@googlemail.com> wrote:

>
>
> On Nov 16, 2007 11:41 AM, Simon Laws <si...@googlemail.com> wrote:
>
> >
> >
> > On Nov 16, 2007 11:25 AM, Simon Laws <si...@googlemail.com> wrote:
> >
> > >
> > >
> > > On Nov 16, 2007 10:58 AM, ant elder <an...@apache.org> wrote:
> > >
> > > > On Nov 13, 2007 4:25 PM, Simon Laws <si...@googlemail.com>
> > > > wrote:
> > > >
> > > > > On Nov 13, 2007 4:06 PM, ant elder < ant.elder@gmail.com> wrote:
> > > > >
> > > > > > Trying to run a domain manager node within a webapp and it fails
> > > > as
> > > > > right
> > > > > > now you can only use a domain manager url without a path, eg
> > > > > > http://localhost:8080 not
> > > > http://localhost:8080/tuscany/domainManager.
> > > > > I'd
> > > > > > like to try to fix this so a path if supported if no one has any
> > > >
> > > > > > objections,
> > > > > > also if there are any pointers to where in the node and domain
> > > > code this
> > > > >
> > > > > > is
> > > > > > handled that would be great too!
> > > > > >
> > > > > >   ...ant
> > > > > >
> > > > > No objections from me. It's dealt with in three places..
> > > > >
> > > > > SCADomainImpl.init() - sets up the domain runtime
> > > > > SCANodeImpl.init() - sets up the node runtime
> > > > > SCADomainProxy.start() - sets up a local runtime if no node is
> > > > provided
> > > > >
> > > > > The code you are looking for is something like...
> > > > >
> > > > >            // Configure the default server port
> > > > >            int port = URI.create(domainModel.getDomainURI
> > > > ()).getPort();
> > > > >            if (port != -1) {
> > > > >                ServletHostExtensionPoint servletHosts =
> > > > > domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(
> > > > > ServletHostExtensionPoint.class);
> > > > >                for (ServletHost servletHost:
> > > > servletHosts.getServletHosts
> > > > > ())
> > > > > {
> > > > >                    servletHost.setDefaultPort(port);
> > > > >                }
> > > > >            }
> > > > >
> > > > > This is stripping the port out of the provided URL and putting it
> > > > into the
> > > > > servlet host. I think we would need to change this interface to
> > > > allow the
> > > > > whole base URL to be set on the servlet host.
> > > > >
> > > > > External web app container - The web app container controls the
> > > > actual
> > > > > endpoint and the NodeURL simply tells the tuscany runtime what
> > > > endpoints
> > > > > to
> > > > > register. It's seems awkward that we have to provide the URL here
> > > > but
> > > > > there
> > > > > doesn't appear to be an easy way round it.
> > > > > Embedded web app container - The NodeURL should instruct the
> > > > embedded
> > > > > container what base URL to use for services.
> > > > >
> > > > > For the Node URL you must either provide a valid URL or nothing.
> > > > If
> > > > > nothing
> > > > > then one will be chosen for you.
> > > > > For Domain URL (at the node) you must either provide the URL of
> > > > the domain
> > > > > or nothing.If nothing then the node will run standalone.
> > > > >
> > > > > Regards
> > > > >
> > > > > Simon
> > > > >
> > > >
> > > > This is working now for the standalone strawman testcase with both
> > > > the
> > > > domain and node running at a url including a path. There's a problem
> > > > though
> > > > with running it within the same webapp or same Tomcat container (and
> > > >
> > > > probably the Tuscany Geronimo integration) in that the nodes try to
> > > > talk to
> > > > the domain when they're started but the domain doesn't accept
> > > > connections
> > > > until after the container is completely up and started, so the node
> > > > sends
> > > > the register request to the domain and hangs waiting for the domain
> > > > to
> > > > answer. Not sure whats the best way to get around this, anyone have
> > > > any good
> > > > ideas?
> > > >
> > > >   ...ant
> > > >
> > >  In trying to understand the problem here I see two scenarios.
> > >
> > > - I want to run my webapp as a standalone SCA application in which
> > > case I don't specify a domain URL and the node doesn't try to connect to the
> > > domain.
> > > - I want to run my webapp as part of an SCA domain. The SCADomain
> > > could include many nodes using different runtimes in different hosting
> > > environments so I think we should expect that it is already available when
> > > the webapp is started.
> > >
> > > I accept that it's possible to start the domain manager within the
> > > same webapp but I'm not sure why you would want to. I'm a little more
> > > convinced by wanting to start the domain manager in the same Tomcat
> > > container. Currently the domain and node SCA applications assume remote
> > > connections between each other, hence the problem you are seeing. There are
> > > some solutions of increasing complexity...
> > >
> > > - Advise users not to do it. It's very easy to start the domain using
> > > the inbuilt HTTP server. In reality you are likely to want to deploy it as a
> > > Web App to some clustered app server so you need to be careful how this is
> > > done w.r.t the nodes that are started.
> > > - Change the binding used to wire nodes to the domain to be something
> > > other than binding.ws that relies on HTTP
> > > - Enhance the way that nodes register such that they try again when
> > > other API operations are called if they were unsuccessful the first time.
> > > Would fail altogether if it can't connect when you start() the node.
> > > - Change the domain model to be decentralized so that nodes only
> > > contact other nodes. This may still show the problem when more than one node
> > > is in the same container.
> > >
> > > Regards
> > >
> > > Simon
> > >
> > > Hi Ant
> >
> > Am just trying the changes to the node implementation and I seem to be
> > getting a problem with jetty..
> >
> > org.apache.tuscany.sca.node.NodeException:
> > org.apache.tuscany.sca.domain.DomainException :
> > org.apache.tuscany.sca.host.http.ServletMappingException:
> > java.lang.IllegalArgumentException: ends with /
> >
> > It's happening at line 188 in JettyServer.java where it does...
> >
> >   contextHandler.setContextPath (contextPath);
> >
> > Where contextPath in my case is "/nodeA/".
> >
> > I notice that the node puts "/" on the end of the node URL if the user
> > have proved a URI without one. I expect it's doing this so that the service
> > URLs appear correctly with a "/" between context name and service name. Do
> > you know Jetty well enough to know why it's complaining. The obvious
> > solution is to remove it in the specific jetty case which I'll try now to
> > see if that causes other problems.
> >
> > Regards
> >
> > Simon
> >
> Quick update. If I strip off the "/" as the context is saved in the jetty
> server then the code
>
> registers servlets at
> http://L3AW203:8100/nodeANodeManagerComponent/NodeManagerService
> tells the domain they are at http://L3AW203:8100/nodeA//NodeManagerComponent/NodeManagerService
>
>
> Both of which are wrong.
>
> Simon
>
We crossed posts there. My experiment suggest you are correct. I'll go look
at where the URLs are build up.

Simon

Re: Starting a domain manager on a url including a path?

Posted by Simon Laws <si...@googlemail.com>.
On Nov 16, 2007 11:41 AM, Simon Laws <si...@googlemail.com> wrote:

>
>
> On Nov 16, 2007 11:25 AM, Simon Laws <si...@googlemail.com> wrote:
>
> >
> >
> > On Nov 16, 2007 10:58 AM, ant elder <an...@apache.org> wrote:
> >
> > > On Nov 13, 2007 4:25 PM, Simon Laws <si...@googlemail.com> wrote:
> > >
> > > > On Nov 13, 2007 4:06 PM, ant elder < ant.elder@gmail.com> wrote:
> > > >
> > > > > Trying to run a domain manager node within a webapp and it fails
> > > as
> > > > right
> > > > > now you can only use a domain manager url without a path, eg
> > > > > http://localhost:8080 not
> > > http://localhost:8080/tuscany/domainManager.
> > > > I'd
> > > > > like to try to fix this so a path if supported if no one has any
> > > > > objections,
> > > > > also if there are any pointers to where in the node and domain
> > > code this
> > > >
> > > > > is
> > > > > handled that would be great too!
> > > > >
> > > > >   ...ant
> > > > >
> > > > No objections from me. It's dealt with in three places..
> > > >
> > > > SCADomainImpl.init() - sets up the domain runtime
> > > > SCANodeImpl.init() - sets up the node runtime
> > > > SCADomainProxy.start() - sets up a local runtime if no node is
> > > provided
> > > >
> > > > The code you are looking for is something like...
> > > >
> > > >            // Configure the default server port
> > > >            int port = URI.create(domainModel.getDomainURI
> > > ()).getPort();
> > > >            if (port != -1) {
> > > >                ServletHostExtensionPoint servletHosts =
> > > > domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(
> > > > ServletHostExtensionPoint.class);
> > > >                for (ServletHost servletHost:
> > > servletHosts.getServletHosts
> > > > ())
> > > > {
> > > >                    servletHost.setDefaultPort(port);
> > > >                }
> > > >            }
> > > >
> > > > This is stripping the port out of the provided URL and putting it
> > > into the
> > > > servlet host. I think we would need to change this interface to
> > > allow the
> > > > whole base URL to be set on the servlet host.
> > > >
> > > > External web app container - The web app container controls the
> > > actual
> > > > endpoint and the NodeURL simply tells the tuscany runtime what
> > > endpoints
> > > > to
> > > > register. It's seems awkward that we have to provide the URL here
> > > but
> > > > there
> > > > doesn't appear to be an easy way round it.
> > > > Embedded web app container - The NodeURL should instruct the
> > > embedded
> > > > container what base URL to use for services.
> > > >
> > > > For the Node URL you must either provide a valid URL or nothing. If
> > > > nothing
> > > > then one will be chosen for you.
> > > > For Domain URL (at the node) you must either provide the URL of the
> > > domain
> > > > or nothing.If nothing then the node will run standalone.
> > > >
> > > > Regards
> > > >
> > > > Simon
> > > >
> > >
> > > This is working now for the standalone strawman testcase with both the
> > > domain and node running at a url including a path. There's a problem
> > > though
> > > with running it within the same webapp or same Tomcat container (and
> > > probably the Tuscany Geronimo integration) in that the nodes try to
> > > talk to
> > > the domain when they're started but the domain doesn't accept
> > > connections
> > > until after the container is completely up and started, so the node
> > > sends
> > > the register request to the domain and hangs waiting for the domain to
> > > answer. Not sure whats the best way to get around this, anyone have
> > > any good
> > > ideas?
> > >
> > >   ...ant
> > >
> >  In trying to understand the problem here I see two scenarios.
> >
> > - I want to run my webapp as a standalone SCA application in which case
> > I don't specify a domain URL and the node doesn't try to connect to the
> > domain.
> > - I want to run my webapp as part of an SCA domain. The SCADomain could
> > include many nodes using different runtimes in different hosting
> > environments so I think we should expect that it is already available when
> > the webapp is started.
> >
> > I accept that it's possible to start the domain manager within the same
> > webapp but I'm not sure why you would want to. I'm a little more convinced
> > by wanting to start the domain manager in the same Tomcat container.
> > Currently the domain and node SCA applications assume remote connections
> > between each other, hence the problem you are seeing. There are some
> > solutions of increasing complexity...
> >
> > - Advise users not to do it. It's very easy to start the domain using
> > the inbuilt HTTP server. In reality you are likely to want to deploy it as a
> > Web App to some clustered app server so you need to be careful how this is
> > done w.r.t the nodes that are started.
> > - Change the binding used to wire nodes to the domain to be something
> > other than binding.ws that relies on HTTP
> > - Enhance the way that nodes register such that they try again when
> > other API operations are called if they were unsuccessful the first time.
> > Would fail altogether if it can't connect when you start() the node.
> > - Change the domain model to be decentralized so that nodes only contact
> > other nodes. This may still show the problem when more than one node is in
> > the same container.
> >
> > Regards
> >
> > Simon
> >
> > Hi Ant
>
> Am just trying the changes to the node implementation and I seem to be
> getting a problem with jetty..
>
> org.apache.tuscany.sca.node.NodeException:
> org.apache.tuscany.sca.domain.DomainException :
> org.apache.tuscany.sca.host.http.ServletMappingException:
> java.lang.IllegalArgumentException: ends with /
>
> It's happening at line 188 in JettyServer.java where it does...
>
>   contextHandler.setContextPath (contextPath);
>
> Where contextPath in my case is "/nodeA/".
>
> I notice that the node puts "/" on the end of the node URL if the user
> have proved a URI without one. I expect it's doing this so that the service
> URLs appear correctly with a "/" between context name and service name. Do
> you know Jetty well enough to know why it's complaining. The obvious
> solution is to remove it in the specific jetty case which I'll try now to
> see if that causes other problems.
>
> Regards
>
> Simon
>
Quick update. If I strip off the "/" as the context is saved in the jetty
server then the code

registers servlets at
http://L3AW203:8100/nodeANodeManagerComponent/NodeManagerService
tells the domain they are at
http://L3AW203:8100/nodeA//NodeManagerComponent/NodeManagerService

Both of which are wrong.

Simon

Re: Starting a domain manager on a url including a path?

Posted by Simon Laws <si...@googlemail.com>.
On Nov 16, 2007 11:25 AM, Simon Laws <si...@googlemail.com> wrote:

>
>
> On Nov 16, 2007 10:58 AM, ant elder <an...@apache.org> wrote:
>
> > On Nov 13, 2007 4:25 PM, Simon Laws <si...@googlemail.com> wrote:
> >
> > > On Nov 13, 2007 4:06 PM, ant elder < ant.elder@gmail.com> wrote:
> > >
> > > > Trying to run a domain manager node within a webapp and it fails as
> > > right
> > > > now you can only use a domain manager url without a path, eg
> > > > http://localhost:8080 not
> > http://localhost:8080/tuscany/domainManager.
> > > I'd
> > > > like to try to fix this so a path if supported if no one has any
> > > > objections,
> > > > also if there are any pointers to where in the node and domain code
> > this
> > >
> > > > is
> > > > handled that would be great too!
> > > >
> > > >   ...ant
> > > >
> > > No objections from me. It's dealt with in three places..
> > >
> > > SCADomainImpl.init() - sets up the domain runtime
> > > SCANodeImpl.init() - sets up the node runtime
> > > SCADomainProxy.start() - sets up a local runtime if no node is
> > provided
> > >
> > > The code you are looking for is something like...
> > >
> > >            // Configure the default server port
> > >            int port = URI.create(domainModel.getDomainURI
> > ()).getPort();
> > >            if (port != -1) {
> > >                ServletHostExtensionPoint servletHosts =
> > > domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(
> > > ServletHostExtensionPoint.class);
> > >                for (ServletHost servletHost:
> > servletHosts.getServletHosts
> > > ())
> > > {
> > >                    servletHost.setDefaultPort(port);
> > >                }
> > >            }
> > >
> > > This is stripping the port out of the provided URL and putting it into
> > the
> > > servlet host. I think we would need to change this interface to allow
> > the
> > > whole base URL to be set on the servlet host.
> > >
> > > External web app container - The web app container controls the actual
> >
> > > endpoint and the NodeURL simply tells the tuscany runtime what
> > endpoints
> > > to
> > > register. It's seems awkward that we have to provide the URL here but
> > > there
> > > doesn't appear to be an easy way round it.
> > > Embedded web app container - The NodeURL should instruct the embedded
> > > container what base URL to use for services.
> > >
> > > For the Node URL you must either provide a valid URL or nothing. If
> > > nothing
> > > then one will be chosen for you.
> > > For Domain URL (at the node) you must either provide the URL of the
> > domain
> > > or nothing.If nothing then the node will run standalone.
> > >
> > > Regards
> > >
> > > Simon
> > >
> >
> > This is working now for the standalone strawman testcase with both the
> > domain and node running at a url including a path. There's a problem
> > though
> > with running it within the same webapp or same Tomcat container (and
> > probably the Tuscany Geronimo integration) in that the nodes try to talk
> > to
> > the domain when they're started but the domain doesn't accept
> > connections
> > until after the container is completely up and started, so the node
> > sends
> > the register request to the domain and hangs waiting for the domain to
> > answer. Not sure whats the best way to get around this, anyone have any
> > good
> > ideas?
> >
> >   ...ant
> >
> In trying to understand the problem here I see two scenarios.
>
> - I want to run my webapp as a standalone SCA application in which case I
> don't specify a domain URL and the node doesn't try to connect to the
> domain.
> - I want to run my webapp as part of an SCA domain. The SCADomain could
> include many nodes using different runtimes in different hosting
> environments so I think we should expect that it is already available when
> the webapp is started.
>
> I accept that it's possible to start the domain manager within the same
> webapp but I'm not sure why you would want to. I'm a little more convinced
> by wanting to start the domain manager in the same Tomcat container.
> Currently the domain and node SCA applications assume remote connections
> between each other, hence the problem you are seeing. There are some
> solutions of increasing complexity...
>
> - Advise users not to do it. It's very easy to start the domain using the
> inbuilt HTTP server. In reality you are likely to want to deploy it as a Web
> App to some clustered app server so you need to be careful how this is done
> w.r.t the nodes that are started.
> - Change the binding used to wire nodes to the domain to be something
> other than binding.ws that relies on HTTP
> - Enhance the way that nodes register such that they try again when other
> API operations are called if they were unsuccessful the first time. Would
> fail altogether if it can't connect when you start() the node.
> - Change the domain model to be decentralized so that nodes only contact
> other nodes. This may still show the problem when more than one node is in
> the same container.
>
> Regards
>
> Simon
>
> Hi Ant

Am just trying the changes to the node implementation and I seem to be
getting a problem with jetty..

org.apache.tuscany.sca.node.NodeException:
org.apache.tuscany.sca.domain.DomainException:
org.apache.tuscany.sca.host.http.ServletMappingException:
java.lang.IllegalArgumentException: ends with /

It's happening at line 188 in JettyServer.java where it does...

  contextHandler.setContextPath(contextPath);

Where contextPath in my case is "/nodeA/".

I notice that the node puts "/" on the end of the node URL if the user have
proved a URI without one. I expect it's doing this so that the service URLs
appear correctly with a "/" between context name and service name. Do you
know Jetty well enough to know why it's complaining. The obvious solution is
to remove it in the specific jetty case which I'll try now to see if that
causes other problems.

Regards

Simon

Re: Starting a domain manager on a url including a path?

Posted by Simon Laws <si...@googlemail.com>.
On Nov 16, 2007 12:06 PM, Simon Laws <si...@googlemail.com> wrote:

>
>
> On Nov 16, 2007 11:59 AM, ant elder <an...@gmail.com> wrote:
>
> >
> >
> > On Nov 16, 2007 11:25 AM, Simon Laws <si...@googlemail.com> wrote:
> >
> > >
> > >
> > > On Nov 16, 2007 10:58 AM, ant elder <an...@apache.org> wrote:
> > >
> > > > On Nov 13, 2007 4:25 PM, Simon Laws <si...@googlemail.com>
> > > > wrote:
> > > >
> > > > > On Nov 13, 2007 4:06 PM, ant elder < ant.elder@gmail.com> wrote:
> > > > >
> > > > > > Trying to run a domain manager node within a webapp and it fails
> > > > as
> > > > > right
> > > > > > now you can only use a domain manager url without a path, eg
> > > > > > http://localhost:8080 not
> > > > http://localhost:8080/tuscany/domainManager.
> > > > > I'd
> > > > > > like to try to fix this so a path if supported if no one has any
> > > >
> > > > > > objections,
> > > > > > also if there are any pointers to where in the node and domain
> > > > code this
> > > > >
> > > > > > is
> > > > > > handled that would be great too!
> > > > > >
> > > > > >   ...ant
> > > > > >
> > > > > No objections from me. It's dealt with in three places..
> > > > >
> > > > > SCADomainImpl.init() - sets up the domain runtime
> > > > > SCANodeImpl.init() - sets up the node runtime
> > > > > SCADomainProxy.start() - sets up a local runtime if no node is
> > > > provided
> > > > >
> > > > > The code you are looking for is something like...
> > > > >
> > > > >            // Configure the default server port
> > > > >            int port = URI.create(domainModel.getDomainURI
> > > > ()).getPort();
> > > > >            if (port != -1) {
> > > > >                ServletHostExtensionPoint servletHosts =
> > > > > domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(
> > > > > ServletHostExtensionPoint.class);
> > > > >                for (ServletHost servletHost:
> > > > servletHosts.getServletHosts
> > > > > ())
> > > > > {
> > > > >                    servletHost.setDefaultPort(port);
> > > > >                }
> > > > >            }
> > > > >
> > > > > This is stripping the port out of the provided URL and putting it
> > > > into the
> > > > > servlet host. I think we would need to change this interface to
> > > > allow the
> > > > > whole base URL to be set on the servlet host.
> > > > >
> > > > > External web app container - The web app container controls the
> > > > actual
> > > > > endpoint and the NodeURL simply tells the tuscany runtime what
> > > > endpoints
> > > > > to
> > > > > register. It's seems awkward that we have to provide the URL here
> > > > but
> > > > > there
> > > > > doesn't appear to be an easy way round it.
> > > > > Embedded web app container - The NodeURL should instruct the
> > > > embedded
> > > > > container what base URL to use for services.
> > > > >
> > > > > For the Node URL you must either provide a valid URL or nothing.
> > > > If
> > > > > nothing
> > > > > then one will be chosen for you.
> > > > > For Domain URL (at the node) you must either provide the URL of
> > > > the domain
> > > > > or nothing.If nothing then the node will run standalone.
> > > > >
> > > > > Regards
> > > > >
> > > > > Simon
> > > > >
> > > >
> > > > This is working now for the standalone strawman testcase with both
> > > > the
> > > > domain and node running at a url including a path. There's a problem
> > > > though
> > > > with running it within the same webapp or same Tomcat container (and
> > > >
> > > > probably the Tuscany Geronimo integration) in that the nodes try to
> > > > talk to
> > > > the domain when they're started but the domain doesn't accept
> > > > connections
> > > > until after the container is completely up and started, so the node
> > > > sends
> > > > the register request to the domain and hangs waiting for the domain
> > > > to
> > > > answer. Not sure whats the best way to get around this, anyone have
> > > > any good
> > > > ideas?
> > > >
> > > >   ...ant
> > > >
> > >  In trying to understand the problem here I see two scenarios.
> > >
> > > - I want to run my webapp as a standalone SCA application in which
> > > case I don't specify a domain URL and the node doesn't try to connect to the
> > > domain.
> > > - I want to run my webapp as part of an SCA domain. The SCADomain
> > > could include many nodes using different runtimes in different hosting
> > > environments so I think we should expect that it is already available when
> > > the webapp is started.
> > >
> > > I accept that it's possible to start the domain manager within the
> > > same webapp but I'm not sure why you would want to. I'm a little more
> > > convinced by wanting to start the domain manager in the same Tomcat
> > > container. Currently the domain and node SCA applications assume remote
> > > connections between each other, hence the problem you are seeing. There are
> > > some solutions of increasing complexity...
> > >
> > > - Advise users not to do it. It's very easy to start the domain using
> > > the inbuilt HTTP server. In reality you are likely to want to deploy it as a
> > > Web App to some clustered app server so you need to be careful how this is
> > > done w.r.t the nodes that are started.
> > > - Change the binding used to wire nodes to the domain to be something
> > > other than binding.ws that relies on HTTP
> > > - Enhance the way that nodes register such that they try again when
> > > other API operations are called if they were unsuccessful the first time.
> > > Would fail altogether if it can't connect when you start() the node.
> > > - Change the domain model to be decentralized so that nodes only
> > > contact other nodes. This may still show the problem when more than one node
> > > is in the same container.
> > >
> > > Regards
> > >
> > > Simon
> > >
> >
> > Thanks, all helpful comments. One reason i was trying to get both
> > domains and nodes running within one webapp (or at least one Tomcat/Geronimo
> > instance) was from the thread [1] where i thought the suggestion was nodes
> > be used for each contribution or group of related contributions. If thats
> > the case then there does need to be  a way to run multiple nodes in the one
> > instance doesn't there? If there was a something other than binding.wsto connect things up, maybe some sort of in-memory binding when its all
> > running within one JVM i guess that could solve this.
> >
> >    ...ant
> >
> > [1]
> > http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/200710.mbox/%3c4727628F.30609@apache.org%3e
> >
> >    ...ant
> >
> >
> > It's fine to run multiple nodes in a single JVM, webapp container. They
> would all talk to the same SCADomain via their local SCADomainProxy
> instances. I don't think this implies that the SCADomain itself has to be
> there as well.
>
> As an aside the node has an extended interface compared to what Sebastien
> was suggesting. Having said that I think it's perfectly possible to use the
> existing node implementation in the "one composite per node" mode. Which
> approach are you taking?
>
> Simon
>
Hi Ant

Sorry, I flipped over into a private mail to you for some reason with my
last post.

A while back Raymond identified three scenarios for components wishing to
communicate. I can't put my finger on the original mail but I've added a
fourth so the list would now be...

1/ Components in the same JVM, node and composite using the local sca
binding - we do this now
2/ Components in the same JVM, node but different composites - I think these
should use the local binding if possible but don't at the moment. Sebastien
is promoting the idea that only one composite runs in a node so this could
be a mute point but it's useful to have as complete a picture as possible.
3/ Components in the same JVM but  in different nodes using some cross node
but local binding - we don't do this now and the code resorts to a remote
binding
4/ Components in different JVMs and nodes using a remote (ws) binding to
communicate - we do this now.

We addressed 4 by introducing the SCADomainImpl to provide a central
registry of service endpoints and currently you need this to make 3 and 2
work. However this causes you a problem when starting up a web app if the
SCADomain is to run in the same container.

A)  think we could say don't start the SCADomainImpl in the same container
you are starting nodes in if you rally want to construct a distributed
domain.

B) If however you want to start a domain that just runs inside a web app
conatiner , e.g. Geronmo integration, then we could leverage the
SCADomainProxy to make this work. Each node has a domain proxy which caches
local service information before passing it  onto the SCADomainImpl. In this
way it can check local service endpoints before going out across the
network. We could share this proxy between all nodes in the same JVM in some
way. This is actually a strategy taken by some of the tests we have but
would require changes to the SCADomainProxy to make it work properly.

Having said this It's not actually clear to me that that's what you want to
do. You are starting nodes inside a web app container. What dictates which
domain these nodes belong to. If I remember correctly from
distributed/webapp a parameter in the webapp provided the domain URI. If
this has to allow for the case where the domain is remote, which I think it
does, then we are back to the original problem and we have to apply A) or
find a way to send an event to the runtime once it has come up so the
registration process can be delayed (I think someone also suggested putting
a background task in), or one of the other suggesting from this thread.

Regards

Simon

Re: Starting a domain manager on a url including a path?

Posted by ant elder <an...@gmail.com>.
On Nov 16, 2007 11:25 AM, Simon Laws <si...@googlemail.com> wrote:

>
>
> On Nov 16, 2007 10:58 AM, ant elder <an...@apache.org> wrote:
>
> > On Nov 13, 2007 4:25 PM, Simon Laws <si...@googlemail.com> wrote:
> >
> > > On Nov 13, 2007 4:06 PM, ant elder < ant.elder@gmail.com> wrote:
> > >
> > > > Trying to run a domain manager node within a webapp and it fails as
> > > right
> > > > now you can only use a domain manager url without a path, eg
> > > > http://localhost:8080 not
> > http://localhost:8080/tuscany/domainManager.
> > > I'd
> > > > like to try to fix this so a path if supported if no one has any
> > > > objections,
> > > > also if there are any pointers to where in the node and domain code
> > this
> > >
> > > > is
> > > > handled that would be great too!
> > > >
> > > >   ...ant
> > > >
> > > No objections from me. It's dealt with in three places..
> > >
> > > SCADomainImpl.init() - sets up the domain runtime
> > > SCANodeImpl.init() - sets up the node runtime
> > > SCADomainProxy.start() - sets up a local runtime if no node is
> > provided
> > >
> > > The code you are looking for is something like...
> > >
> > >            // Configure the default server port
> > >            int port = URI.create(domainModel.getDomainURI
> > ()).getPort();
> > >            if (port != -1) {
> > >                ServletHostExtensionPoint servletHosts =
> > > domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(
> > > ServletHostExtensionPoint.class);
> > >                for (ServletHost servletHost:
> > servletHosts.getServletHosts
> > > ())
> > > {
> > >                    servletHost.setDefaultPort(port);
> > >                }
> > >            }
> > >
> > > This is stripping the port out of the provided URL and putting it into
> > the
> > > servlet host. I think we would need to change this interface to allow
> > the
> > > whole base URL to be set on the servlet host.
> > >
> > > External web app container - The web app container controls the actual
> >
> > > endpoint and the NodeURL simply tells the tuscany runtime what
> > endpoints
> > > to
> > > register. It's seems awkward that we have to provide the URL here but
> > > there
> > > doesn't appear to be an easy way round it.
> > > Embedded web app container - The NodeURL should instruct the embedded
> > > container what base URL to use for services.
> > >
> > > For the Node URL you must either provide a valid URL or nothing. If
> > > nothing
> > > then one will be chosen for you.
> > > For Domain URL (at the node) you must either provide the URL of the
> > domain
> > > or nothing.If nothing then the node will run standalone.
> > >
> > > Regards
> > >
> > > Simon
> > >
> >
> > This is working now for the standalone strawman testcase with both the
> > domain and node running at a url including a path. There's a problem
> > though
> > with running it within the same webapp or same Tomcat container (and
> > probably the Tuscany Geronimo integration) in that the nodes try to talk
> > to
> > the domain when they're started but the domain doesn't accept
> > connections
> > until after the container is completely up and started, so the node
> > sends
> > the register request to the domain and hangs waiting for the domain to
> > answer. Not sure whats the best way to get around this, anyone have any
> > good
> > ideas?
> >
> >   ...ant
> >
> In trying to understand the problem here I see two scenarios.
>
> - I want to run my webapp as a standalone SCA application in which case I
> don't specify a domain URL and the node doesn't try to connect to the
> domain.
> - I want to run my webapp as part of an SCA domain. The SCADomain could
> include many nodes using different runtimes in different hosting
> environments so I think we should expect that it is already available when
> the webapp is started.
>
> I accept that it's possible to start the domain manager within the same
> webapp but I'm not sure why you would want to. I'm a little more convinced
> by wanting to start the domain manager in the same Tomcat container.
> Currently the domain and node SCA applications assume remote connections
> between each other, hence the problem you are seeing. There are some
> solutions of increasing complexity...
>
> - Advise users not to do it. It's very easy to start the domain using the
> inbuilt HTTP server. In reality you are likely to want to deploy it as a Web
> App to some clustered app server so you need to be careful how this is done
> w.r.t the nodes that are started.
> - Change the binding used to wire nodes to the domain to be something
> other than binding.ws that relies on HTTP
> - Enhance the way that nodes register such that they try again when other
> API operations are called if they were unsuccessful the first time. Would
> fail altogether if it can't connect when you start() the node.
> - Change the domain model to be decentralized so that nodes only contact
> other nodes. This may still show the problem when more than one node is in
> the same container.
>
> Regards
>
> Simon
>

Thanks, all helpful comments. One reason i was trying to get both domains
and nodes running within one webapp (or at least one Tomcat/Geronimo
instance) was from the thread [1] where i thought the suggestion was nodes
be used for each contribution or group of related contributions. If thats
the case then there does need to be  a way to run multiple nodes in the one
instance doesn't there? If there was a something other than binding.ws to
connect things up, maybe some sort of in-memory binding when its all running
within one JVM i guess that could solve this.

   ...ant

[1]
http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/200710.mbox/%3c4727628F.30609@apache.org%3e

   ...ant

Re: Starting a domain manager on a url including a path?

Posted by Simon Laws <si...@googlemail.com>.
On Nov 16, 2007 10:58 AM, ant elder <an...@apache.org> wrote:

> On Nov 13, 2007 4:25 PM, Simon Laws <si...@googlemail.com> wrote:
>
> > On Nov 13, 2007 4:06 PM, ant elder <an...@gmail.com> wrote:
> >
> > > Trying to run a domain manager node within a webapp and it fails as
> > right
> > > now you can only use a domain manager url without a path, eg
> > > http://localhost:8080 not http://localhost:8080/tuscany/domainManager.
> > I'd
> > > like to try to fix this so a path if supported if no one has any
> > > objections,
> > > also if there are any pointers to where in the node and domain code
> this
> >
> > > is
> > > handled that would be great too!
> > >
> > >   ...ant
> > >
> > No objections from me. It's dealt with in three places..
> >
> > SCADomainImpl.init() - sets up the domain runtime
> > SCANodeImpl.init() - sets up the node runtime
> > SCADomainProxy.start() - sets up a local runtime if no node is provided
> >
> > The code you are looking for is something like...
> >
> >            // Configure the default server port
> >            int port = URI.create(domainModel.getDomainURI()).getPort();
> >            if (port != -1) {
> >                ServletHostExtensionPoint servletHosts =
> > domainManagementRuntime.getExtensionPointRegistry ().getExtensionPoint(
> > ServletHostExtensionPoint.class);
> >                for (ServletHost servletHost:
> servletHosts.getServletHosts
> > ())
> > {
> >                    servletHost.setDefaultPort(port);
> >                }
> >            }
> >
> > This is stripping the port out of the provided URL and putting it into
> the
> > servlet host. I think we would need to change this interface to allow
> the
> > whole base URL to be set on the servlet host.
> >
> > External web app container - The web app container controls the actual
> > endpoint and the NodeURL simply tells the tuscany runtime what endpoints
> > to
> > register. It's seems awkward that we have to provide the URL here but
> > there
> > doesn't appear to be an easy way round it.
> > Embedded web app container - The NodeURL should instruct the embedded
> > container what base URL to use for services.
> >
> > For the Node URL you must either provide a valid URL or nothing. If
> > nothing
> > then one will be chosen for you.
> > For Domain URL (at the node) you must either provide the URL of the
> domain
> > or nothing.If nothing then the node will run standalone.
> >
> > Regards
> >
> > Simon
> >
>
> This is working now for the standalone strawman testcase with both the
> domain and node running at a url including a path. There's a problem
> though
> with running it within the same webapp or same Tomcat container (and
> probably the Tuscany Geronimo integration) in that the nodes try to talk
> to
> the domain when they're started but the domain doesn't accept connections
> until after the container is completely up and started, so the node sends
> the register request to the domain and hangs waiting for the domain to
> answer. Not sure whats the best way to get around this, anyone have any
> good
> ideas?
>
>   ...ant
>
In trying to understand the problem here I see two scenarios.

- I want to run my webapp as a standalone SCA application in which case I
don't specify a domain URL and the node doesn't try to connect to the
domain.
- I want to run my webapp as part of an SCA domain. The SCADomain could
include many nodes using different runtimes in different hosting
environments so I think we should expect that it is already available when
the webapp is started.

I accept that it's possible to start the domain manager within the same
webapp but I'm not sure why you would want to. I'm a little more convinced
by wanting to start the domain manager in the same Tomcat container.
Currently the domain and node SCA applications assume remote connections
between each other, hence the problem you are seeing. There are some
solutions of increasing complexity...

- Advise users not to do it. It's very easy to start the domain using the
inbuilt HTTP server. In reality you are likely to want to deploy it as a Web
App to some clustered app server so you need to be careful how this is done
w.r.t the nodes that are started.
- Change the binding used to wire nodes to the domain to be something other
than binding.ws that relies on HTTP
- Enhance the way that nodes register such that they try again when other
API operations are called if they were unsuccessful the first time. Would
fail altogether if it can't connect when you start() the node.
- Change the domain model to be decentralized so that nodes only contact
other nodes. This may still show the problem when more than one node is in
the same container.

Regards

Simon

Re: Starting a domain manager on a url including a path?

Posted by ant elder <an...@apache.org>.
On Nov 13, 2007 4:25 PM, Simon Laws <si...@googlemail.com> wrote:

> On Nov 13, 2007 4:06 PM, ant elder <an...@gmail.com> wrote:
>
> > Trying to run a domain manager node within a webapp and it fails as
> right
> > now you can only use a domain manager url without a path, eg
> > http://localhost:8080 not http://localhost:8080/tuscany/domainManager.
> I'd
> > like to try to fix this so a path if supported if no one has any
> > objections,
> > also if there are any pointers to where in the node and domain code this
>
> > is
> > handled that would be great too!
> >
> >   ...ant
> >
> No objections from me. It's dealt with in three places..
>
> SCADomainImpl.init() - sets up the domain runtime
> SCANodeImpl.init() - sets up the node runtime
> SCADomainProxy.start() - sets up a local runtime if no node is provided
>
> The code you are looking for is something like...
>
>            // Configure the default server port
>            int port = URI.create(domainModel.getDomainURI()).getPort();
>            if (port != -1) {
>                ServletHostExtensionPoint servletHosts =
> domainManagementRuntime.getExtensionPointRegistry ().getExtensionPoint(
> ServletHostExtensionPoint.class);
>                for (ServletHost servletHost: servletHosts.getServletHosts
> ())
> {
>                    servletHost.setDefaultPort(port);
>                }
>            }
>
> This is stripping the port out of the provided URL and putting it into the
> servlet host. I think we would need to change this interface to allow the
> whole base URL to be set on the servlet host.
>
> External web app container - The web app container controls the actual
> endpoint and the NodeURL simply tells the tuscany runtime what endpoints
> to
> register. It's seems awkward that we have to provide the URL here but
> there
> doesn't appear to be an easy way round it.
> Embedded web app container - The NodeURL should instruct the embedded
> container what base URL to use for services.
>
> For the Node URL you must either provide a valid URL or nothing. If
> nothing
> then one will be chosen for you.
> For Domain URL (at the node) you must either provide the URL of the domain
> or nothing.If nothing then the node will run standalone.
>
> Regards
>
> Simon
>

This is working now for the standalone strawman testcase with both the
domain and node running at a url including a path. There's a problem though
with running it within the same webapp or same Tomcat container (and
probably the Tuscany Geronimo integration) in that the nodes try to talk to
the domain when they're started but the domain doesn't accept connections
until after the container is completely up and started, so the node sends
the register request to the domain and hangs waiting for the domain to
answer. Not sure whats the best way to get around this, anyone have any good
ideas?

   ...ant

Re: Starting a domain manager on a url including a path?

Posted by Simon Laws <si...@googlemail.com>.
On Nov 13, 2007 4:06 PM, ant elder <an...@gmail.com> wrote:

> Trying to run a domain manager node within a webapp and it fails as right
> now you can only use a domain manager url without a path, eg
> http://localhost:8080 not http://localhost:8080/tuscany/domainManager. I'd
> like to try to fix this so a path if supported if no one has any
> objections,
> also if there are any pointers to where in the node and domain code this
> is
> handled that would be great too!
>
>   ...ant
>
No objections from me. It's dealt with in three places..

SCADomainImpl.init() - sets up the domain runtime
SCANodeImpl.init() - sets up the node runtime
SCADomainProxy.start() - sets up a local runtime if no node is provided

The code you are looking for is something like...

            // Configure the default server port
            int port = URI.create(domainModel.getDomainURI()).getPort();
            if (port != -1) {
                ServletHostExtensionPoint servletHosts =
domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(
ServletHostExtensionPoint.class);
                for (ServletHost servletHost: servletHosts.getServletHosts())
{
                    servletHost.setDefaultPort(port);
                }
            }

This is stripping the port out of the provided URL and putting it into the
servlet host. I think we would need to change this interface to allow the
whole base URL to be set on the servlet host.

External web app container - The web app container controls the actual
endpoint and the NodeURL simply tells the tuscany runtime what endpoints to
register. It's seems awkward that we have to provide the URL here but there
doesn't appear to be an easy way round it.
Embedded web app container - The NodeURL should instruct the embedded
container what base URL to use for services.

For the Node URL you must either provide a valid URL or nothing. If nothing
then one will be chosen for you.
For Domain URL (at the node) you must either provide the URL of the domain
or nothing.If nothing then the node will run standalone.

Regards

Simon