Multiple BaseX Tomcat webapps
Wednesday, 27 May 2015 · 7 messages · last reply 1 Jun 2015
KK
Kristian Kankainen27 May 2015 09:57 #
Hello!
I previously had BaseX 8.1.1 working as a Tomcat webapp and it all worked fine. I know tried to simply put BaseX82.war as another webapp, but the second webapp seems to connect to the BaseX instance in the first webapp.
For example:
the address
http://tomcat.myhost.ee/BaseX82/rest/
lists all the databases that are in
http://tomcat.myhost.ee/BaseX811/
even though the new BaseX82 instance should be empty.
I have problems understanding if this concerns BaseX configuration or Tomcat configuration... Which files should I check? Looking at the both's webapps' WEB-INF/web.xml they seem logically fine to me.
Best regards
Kristian K
CG
Christian Grün27 May 2015 12:53 #
Hi Kristian,
Quoted text · Kristian Kankainen · 3 lines
> I previously had BaseX 8.1.1 working as a Tomcat webapp and it all worked > fine. I know tried to simply put BaseX82.war as another webapp, but the > second webapp seems to connect to the BaseX instance in the first webapp.
True, same on my machine. It doesn't seem to be due to 8.2. Instead, Tomcat seems to adopts some options from a running BaseX instance (and the primary instance might differ after a restart of Tomcat):
http://localhost:8080/BaseX811/rest?query=db:system()
<system>
<generalinformation>
<version>8.1.1</version>
</generalinformation>
<globaloptions>
<dbpath>C:\Program Files\Apache Software Foundation\Tomcat
8.0\webapps\BaseX811\data</dbpath>
...<system>
<generalinformation>
<version>8.2</version>
<usedmemory>37 MB</usedmemory>
</generalinformation>
<globaloptions>
<authmethod>Basic</authmethod>
<dbpath>C:\Program Files\Apache Software Foundation\Tomcat
8.0\webapps\BaseX811\data</dbpath>
...I currently have no idea if this can be fixed in Tomcat or BaseX (I don't know such a behavior from Jetty), but... I'll try to find out more.
Christian
KK
Kristian Kankainen28 May 2015 08:03 #
I think it has to do with Tomcat webapps' context settings [1]. It states that there is some kind of default context that will be used if no other contexts are matched. I'm reading it now and will try some experimenting.
I also note that my Tomcat setup is not configured for multiple instances, thus my CATALINA_BASE is the same as CATALINA_HOME.
Cheers
Kristian
[1]: http://tomcat.eki.ee/docs/config/context.html
27.05.2015 13:53, Christian Grün kirjutas:
Quoted text · Christian Grün · 38 lines
> Hi Kristian, > >> I previously had BaseX 8.1.1 working as a Tomcat webapp and it all worked >> fine. I know tried to simply put BaseX82.war as another webapp, but the >> second webapp seems to connect to the BaseX instance in the first webapp. > True, same on my machine. It doesn't seem to be due to 8.2. Instead, > Tomcat seems to adopts some options from a running BaseX instance (and > the primary instance might differ after a restart of Tomcat): > > http://localhost:8080/BaseX811/rest?query=db:system() > > <system> > <generalinformation> > <version>8.1.1</version> > </generalinformation> > <globaloptions> > <dbpath>C:\Program Files\Apache Software Foundation\Tomcat > 8.0\webapps\BaseX811\data</dbpath> > ... > > http://localhost:8080/BaseX82/rest?query=db:system() > > <system> > <generalinformation> > <version>8.2</version> > <usedmemory>37 MB</usedmemory> > </generalinformation> > <globaloptions> > <authmethod>Basic</authmethod> > <dbpath>C:\Program Files\Apache Software Foundation\Tomcat > 8.0\webapps\BaseX811\data</dbpath> > ... > > I currently have no idea if this can be fixed in Tomcat or BaseX (I > don't know such a behavior from Jetty), but... I'll try to find out > more. > > Christian
KK
Kristian Kankainen28 May 2015 09:22 #
Quoted text · but I · 1 line
I haven't found any solutions, but I wrote down what I noticed:
None of my webapps have a corresponding context.xml file in: $CATALINA_BASE/conf/[enginename]/[hostname]/
Neither is there any default context file in:
$CATALINA_BASE/conf/[enginename]/[hostname]/context.xml.default
So the only default values are read from:
$CATALINA_BASE/conf/context.xml
When looking at the WEB-INF/web.xml that is shipped with BaseX I notice it doesn't give the context parameter for:
* restpath
* webpath
Comparing both of my webapps
http://[...]/rest?command=info
I noticed that one has EVENTPORT: 1985 set while the other lacks it completely,
one has CACHEQUERY: false while the other lacks it completely, one has MAXHITS: -1 while the other lacks it completely.
Please tell me to stop if you feel I clutter the list. I thought maybe it helps to share my observations.
Best wishes
Kristian
28.05.2015 09:03, Kristian Kankainen kirjutas:
Quoted text · Kristian Kankainen · 55 lines
> I think it has to do with Tomcat webapps' context settings [1]. It > states that there is some kind of default context that will be used if > no other contexts are matched. I'm reading it now and will try some > experimenting. > > I also note that my Tomcat setup is not configured for multiple > instances, thus my CATALINA_BASE is the same as CATALINA_HOME. > > Cheers > Kristian > > [1]: http://tomcat.eki.ee/docs/config/context.html > > 27.05.2015 13:53, Christian Grün kirjutas: >> Hi Kristian, >> >>> I previously had BaseX 8.1.1 working as a Tomcat webapp and it all >>> worked >>> fine. I know tried to simply put BaseX82.war as another webapp, but the >>> second webapp seems to connect to the BaseX instance in the first >>> webapp. >> True, same on my machine. It doesn't seem to be due to 8.2. Instead, >> Tomcat seems to adopts some options from a running BaseX instance (and >> the primary instance might differ after a restart of Tomcat): >> >> http://localhost:8080/BaseX811/rest?query=db:system() >> >> <system> >> <generalinformation> >> <version>8.1.1</version> >> </generalinformation> >> <globaloptions> >> <dbpath>C:\Program Files\Apache Software Foundation\Tomcat >> 8.0\webapps\BaseX811\data</dbpath> >> ... >> >> http://localhost:8080/BaseX82/rest?query=db:system() >> >> <system> >> <generalinformation> >> <version>8.2</version> >> <usedmemory>37 MB</usedmemory> >> </generalinformation> >> <globaloptions> >> <authmethod>Basic</authmethod> >> <dbpath>C:\Program Files\Apache Software Foundation\Tomcat >> 8.0\webapps\BaseX811\data</dbpath> >> ... >> >> I currently have no idea if this can be fixed in Tomcat or BaseX (I >> don't know such a behavior from Jetty), but... I'll try to find out >> more. >> >> Christian >
CG
Christian Grün28 May 2015 11:45 #
Hi Kristian,
Thanks, keep on going, every feedback is valuable.
Christian
Quoted text · Kristian Kankainen · 93 lines
On Thu, May 28, 2015 at 9:22 AM, Kristian Kankainen <kristian at keeleleek.ee> wrote: > I haven't found any solutions, but I wrote down what I noticed: > > None of my webapps have a corresponding context.xml file in: > $CATALINA_BASE/conf/[enginename]/[hostname]/ > > Neither is there any default context file in: > $CATALINA_BASE/conf/[enginename]/[hostname]/context.xml.default > > So the only default values are read from: > $CATALINA_BASE/conf/context.xml > > When looking at the WEB-INF/web.xml that is shipped with BaseX I notice it > doesn't give the context parameter for: > * restpath > * webpath > > Comparing both of my webapps > http://[...]/rest?command=info > I noticed that one has EVENTPORT: 1985 set while the other lacks it > completely, > one has CACHEQUERY: false while the other lacks it completely, > one has MAXHITS: -1 while the other lacks it completely. > > Please tell me to stop if you feel I clutter the list. I thought maybe it > helps to share my observations. > > Best wishes > Kristian > > > > 28.05.2015 09:03, Kristian Kankainen kirjutas: >> >> I think it has to do with Tomcat webapps' context settings [1]. It states >> that there is some kind of default context that will be used if no other >> contexts are matched. I'm reading it now and will try some experimenting. >> >> I also note that my Tomcat setup is not configured for multiple instances, >> thus my CATALINA_BASE is the same as CATALINA_HOME. >> >> Cheers >> Kristian >> >> [1]: http://tomcat.eki.ee/docs/config/context.html >> >> 27.05.2015 13:53, Christian Grün kirjutas: >>> >>> Hi Kristian, >>> >>>> I previously had BaseX 8.1.1 working as a Tomcat webapp and it all >>>> worked >>>> fine. I know tried to simply put BaseX82.war as another webapp, but the >>>> second webapp seems to connect to the BaseX instance in the first >>>> webapp. >>> >>> True, same on my machine. It doesn't seem to be due to 8.2. Instead, >>> Tomcat seems to adopts some options from a running BaseX instance (and >>> the primary instance might differ after a restart of Tomcat): >>> >>> http://localhost:8080/BaseX811/rest?query=db:system() >>> >>> <system> >>> <generalinformation> >>> <version>8.1.1</version> >>> </generalinformation> >>> <globaloptions> >>> <dbpath>C:\Program Files\Apache Software Foundation\Tomcat >>> 8.0\webapps\BaseX811\data</dbpath> >>> ... >>> >>> http://localhost:8080/BaseX82/rest?query=db:system() >>> >>> <system> >>> <generalinformation> >>> <version>8.2</version> >>> <usedmemory>37 MB</usedmemory> >>> </generalinformation> >>> <globaloptions> >>> <authmethod>Basic</authmethod> >>> <dbpath>C:\Program Files\Apache Software Foundation\Tomcat >>> 8.0\webapps\BaseX811\data</dbpath> >>> ... >>> >>> I currently have no idea if this can be fixed in Tomcat or BaseX (I >>> don't know such a behavior from Jetty), but... I'll try to find out >>> more. >>> >>> Christian >> >> >
KK
Kristian Kankainen1 Jun 2015 16:29 #
Since this conversation accidentally went off-list somewhere on it's way...
I am happy to announce that Christian now has solved the Tomcat problem.
Cheers!
Kristian
29.05.2015 20:48, Christian Grün kirjutas:
Quoted text · Christian Grün · 144 lines
> Hi Kristian, > > I'm quite positive I could fix some potential Tomcat-related issues > today! It shouldn't happen anymore that the database paths of multiple > instances are mixed up. Your feedback on the latest snapshot [1] is > welcome. > > Have a nice evening or even weekend, > Christian > > [1] http://files.basex.org/releases/latest/ > > > > On Fri, May 29, 2015 at 11:55 AM, Kristian Kankainen > <kristian at keeleleek.ee> wrote: >> Hi, I try to describe a possible solution scenario even though I am not at >> all familiar with Java. Please bare with me and help me to debug my scenario >> :-) >> >> I found Tomcat documentation for class loaders[1]. Since I don't know any >> Java, I can't really understand any of it. But it does state, that Tomcats >> way of loading classes is fundamentally different from standard Java class >> loading. Maybe this can be part of the problem? >> >> Also the comment at the end of the documentation asks about an attribute >> "delegate=true" that can impose (I guess) the standard Java way of loading >> classes... >> >> As I understand it, there is a way of achieving class loading in a way that >> allready loaded classes are re-used -- this I understand as the situation of >> our problem. >> >> Maybe the way of loading classes has to be explicitly spelled out in a >> context.xml file which BaseX doesn't have? >> >> Cheers >> Kristian >> >> [1] http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html >> >> >> >> 28.05.2015 12:45, Christian Grün kirjutas: >>> Hi Kristian, >>> >>> Thanks, keep on going, every feedback is valuable. >>> >>> Christian >>> >>> >>> On Thu, May 28, 2015 at 9:22 AM, Kristian Kankainen >>> <kristian at keeleleek.ee> wrote: >>>> I haven't found any solutions, but I wrote down what I noticed: >>>> >>>> None of my webapps have a corresponding context.xml file in: >>>> $CATALINA_BASE/conf/[enginename]/[hostname]/ >>>> >>>> Neither is there any default context file in: >>>> $CATALINA_BASE/conf/[enginename]/[hostname]/context.xml.default >>>> >>>> So the only default values are read from: >>>> $CATALINA_BASE/conf/context.xml >>>> >>>> When looking at the WEB-INF/web.xml that is shipped with BaseX I notice >>>> it >>>> doesn't give the context parameter for: >>>> * restpath >>>> * webpath >>>> >>>> Comparing both of my webapps >>>> http://[...]/rest?command=info >>>> I noticed that one has EVENTPORT: 1985 set while the other lacks it >>>> completely, >>>> one has CACHEQUERY: false while the other lacks it completely, >>>> one has MAXHITS: -1 while the other lacks it completely. >>>> >>>> Please tell me to stop if you feel I clutter the list. I thought maybe it >>>> helps to share my observations. >>>> >>>> Best wishes >>>> Kristian >>>> >>>> >>>> >>>> 28.05.2015 09:03, Kristian Kankainen kirjutas: >>>>> I think it has to do with Tomcat webapps' context settings [1]. It >>>>> states >>>>> that there is some kind of default context that will be used if no other >>>>> contexts are matched. I'm reading it now and will try some >>>>> experimenting. >>>>> >>>>> I also note that my Tomcat setup is not configured for multiple >>>>> instances, >>>>> thus my CATALINA_BASE is the same as CATALINA_HOME. >>>>> >>>>> Cheers >>>>> Kristian >>>>> >>>>> [1]: http://tomcat.eki.ee/docs/config/context.html >>>>> >>>>> 27.05.2015 13:53, Christian Grün kirjutas: >>>>>> Hi Kristian, >>>>>> >>>>>>> I previously had BaseX 8.1.1 working as a Tomcat webapp and it all >>>>>>> worked >>>>>>> fine. I know tried to simply put BaseX82.war as another webapp, but >>>>>>> the >>>>>>> second webapp seems to connect to the BaseX instance in the first >>>>>>> webapp. >>>>>> True, same on my machine. It doesn't seem to be due to 8.2. Instead, >>>>>> Tomcat seems to adopts some options from a running BaseX instance (and >>>>>> the primary instance might differ after a restart of Tomcat): >>>>>> >>>>>> http://localhost:8080/BaseX811/rest?query=db:system() >>>>>> >>>>>> <system> >>>>>> <generalinformation> >>>>>> <version>8.1.1</version> >>>>>> </generalinformation> >>>>>> <globaloptions> >>>>>> <dbpath>C:\Program Files\Apache Software Foundation\Tomcat >>>>>> 8.0\webapps\BaseX811\data</dbpath> >>>>>> ... >>>>>> >>>>>> http://localhost:8080/BaseX82/rest?query=db:system() >>>>>> >>>>>> <system> >>>>>> <generalinformation> >>>>>> <version>8.2</version> >>>>>> <usedmemory>37 MB</usedmemory> >>>>>> </generalinformation> >>>>>> <globaloptions> >>>>>> <authmethod>Basic</authmethod> >>>>>> <dbpath>C:\Program Files\Apache Software Foundation\Tomcat >>>>>> 8.0\webapps\BaseX811\data</dbpath> >>>>>> ... >>>>>> >>>>>> I currently have no idea if this can be fixed in Tomcat or BaseX (I >>>>>> don't know such a behavior from Jetty), but... I'll try to find out >>>>>> more. >>>>>> >>>>>> Christian >>>>>
CG
Christian Grün1 Jun 2015 16:37 #
Hi Kristian, thanks as well! Keep me updated. Christian
Quoted text · Kristian Kankainen · 174 lines
On Mon, Jun 1, 2015 at 4:29 PM, Kristian Kankainen <kristian at keeleleek.ee> wrote: > Since this conversation accidentally went off-list somewhere on it's way... > > I am happy to announce that Christian now has solved the Tomcat problem. > > Cheers! > Kristian > > > 29.05.2015 20:48, Christian Grün kirjutas: >> >> Hi Kristian, >> >> I'm quite positive I could fix some potential Tomcat-related issues >> today! It shouldn't happen anymore that the database paths of multiple >> instances are mixed up. Your feedback on the latest snapshot [1] is >> welcome. >> >> Have a nice evening or even weekend, >> Christian >> >> [1] http://files.basex.org/releases/latest/ >> >> >> >> On Fri, May 29, 2015 at 11:55 AM, Kristian Kankainen >> <kristian at keeleleek.ee> wrote: >>> >>> Hi, I try to describe a possible solution scenario even though I am not >>> at >>> all familiar with Java. Please bare with me and help me to debug my >>> scenario >>> :-) >>> >>> I found Tomcat documentation for class loaders[1]. Since I don't know any >>> Java, I can't really understand any of it. But it does state, that >>> Tomcats >>> way of loading classes is fundamentally different from standard Java >>> class >>> loading. Maybe this can be part of the problem? >>> >>> Also the comment at the end of the documentation asks about an attribute >>> "delegate=true" that can impose (I guess) the standard Java way of >>> loading >>> classes... >>> >>> As I understand it, there is a way of achieving class loading in a way >>> that >>> allready loaded classes are re-used -- this I understand as the situation >>> of >>> our problem. >>> >>> Maybe the way of loading classes has to be explicitly spelled out in a >>> context.xml file which BaseX doesn't have? >>> >>> Cheers >>> Kristian >>> >>> [1] http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html >>> >>> >>> >>> 28.05.2015 12:45, Christian Grün kirjutas: >>>> >>>> Hi Kristian, >>>> >>>> Thanks, keep on going, every feedback is valuable. >>>> >>>> Christian >>>> >>>> >>>> On Thu, May 28, 2015 at 9:22 AM, Kristian Kankainen >>>> <kristian at keeleleek.ee> wrote: >>>>> >>>>> I haven't found any solutions, but I wrote down what I noticed: >>>>> >>>>> None of my webapps have a corresponding context.xml file in: >>>>> $CATALINA_BASE/conf/[enginename]/[hostname]/ >>>>> >>>>> Neither is there any default context file in: >>>>> $CATALINA_BASE/conf/[enginename]/[hostname]/context.xml.default >>>>> >>>>> So the only default values are read from: >>>>> $CATALINA_BASE/conf/context.xml >>>>> >>>>> When looking at the WEB-INF/web.xml that is shipped with BaseX I notice >>>>> it >>>>> doesn't give the context parameter for: >>>>> * restpath >>>>> * webpath >>>>> >>>>> Comparing both of my webapps >>>>> http://[...]/rest?command=info >>>>> I noticed that one has EVENTPORT: 1985 set while the other lacks it >>>>> completely, >>>>> one has CACHEQUERY: false while the other lacks it completely, >>>>> one has MAXHITS: -1 while the other lacks it completely. >>>>> >>>>> Please tell me to stop if you feel I clutter the list. I thought maybe >>>>> it >>>>> helps to share my observations. >>>>> >>>>> Best wishes >>>>> Kristian >>>>> >>>>> >>>>> >>>>> 28.05.2015 09:03, Kristian Kankainen kirjutas: >>>>>> >>>>>> I think it has to do with Tomcat webapps' context settings [1]. It >>>>>> states >>>>>> that there is some kind of default context that will be used if no >>>>>> other >>>>>> contexts are matched. I'm reading it now and will try some >>>>>> experimenting. >>>>>> >>>>>> I also note that my Tomcat setup is not configured for multiple >>>>>> instances, >>>>>> thus my CATALINA_BASE is the same as CATALINA_HOME. >>>>>> >>>>>> Cheers >>>>>> Kristian >>>>>> >>>>>> [1]: http://tomcat.eki.ee/docs/config/context.html >>>>>> >>>>>> 27.05.2015 13:53, Christian Grün kirjutas: >>>>>>> >>>>>>> Hi Kristian, >>>>>>> >>>>>>>> I previously had BaseX 8.1.1 working as a Tomcat webapp and it all >>>>>>>> worked >>>>>>>> fine. I know tried to simply put BaseX82.war as another webapp, but >>>>>>>> the >>>>>>>> second webapp seems to connect to the BaseX instance in the first >>>>>>>> webapp. >>>>>>> >>>>>>> True, same on my machine. It doesn't seem to be due to 8.2. Instead, >>>>>>> Tomcat seems to adopts some options from a running BaseX instance >>>>>>> (and >>>>>>> the primary instance might differ after a restart of Tomcat): >>>>>>> >>>>>>> http://localhost:8080/BaseX811/rest?query=db:system() >>>>>>> >>>>>>> <system> >>>>>>> <generalinformation> >>>>>>> <version>8.1.1</version> >>>>>>> </generalinformation> >>>>>>> <globaloptions> >>>>>>> <dbpath>C:\Program Files\Apache Software Foundation\Tomcat >>>>>>> 8.0\webapps\BaseX811\data</dbpath> >>>>>>> ... >>>>>>> >>>>>>> http://localhost:8080/BaseX82/rest?query=db:system() >>>>>>> >>>>>>> <system> >>>>>>> <generalinformation> >>>>>>> <version>8.2</version> >>>>>>> <usedmemory>37 MB</usedmemory> >>>>>>> </generalinformation> >>>>>>> <globaloptions> >>>>>>> <authmethod>Basic</authmethod> >>>>>>> <dbpath>C:\Program Files\Apache Software Foundation\Tomcat >>>>>>> 8.0\webapps\BaseX811\data</dbpath> >>>>>>> ... >>>>>>> >>>>>>> I currently have no idea if this can be fixed in Tomcat or BaseX (I >>>>>>> don't know such a behavior from Jetty), but... I'll try to find out >>>>>>> more. >>>>>>> >>>>>>> Christian >>>>>> >>>>>> >
Written for BaseX 8.2. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery