0
我想在Tomcat中使用以下server.conf運行兩個BaseX實例。我遇到了一個奇怪的問題:它們都在各自的端口上可用,但是webapp本身是相同的WAR;即webapps/WAR中只有的鏈接出現在從webapps2加載的WAR中。我不確定我的下一步應該是什麼 - 我會問BaseX郵件列表,但他們沒有在那裏使用很多的Tomcat。Tomcat多服務 - 啓動問題
這裏是我的server.conf中
<Service name="Catalina">
<Connector port="8080"
protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"/>
<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">
<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>
當我啓動Tomcat,一切都在這兩個服務的負荷還好,除了第二BaseX應用。當Tomcat開始加載時,我收到以下錯誤:
INFO: Starting service Catalina2
Nov 03, 2014 7:59:58 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.53
Nov 03, 2014 7:59:58 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /usr/home/cob/src/apache-tomcat- 7.0.53/webapps2/bX79.war
Nov 03, 2014 7:59:58 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 7:59:58 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/home/cob/src/apache-tomcat-7.0.53/webapps2/examples
Nov 03, 2014 7:59:59 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Nov 03, 2014 7:59:59 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Nov 03, 2014 7:59:59 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', '[email protected]')
Nov 03, 2014 7:59:59 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/home/cob/src/apache-tomcat-7.0.53/webapps2/docs
Nov 03, 2014 7:59:59 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/home/cob/src/apache-tomcat-7.0.53/webapps2/ROOT
Nov 03, 2014 7:59:59 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/home/cob/src/apache-tomcat-7.0.53/webapps2/manager
Nov 03, 2014 7:59:59 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/home/cob/src/apache-tomcat-7.0.53/webapps2/host-manager
Nov 03, 2014 7:59:59 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-18080"]
Nov 03, 2014 7:59:59 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-18009"]
Nov 03, 2014 7:59:59 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8304 ms
我不太確定端口是否會導致問題。 netstat
和其他使用中的端口不會返回任何有用的內容。