GithubHelp home page GithubHelp logo

openliberty / open-liberty-deep-dive Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 12.0 31.28 MB

This repository has been archived. Visit https://github.com/openliberty/guide-liberty-deep-dive for the new version of this tutorial..

Dockerfile 2.08% Java 97.92%

open-liberty-deep-dive's People

Contributors

austin0 avatar gkwan-ibm avatar jakub-pomykala avatar tomjenningss avatar yeekangc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

open-liberty-deep-dive's Issues

Module 2 (step 3) - error after added openapi-2.0 feature

Should not have the following error:

[INFO] [ERROR   ] CWWKO1650E: Validation of the OpenAPI document produced the following error(s): 
[INFO]                                                                                                                
[INFO]  - Message: The Schema Object of "array" type must have "items" property defined, Location: #/paths/~1resources~1orders/get/responses/200/content/application~1json/schema

Module 7 (step 8) add jq

For Module 7 (step8) and Module 10 (s
At module 7 (step 8) and 9 (step 10),

change

curl http://localhost:9080/health
curl -X POST "http://localhost:9080/coffee-shop/resources/orders" \
     -H  "accept: */*" -H  "Content-Type: application/json" \
     -d "{\"status\":\"FINISHED\",\"type\":\"ESPRESSO\"}"
curl http://localhost:9080/coffee-shop/resources/orders

to

curl http://localhost:9080/health | jq
curl -X POST "http://localhost:9080/coffee-shop/resources/orders" \
     -H  "accept: */*" -H  "Content-Type: application/json" \
     -d "{\"status\":\"FINISHED\",\"type\":\"ESPRESSO\"}"
curl http://localhost:9080/coffee-shop/resources/orders | jq

incorrect paths in cloud hosted

in cloud hosted version, any paths containing sebastian_daschner are displayed as sebastiandaschner. That caused problems

Add a copy button for log4j.properties content in Module 8

This is for the cloud-hosted instruction for Module 8. Add a copy button to make it easier for users.

og4j.rootLogger=INFO, stdout

log4j.appender=org.apache.log4j.ConsoleAppender
log4j.appender.layout=org.apache.log4j.PatternLayout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%r %p %c %x - %m%n

log4j.logger.org.microshed=DEBUG

The touch command has a copy button but not for the file content.

Screen Shot 2021-05-10 at 10 15 04 AM

Error when sending POST request in module 4

instead of receiving the expected [INFO] BaristaClient response: 200

I am seeing

[INFO] http://localhost:9081/barista
[INFO] [WARNING ] CWPMI2005W: The MicroProfile Metrics exception mapper detected and is handling an unhandled exception from the JAX-RS application. 
[INFO]                                                                                                                java.lang.NoClassDefFoundError: com.ibm.websphere.monitor.jmx.Counter
[INFO]  at java.base/java.lang.Class.getDeclaredMethodsImpl(Native Method)
[INFO]  at java.base/java.lang.Class.getDeclaredMethods(Class.java:1129)
[INFO]  at java.base/java.lang.Class.getMethodSet(Class.java:1596)
[INFO]  at java.base/java.lang.Class.addInterfaceMethods(Class.java:1645)
[INFO]  at java.base/java.lang.Class.getMethodSet(Class.java:1604)
[INFO]  at java.base/java.lang.Class.getMethods(Class.java:1520)
[INFO]  at java.management/com.sun.jmx.mbeanserver.MBeanIntrospector.getMethods(MBeanIntrospector.java:181)
[INFO]  at java.management/com.sun.jmx.mbeanserver.MBeanAnalyzer.initMaps(MBeanAnalyzer.java:128)
[INFO]  at java.management/com.sun.jmx.mbeanserver.MBeanAnalyzer.<init>(MBeanAnalyzer.java:118)
[INFO]  at java.management/com.sun.jmx.mbeanserver.MBeanAnalyzer.analyzer(MBeanAnalyzer.java:102)
[INFO]  at java.management/com.sun.jmx.mbeanserver.MXBeanIntrospector.getAnalyzer(MXBeanIntrospector.java:74)
[INFO]  at java.management/com.sun.jmx.mbeanserver.MBeanIntrospector.getPerInterface(MBeanIntrospector.java:192)
[INFO]  at java.management/com.sun.jmx.mbeanserver.MBeanSupport.<init>(MBeanSupport.java:138)
[INFO]  at java.management/com.sun.jmx.mbeanserver.MXBeanSupport.<init>(MXBeanSupport.java:66)
[INFO]  at java.management/com.sun.jmx.mbeanserver.Introspector.makeDynamicMBean(Introspector.java:203)
[INFO]  at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:888)
[INFO]  at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:320)
[INFO]  at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
[INFO]  at com.ibm.ws.kernel.boot.jmx.service.MBeanServerForwarderDelegate.registerMBean(MBeanServerForwarderDelegate.java:221)
[INFO]  at [internal classes]
[INFO] Caused by: java.lang.ClassNotFoundException: com.ibm.websphere.monitor.jmx.Counter cannot be found by com.ibm.websphere.appserver.api.jaxrs20_1.1.51.cl210420210407-0944
[INFO]  at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:519)
[INFO]  ... 1 more
[INFO] 
[INFO] [WARNING ] Interceptor for {http://boundary.coffee_shop.sebastian_daschner.com/}OrdersResource has thrown exception, unwinding now
[INFO] com.ibm.websphere.monitor.jmx.Counter
[INFO] BaristaClient response: 200

A work around for this issue is:

  • shut down the server. (ctrl + c)
  • mvn clean
  • mvn liberty:dev
  • Send POST request again

Update URLs for build plugins

The below should point to what's under OpenLiberty (and not wasdev):

https://github.com/wasdev/ci.maven
https://github.com/wasdev/ci.gradle

Ensure that all Central coordinates point to io.openliberty too.

Module 3 (step4) - the OrdersResource.java path not right

Show

[File->Open] open-liberty-masterclass/start/coffee-shop/src/main/java/com/sebastiandaschner/coffeeshop/boundary/OrdersResource.java

Actual path is open-liberty-masterclass/start/coffee-shop/src/main/java/com/sebastian_daschner/coffee_shop/boundary/OrdersResource.java
Because md cannot show _ underscore characters, suggest to change the path to use - dash character as sebastian-daschner/coffee-shop instead

Module 7: not mounting in the drops config (Possibly Windows issue only)

Instead of seeing the expeced

[AUDIT ] CWWKG0093A: Processing configuration drop-ins resource: /opt/ol/wlp/usr/servers/defaultServer/configDropins/overrides/metrics-prod.xml

I am seeing the bellow:

$ docker logs coffee-shop
Launching defaultServer (Open Liberty 21.0.0.4/wlp-1.0.51.cl210420210407-0944) on Eclipse OpenJ9 VM, version 1.8.0_292-b10 (en_US)
[AUDIT   ] CWWKE0001I: The server defaultServer has been launched.
[AUDIT   ] CWWKG0093A: Processing configuration drop-ins resource: /opt/ol/wlp/usr/servers/defaultServer/configDropins/defaults/keystore.xml
[AUDIT   ] CWWKG0093A: Processing configuration drop-ins resource: /opt/ol/wlp/usr/servers/defaultServer/configDropins/defaults/open-default-port.xml
[AUDIT   ] CWWKZ0058I: Monitoring dropins for applications.
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://15b6f01c93d9:9080/openapi/ui/
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://15b6f01c93d9:9080/openapi/
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://15b6f01c93d9:9080/ibm/api/
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://15b6f01c93d9:9080/health/
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://15b6f01c93d9:9080/metrics/
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://15b6f01c93d9:9080/coffee-shop/
[AUDIT   ] CWWKZ0001I: Application coffee-shop started in 2.581 seconds.
[AUDIT   ] CWWKF0012I: The server installed the following features: [beanValidation-2.0, cdi-2.0, distributedMap-1.0, ejbLite-3.2, el-3.0, jaxrs-2.1, jaxrsClient-2.1, jndi-1.0, json-1.0, jsonp-1.1, monitor-1.0, mpConfig-2.0, mpHealth-3.0, mpMetrics-3.0, mpOpenAPI-2.0, mpRestClient-2.0, servlet-4.0, ssl-1.0].
[AUDIT   ] CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 5.057 seconds.
[ERROR   ] CWWKS3005E: A configuration exception has occurred. No UserRegistry implementation service is available.  Ensure that you have a user registry configured.```

Missing dependecy in Module 8: Testing in Containers

in barista/pom.xml missing following, so mvn failsafe:integration-test failed at the end of this Module

        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <version>1.16.2</version>
            <scope>test</scope>
        </dependency>

Module 5 (step 6) - need better path

  • change
    Open the coffee-shop/src/main/webapp/META-INF/microprofile-config.properties to
    New the open-liberty-masterclass/start/coffee-shop/src/main/webapp/META-INF/microprofile-config.properties
  • correct the path (same issue #50)

Edit the file: open-liberty-masterclass/start/coffee-shop/src/main/java/com/sebastiandaschner/coffeeshop/health/CoffeeShopReadinessCheck.java

  • change curl http://localhost:9080/health/ready to curl -s http://localhost:9080/health/ready | jq and the output as
{
  "checks": [
    {
      "data": {},
      "name": "CoffeeShopReadinessCheck Readiness Check",
      "status": "DOWN"
    }
  ],
  "status": "DOWN"
}

Remove/update outdated references

(1) Remove the below since users no longer need to worry about these with the use of dev mode and our opinionated ideal POM file.

For example, take a look at: https://search.maven.org/artifact/io.openliberty.features/mpMetrics-2.0/20.0.0.4/esa

You'll see in the XML on the left that this feature depends on:

<dependency>
  <groupId>io.openliberty.features</groupId>
  <artifactId>com.ibm.websphere.appserver.org.eclipse.microprofile.metrics-2.0</artifactId>
  <version>19.0.0.8</version>
  <type>esa</type>
</dependency>

Which depends on the Metrics API from Eclipse MicroProfile:

<dependency>
  <groupId>org.eclipse.microprofile.metrics</groupId>
  <artifactId>microprofile-metrics-api</artifactId>
  <version>2.3.0</version>
</dependency>

And so during build, this API will be added for you.

Update the below to clarify that you don't need to update the dependencies since we suggest that you depend on the public API from MP and Jakarta EE (as noted in the previous section on Dev Mode) and you only need to configure the features you need in the server.xml.

As we've seen, to use a new feature, we need to add them to the build. There is no need to add a dependency on the APIs for the feature because each feature depends on the APIs. That means during build, the API dependencies are automatically added from maven central.

(2) The use of a parent POM is not necessary especially with dev mode. Should remove the sentence below and the use of parent POM unless there are issues.

The starting and stopping of the Liberty server is configured by the Liberty parent pom (see https://search.maven.org/artifact/net.wasdev.wlp.maven.parent/liberty-maven-app-parent/2.6.3/pom), which is configured as the parent of the Masterclass poms.

Did not observe CWWKG0102I in Module 7

AUDIT ] CWWKG0102I: Found conflicting settings for mpMetrics configuration.
Property authentication has conflicting values:
Value false is set in file:/opt/ol/wlp/usr/servers/defaultServer/server.xml.
Value true is set in file:/opt/ol/wlp/usr/servers/defaultServer/configDropins/overrides/metrics-prod.xml.
Property authentication will be set to true.

Issue with UI access too:

Access the /metrics metrics endpoint at: https://accountname-9080.theiadocker-1.proxy.cognitiveclass.ai/metrics via the Launch application tab above the IDE and enter the port 9445.

You will see that the browser complains about the certificate. This is a self-signed certificate generated by Liberty for test purposes. Accept the exception (note, Firefox may not allow you to do this in which case you'll need to use a different browser). You'll be presented with a login prompt. Sign in with userid admin and password change_it (the values in the metrics-prod.xml).

Usage of dev mode

(1) mvn liberty:dev should suffice

mvn install liberty:dev

(2) Clarify when users need to exit dev mode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.