Hi all,
I know that there aren't many Tomcat users on this list, and that I'm echoing previous emails to the list but I wanted to see if anyone here had encountered this issue. Some pieces of this may be steps forward to solving problems that others on the list have mentioned; I've cc'd you in the hopes that the information is helpful.
Tomcat can be configured to multiple services, on varying ports, in the $TOMCAT_HOME/conf/server.xml file; e.g. [1]. I have two nearly-identical WARs in the following directory structure: $TOMCAT_HOME/
__conf/ __
[1] example server.xml: <Server port="8005" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/> <Listener className="org.apache.catalina.core.JasperListener"/> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/> <GlobalNamingResources> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/> </GlobalNamingResources> <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" maxThreads="125" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" acceptCount="100"/> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b"/> </Host> </Engine> </Service> <Service name="Catalina2"> <Connector port="18080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="18443"/> <Connector port="18009" protocol="AJP/1.3" redirectPort="18443"/> <Engine name="Catalina2" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps2" unpackWARS="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs2" prefix="localhost_Cat2_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b"/> </Host> </Engine> </Service> </Server>
My apologies -- I accidentally clicked 'send'. :/
On Tue, Nov 4, 2014 at 10:12 AM, Bridger Dyson-Smith bdysonsmith@gmail.com wrote:
Hi all,
I know that there aren't many Tomcat users on this list, and that I'm echoing previous emails to the list but I wanted to see if anyone here had encountered this issue. Some pieces of this may be steps forward to solving problems that others on the list have mentioned; I've cc'd you in the hopes that the information is helpful.
Tomcat can be configured to multiple services, on varying ports, in the $TOMCAT_HOME/conf/server.xml file; e.g. [1]. I have two nearly-identical WARs in the following directory structure:
`--> tree -L 1 apache-tomcat-7.0.53 apache-tomcat-7.0.53 ├── LICENSE ├── NOTICE ├── RELEASE-NOTES ├── RUNNING.txt ├── bin ├── conf ├── lib ├── logs ├── logs2 ├── temp ├── webapps ├── webapps2 └── work
`--> tree -L 1 webapps webapps ├── BaseX79 ├── BaseX79.war ├── ROOT ├── docs ├── examples ├── fop ├── fop.war ├── host-manager ├── imagemanip ├── imagemanip.war ├── lukeall-1.0.1.jar ├── manager ├── retailer ├── retailer.war ├── saxon ├── saxon.war ├── spc ├── spc.war ├── static ├── utk-xtf ├── utk-xtf-frameless ├── utk-xtf-frameless.war └── utk-xtf.war
`--> tree -L 1 webapps2 webapps2 ├── ROOT ├── bX79 ├── bX79.war ├── docs ├── examples ├── host-manager └── manager
Now, the problem is that I get a port conflict message from Tomcat [2] and only the first WAR ($TOMCAT_HOME/webapps/BaseX79) loads. E.g. there are some minor textual changes between the two restxq.xqm files.
I've tried to add a .basex file (webapps2/bX79/.basex) that specifies a different port, and I've also tried adding that information in webapps2/bX79/WEB-INF/web.xml as <context-params> [3].
I'm planning to email the Tomcat-users list to see if someone there can shed more light on this; i.e. is this a problem with the way that server.xml is configured, etc. However I was also curious if anyone here had any thoughts or suggestions on this setup. Am I missing a step; e.g. should I be incorporating a compilation step - generating a WAR file - or something else?
I apologize for the breadth of the questions - I've jumped into the middle of a problem and now I'm trying to work my back out to the start. Thank you for your time & trouble.
Best, Bridger
[1] example server.xml:
<Server port="8005" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/> <Listener className="org.apache.catalina.core.JasperListener"/> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/> <GlobalNamingResources> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/>
</GlobalNamingResources> <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" maxThreads="125" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" acceptCount="100"/> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b"/> </Host> </Engine> </Service> <Service name="Catalina2"> <Connector port="18080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="18443"/> <Connector port="18009" protocol="AJP/1.3" redirectPort="18443"/> <Engine name="Catalina2" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps2" unpackWARS="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs2" prefix="localhost_Cat2_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b"/> </Host> </Engine> </Service> </Server>
[2] $TOMCAT_HOME/logs/catalina.out: INFO: Starting service Catalina2 Nov 03, 2014 9:08:30 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.53 Nov 03, 2014 9:08:30 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/bX79.war Nov 03, 2014 9:08:31 PM org.apache.catalina.core.StandardContext loadOnStartup *SEVERE: Servlet /bX79 threw load() exception* java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376) at java.net.ServerSocket.bind(ServerSocket.java:376) at java.net.ServerSocket.bind(ServerSocket.java:330) at org.basex.BaseXServer.<init>(BaseXServer.java:110) at org.basex.http.HTTPContext.init(HTTPContext.java:379) at org.basex.http.BaseXServlet.init(BaseXServlet.java:34) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/examples Nov 03, 2014 9:08:31 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() Nov 03, 2014 9:08:31 PM org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized() Nov 03, 2014 9:08:31 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@5f0f8770') Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/docs Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/ROOT Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/manager Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/host-manager Nov 03, 2014 9:08:31 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-18080"] Nov 03, 2014 9:08:31 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-18009"] Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 7893 ms
[3] $TOMCAT_HOME/webapps2/bX79/WEB-INF/web.xml <context-param> <param-name>org.basex.port</param-name> <param-value>8984</param-value> </context-param> <context-param> <param-name>org.basex.serverport</param-name> <param-value>8984</param-value> </context-param>
Hi all,
On Tue, Nov 4, 2014 at 10:31 AM, Bridger Dyson-Smith bdysonsmith@gmail.com wrote:
My apologies -- I accidentally clicked 'send'. :/
On Tue, Nov 4, 2014 at 10:12 AM, Bridger Dyson-Smith < bdysonsmith@gmail.com> wrote:
Hi all,
I know that there aren't many Tomcat users on this list, and that I'm echoing previous emails to the list but I wanted to see if anyone here had encountered this issue. Some pieces of this may be steps forward to solving problems that others on the list have mentioned; I've cc'd you in the hopes that the information is helpful.
Tomcat can be configured to multiple services, on varying ports, in the $TOMCAT_HOME/conf/server.xml file; e.g. [1]. I have two nearly-identical WARs in the following directory structure:
`--> tree -L 1 apache-tomcat-7.0.53 apache-tomcat-7.0.53 ├── LICENSE ├── NOTICE ├── RELEASE-NOTES ├── RUNNING.txt ├── bin ├── conf ├── lib ├── logs ├── logs2 ├── temp ├── webapps ├── webapps2 └── work
`--> tree -L 1 webapps webapps ├── BaseX79 ├── BaseX79.war ├── ROOT ├── docs ├── examples ├── fop ├── fop.war ├── host-manager ├── imagemanip ├── imagemanip.war ├── lukeall-1.0.1.jar ├── manager ├── retailer ├── retailer.war ├── saxon ├── saxon.war ├── spc ├── spc.war ├── static ├── utk-xtf ├── utk-xtf-frameless ├── utk-xtf-frameless.war └── utk-xtf.war
`--> tree -L 1 webapps2 webapps2 ├── ROOT ├── bX79 ├── bX79.war ├── docs ├── examples ├── host-manager └── manager
Now, the problem is that I get a port conflict message from Tomcat [2] and only the first WAR ($TOMCAT_HOME/webapps/BaseX79) loads. E.g. there are some minor textual changes between the two restxq.xqm files.
I've tried to add a .basex file (webapps2/bX79/.basex) that specifies a different port, and I've also tried adding that information in webapps2/bX79/WEB-INF/web.xml as <context-params> [3].
I'm planning to email the Tomcat-users list to see if someone there can shed more light on this; i.e. is this a problem with the way that server.xml is configured, etc. However I was also curious if anyone here had any thoughts or suggestions on this setup. Am I missing a step; e.g. should I be incorporating a compilation step - generating a WAR file - or something else?
I apologize for the breadth of the questions - I've jumped into the middle of a problem and now I'm trying to work my back out to the start. Thank you for your time & trouble.
Best, Bridger
[1] example server.xml:
<Server port="8005" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/> <Listener className="org.apache.catalina.core.JasperListener"/> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/> <GlobalNamingResources> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/>
</GlobalNamingResources> <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" maxThreads="125" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" acceptCount="100"/> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b"/> </Host> </Engine> </Service> <Service name="Catalina2"> <Connector port="18080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="18443"/> <Connector port="18009" protocol="AJP/1.3" redirectPort="18443"/> <Engine name="Catalina2" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps2" unpackWARS="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs2" prefix="localhost_Cat2_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b"/> </Host> </Engine> </Service> </Server>
[2] $TOMCAT_HOME/logs/catalina.out: INFO: Starting service Catalina2 Nov 03, 2014 9:08:30 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.53 Nov 03, 2014 9:08:30 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/bX79.war Nov 03, 2014 9:08:31 PM org.apache.catalina.core.StandardContext loadOnStartup *SEVERE: Servlet /bX79 threw load() exception* java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376) at java.net.ServerSocket.bind(ServerSocket.java:376) at java.net.ServerSocket.bind(ServerSocket.java:330) at org.basex.BaseXServer.<init>(BaseXServer.java:110) at org.basex.http.HTTPContext.init(HTTPContext.java:379) at org.basex.http.BaseXServlet.init(BaseXServlet.java:34) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/examples Nov 03, 2014 9:08:31 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() Nov 03, 2014 9:08:31 PM org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized() Nov 03, 2014 9:08:31 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@5f0f8770') Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/docs Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/ROOT Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/manager Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/host-manager Nov 03, 2014 9:08:31 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-18080"] Nov 03, 2014 9:08:31 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-18009"] Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 7893 ms
[3] $TOMCAT_HOME/webapps2/bX79/WEB-INF/web.xml
<context-param> <param-name>org.basex.port</param-name> <param-value>8984</param-value> </context-param> <context-param> <param-name>org.basex.serverport</param-name> <param-value>8984</param-value> </context-param>
After poking at this some more, I'm pretty much stumped. I have
$webapp/WEB-INF/web.xml files that specify different ports for everything that isn't configured in $CATALINA_HOME/conf/server.xml, including org.basex.stopport. But no matter what, I get the same error when Tomcat starts to load the second .war:
INFO: Starting service Catalina2
Nov 06, 2014 9:50:03 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.53 Nov 06, 2014 9:50:03 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/second.war Nov 06, 2014 9:50:04 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /second threw load() exception java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376) at java.net.ServerSocket.bind(ServerSocket.java:376) at java.net.ServerSocket.bind(ServerSocket.java:330) at org.basex.BaseXServer.<init>(BaseXServer.java:107) at org.basex.http.HTTPContext.init(HTTPContext.java:379) at org.basex.http.BaseXServlet.init(BaseXServlet.java:34) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
I've looked at the source, but I know even less about Java than I do about XQuery (e.g. next to nothing) so I'm not sure what else to try. If the list has any suggestions about following this further, I'd be delighted to try them -- there's something about this behavior that doesn't seem quite right. I can think of potential use cases where mutliple .wars serving different needs could be very handy.
This behavior doesn't appear to be limited to Tomcat, either. I just tested both $webapps in the 20141103 jetty distribution and got a very similar error. I've linked to a PasteBin [1] for the full error log.
Cheers, Bridger
Hi Bridger,
I would be interested to know if you have set HTTPLOCAL to true or false? In the latter case, the database server will be started as well (which allows you to use the client bindings, "basexclient", etc.). In that case, you may also need to change the EVENTPORT [2]. As you see on the referenced Wiki page, there are some more ports (like STOPPORT), which you could try to change in each web.xml file.
Please tell me if this brings you any further. If yes, we should surely add some more information in our Wiki.
Thanks, Christian
[1] http://docs.basex.org/wiki/Web_Application#Configuration [2] http://docs.basex.org/wiki/Options#EVENTPORT
On Fri, Nov 7, 2014 at 4:23 AM, Bridger Dyson-Smith bdysonsmith@gmail.com wrote:
Hi all,
On Tue, Nov 4, 2014 at 10:31 AM, Bridger Dyson-Smith bdysonsmith@gmail.com wrote:
My apologies -- I accidentally clicked 'send'. :/
On Tue, Nov 4, 2014 at 10:12 AM, Bridger Dyson-Smith bdysonsmith@gmail.com wrote:
Hi all,
I know that there aren't many Tomcat users on this list, and that I'm echoing previous emails to the list but I wanted to see if anyone here had encountered this issue. Some pieces of this may be steps forward to solving problems that others on the list have mentioned; I've cc'd you in the hopes that the information is helpful.
Tomcat can be configured to multiple services, on varying ports, in the $TOMCAT_HOME/conf/server.xml file; e.g. [1]. I have two nearly-identical WARs in the following directory structure:
`--> tree -L 1 apache-tomcat-7.0.53 apache-tomcat-7.0.53 ├── LICENSE ├── NOTICE ├── RELEASE-NOTES ├── RUNNING.txt ├── bin ├── conf ├── lib ├── logs ├── logs2 ├── temp ├── webapps ├── webapps2 └── work
`--> tree -L 1 webapps webapps ├── BaseX79 ├── BaseX79.war ├── ROOT ├── docs ├── examples ├── fop ├── fop.war ├── host-manager ├── imagemanip ├── imagemanip.war ├── lukeall-1.0.1.jar ├── manager ├── retailer ├── retailer.war ├── saxon ├── saxon.war ├── spc ├── spc.war ├── static ├── utk-xtf ├── utk-xtf-frameless ├── utk-xtf-frameless.war └── utk-xtf.war
`--> tree -L 1 webapps2 webapps2 ├── ROOT ├── bX79 ├── bX79.war ├── docs ├── examples ├── host-manager └── manager
Now, the problem is that I get a port conflict message from Tomcat [2] and only the first WAR ($TOMCAT_HOME/webapps/BaseX79) loads. E.g. there are some minor textual changes between the two restxq.xqm files.
I've tried to add a .basex file (webapps2/bX79/.basex) that specifies a different port, and I've also tried adding that information in webapps2/bX79/WEB-INF/web.xml as <context-params> [3].
I'm planning to email the Tomcat-users list to see if someone there can shed more light on this; i.e. is this a problem with the way that server.xml is configured, etc. However I was also curious if anyone here had any thoughts or suggestions on this setup. Am I missing a step; e.g. should I be incorporating a compilation step - generating a WAR file - or something else?
I apologize for the breadth of the questions - I've jumped into the middle of a problem and now I'm trying to work my back out to the start. Thank you for your time & trouble.
Best, Bridger
[1] example server.xml:
<Server port="8005" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/> <Listener className="org.apache.catalina.core.JasperListener"/> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/> <GlobalNamingResources> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/>
</GlobalNamingResources> <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" maxThreads="125" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" acceptCount="100"/> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b"/> </Host> </Engine> </Service> <Service name="Catalina2"> <Connector port="18080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="18443"/> <Connector port="18009" protocol="AJP/1.3" redirectPort="18443"/> <Engine name="Catalina2" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps2" unpackWARS="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs2" prefix="localhost_Cat2_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b"/> </Host> </Engine> </Service> </Server>
[2] $TOMCAT_HOME/logs/catalina.out: INFO: Starting service Catalina2 Nov 03, 2014 9:08:30 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.53 Nov 03, 2014 9:08:30 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/bX79.war Nov 03, 2014 9:08:31 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /bX79 threw load() exception java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376) at java.net.ServerSocket.bind(ServerSocket.java:376) at java.net.ServerSocket.bind(ServerSocket.java:330) at org.basex.BaseXServer.<init>(BaseXServer.java:110) at org.basex.http.HTTPContext.init(HTTPContext.java:379) at org.basex.http.BaseXServlet.init(BaseXServlet.java:34) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/examples Nov 03, 2014 9:08:31 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() Nov 03, 2014 9:08:31 PM org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized() Nov 03, 2014 9:08:31 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@5f0f8770') Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/docs Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/ROOT Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/manager Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/host-manager Nov 03, 2014 9:08:31 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-18080"] Nov 03, 2014 9:08:31 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-18009"] Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 7893 ms
[3] $TOMCAT_HOME/webapps2/bX79/WEB-INF/web.xml
<context-param> <param-name>org.basex.port</param-name> <param-value>8984</param-value> </context-param> <context-param> <param-name>org.basex.serverport</param-name> <param-value>8984</param-value> </context-param>
After poking at this some more, I'm pretty much stumped. I have $webapp/WEB-INF/web.xml files that specify different ports for everything that isn't configured in $CATALINA_HOME/conf/server.xml, including org.basex.stopport. But no matter what, I get the same error when Tomcat starts to load the second .war:
INFO: Starting service Catalina2 Nov 06, 2014 9:50:03 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.53 Nov 06, 2014 9:50:03 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/second.war Nov 06, 2014 9:50:04 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /second threw load() exception java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376) at java.net.ServerSocket.bind(ServerSocket.java:376) at java.net.ServerSocket.bind(ServerSocket.java:330) at org.basex.BaseXServer.<init>(BaseXServer.java:107) at org.basex.http.HTTPContext.init(HTTPContext.java:379) at org.basex.http.BaseXServlet.init(BaseXServlet.java:34) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
I've looked at the source, but I know even less about Java than I do about XQuery (e.g. next to nothing) so I'm not sure what else to try. If the list has any suggestions about following this further, I'd be delighted to try them -- there's something about this behavior that doesn't seem quite right. I can think of potential use cases where mutliple .wars serving different needs could be very handy.
This behavior doesn't appear to be limited to Tomcat, either. I just tested both $webapps in the 20141103 jetty distribution and got a very similar error. I've linked to a PasteBin [1] for the full error log.
Cheers, Bridger
Hi Christian,
On Fri, Nov 7, 2014 at 11:18 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Bridger,
I would be interested to know if you have set HTTPLOCAL to true or false? In the latter case, the database server will be started as well (which allows you to use the client bindings, "basexclient", etc.). In that case, you may also need to change the EVENTPORT [2]. As you see on the referenced Wiki page, there are some more ports (like STOPPORT), which you could try to change in each web.xml file.
Please tell me if this brings you any further. If yes, we should surely add some more information in our Wiki.
Thanks, Christian
[1] http://docs.basex.org/wiki/Web_Application#Configuration [2] http://docs.basex.org/wiki/Options#EVENTPORT
On Fri, Nov 7, 2014 at 4:23 AM, Bridger Dyson-Smith bdysonsmith@gmail.com wrote:
Hi all,
On Tue, Nov 4, 2014 at 10:31 AM, Bridger Dyson-Smith <
bdysonsmith@gmail.com>
wrote:
My apologies -- I accidentally clicked 'send'. :/
On Tue, Nov 4, 2014 at 10:12 AM, Bridger Dyson-Smith bdysonsmith@gmail.com wrote:
Hi all,
I know that there aren't many Tomcat users on this list, and that I'm echoing previous emails to the list but I wanted to see if anyone here
had
encountered this issue. Some pieces of this may be steps forward to
solving
problems that others on the list have mentioned; I've cc'd you in the
hopes
that the information is helpful.
Tomcat can be configured to multiple services, on varying ports, in the $TOMCAT_HOME/conf/server.xml file; e.g. [1]. I have two
nearly-identical
WARs in the following directory structure:
`--> tree -L 1 apache-tomcat-7.0.53 apache-tomcat-7.0.53 ├── LICENSE ├── NOTICE ├── RELEASE-NOTES ├── RUNNING.txt ├── bin ├── conf ├── lib ├── logs ├── logs2 ├── temp ├── webapps ├── webapps2 └── work
`--> tree -L 1 webapps webapps ├── BaseX79 ├── BaseX79.war ├── ROOT ├── docs ├── examples ├── fop ├── fop.war ├── host-manager ├── imagemanip ├── imagemanip.war ├── lukeall-1.0.1.jar ├── manager ├── retailer ├── retailer.war ├── saxon ├── saxon.war ├── spc ├── spc.war ├── static ├── utk-xtf ├── utk-xtf-frameless ├── utk-xtf-frameless.war └── utk-xtf.war
`--> tree -L 1 webapps2 webapps2 ├── ROOT ├── bX79 ├── bX79.war ├── docs ├── examples ├── host-manager └── manager
Now, the problem is that I get a port conflict message from Tomcat [2]
and
only the first WAR ($TOMCAT_HOME/webapps/BaseX79) loads. E.g. there are
some
minor textual changes between the two restxq.xqm files.
I've tried to add a .basex file (webapps2/bX79/.basex) that specifies a different port, and I've also tried adding that information in webapps2/bX79/WEB-INF/web.xml as <context-params> [3].
I'm planning to email the Tomcat-users list to see if someone there can shed more light on this; i.e. is this a problem with the way that
server.xml
is configured, etc. However I was also curious if anyone here had any thoughts or suggestions on this setup. Am I missing a step; e.g. should
I be
incorporating a compilation step - generating a WAR file - or something else?
I apologize for the breadth of the questions - I've jumped into the
middle
of a problem and now I'm trying to work my back out to the start. Thank
you
for your time & trouble.
Best, Bridger
[1] example server.xml:
<Server port="8005" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/> <Listener className="org.apache.catalina.core.JasperListener"/> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/> <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener
className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<GlobalNamingResources> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and
saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/>
</GlobalNamingResources> <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" maxThreads="125" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" acceptCount="100"/> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve
className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b"/> </Host> </Engine>
</Service> <Service name="Catalina2"> <Connector port="18080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="18443"/> <Connector port="18009" protocol="AJP/1.3" redirectPort="18443"/> <Engine name="Catalina2" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps2" unpackWARS="true" autoDeploy="true"> <Valve
className="org.apache.catalina.valves.AccessLogValve"
directory="logs2" prefix="localhost_Cat2_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b"/> </Host> </Engine>
</Service> </Server>
[2] $TOMCAT_HOME/logs/catalina.out: INFO: Starting service Catalina2 Nov 03, 2014 9:08:30 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.53 Nov 03, 2014 9:08:30 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/bX79.war Nov 03, 2014 9:08:31 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /bX79 threw load() exception java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376) at java.net.ServerSocket.bind(ServerSocket.java:376) at java.net.ServerSocket.bind(ServerSocket.java:330) at org.basex.BaseXServer.<init>(BaseXServer.java:110) at org.basex.http.HTTPContext.init(HTTPContext.java:379) at org.basex.http.BaseXServlet.init(BaseXServlet.java:34) at
org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073) at
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/examples Nov 03, 2014 9:08:31 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() Nov 03, 2014 9:08:31 PM org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized() Nov 03, 2014 9:08:31 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@5f0f8770') Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/docs Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/ROOT Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/manager Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/host-manager Nov 03, 2014 9:08:31 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-18080"] Nov 03, 2014 9:08:31 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-18009"] Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 7893 ms
[3] $TOMCAT_HOME/webapps2/bX79/WEB-INF/web.xml
<context-param> <param-name>org.basex.port</param-name> <param-value>8984</param-value> </context-param> <context-param> <param-name>org.basex.serverport</param-name> <param-value>8984</param-value> </context-param>
After poking at this some more, I'm pretty much stumped. I have $webapp/WEB-INF/web.xml files that specify different ports for everything that isn't configured in $CATALINA_HOME/conf/server.xml, including org.basex.stopport. But no matter what, I get the same error when Tomcat starts to load the second .war:
INFO: Starting service Catalina2 Nov 06, 2014 9:50:03 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.53 Nov 06, 2014 9:50:03 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/second.war Nov 06, 2014 9:50:04 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /second threw load() exception java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376) at java.net.ServerSocket.bind(ServerSocket.java:376) at java.net.ServerSocket.bind(ServerSocket.java:330) at org.basex.BaseXServer.<init>(BaseXServer.java:107) at org.basex.http.HTTPContext.init(HTTPContext.java:379) at org.basex.http.BaseXServlet.init(BaseXServlet.java:34) at
org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073) at
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
I've looked at the source, but I know even less about Java than I do
about
XQuery (e.g. next to nothing) so I'm not sure what else to try. If the
list
has any suggestions about following this further, I'd be delighted to try them -- there's something about this behavior that doesn't seem quite
right.
I can think of potential use cases where mutliple .wars serving different needs could be very handy.
This behavior doesn't appear to be limited to Tomcat, either. I just
tested
both $webapps in the 20141103 jetty distribution and got a very similar error. I've linked to a PasteBin [1] for the full error log.
Cheers, Bridger
Thanks for the response. I've included the pertinent parts of my $webapp/WEB-INF/web.xmls below [1,2]. A couple of items from this round of "testing":
1) with HTTPLOCAL set to 'true' in both web.xml files, neither webapp's databases are accessible from basexclient (to be expected, if I'm reading things correctly). I think this prevents the 'java.net.BindException: Address already in use' error mention below.
2) while I no longer get the error message re 'java.net.BindException: Address already in use', only one WAR loads; e.g I've changed the <title> of the second WAR to <title>BaseX HTTP Services -- the second webapp</title>, along with a couple of other minor changes. None of them appear, and to drive the point home, the text under 'Example 3' says, in both webapps, "The source code of the file that created this page (file:/usr/home/bridger/src/apache-tomcat-7.0.53/webapps/BaseX79/restxq.xqm) is shown below:". This is a continuation of the behavior from earlier experiments.
So aside from the missing error message, it would appear that I'm not much further. I'd be delighted to try alternate approaches - please let me know if there are other things I can help with.
Best, Bridger
[1] $TOMCAT/webapps/BaseX79/WEB-INF/web.xml: (partial) <!-- Set default credentials --> <context-param> <param-name>org.basex.user</param-name> <param-value>admin</param-value> </context-param> <context-param> <param-name>org.basex.password</param-name> <param-value>admin</param-value> </context-param> <!-- added, bridger --> <context-param> <param-name>org.basex.eventport</param-name> <param-value>11985</param-value> </context-param> <context-param> <param-name>org.basex.port</param-name> <param-value>18984</param-value> </context-param> <context-param> <param-name>org.basex.serverport</param-name> <param-value>18984</param-value> </context-param> <context-param> <param-name>org.basex.stopport</param-name> <param-value>19985</param-value> </context-param> <context-param> <param-name>org.basex.httplocal</param-name> <param-value>false</param-value> </context-param>
[2] $TOMCAT/webapps2/second/WEB-INF/web.xml: (partial) <!-- Set default credentials --> <context-param> <param-name>org.basex.user</param-name> <param-value>admin</param-value> </context-param> <context-param> <param-name>org.basex.password</param-name> <param-value>admin</param-value> </context-param> <!-- added, bridger --> <context-param> <param-name>org.basex.eventport</param-name> <param-value>11986</param-value> </context-param> <context-param> <param-name>org.basex.port</param-name> <param-value>18985</param-value> </context-param> <context-param> <param-name>org.basex.serverport</param-name> <param-value>18985</param-value> </context-param> <context-param> <param-name>org.basex.stopport</param-name> <param-value>19986</param-value> </context-param> <context-param> <param-name>org.basex.httplocal</param-name> <param-value>false</param-value> </context-param>
Hi Bridger,
Maybe one more question: does the bind exception disappear when you set another eventport (and set httplocal=false to activate the database server)?
You could additionally try to change the value of the RESTXQPATH option (and, possibly WEBPATH). [1]
It's time for us to get some own experience with Tomcat… Christian
[1] http://docs.basex.org/wiki/Options#HTTP_Options
On Fri, Nov 7, 2014 at 11:18 PM, Bridger Dyson-Smith bdysonsmith@gmail.com wrote:
Hi Christian,
On Fri, Nov 7, 2014 at 11:18 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Bridger,
I would be interested to know if you have set HTTPLOCAL to true or false? In the latter case, the database server will be started as well (which allows you to use the client bindings, "basexclient", etc.). In that case, you may also need to change the EVENTPORT [2]. As you see on the referenced Wiki page, there are some more ports (like STOPPORT), which you could try to change in each web.xml file.
Please tell me if this brings you any further. If yes, we should surely add some more information in our Wiki.
Thanks, Christian
[1] http://docs.basex.org/wiki/Web_Application#Configuration [2] http://docs.basex.org/wiki/Options#EVENTPORT
On Fri, Nov 7, 2014 at 4:23 AM, Bridger Dyson-Smith bdysonsmith@gmail.com wrote:
Hi all,
On Tue, Nov 4, 2014 at 10:31 AM, Bridger Dyson-Smith bdysonsmith@gmail.com wrote:
My apologies -- I accidentally clicked 'send'. :/
On Tue, Nov 4, 2014 at 10:12 AM, Bridger Dyson-Smith bdysonsmith@gmail.com wrote:
Hi all,
I know that there aren't many Tomcat users on this list, and that I'm echoing previous emails to the list but I wanted to see if anyone here had encountered this issue. Some pieces of this may be steps forward to solving problems that others on the list have mentioned; I've cc'd you in the hopes that the information is helpful.
Tomcat can be configured to multiple services, on varying ports, in the $TOMCAT_HOME/conf/server.xml file; e.g. [1]. I have two nearly-identical WARs in the following directory structure:
`--> tree -L 1 apache-tomcat-7.0.53 apache-tomcat-7.0.53 ├── LICENSE ├── NOTICE ├── RELEASE-NOTES ├── RUNNING.txt ├── bin ├── conf ├── lib ├── logs ├── logs2 ├── temp ├── webapps ├── webapps2 └── work
`--> tree -L 1 webapps webapps ├── BaseX79 ├── BaseX79.war ├── ROOT ├── docs ├── examples ├── fop ├── fop.war ├── host-manager ├── imagemanip ├── imagemanip.war ├── lukeall-1.0.1.jar ├── manager ├── retailer ├── retailer.war ├── saxon ├── saxon.war ├── spc ├── spc.war ├── static ├── utk-xtf ├── utk-xtf-frameless ├── utk-xtf-frameless.war └── utk-xtf.war
`--> tree -L 1 webapps2 webapps2 ├── ROOT ├── bX79 ├── bX79.war ├── docs ├── examples ├── host-manager └── manager
Now, the problem is that I get a port conflict message from Tomcat [2] and only the first WAR ($TOMCAT_HOME/webapps/BaseX79) loads. E.g. there are some minor textual changes between the two restxq.xqm files.
I've tried to add a .basex file (webapps2/bX79/.basex) that specifies a different port, and I've also tried adding that information in webapps2/bX79/WEB-INF/web.xml as <context-params> [3].
I'm planning to email the Tomcat-users list to see if someone there can shed more light on this; i.e. is this a problem with the way that server.xml is configured, etc. However I was also curious if anyone here had any thoughts or suggestions on this setup. Am I missing a step; e.g. should I be incorporating a compilation step - generating a WAR file - or something else?
I apologize for the breadth of the questions - I've jumped into the middle of a problem and now I'm trying to work my back out to the start. Thank you for your time & trouble.
Best, Bridger
[1] example server.xml:
<Server port="8005" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/> <Listener className="org.apache.catalina.core.JasperListener"/> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/> <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/> <Listener
className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<GlobalNamingResources> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/>
</GlobalNamingResources> <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" maxThreads="125" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" acceptCount="100"/> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b"/> </Host> </Engine> </Service> <Service name="Catalina2"> <Connector port="18080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="18443"/> <Connector port="18009" protocol="AJP/1.3" redirectPort="18443"/> <Engine name="Catalina2" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps2" unpackWARS="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs2" prefix="localhost_Cat2_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b"/> </Host> </Engine> </Service> </Server>
[2] $TOMCAT_HOME/logs/catalina.out: INFO: Starting service Catalina2 Nov 03, 2014 9:08:30 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.53 Nov 03, 2014 9:08:30 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/bX79.war Nov 03, 2014 9:08:31 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /bX79 threw load() exception java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376) at java.net.ServerSocket.bind(ServerSocket.java:376) at java.net.ServerSocket.bind(ServerSocket.java:330) at org.basex.BaseXServer.<init>(BaseXServer.java:110) at org.basex.http.HTTPContext.init(HTTPContext.java:379) at org.basex.http.BaseXServlet.init(BaseXServlet.java:34) at
org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210) at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073) at
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/examples Nov 03, 2014 9:08:31 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() Nov 03, 2014 9:08:31 PM org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized() Nov 03, 2014 9:08:31 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@5f0f8770') Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/docs Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/ROOT Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/manager Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/host-manager Nov 03, 2014 9:08:31 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-18080"] Nov 03, 2014 9:08:31 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-18009"] Nov 03, 2014 9:08:31 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 7893 ms
[3] $TOMCAT_HOME/webapps2/bX79/WEB-INF/web.xml
<context-param> <param-name>org.basex.port</param-name> <param-value>8984</param-value> </context-param> <context-param> <param-name>org.basex.serverport</param-name> <param-value>8984</param-value> </context-param>
After poking at this some more, I'm pretty much stumped. I have $webapp/WEB-INF/web.xml files that specify different ports for everything that isn't configured in $CATALINA_HOME/conf/server.xml, including org.basex.stopport. But no matter what, I get the same error when Tomcat starts to load the second .war:
INFO: Starting service Catalina2 Nov 06, 2014 9:50:03 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.53 Nov 06, 2014 9:50:03 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /usr/home/bridger/src/apache-tomcat-7.0.53/webapps2/second.war Nov 06, 2014 9:50:04 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /second threw load() exception java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376) at java.net.ServerSocket.bind(ServerSocket.java:376) at java.net.ServerSocket.bind(ServerSocket.java:330) at org.basex.BaseXServer.<init>(BaseXServer.java:107) at org.basex.http.HTTPContext.init(HTTPContext.java:379) at org.basex.http.BaseXServlet.init(BaseXServlet.java:34) at
org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210) at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073) at
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
I've looked at the source, but I know even less about Java than I do about XQuery (e.g. next to nothing) so I'm not sure what else to try. If the list has any suggestions about following this further, I'd be delighted to try them -- there's something about this behavior that doesn't seem quite right. I can think of potential use cases where mutliple .wars serving different needs could be very handy.
This behavior doesn't appear to be limited to Tomcat, either. I just tested both $webapps in the 20141103 jetty distribution and got a very similar error. I've linked to a PasteBin [1] for the full error log.
Cheers, Bridger
Thanks for the response. I've included the pertinent parts of my $webapp/WEB-INF/web.xmls below [1,2]. A couple of items from this round of "testing":
- with HTTPLOCAL set to 'true' in both web.xml files, neither webapp's
databases are accessible from basexclient (to be expected, if I'm reading things correctly). I think this prevents the 'java.net.BindException: Address already in use' error mention below.
- while I no longer get the error message re 'java.net.BindException:
Address already in use', only one WAR loads; e.g I've changed the <title> of the second WAR to <title>BaseX HTTP Services -- the second webapp</title>, along with a couple of other minor changes. None of them appear, and to drive the point home, the text under 'Example 3' says, in both webapps, "The source code of the file that created this page (file:/usr/home/bridger/src/apache-tomcat-7.0.53/webapps/BaseX79/restxq.xqm) is shown below:". This is a continuation of the behavior from earlier experiments.
So aside from the missing error message, it would appear that I'm not much further. I'd be delighted to try alternate approaches - please let me know if there are other things I can help with.
Best, Bridger
[1] $TOMCAT/webapps/BaseX79/WEB-INF/web.xml: (partial)
<!-- Set default credentials -->
<context-param> <param-name>org.basex.user</param-name> <param-value>admin</param-value> </context-param> <context-param> <param-name>org.basex.password</param-name> <param-value>admin</param-value> </context-param> <!-- added, bridger --> <context-param> <param-name>org.basex.eventport</param-name> <param-value>11985</param-value> </context-param> <context-param> <param-name>org.basex.port</param-name> <param-value>18984</param-value> </context-param> <context-param> <param-name>org.basex.serverport</param-name> <param-value>18984</param-value> </context-param> <context-param> <param-name>org.basex.stopport</param-name> <param-value>19985</param-value> </context-param> <context-param> <param-name>org.basex.httplocal</param-name> <param-value>false</param-value> </context-param>
[2] $TOMCAT/webapps2/second/WEB-INF/web.xml: (partial)
<!-- Set default credentials -->
<context-param> <param-name>org.basex.user</param-name> <param-value>admin</param-value> </context-param> <context-param> <param-name>org.basex.password</param-name> <param-value>admin</param-value> </context-param> <!-- added, bridger --> <context-param> <param-name>org.basex.eventport</param-name> <param-value>11986</param-value> </context-param> <context-param> <param-name>org.basex.port</param-name> <param-value>18985</param-value> </context-param> <context-param> <param-name>org.basex.serverport</param-name> <param-value>18985</param-value> </context-param> <context-param> <param-name>org.basex.stopport</param-name> <param-value>19986</param-value> </context-param> <context-param> <param-name>org.basex.httplocal</param-name> <param-value>false</param-value> </context-param>
basex-talk@mailman.uni-konstanz.de