server.xml 的详细信息如下。
<?xml version="1.0" encoding="UTF-8"?>
<server description="Controller">
<!-- Enable features -->
<featureManager>
<feature>webProfile-7.0</feature>
<feature>adminCenter-1.0</feature>
<feature>websocket-1.1</feature>
<feature>httpWhiteboard-1.0</feature>
<feature>dynamicRouting-1.0</feature>
</featureManager>
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint id="defaultHttpEndpoint"
httpPort="9042"
httpsPort="9043"
host="*" />
<basicRegistry id="basic" realm="defaultRealm">
<user name="admin" password="admin"/>
</basicRegistry>
<administrator-role>
<user>admin</user>
</administrator-role>
<!-- Collective Administration, This file will be generated during provisioning -->
<include location="collective-create-include.xml" />
<remoteFileAccess>
<writeDir>${server.config.dir}</writeDir>
</remoteFileAccess>
<webApplication id="Test" location="/home/vagrant/dev/temp/TestWeb.war" name="Test"/>
</server>
服务器启动日志
Listening for transport dt_socket at address: 7778
Launching controller (WebSphere Application Server 17.0.0.4/wlp-1.0.19.201712061531) on Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_161-b12 (en_US)
[AUDIT ] CWWKE0001I: The server controller has been launched.
[AUDIT ] CWWKG0028A: Processing included configuration resource: /opt/ibm/wlp/usr/servers/controller/collective-create-include.xml
[WARNING ] TRAS0034W: Trace level trace for specification com.ibm.ws.collective.routing.controller.internal.*=trace=enabled is not valid. The trace specification will be ignored.
[AUDIT ] CWWKZ0058I: Monitoring dropins for applications.
[ERROR ] /opt/config/controllerReplica/environment/mk_aws/SSOConfig.properties (No such file or directory)
/opt/config/controllerReplica/environment/mk_aws/SSOConfig.properties (No such file or directory)
[AUDIT ] CWWKT0016I: Web application available (default_host): http://192.168.38.33:9042/ibm/api/
[AUDIT ] CWWKT0016I: Web application available (default_host): http://192.168.38.33:9042/IBMJMXConnectorREST/
[AUDIT ] CWWKT0016I: Web application available (default_host): http://192.168.38.33:9042/adminCenter/
[AUDIT ] CWWKT0016I: Web application available (default_host): http://192.168.38.33:9042/login/
[AUDIT ] CWWKT0016I: Web application available (default_host): http://192.168.38.33:9042/jwt/
[AUDIT ] CWWKT0016I: Web application available (default_host): http://192.168.38.33:9042/testlogin/
[AUDIT ] CWWKT0016I: Web application available (default_host): http://192.168.38.33:9042/ibm/adminCenter/deploy-1.0/
[AUDIT ] CWWKT0016I: Web application available (default_host): http://192.168.38.33:9042/ibm/api/collective/notify/
[AUDIT ] CWWKT0016I: Web application available (default_host): http://192.168.38.33:9042/ibm/adminCenter/serverConfig-1.0/
[AUDIT ] CWWKT0016I: Web application available (default_host): http://192.168.38.33:9042/ibm/adminCenter/explore-1.0/
[AUDIT ] CWWKT0016I: Web application available (default_host): http://192.168.38.33:9042/osgi/http/
[AUDIT ] CWWKT0016I: Web application available (default_host): http://192.168.38.33:9042/Test/
[AUDIT ] CWWKZ0001I: Application Test started in 0.561 seconds.
[AUDIT ] CWWKF0012I: The server installed the following features: [servlet-3.1, beanValidation-1.1, ssl-1.0, jndi-1.0, appSecurity-2.0, jdbc-4.1, jaxrs-2.0, adminCenter-1.0, cdi-1.2, webProfile-7.0, jpa-2.1, jsp-2.3, ejbLite-3.2, managedBeans-1.0, jsf-2.2, jsonp-1.0, restConnector-1.0, usr:liberty-login-module-1.1.0, dynamicRouting-1.0, el-3.0, jaxrsClient-2.0, jwt-1.0, collectiveMember-1.0, collectiveController-1.0, json-1.0, jpaContainer-2.1, distributedMap-1.0, websocket-1.1, httpWhiteboard-1.0].
[AUDIT ] CWWKF0011I: The server controller is ready to run a smarter planet.
生成的plugin-cfg.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--HTTP server plugin config file for web1 generated on 2018.04.20 at 14:23:59 AEST--><!--Merged HTTP server plugin config file--><Config ASDisableNagle="false" AcceptAllContent="false" AppServerPortPreference="HostHeader" ChunkedResponse="false" FIPSEnable="false" IISDisableNagle="false" IISPluginPriority="High" IgnoreDNSFailures="false" RefreshInterval="60" ResponseChunkSize="64" SSLConsolidate="false" TrustedProxyEnable="false" VHostMatchingCompat="false">
<Log LogLevel="Trace" Name="/opt/IBM/HTTPServerPlugins/logs/web1/http_plugin.log"/>
<Property Name="ESIEnable" Value="true"/>
<Property Name="ESIMaxCacheSize" Value="1024"/>
<Property Name="ESIInvalidationMonitor" Value="false"/>
<Property Name="ESIEnableToPassCookies" Value="false"/>
<Property Name="PluginInstallRoot" Value="/opt/IBM/HTTPServerPlugins/"/>
<!-- Configuration generated using httpEndpointRef=defaultHttpEndpoint-->
<!-- The default_host contained only aliases for endpoint defaultHttpEndpoint.
The generated VirtualHostGroup will contain only configured web server ports:
webserverPort=80
webserverSecurePort=443 -->
<Property Name="Keyfile" Value="/opt/IBM/HTTPServerPlugins/config/web1/plugin-key.kdb"/>
<Property Name="Stashfile" Value="/opt/IBM/HTTPServerPlugins/config/web1/plugin-key.sth"/>
<IntelligentManagement>
<Property name="webserverName" value="web1"/>
<ConnectorCluster enabled="true" maxRetries="-1" name="defaultCollective" retryInterval="60">
<Property name="uri" value="/ibm/api/dynamicRouting"/>
<Connector host="localhost" port="9043" protocol="https">
<Property name="keyring" value="/opt/IBM/HTTPServerPlugins/config/web1/plugin-key.kdb"/>
</Connector>
</ConnectorCluster>
<Property name="RoutingRulesConnectorClusterName" value="defaultCollective"/>
</IntelligentManagement>
</Config>
在上面的配置中,Test只是在server.xml中使用标记webApplication定义的Web应用程序。剩余的所有上下文路径都来自功能。
我可以从IHS(https://localhost/Test)访问Test,但是当我尝试访问adminCenter(https://localhost/adminCenter)时,它无法正常工作。动态路由配置有什么问题吗?为什么动态路由仅适用于普通的Web应用程序,而不适用于WAB上下文路径。