Configure the Servlet to work in the Liberty environment.
Download Derby for use from Liberty and db-derby-10.14.2.0-lib.zip Extract the jar file to the directory [liberty_install_dir] / usr / servers / [server_name] / derby.
dir
C:\opt\wlp\usr\servers\server1\derby\lib>dir
...
C:\opt\wlp\usr\servers\server1\derby\lib directory
2018/06/14 23:33 <DIR> .
2018/06/14 23:33 <DIR> ..
2018/06/14 23:33 3,232,770 derby.jar
2018/06/14 23:33 1,490 derby.war
2018/06/14 23:33 588,394 derbyclient.jar
2018/06/14 23:33 94,559 derbyLocale_cs.jar
2018/06/14 23:33 112,080 derbyLocale_de_DE.jar
2018/06/14 23:33 105,743 derbyLocale_es.jar
...
Liberty is configured by editing server.xml. If it is created by default, the SSL key password and administrative user are not specified. The following is the specification and Derby specified in the session DB. The location of server.xml is server.config.dir
server.config.dir : [liberty_install_dir]/usr/servers/[server_name]
Will be.
server.xml
<server description="new server">
<featureManager>
<feature>javaee-7.0</feature>
<feature>sessionDatabase-1.0</feature>
<feature>localConnector-1.0</feature>
</featureManager>
<keyStore password="password"/>
<basicRegistry id="basic" realm="BasicRealm">
<user name="wasadmin" password="password"/>
</basicRegistry>
<httpEndpoint httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint"/>
<httpSessionDatabase id="SessionDB" dataSourceRef="SessionDS"/>
<fileset id="DerbyFiles" includes="*.jar" dir="${server.config.dir}/derby/lib"/>
<library id="DerbyLib" filesetRef="DerbyFiles"/>
<jdbcDriver id="DerbyDriver" libraryRef="DerbyLib"/>
<dataSource id="SessionDS" jdbcDriverRef="DerbyDriver" jndiName="jdbc/sessions">
<properties.derby.embedded
databaseName="${server.config.dir}/derby/sessiondb" createDatabase="create" />
</dataSource>
<applicationManager autoExpand="true"/>
</server>
This is not a problem when starting from Eclipse, but the following settings are required when executing from the command line. You can start server1.
cmd
set JAVA_HOME=C:\opt\eclipseJ9\ibm_sdk80
set PATH=C:\opt\wlp\bin;%PATH%
server start server1
Server server1 is starting.
Server server1 has started.
server stop server1
Server server1 is down.
Server server1 has stopped.
Create a Web Project with File> New> Web Project.
Create with Servlet> New> Servlet.
Start the application with Servlet> Run As> Run On Server to access the Servlet.
If you remember this procedure, you will be able to do a simple test immediately.
Configure Liberty session persistence (https://www.ibm.com/support/knowledgecenter/en/SS7K4U_liberty/com.ibm.websphere.wlp.zseries.doc/ae/twlp_admin_session_persistence.html) Configuring related database connections in Liberty (https://www.ibm.com/support/knowledgecenter/en/SSAW57_liberty/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/twlp_dep_configuring_ds.html) Server command options (https://www.ibm.com/support/knowledgecenter/en/SSAW57_liberty/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/rwlp_command_server.html)
Recommended Posts