Skip to content

Commit 441f1cd

Browse files
committed
switch to open-liberty maven tools
1 parent 2e08ab7 commit 441f1cd

4 files changed

Lines changed: 174 additions & 189 deletions

File tree

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM openliberty/open-liberty:kernel-java11-openj9-ubi
2+
3+
COPY --chown=1001:0 src/main/liberty/config/server.xml /config/server.xml
4+
COPY --chown=1001:0 src/main/liberty/config/server.xml /config/server.env
5+
COPY --chown=1001:0 target/io.openliberty.sample.daytrader8.war /config/apps/
6+
7+
#Derby
8+
COPY --chown=1001:0 target/liberty/wlp/usr/shared/resources/DerbyLibs/derby-10.14.2.0.jar /opt/ol/wlp/usr/shared/resources/DerbyLibs/derby-10.14.2.0.jar
9+
COPY --chown=1001:0 target/liberty/wlp/usr/shared/resources/data /opt/ol/wlp/usr/shared/resources/data
10+
11+
RUN configure.sh

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ git clone git@github.com:OpenLiberty/sample.daytrader8.git
1414

1515
From inside the sample.daytrader8 directory, build and start the application in Open Liberty with the following command:
1616
```
17-
mvn clean package liberty:run-server
17+
mvn clean package liberty:run
1818
```
1919

20-
The server will listen on port 9080 by default. You can change the port (for example, to port 9081) by adding `mvn clean package liberty:run-server -DtestServerHttpPort=9081` to the end of the Maven command.
20+
The server will listen on port 9080 by default. You can change the port (for example, to port 9081) by adding `mvn clean package liberty:run -DtestServerHttpPort=9081` to the end of the Maven command.
2121

2222
Once the server is started, you should be able to access the application at:
2323
http://localhost:9080/daytrader

pom.xml

Lines changed: 88 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,104 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2-
<modelVersion>4.0.0</modelVersion>
3-
4-
<groupId>io.openliberty.samples</groupId>
5-
<artifactId>io.openliberty.sample.daytrader8</artifactId>
6-
<version>1.0-SNAPSHOT</version>
7-
<packaging>war</packaging>
8-
9-
<parent>
10-
<groupId>net.wasdev.wlp.maven.parent</groupId>
11-
<artifactId>liberty-maven-app-parent</artifactId>
12-
<version>2.6.1</version>
13-
</parent>
14-
15-
16-
<properties>
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>io.openliberty.samples</groupId>
5+
<artifactId>io.openliberty.sample.daytrader8</artifactId>
6+
<version>1.0-SNAPSHOT</version>
7+
<packaging>war</packaging>
8+
<properties>
179
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1810
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
1911
<maven.compiler.source>1.8</maven.compiler.source>
2012
<maven.compiler.target>1.8</maven.compiler.target>
21-
<app.name>LibertyProject</app.name>
13+
<!-- Derby library -->
14+
<version.derby>10.14.2.0</version.derby>
15+
<derby.path>${user.home}/.m2/repository/org/apache/derby/derby</derby.path>
16+
<!-- Liberty configuration -->
2217
<testServerHttpPort>9080</testServerHttpPort>
2318
<testServerHttpsPort>9443</testServerHttpsPort>
24-
<package.file>${project.build.directory}/${app.name}.zip</package.file>
25-
<packaging.type>usr</packaging.type>
26-
<skipTests>false</skipTests>
27-
</properties>
28-
29-
<dependencies>
19+
</properties>
20+
<dependencies>
3021
<dependency>
31-
<groupId>javax</groupId>
32-
<artifactId>javaee-api</artifactId>
33-
<version>8.0</version>
34-
<scope>provided</scope>
22+
<groupId>javax</groupId>
23+
<artifactId>javaee-api</artifactId>
24+
<version>8.0</version>
25+
<scope>provided</scope>
3526
</dependency>
3627
<dependency>
37-
<groupId>taglibs</groupId>
38-
<artifactId>standard</artifactId>
39-
<version>1.1.1</version>
40-
<scope>compile</scope>
28+
<groupId>taglibs</groupId>
29+
<artifactId>standard</artifactId>
30+
<version>1.1.1</version>
31+
<scope>compile</scope>
4132
</dependency>
4233
<dependency>
43-
<groupId>javax.xml.bind</groupId>
44-
<artifactId>jaxb-api</artifactId>
45-
<version>2.3.0</version>
46-
<scope>provided</scope>
34+
<groupId>javax.xml.bind</groupId>
35+
<artifactId>jaxb-api</artifactId>
36+
<version>2.3.0</version>
37+
<scope>provided</scope>
4738
</dependency>
48-
</dependencies>
49-
50-
<build>
51-
<finalName>${project.artifactId}</finalName>
52-
<plugins>
53-
<plugin>
54-
<groupId>org.apache.maven.plugins</groupId>
55-
<artifactId>maven-dependency-plugin</artifactId>
56-
<version>3.0.0</version>
57-
<executions>
58-
<execution>
59-
<id>copy-derby</id>
60-
<phase>package</phase>
61-
<goals>
62-
<goal>copy</goal>
63-
</goals>
39+
<!-- Derby from https://mvnrepository.com/artifact/org.apache.derby/derby -->
40+
<dependency>
41+
<groupId>org.apache.derby</groupId>
42+
<artifactId>derby</artifactId>
43+
<version>${version.derby}</version>
44+
<scope>test</scope>
45+
</dependency>
46+
</dependencies>
47+
<build>
48+
<finalName>${project.artifactId}</finalName>
49+
<!-- Enable liberty-maven plugin -->
50+
<plugins>
51+
<plugin>
52+
<groupId>io.openliberty.tools</groupId>
53+
<artifactId>liberty-maven-plugin</artifactId>
54+
<version>3.3-M4</version>
6455
<configuration>
65-
<artifactItems>
66-
<artifactItem>
67-
<groupId>org.apache.derby</groupId>
68-
<artifactId>derby</artifactId>
69-
<version>10.13.1.1</version>
70-
<outputDirectory>${project.build.directory}/liberty/wlp/usr/shared/resources/DerbyLibs</outputDirectory>
71-
</artifactItem>
72-
</artifactItems>
56+
<bootstrapProperties>
57+
<default.http.port>${testServerHttpPort}</default.http.port>
58+
<default.https.port>${testServerHttpsPort}</default.https.port>
59+
</bootstrapProperties>
7360
</configuration>
74-
</execution>
75-
</executions>
76-
</plugin>
77-
<plugin>
78-
<artifactId>maven-resources-plugin</artifactId>
79-
<version>2.6</version>
80-
<executions>
81-
<execution>
82-
<id>copy-resources</id>
83-
<phase>package</phase>
84-
<goals>
85-
<goal>copy-resources</goal>
86-
</goals>
87-
<configuration>
88-
<outputDirectory>${project.build.directory}/liberty/wlp/usr/shared/resources/data</outputDirectory>
89-
<resources>
90-
<resource>
91-
<directory>resources/data</directory>
92-
<filtering>false</filtering>
93-
</resource>
94-
</resources>
95-
</configuration>
96-
</execution>
97-
</executions>
98-
</plugin>
99-
<plugin>
100-
<groupId>org.apache.maven.plugins</groupId>
101-
<artifactId>maven-war-plugin</artifactId>
102-
<version>2.6</version>
103-
<configuration>
104-
<failOnMissingWebXml>false</failOnMissingWebXml>
105-
<packagingExcludes>pom.xml</packagingExcludes>
106-
</configuration>
107-
</plugin>
108-
<!-- Enable liberty-maven plugin -->
109-
<plugin>
110-
<groupId>net.wasdev.wlp.maven.plugins</groupId>
111-
<artifactId>liberty-maven-plugin</artifactId>
112-
<version>2.0</version>
113-
<configuration>
114-
<assemblyArtifact>
115-
<groupId>io.openliberty</groupId>
116-
<artifactId>openliberty-runtime</artifactId>
117-
<version>RELEASE</version>
118-
<type>zip</type>
119-
</assemblyArtifact>
120-
<serverName>sampleAppServer</serverName>
121-
<configFile>src/main/liberty/config/server.xml</configFile>
122-
<serverEnv>src/main/liberty/config/server.env</serverEnv>
123-
<packageFile>${package.file}</packageFile>
124-
<include>${packaging.type}</include>
125-
<bootstrapProperties>
126-
<default.http.port>${testServerHttpPort}</default.http.port>
127-
<default.https.port>${testServerHttpsPort}</default.https.port>
128-
</bootstrapProperties>
129-
</configuration>
130-
</plugin>
131-
</plugins>
132-
</build>
133-
61+
</plugin>
62+
<plugin>
63+
<groupId>org.apache.maven.plugins</groupId>
64+
<artifactId>maven-dependency-plugin</artifactId>
65+
<version>3.1.2</version>
66+
<executions>
67+
<execution>
68+
<id>copy-derby-dependency</id>
69+
<phase>package</phase>
70+
<goals>
71+
<goal>copy-dependencies</goal>
72+
</goals>
73+
<configuration>
74+
<includeArtifactIds>derby</includeArtifactIds>
75+
<outputDirectory>${project.build.directory}/liberty/wlp/usr/shared/resources/DerbyLibs/</outputDirectory>
76+
</configuration>
77+
</execution>
78+
</executions>
79+
</plugin>
80+
<plugin>
81+
<artifactId>maven-resources-plugin</artifactId>
82+
<version>2.6</version>
83+
<executions>
84+
<execution>
85+
<id>copy-resources</id>
86+
<phase>package</phase>
87+
<goals>
88+
<goal>copy-resources</goal>
89+
</goals>
90+
<configuration>
91+
<outputDirectory>${project.build.directory}/liberty/wlp/usr/shared/resources/data</outputDirectory>
92+
<resources>
93+
<resource>
94+
<directory>resources/data</directory>
95+
<filtering>false</filtering>
96+
</resource>
97+
</resources>
98+
</configuration>
99+
</execution>
100+
</executions>
101+
</plugin>
102+
</plugins>
103+
</build>
134104
</project>

src/main/liberty/config/server.xml

Lines changed: 73 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,79 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<server>
2-
<featureManager>
3-
<feature>ejb-3.2</feature>
4-
<feature>servlet-4.0</feature>
5-
<feature>jsf-2.3</feature>
6-
<feature>jpa-2.2</feature>
7-
<feature>mdb-3.2</feature>
8-
<feature>wasJmsServer-1.0</feature>
9-
<feature>wasJmsClient-2.0</feature>
10-
<feature>cdi-2.0</feature>
11-
<feature>websocket-1.1</feature>
12-
<feature>concurrent-1.0</feature>
13-
<feature>jsonp-1.1</feature>
14-
<feature>jsonb-1.0</feature>
15-
<feature>beanValidation-2.0</feature>
16-
<feature>jaxrs-2.1</feature>
17-
<feature>ssl-1.0</feature>
18-
</featureManager>
19-
20-
<keyStore id="defaultKeyStore" password="yourPassword" />
3+
<featureManager>
4+
<feature>ejb-3.2</feature>
5+
<feature>servlet-4.0</feature>
6+
<feature>jsf-2.3</feature>
7+
<feature>jpa-2.2</feature>
8+
<feature>mdb-3.2</feature>
9+
<feature>wasJmsServer-1.0</feature>
10+
<feature>wasJmsClient-2.0</feature>
11+
<feature>cdi-2.0</feature>
12+
<feature>websocket-1.1</feature>
13+
<feature>concurrent-1.0</feature>
14+
<feature>jsonp-1.1</feature>
15+
<feature>jsonb-1.0</feature>
16+
<feature>beanValidation-2.0</feature>
17+
<feature>jaxrs-2.1</feature>
18+
<feature>ssl-1.0</feature>
19+
</featureManager>
2120

22-
<!--<logging traceSpecification="daytrader=fine"/>-->
21+
<variable name="derby.lib" defaultValue="${shared.resource.dir}/DerbyLibs/derby-10.14.2.0.jar" />
2322

24-
<!-- allow reuse of 'busy' ports for fast server recycling on linux (where ports remain blocked for up to 2 mins after server stops) ${tradelite.http.port} set in bootstrap.properties -->
25-
<httpEndpoint host="*" httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint">
26-
<tcpOptions soReuseAddr="true"/>
27-
<httpOptions maxKeepAliveRequests="-1"/>
28-
</httpEndpoint>
23+
<keyStore id="defaultKeyStore" password="yourPassword" />
2924

30-
<webApplication id="daytrader8" location="io.openliberty.sample.daytrader8.war" name="daytrader8" context-root="daytrader"/>
25+
<!--<logging traceSpecification="daytrader=fine"/>-->
3126

32-
<connectionManager agedTimeout="-1" connectionTimeout="0" id="conMgr1" maxIdleTime="-1" maxPoolSize="100" minPoolSize="100" purgePolicy="FailingConnectionOnly" reapTime="-1"/>
27+
<!-- allow reuse of 'busy' ports for fast server recycling on linux (where ports remain blocked for up to 2 mins after server stops) ${tradelite.http.port} set in bootstrap.properties -->
28+
<httpEndpoint host="*" httpPort="${default.http.port}" httpsPort="${default.https.port}" id="defaultHttpEndpoint">
29+
<tcpOptions soReuseAddr="true" />
30+
<httpOptions maxKeepAliveRequests="-1" />
31+
</httpEndpoint>
32+
33+
<application location="io.openliberty.sample.daytrader8.war" type="war" context-root="/daytrader" />
34+
35+
<!-- Derby Library Configuration -->
36+
<library id="derbyJDBCLib">
37+
<file name="${derby.lib}" />
38+
</library>
39+
40+
<authData id="TradeDataSourceAuthData" password="db_password" user="db_username" />
41+
<authData id="TradeAdminAuthData" password="db_password" user="db_username" />
3342

34-
<jdbcDriver id="DerbyEmbedded" libraryRef="DerbyLib"/>
35-
<library filesetRef="DerbyFileset" id="DerbyLib"/>
36-
<fileset dir="${shared.resource.dir}/DerbyLibs" id="DerbyFileset" includes="derby-10.13.1.1.jar"/>
37-
38-
<authData id="TradeDataSourceAuthData" password="db_password" user="db_username"/>
39-
<authData id="TradeAdminAuthData" password="db_password" user="db_username"/>
40-
41-
<dataSource connectionManagerRef="conMgr1" id="DefaultDataSource" isolationLevel="TRANSACTION_READ_COMMITTED" jdbcDriverRef="DerbyEmbedded" jndiName="jdbc/TradeDataSource" statementCacheSize="60">
42-
<properties.derby.embedded createDatabase="create" databaseName="${shared.resource.dir}/data/tradedb" password="db_password" user="db_username"/>
43-
</dataSource>
44-
45-
<messagingEngine id="defaultME">
46-
<queue id="TradeBrokerQueue"/>
47-
<topicSpace id="TradeTopicSpace"/>
48-
</messagingEngine>
49-
50-
<jmsQueueConnectionFactory connectionManagerRef="ConMgr3" jndiName="jms/TradeBrokerQCF">
51-
<properties.wasJms/>
52-
</jmsQueueConnectionFactory>
53-
<connectionManager id="ConMgr3" maxPoolSize="20"/>
54-
55-
<jmsTopicConnectionFactory connectionManagerRef="ConMgr4" jndiName="jms/TradeStreamerTCF">
56-
<properties.wasJms/>
57-
</jmsTopicConnectionFactory>
58-
<connectionManager id="ConMgr4" maxPoolSize="20"/>
59-
60-
<jmsQueue id="TradeBrokerQueue" jndiName="jms/TradeBrokerQueue">
61-
<properties.wasJms deliveryMode="NonPersistent" queueName="TradeBrokerQueue"/>
62-
</jmsQueue>
63-
64-
<jmsTopic id="TradeStreamerTopic" jndiName="jms/TradeStreamerTopic">
65-
<properties.wasJms deliveryMode="NonPersistent" topicSpace="TradeTopicSpace"/>
66-
</jmsTopic>
67-
68-
<jmsActivationSpec id="io.openliberty.sample.daytrader8/DTBroker3MDB">
69-
<properties.wasJms destinationRef="TradeBrokerQueue"/>
70-
</jmsActivationSpec>
71-
72-
<jmsActivationSpec id="io.openliberty.sample.daytrader8/DTStreamer3MDB">
73-
<properties.wasJms destinationRef="TradeStreamerTopic" destinationType="javax.jms.Topic"/>
74-
</jmsActivationSpec>
75-
</server>
43+
<connectionManager agedTimeout="-1" connectionTimeout="0" id="conMgr1" maxIdleTime="-1" maxPoolSize="100" minPoolSize="100" purgePolicy="FailingConnectionOnly" reapTime="-1" />
44+
<dataSource connectionManagerRef="conMgr1" id="DefaultDataSource" isolationLevel="TRANSACTION_READ_COMMITTED" jndiName="jdbc/TradeDataSource" statementCacheSize="60">
45+
<jdbcDriver libraryRef="derbyJDBCLib" />
46+
<properties.derby.embedded databaseName="${shared.resource.dir}/data/tradedb" password="db_password" user="db_username" />
47+
</dataSource>
48+
49+
<messagingEngine id="defaultME">
50+
<queue id="TradeBrokerQueue" />
51+
<topicSpace id="TradeTopicSpace" />
52+
</messagingEngine>
53+
54+
<connectionManager id="ConMgr2" maxPoolSize="20" />
55+
<jmsQueueConnectionFactory connectionManagerRef="ConMgr2" jndiName="jms/TradeBrokerQCF">
56+
<properties.wasJms />
57+
</jmsQueueConnectionFactory>
58+
59+
<connectionManager id="ConMgr3" maxPoolSize="20" />
60+
<jmsTopicConnectionFactory connectionManagerRef="ConMgr3" jndiName="jms/TradeStreamerTCF">
61+
<properties.wasJms />
62+
</jmsTopicConnectionFactory>
63+
64+
<jmsQueue id="TradeBrokerQueue" jndiName="jms/TradeBrokerQueue">
65+
<properties.wasJms deliveryMode="NonPersistent" queueName="TradeBrokerQueue" />
66+
</jmsQueue>
67+
68+
<jmsTopic id="TradeStreamerTopic" jndiName="jms/TradeStreamerTopic">
69+
<properties.wasJms deliveryMode="NonPersistent" topicSpace="TradeTopicSpace" />
70+
</jmsTopic>
71+
72+
<jmsActivationSpec id="io.openliberty.sample.daytrader8/DTBroker3MDB">
73+
<properties.wasJms destinationRef="TradeBrokerQueue" />
74+
</jmsActivationSpec>
75+
76+
<jmsActivationSpec id="io.openliberty.sample.daytrader8/DTStreamer3MDB">
77+
<properties.wasJms destinationRef="TradeStreamerTopic" destinationType="javax.jms.Topic" />
78+
</jmsActivationSpec>
79+
</server>

0 commit comments

Comments
 (0)