Quantcast
Channel: DevOps tips & tricks
Viewing all 181 articles
Browse latest View live

Connect to Ethereum geth client using web3j

$
0
0
Introduction video to web3j
https://www.youtube.com/watch?v=ea3miXs_P6Y

Blockchain - Using cryptocurrency with Java

http://www.javamagazine.mozaicreader.com/JanFeb2017/Default/36/0#&pageSet=36&page=0&contentItem=0

 

Reactive-Functional Fun on the Blockchain with web3j

https://community.oracle.com/docs/DOC-1011373


Ethereum Geth client
https://github.com/ethereum/go-ethereum/wiki/Installing-Geth#build-it-from-source-code


Web3j
https://web3j.io/
https://github.com/web3j/web3j 

Install Ethereum client

Get Golang and geth code
dnf install golang

git clone https://github.com/ethereum/go-ethereum.git

Compile geth client
[dave@localhost go-ethereum]$ make
build/env.sh go run build/ci.go install ./cmd/geth
>>> /usr/lib/golang/bin/go install -ldflags -X main.gitCommit=0662384d294eaa44390799747db030e8d401111d -v ./cmd/geth
github.com/ethereum/go-ethereum/common/hexutil
github.com/ethereum/go-ethereum/crypto/sha3
github.com/ethereum/go-ethereum/common/math
github.com/ethereum/go-ethereum/rlp
github.com/ethereum/go-ethereum/crypto/secp256k1
github.com/ethereum/go-ethereum/vendor/github.com/go-stack/stack
github.com/ethereum/go-ethereum/log
github.com/ethereum/go-ethereum/vendor/github.com/rcrowley/go-metrics
github.com/ethereum/go-ethereum/vendor/gopkg.in/karalabe/cookiejar.v2/collections/prque
github.com/ethereum/go-ethereum/common
github.com/ethereum/go-ethereum/vendor/github.com/aristanetworks/goarista/monotime
github.com/ethereum/go-ethereum/common/mclock
github.com/ethereum/go-ethereum/event
github.com/ethereum/go-ethereum/params
github.com/ethereum/go-ethereum/crypto/randentropy
github.com/ethereum/go-ethereum/vendor/github.com/pborman/uuid
github.com/ethereum/go-ethereum/vendor/golang.org/x/sys/unix
github.com/ethereum/go-ethereum/vendor/golang.org/x/crypto/pbkdf2
github.com/ethereum/go-ethereum/vendor/golang.org/x/crypto/scrypt
github.com/ethereum/go-ethereum/vendor/gopkg.in/fatih/set.v0
github.com/ethereum/go-ethereum/cmd/internal/browser
github.com/ethereum/go-ethereum/common/fdlimit
github.com/ethereum/go-ethereum/vendor/github.com/rcrowley/go-metrics/exp
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/util
github.com/ethereum/go-ethereum/metrics
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/cache
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/comparer
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/storage
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/filter
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/opt
github.com/ethereum/go-ethereum/vendor/github.com/golang/snappy
github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify
github.com/ethereum/go-ethereum/vendor/github.com/hashicorp/golang-lru/simplelru
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/errors
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/iterator
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/journal
github.com/ethereum/go-ethereum/vendor/github.com/hashicorp/golang-lru
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/memdb
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/table
github.com/ethereum/go-ethereum/vendor/golang.org/x/net/context
github.com/ethereum/go-ethereum/vendor/github.com/rs/xhandler
github.com/ethereum/go-ethereum/vendor/golang.org/x/net/websocket
github.com/ethereum/go-ethereum/vendor/github.com/rs/cors
github.com/ethereum/go-ethereum/vendor/github.com/edsrzf/mmap-go
github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb
github.com/ethereum/go-ethereum/common/bitutil
github.com/ethereum/go-ethereum/crypto/bn256
github.com/ethereum/go-ethereum/rpc
github.com/ethereum/go-ethereum/vendor/golang.org/x/crypto/ripemd160
github.com/ethereum/go-ethereum/vendor/github.com/elastic/gosigar
github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/httpu
github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/scpd
github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/soap
github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/ssdp
github.com/ethereum/go-ethereum/ethdb
github.com/ethereum/go-ethereum/vendor/golang.org/x/net/html/atom
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/internal/identifier
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/transform
github.com/ethereum/go-ethereum/vendor/golang.org/x/net/html
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/internal/utf8internal
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/internal/tag
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/runes
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/internal
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/language
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/charmap
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/japanese
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/korean
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/simplifiedchinese
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/traditionalchinese
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/unicode
github.com/ethereum/go-ethereum/vendor/github.com/jackpal/go-nat-pmp
github.com/ethereum/go-ethereum/p2p/netutil
github.com/ethereum/go-ethereum/eth/tracers/internal/tracers
github.com/ethereum/go-ethereum/vendor/gopkg.in/olebedev/go-duktape.v3
github.com/ethereum/go-ethereum/vendor/github.com/golang/protobuf/proto
github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/htmlindex
github.com/ethereum/go-ethereum/vendor/golang.org/x/net/html/charset
github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp
github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/dcps/internetgateway1
github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/dcps/internetgateway2
github.com/ethereum/go-ethereum/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor
github.com/ethereum/go-ethereum/p2p/nat
github.com/ethereum/go-ethereum/accounts/usbwallet/internal/trezor
github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid
github.com/ethereum/go-ethereum/log/term
github.com/ethereum/go-ethereum/vendor/github.com/mattn/go-colorable
github.com/ethereum/go-ethereum/vendor/gopkg.in/urfave/cli.v1
github.com/ethereum/go-ethereum/internal/debug
github.com/ethereum/go-ethereum/vendor/github.com/prometheus/prometheus/util/flock
github.com/ethereum/go-ethereum/les/flowcontrol
github.com/ethereum/go-ethereum/vendor/golang.org/x/sync/syncmap
github.com/ethereum/go-ethereum/internal/jsre/deps
github.com/ethereum/go-ethereum/vendor/github.com/mattn/go-isatty
github.com/ethereum/go-ethereum/vendor/github.com/fatih/color
# github.com/ethereum/go-ethereum/vendor/gopkg.in/olebedev/go-duktape.v3
In file included from vendor/gopkg.in/olebedev/go-duktape.v3/api.go:7:0:
vendor/gopkg.in/olebedev/go-duktape.v3/api.go: In function ‘_duk_error’:
vendor/gopkg.in/olebedev/go-duktape.v3/duktape.h:510:127: warning: right-hand operand of comma expression has no effect [-Wunused-value]
  (duk_error_raw((ctx), (duk_errcode_t) (err_code), (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), __VA_ARGS__), (duk_ret_t) 0)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
vendor/gopkg.in/olebedev/go-duktape.v3/api.go:153:2: note: in expansion of macro ‘duk_error’
  duk_error(ctx, err_code, "%s", str);
  ^~~~~~~~~
github.com/ethereum/go-ethereum/vendor/gopkg.in/sourcemap.v1/base64vlq
github.com/ethereum/go-ethereum/vendor/gopkg.in/sourcemap.v1
github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/file
github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/token
github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/ast
github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/dbg
github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/parser
github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/registry
github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto
github.com/ethereum/go-ethereum/crypto
github.com/ethereum/go-ethereum/trie
github.com/ethereum/go-ethereum/core/types
github.com/ethereum/go-ethereum/crypto/ecies
github.com/ethereum/go-ethereum/p2p/discover
github.com/ethereum/go-ethereum
github.com/ethereum/go-ethereum/accounts
github.com/ethereum/go-ethereum/accounts/keystore
github.com/ethereum/go-ethereum/core/state
github.com/ethereum/go-ethereum/core/vm
github.com/ethereum/go-ethereum/p2p/discv5
github.com/ethereum/go-ethereum/consensus
github.com/ethereum/go-ethereum/consensus/misc
github.com/ethereum/go-ethereum/consensus/clique
github.com/ethereum/go-ethereum/consensus/ethash
github.com/ethereum/go-ethereum/core
github.com/ethereum/go-ethereum/p2p
github.com/ethereum/go-ethereum/core/bloombits
github.com/ethereum/go-ethereum/eth/fetcher
github.com/ethereum/go-ethereum/accounts/usbwallet
github.com/ethereum/go-ethereum/dashboard
github.com/ethereum/go-ethereum/node
github.com/ethereum/go-ethereum/whisper/whisperv5
github.com/ethereum/go-ethereum/eth/downloader
github.com/ethereum/go-ethereum/eth/filters
github.com/ethereum/go-ethereum/light
github.com/ethereum/go-ethereum/internal/jsre
github.com/ethereum/go-ethereum/internal/ethapi
github.com/ethereum/go-ethereum/miner
github.com/ethereum/go-ethereum/internal/web3ext
github.com/ethereum/go-ethereum/vendor/github.com/peterh/liner
github.com/ethereum/go-ethereum/eth/gasprice
github.com/ethereum/go-ethereum/ethclient
github.com/ethereum/go-ethereum/vendor/github.com/maruel/panicparse/stack
github.com/ethereum/go-ethereum/console
github.com/ethereum/go-ethereum/vendor/github.com/mattn/go-runewidth
github.com/ethereum/go-ethereum/vendor/github.com/mitchellh/go-wordwrap
github.com/ethereum/go-ethereum/vendor/github.com/nsf/termbox-go
github.com/ethereum/go-ethereum/vendor/github.com/naoina/go-stringutil
github.com/ethereum/go-ethereum/vendor/github.com/naoina/toml/ast
github.com/ethereum/go-ethereum/vendor/github.com/gizak/termui
github.com/ethereum/go-ethereum/vendor/github.com/naoina/toml
github.com/ethereum/go-ethereum/eth/tracers
github.com/ethereum/go-ethereum/eth
github.com/ethereum/go-ethereum/les
github.com/ethereum/go-ethereum/ethstats
github.com/ethereum/go-ethereum/cmd/utils
github.com/ethereum/go-ethereum/cmd/geth
Done building.
Run "/home/dave/github/go-ethereum/build/bin/geth" to launch geth.



Start geth client
[dave@localhost go-ethereum]$ /home/dave/github/go-ethereum/build/bin/geth --fast --cache=512 --rpcapi personal,db,eth,net,web3 --rpc --testnet
INFO [02-04|06:34:54] Starting peer-to-peer node               instance=Geth/v1.8.0-unstable-0662384d/linux-amd64/go1.8.5
INFO [02-04|06:34:54] Allocated cache and file handles         database=/home/dave/.ethereum/testnet/geth/chaindata cache=512 handles=512
INFO [02-04|06:34:55] Writing custom genesis block
INFO [02-04|06:34:55] Initialised chain configuration          config="{ChainID: 3 Homestead: 0 DAO: <nil> DAOSupport: true EIP150: 0 EIP155: 10 EIP158: 10 Byzantium: 1700000 Engine: ethash}"
INFO [02-04|06:34:55] Disk storage enabled for ethash caches   dir=/home/dave/.ethereum/testnet/geth/ethash count=3
INFO [02-04|06:34:55] Disk storage enabled for ethash DAGs     dir=/home/dave/.ethash                       count=2
INFO [02-04|06:34:55] Initialising Ethereum protocol           versions="[63 62]" network=3
INFO [02-04|06:34:55] Loaded most recent local header          number=0 hash=419410…ca4a2d td=1048576
INFO [02-04|06:34:55] Loaded most recent local full block      number=0 hash=419410…ca4a2d td=1048576
INFO [02-04|06:34:55] Loaded most recent local fast block      number=0 hash=419410…ca4a2d td=1048576
INFO [02-04|06:34:55] Regenerated local transaction journal    transactions=0 accounts=0
INFO [02-04|06:34:55] Starting P2P networking
INFO [02-04|06:34:57] UDP listener up                          self=enode://9bbc55ed1cca170be4cba9c3ea9e22322680d2f9cdd7e363591d2a6738e55707cb58fa64764c9b1ead28174dbec81ec5721cb2452e625de6292fe36881d672a2@89.233.189.164:30303
INFO [02-04|06:34:57] RLPx listener up                         self=enode://9bbc55ed1cca170be4cba9c3ea9e22322680d2f9cdd7e363591d2a6738e55707cb58fa64764c9b1ead28174dbec81ec5721cb2452e625de6292fe36881d672a2@89.233.189.164:30303
INFO [02-04|06:34:57] IPC endpoint opened: /home/dave/.ethereum/testnet/geth.ipc
INFO [02-04|06:34:57] HTTP endpoint opened: http://127.0.0.1:8545


Geth client running
INFO [02-04|07:06:39] Imported new state entries               count=273 elapsed=8.868µs processed=273 pending=4369 retry=0 duplicate=0 unexpected=0
INFO [02-04|07:06:39] Imported new block headers               count=0   elapsed=8.269ms number=83814 hash=94033d…457655 ignored=192
INFO [02-04|07:06:39] Imported new block receipts              count=4   elapsed=659.004µs bytes=3957 number=83626 hash=ba23b3…b7e218 ignored=0
INFO [02-04|07:06:40] Imported new block receipts              count=33  elapsed=4.361ms   bytes=33409 number=83659 hash=5eb979…3e5a58 ignored=0
INFO [02-04|07:06:40] Imported new block headers               count=0   elapsed=7.208ms   number=84006 hash=aee4cb…1bb757 ignored=192
INFO [02-04|07:06:40] Imported new block receipts              count=155 elapsed=35.627ms  bytes=89944 number=83814 hash=94033d…457655 ignored=0
INFO [02-04|07:06:40] Imported new block receipts              count=192 elapsed=9.058ms   bytes=130405 number=84006 hash=aee4cb…1bb757 ignored=0


Connect to client using https://web3j.io/

Web3j code samples
https://github.com/web3j/examples/blob/master/rx/src/main/java/org/web3j/examples/rx/Main.java

Maven sample project
https://github.com/JacqMT/web3j-maven-example/blob/master/pom.xml

Clone sample project
git clone https://github.com/JacqMT/web3j-maven-example


Compile test project using
[dave@localhost web3j-maven-example]$ mvn install
[INFO] Scanning for projects...
[WARNING]
[[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building web3j-maven-example 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ web3j-maven-example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/dave/github/web3j-maven-example/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ web3j-maven-example ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 4 source files to /home/dave/github/web3j-maven-example/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ web3j-maven-example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/dave/github/web3j-maven-example/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ web3j-maven-example ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ web3j-maven-example ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ web3j-maven-example ---
[INFO] Building jar: /home/dave/github/web3j-maven-example/target/web3j-maven-example-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ web3j-maven-example ---
[INFO] Installing /home/dave/github/web3j-maven-example/target/web3j-maven-example-1.0-SNAPSHOT.jar to /home/dave/.m2/repository/org/train/web3j-maven-example/1.0-SNAPSHOT/web3j-maven-example-1.0-SNAPSHOT.jar
[INFO] Installing /home/dave/github/web3j-maven-example/pom.xml to /home/dave/.m2/repository/org/train/web3j-maven-example/1.0-SNAPSHOT/web3j-maven-example-1.0-SNAPSHOT.pom



[dave@localhost web3j-maven-example]$ ls -R
.:
contracts  LICENSE  pom.xml  README.md  src  tutorial-images

./contracts:
build  solidity

./contracts/build:
greeter.abi  greeter.bin  mortal.abi  mortal.bin

./contracts/solidity:
Greeter.sol

./src:
main

./src/main:
java

./src/main/java:
org

./src/main/java/org:
train  web3j

./src/main/java/org/train:
FundsService.java  Greeting.java  VersionFinder.java

./src/main/java/org/web3j:
example

./src/main/java/org/web3j/example:
generated

./src/main/java/org/web3j/example/generated:
Greeter.java

./tutorial-images:
'Generate a Wallet.png'           'Rinkeby EtherScan.png'             'Setting Contract Value Output.png'
'Greetings Output.png'            'Rinkeby Faucet.png'                'Starting Local Ethereum Node.png'
'Local Node Sync Status.png'      'Sending Funds Local Node Log.png'  'VersionFinder Output.png'
'Rinkeby EtherScan Overview.png'  'Sending Funds Output.png'



Display version of Ethereum geth  client
[dave@localhost web3j-maven-example]$ mvn exec:java -Dexec.mainClass="org.train.VersionFinder"

Client version: Geth/v1.8.0-unstable-0662384d/linux-amd64/go1.8.5
Network version: 3


Download web3j CLI tools
https://github.com/web3j/web3j/releases/tag/v3.2.0

 Create  wallet
[dave@localhost bin]$ ./web3j wallet create

              _      _____ _     _       
             | |    |____ (_)   (_)      
__      _____| |__      / /_     _   ___ 
\ \ /\ / / _ \ '_ \     \ \ |   | | / _ \
 \ V  V /  __/ |_) |.___/ / | _ | || (_) |
  \_/\_/ \___|_.__/ \____/| |(_)|_| \___/
                         _/ |            
                        |__/             

Please enter a wallet file password:
Please re-enter the password:
Please enter a destination directory location [/home/dave/.ethereum/testnet/keystore]:
Wallet file UTC--2018-02-04T06-34-14.95000000Z--1234567890123456789012345678.json successfully created in: /home/dave/.ethereum/testnet/keystore


Check transactions on testnet
https://rinkeby.etherscan.io/address/

Getting ether from https://www.rinkeby.io/ "Crypto Faucet"
https://gist.github.com/cryptogoth/10a98e8078cfd69f7ca892ddbdcf26bc

Post wallet id on Google+ and then go to
https://www.rinkeby.io/#faucet

Check if Ether  transaction is properly finished on  https://rinkeby.etherscan.io/address/



Transaction Information
TxHash:
0xTX_HASH
TxReceipt Status: Success
Block Height: 1710713 (102 block confirmations)
TimeStamp: 25 mins ago (Feb-04-2018 07:48:00 AM +UTC)
From:  0xTO_WALLET_ADDRESS
To:0xFROM_WALLET_ADDRESS
Value: 3 Ether ($0.00)
Gas Limit: 21000
Gas Used By Txn: 21000
Gas Price: 0.000000004 Ether (4 Gwei)
Actual Tx Cost/Fee: 0.000084 Ether ($0.000000)
Cumulative Gas Used: 21000
Nonce: 5246


Block information


Block Information
  Height:    
   1710713 
  TimeStamp:     1 hr 4 mins ago (Feb-04-2018 07:48:00 AM +UTC)
  Transactions:     2 transactions and 0 contract internal transactions in this block
  Hash:     0xTX_HASH
  Parent Hash:     0xPARENT_TX_HASH
  Sha3Uncles:     0x1dcc4de8dec75d7aa45645645651b948a7413f0a142fd40d49347
  Mined By:     0xfc18cbc391de84dbd87466689f5dd91 in 15 secs
  Difficulty:     2
  Total Difficulty:     3,188,999
  Size:     864 bytes
  Gas Used:     5,033,664 (71.90%)
  Gas Limit:     7,001,200
  Nonce:     0x0000000000000000
  Block Reward:     0 Ether
  Uncles Reward:    


Fully synchronize geth client

dave@localhost go-ethereum]$ /home/dave/github/go-ethereum/build/bin/geth --fast --cache=512 --rpcapi personal,db,eth,net,web3 --rpc --testnet
INFO [02-04|09:33:58] Starting peer-to-peer node               instance=Geth/v1.8.0-unstable-0662384d/linux-amd64/go1.8.5
INFO [02-04|09:33:58] Allocated cache and file handles         database=/home/dave/.ethereum/testnet/geth/chaindata cache=512 handles=512
INFO [02-04|09:34:00] Initialised chain configuration          config="{ChainID: 3 Homestead: 0 DAO: <nil> DAOSupport: true EIP150: 0 EIP155: 10 EIP158: 10 Byzantium: 1700000 Engine: ethash}"
INFO [02-04|09:34:00] Disk storage enabled for ethash caches   dir=/home/dave/.ethereum/testnet/geth/ethash count=3
INFO [02-04|09:34:00] Disk storage enabled for ethash DAGs     dir=/home/dave/.ethash                       count=2
INFO [02-04|09:34:01] Initialising Ethereum protocol           versions="[63 62]" network=3
INFO [02-04|09:34:01] Loaded most recent local header          number=926234 hash=a2bb1a…990d6c td=642817207095421
INFO [02-04|09:34:01] Loaded most recent local full block      number=0      hash=419410…ca4a2d td=1048576
INFO [02-04|09:34:01] Loaded most recent local fast block      number=913040 hash=9c0570…0f970a td=627371749055334
INFO [02-04|09:34:01] Loaded local transaction journal         transactions=0 dropped=0
INFO [02-04|09:34:01] Upgrading chain index                    type=bloombits percentage=70
INFO [02-04|09:34:01] Regenerated local transaction journal    transactions=0 accounts=0
INFO [02-04|09:34:01] Starting P2P networking
INFO [02-04|09:34:05] UDP listener up                          self=enode://9bbc55ed1cca170be4cba9c3ea76765cca170226dd7e363591d2a6738e55707cb58fa64764c9b1ead28174dbec81ec5721cb2452e625de6292fe36881d672a2@89.233.189.164:30303
INFO [02-04|09:34:05] RLPx listener up                         self=enode://9bbc55ed1cca170be4cba9c322680d2f956565635956565738e55707cb58fa64764c9b1ead28174dbec81ec5721cb2452e625de6292fe36881d672a2@89.233.189.164:30303
INFO [02-04|09:34:05] IPC endpoint opened: /home/dave/.ethereum/testnet/geth.ipc
INFO [02-04|09:34:05] HTTP endpoint opened: http://127.0.0.1:8545



[dave@localhost go-ethereum]$ du -h  /home/dave/.ethereum/
2.8M    /home/dave/.ethereum/geth/chaindata
20K    /home/dave/.ethereum/geth/nodes
2.9M    /home/dave/.ethereum/geth
60M    /home/dave/.ethereum/testnet/geth/ethash
2.0G    /home/dave/.ethereum/testnet/geth/chaindata
6.2M    /home/dave/.ethereum/testnet/geth/nodes
2.0G    /home/dave/.ethereum/testnet/geth
8.0K    /home/dave/.ethereum/testnet/keystore
2.0G    /home/dave/.ethereum/testnet
4.0K    /home/dave/.ethereum/keystore
2.0G    /home/dave/.ethereum/



Without properly finished transaction you will get following error

java.util.concurrent.ExecutionException: java.lang.RuntimeException: Error processing transaction request: insufficient funds for gas * price + value


Run the test code
mvn exec:java -Dexec.mainClass="org.train.FundsService"

 
Transfer funds using web3j test code

package org.train;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.concurrent.ExecutionException;

import org.web3j.crypto.CipherException;
import org.web3j.crypto.Credentials;
import org.web3j.crypto.WalletUtils;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.protocol.exceptions.TransactionTimeoutException;
import org.web3j.protocol.http.HttpService;
import org.web3j.tx.Transfer;
import org.web3j.utils.Convert;

public class FundsService {
public static void main(String[] args) throws IOException, CipherException, InterruptedException,
ExecutionException, TransactionTimeoutException {
Web3j web3 = Web3j.build(new HttpService());
String walletId = "<WALLET_ADDRESS>";
String walletSource = "/home/dave/.ethereum/testnet/keystore/UTC--2018-02-04T06-34-14.95000000Z--" + walletId + "" +
".json";
Credentials credentials = WalletUtils.loadCredentials("<WALLET_PASSWORD>", walletSource);
String myWalletAddr = "0x" + walletId;
TransactionReceipt transactionReceipt = Transfer.sendFundsAsync(web3, credentials, myWalletAddr,
BigDecimal.valueOf(0.2), Convert.Unit.ETHER).get();
System.out.println("Funds transfer completed...");
System.out.println("Hash: " + transactionReceipt.getBlockHash());
System.out.println("Block number: " + transactionReceipt.getBlockNumber());
}
}


Using Ethereum Mist Wallet

$
0
0
Ethereum main wiki

Mist release
https://github.com/ethereum/mist/releases


Step-by-Step Guide: Getting Started with Ethereum Mist Wallet

https://medium.com/@attores/step-by-step-guide-getting-started-with-ethereum-mist-wallet-772a3cc99af4


Use testnet
https://testnet.etherscan.io/

Choose RINKEBY
https://rinkeby.etherscan.io/

Start geth testnet
geth --fast --cache=512 --rpcapi personal,db,eth,net,web3 --rpc --testnet




Start mist - without local testnet

dave@localhost linux-unpacked]$ ./mist 
[2018-02-08 06:48:57.260] [INFO] main - Running in production mode: true
[2018-02-08 06:48:57.308] [INFO] EthereumNode - undefined null 'fast'
[2018-02-08 06:48:57.310] [INFO] EthereumNode - Defaults loaded: geth main fast
[2018-02-08 06:48:57.681] [INFO] main - Starting in Mist mode
[2018-02-08 06:48:59.652] [INFO] Db - Creating db: /home/dave/.config/Mist/mist.lokidb
[2018-02-08 06:48:59.812] [INFO] Db - Loading db: /home/dave/.config/Mist/mist.lokidb
[2018-02-08 06:48:59.820] [INFO] Windows - Creating commonly-used windows
[2018-02-08 06:48:59.820] [INFO] Windows - Create secondary window: loading, owner: notset
[2018-02-08 06:49:00.981] [INFO] updateChecker - Check for update...
[2018-02-08 06:49:04.822] [INFO] Windows - Create primary window: main, owner: notset
[2018-02-08 06:49:04.845] [INFO] Windows - Create primary window: splash, owner: notset
[2018-02-08 06:49:05.982] [INFO] ipcCommunicator - Backend language set to:  en
[2018-02-08 06:49:06.497] [INFO] (ui: splashscreen) - Web3 already initialized, re-using provider.
[2018-02-08 06:49:06.573] [INFO] (ui: splashscreen) - Meteor starting up...
[2018-02-08 06:49:06.652] [INFO] ClientBinaryManager - Initializing...
[2018-02-08 06:49:06.653] [INFO] ClientBinaryManager - Checking for new client binaries config from: https://raw.githubusercontent.com/ethereum/mist/master/clientBinaries.json
[2018-02-08 06:49:06.773] [WARN] ClientBinaryManager - Error loading local config - assuming this is a first run: Error: ENOENT: no such file or directory, open '/home/dave/.config/Mist/clientBinaries.json'
[2018-02-08 06:49:06.773] [INFO] ClientBinaryManager - Write new client binaries local config to disk ...
[2018-02-08 06:49:06.778] [INFO] ClientBinaryManager - No "skippedNodeVersion.json" found.
[2018-02-08 06:49:06.780] [INFO] ClientBinaryManager - Initializing...
[2018-02-08 06:49:06.780] [INFO] ClientBinaryManager - Resolving platform...
[2018-02-08 06:49:06.781] [INFO] ClientBinaryManager - Calculating possible clients...
[2018-02-08 06:49:06.783] [INFO] ClientBinaryManager - 1 possible clients.
[2018-02-08 06:49:06.784] [INFO] ClientBinaryManager - Verifying status of all 1 possible clients...
[2018-02-08 06:49:06.786] [INFO] ClientBinaryManager - Verify Geth status ...
[2018-02-08 06:49:06.888] [ERROR] ClientBinaryManager - Unable to resolve Geth executable: geth
[2018-02-08 06:49:06.891] [INFO] ClientBinaryManager - Download binary for Geth ...
[2018-02-08 06:49:06.912] [INFO] ClientBinaryManager - Downloading package from https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.7.2-1db4ecdc.tar.gz to /home/dave/.config/Mist/binaries/Geth/archive.tar ...
[2018-02-08 06:49:08.058] [INFO] updateChecker - App is up-to-date.

Start mist - with local testnet

Get Started with Lightbend Technologies

$
0
0
 Microservices framework built on Akka and Play
https://www.lightbend.com/lagom-framework

Lagom - Get started 
https://www.lagomframework.com/get-started-java-maven.html


Create project - choose name and package
https://developer.lightbend.com/start/?group=lagom&project=lagom-java-maven

Download project and add it into GitHub
[dave@localhost github]$ cp ~/Downloads/lagom-java-maven.zip .
[dave@localhost github]$ unzip -l lagom-java-maven.zip
Archive:  lagom-java-maven.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  02-16-2018 21:42   lagom-java-maven/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/
     2536  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/pom.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/resources/
       38  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/resources/application.conf
      346  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/resources/logback-test.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/java/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/java/org/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/java/org/dave/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/java/org/dave/it/
     3043  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/java/org/dave/it/StreamIT.java
      130  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/.gitignore
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/
      734  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/pom.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/main/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/main/java/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/main/java/org/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/main/java/org/dave/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/main/java/org/dave/stream/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/main/java/org/dave/stream/api/
     1446  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/main/java/org/dave/stream/api/StreamService.java
     3277  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/pom.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/
     2328  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/pom.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/resources/
      404  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/resources/logback-test.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/java/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/java/org/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/java/org/dave/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/java/org/dave/hello/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/java/org/dave/hello/impl/
     1858  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/java/org/dave/hello/impl/HelloEntityTest.java
     1179  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/java/org/dave/hello/impl/HelloServiceTest.java
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/resources/
      928  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/resources/application.conf
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/impl/
     1838  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/impl/HelloCommand.java
     3488  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/impl/HelloEntity.java
     3119  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/impl/HelloServiceImpl.java
      442  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/impl/HelloModule.java
     1820  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/impl/HelloEvent.java
      726  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/impl/HelloState.java
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/
     2385  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/pom.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/resources/
      935  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/resources/application.conf
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/dave/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/dave/stream/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/dave/stream/impl/
     1221  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/dave/stream/impl/StreamServiceImpl.java
      710  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/dave/stream/impl/StreamModule.java
     1196  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/dave/stream/impl/StreamSubscriber.java
     1878  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/dave/stream/impl/StreamRepository.java
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/
     1051  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/pom.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/org/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/org/dave/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/org/dave/hello/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/org/dave/hello/api/
     1925  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/org/dave/hello/api/HelloService.java
      855  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/org/dave/hello/api/HelloEvent.java
      484  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/org/dave/hello/api/GreetingMessage.java
        0  02-16-2018 21:42   lagom-java-maven//
---------                     -------
    42320                     81 files


Created project on GitHub
https://github.com/dveselka/lagom-java-maven

 Build and run project
[dave@localhost DaveLagomProject]$ mvn lagom:runAll
[INFO] Scanning for projects...


[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] DaveLagomProject
[INFO] hello-api
[INFO] hello-impl
[INFO] stream-api
[INFO] stream-impl
[INFO] integration-test


Akka starting
[INFO] Compiling 6 source files to /home/dave/github/lagom-java-maven/DaveLagomProject/hello-impl/target/classes
22:57:48.601 [info] akka.event.slf4j.Slf4jLogger [] - Slf4jLogger started
22:57:49.941 [info] akka.remote.Remoting [sourceThread=ForkJoinPool-1-worker-1, akkaSource=akka.remote.Remoting, sourceActorSystem=hello-impl-application, akkaTimestamp=21:57:49.939UTC] - Starting remoting
22:57:50.865 [info] akka.remote.Remoting [sourceThread=ForkJoinPool-1-worker-1, akkaTimestamp=21:57:50.864UTC, akkaSource=akka.remote.Remoting, sourceActorSystem=hello-impl-application] - Remoting started; listening on addresses :[akka.tcp://hello-impl-application@127.0.0.1:41899]
22:57:50.883 [info] akka.remote.Remoting [sourceThread=ForkJoinPool-1-worker-1, akkaTimestamp=21:57:50.883UTC, akkaSource=akka.remote.Remoting, sourceActorSystem=hello-impl-application] - Remoting now listens on addresses: [akka.tcp://hello-impl-application@127.0.0.1:41899]
22:57:50.926 [info] akka.cluster.Cluster(akka://hello-impl-application) [sourceThread=ForkJoinPool-1-worker-1, akkaTimestamp=21:57:50.926UTC, akkaSource=akka.cluster.Cluster(akka://hello-impl-application), sourceActorSystem=hello-impl-application] - Cluster Node [akka.tcp://hello-impl-application@127.0.0.1:41899] - Starting up...
22:57:51.084 [info] akka.cluster.Cluster(akka://hello-impl-application) [sourceThread=ForkJoinPool-1-worker-1, akkaTimestamp=21:57:51.084UTC, akkaSource=akka.cluster.Cluster(akka://hello-impl-application), sourceActorSystem=hello-impl-application] - Cluster Node [akka.tcp://hello-impl-application@127.0.0.1:41899] - Registered cluster JMX MBean [akka:type=Cluster,port=41899]
22:57:51.085 [info] akka.cluster.Cluster(akka://hello-impl-application) [sourceThread=ForkJoinPool-1-worker-1, akkaTimestamp=21:57:51.084UTC, akkaSource=akka.cluster.Cluster(akka://hello-impl-application), sourceActorSystem=hello-impl-application] - Cluster Node [akka.tcp://hello-impl-application@127.0.0.1:41899] - Started up successfully


Service started
2:59:47.300 [info] akka.cluster.singleton.ClusterSingletonManager [sourceThread=stream-impl-application-akka.actor.default-dispatcher-17, akkaTimestamp=21:59:47.297UTC, akkaSource=akka.tcp://stream-impl-application@127.0.0.1:41263/user/cassandraOffsetStorePrepare-singleton, sourceActorSystem=stream-impl-application] - ClusterSingletonManager state change [Start -> Oldest]
22:59:47.301 [info] com.lightbend.lagom.internal.persistence.cluster.ClusterStartupTaskActor [sourceThread=stream-impl-application-akka.actor.default-dispatcher-13, akkaTimestamp=21:59:47.300UTC, akkaSource=akka.tcp://stream-impl-application@127.0.0.1:41263/user/cassandraOffsetStorePrepare-singleton/singleton/cassandraOffsetStorePrepare, sourceActorSystem=stream-impl-application] - Executing cluster start task cassandraOffsetStorePrepare.
22:59:47.655 [info] akka.cluster.singleton.ClusterSingletonProxy [sourceThread=stream-impl-application-akka.actor.default-dispatcher-17, akkaTimestamp=21:59:47.655UTC, akkaSource=akka.tcp://stream-impl-application@127.0.0.1:41263/user/cassandraOffsetStorePrepare-singletonProxy, sourceActorSystem=stream-impl-application] - Singleton identified at [akka://stream-impl-application/user/cassandraOffsetStorePrepare-singleton/singleton]
22:59:47.703 [info] play.api.http.EnabledFilters [] - Enabled Filters (see <https://www.playframework.com/documentation/latest/Filters>):


22:59:48.517 [info] play.api.Play [] - Application started (Dev)
[INFO] Service hello-impl listening for HTTP on 0:0:0:0:0:0:0:0:57797
[INFO] Service stream-impl listening for HTTP on 0:0:0:0:0:0:0:0:58445
[INFO] (Services started, press enter to stop and go back to the console..


Fresh  start
INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] DaveLagomProject
[INFO] hello-api
[INFO] hello-impl
[INFO] stream-api
[INFO] stream-impl
[INFO] integration-test
[INFO]                                                                        
[INFO] ------------------------------------------------------------------------
[INFO] Building DaveLagomProject 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- lagom-maven-plugin:1.4.0:runAll (default-cli) @ DaveLagomProject ---
[INFO] Starting Kafka
[INFO] Detected Guava >= 19 in the classpath, using modern compatibility layer
[INFO] Starting Cassandra
.[INFO] Using native clock to generate timestamps.
[INFO] Did not find Netty's native epoll transport in the classpath, defaulting to NIO.
.[INFO] Using native clock to generate timestamps.
.[INFO] Using native clock to generate timestamps.


Verify service by calling

http://localhost:9000/api/hello/World










Lagom Scala HelloWorld project

$
0
0
Get started with Lagom using Scala
https://www.lagomframework.com/get-started-scala.html

Create project and add it to GitHub
https://developer.lightbend.com/start/?group=lagom&project=lagom-scala-sbt

Lagom Scala project
[dave@localhost github]$ cp ~/Downloads/lagom-scala-sbt.zip .
[dave@localhost github]$ unzip -l lagom-scala-sbt.zip
Archive:  lagom-scala-sbt.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  02-16-2018 22:19   lagom-scala-sbt/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-api/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-api/src/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-api/src/main/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-api/src/main/scala/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-api/src/main/scala/com/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-api/src/main/scala/com/example/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-api/src/main/scala/com/example/hello/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-api/src/main/scala/com/example/hello/api/
     2864  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-api/src/main/scala/com/example/hello/api/DavescalalagomService.scala
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-impl/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-impl/src/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-impl/src/main/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-impl/src/main/scala/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-impl/src/main/scala/com/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-impl/src/main/scala/com/example/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-impl/src/main/scala/com/example/hellostream/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-impl/src/main/scala/com/example/hellostream/impl/
     1345  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-impl/src/main/scala/com/example/hellostream/impl/DavescalalagomStreamLoader.scala
      551  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-impl/src/main/scala/com/example/hellostream/impl/DavescalalagomStreamServiceImpl.scala
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-impl/src/main/resources/
      685  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-impl/src/main/resources/application.conf
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-api/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-api/src/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-api/src/main/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-api/src/main/scala/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-api/src/main/scala/com/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-api/src/main/scala/com/example/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-api/src/main/scala/com/example/hellostream/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-api/src/main/scala/com/example/hellostream/api/
      648  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-stream-api/src/main/scala/com/example/hellostream/api/DavescalalagomStreamService.scala
       61  02-16-2018 22:19   lagom-scala-sbt/.sbtopts
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/main/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/main/scala/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/main/scala/com/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/main/scala/com/example/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/main/scala/com/example/hello/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/main/scala/com/example/hello/impl/
     1642  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/main/scala/com/example/hello/impl/DavescalalagomServiceImpl.scala
     1648  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/main/scala/com/example/hello/impl/DavescalalagomLoader.scala
     7007  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/main/scala/com/example/hello/impl/DavescalalagomEntity.scala
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/main/resources/
      965  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/main/resources/application.conf
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/test/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/test/scala/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/test/scala/com/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/test/scala/com/example/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/test/scala/com/example/hello/
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/test/scala/com/example/hello/impl/
     1461  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/test/scala/com/example/hello/impl/DavescalalagomEntitySpec.scala
     1071  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/test/scala/com/example/hello/impl/DavescalalagomServiceSpec.scala
        0  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/test/resources/
      501  02-16-2018 22:19   lagom-scala-sbt/dave-scala-lagom-impl/src/test/resources/logback.xml
        0  02-16-2018 22:19   lagom-scala-sbt/project/
       20  02-16-2018 22:19   lagom-scala-sbt/project/build.properties
      208  02-16-2018 22:19   lagom-scala-sbt/project/plugins.sbt
      118  02-16-2018 22:19   lagom-scala-sbt/.gitignore
      595  02-16-2018 22:19   lagom-scala-sbt/LICENSE
     1514  02-16-2018 22:19   lagom-scala-sbt/build.sbt
      204  02-16-2018 22:19   lagom-scala-sbt/README.md
        0  02-16-2018 22:19   lagom-scala-sbt//
       55  01-15-2018 18:59   lagom-scala-sbt/sbt.bat
       44  01-15-2018 18:59   lagom-scala-sbt/sbt
        0  02-16-2018 22:19   lagom-scala-sbt/sbt-dist/
        0  02-16-2018 22:19   lagom-scala-sbt/sbt-dist/bin/
     6751  01-15-2018 18:59   lagom-scala-sbt/sbt-dist/bin/sbt-launch-lib.bash
     1321  01-15-2018 18:59   lagom-scala-sbt/sbt-dist/bin/sbt.bat
     5062  01-15-2018 18:59   lagom-scala-sbt/sbt-dist/bin/sbt
  1210231  01-15-2018 18:59   lagom-scala-sbt/sbt-dist/bin/sbt-launch.jar
        0  02-16-2018 22:19   lagom-scala-sbt/sbt-dist/conf/
      147  01-15-2018 18:59   lagom-scala-sbt/sbt-dist/conf/sbtconfig.txt
      939  01-15-2018 18:59   lagom-scala-sbt/sbt-dist/conf/sbtopts
---------                     -------
  1247658                     74 files


Add into GitHub
https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/

 Generated project
https://github.com/dveselka/lagom-scala-sbt


Build project
[dave@localhost lagom-scala-sbt]$ ./sbt runAll
Getting org.scala-sbt sbt 0.13.16 ...


Check the running service using
http://localhost:9000/api/hello/World



Getting started with Microprofile

$
0
0

MicroProfile

https://microprofile.io/

https://openliberty.io/docs/ref/microprofile/1.3/

List of microprofile implementations
https://wiki.eclipse.org/MicroProfile/Implementation

Payara 


https://blog.payara.fish/building-your-next-microservice-with-eclipse-microprofile

https://github.com/OndrejM/getting-started-microprofile

OpenLiberty


OpenLiberty guides
https://openliberty.io/guides/

Install OpenLiberty via Maven
https://openliberty.io/blog/2018/07/27/installing-features-from-maven-dependencies.html

http://www.adam-bien.com/roller/abien/entry/microprofile_java_ee_8_thinner

http://javaeemicro.services/

Sample project

Start application HOWTO
 https://openliberty.io/guides/maven-intro.html


Compile the project

mvn install

jar tvf target/ServletSample-1.0-SNAPSHOT.war
    97 Thu Oct 25 11:12:26 CEST 2018 META-INF/MANIFEST.MF
     0 Thu Oct 25 11:12:26 CEST 2018 META-INF/
     0 Thu Oct 25 11:12:26 CEST 2018 WEB-INF/
     0 Thu Oct 25 11:12:26 CEST 2018 WEB-INF/classes/
     0 Thu Oct 25 11:12:26 CEST 2018 WEB-INF/classes/io/
     0 Thu Oct 25 11:12:26 CEST 2018 WEB-INF/classes/io/openliberty/
     0 Thu Oct 25 11:12:26 CEST 2018 WEB-INF/classes/io/openliberty/guides/
     0 Thu Oct 25 11:12:26 CEST 2018 WEB-INF/classes/io/openliberty/guides/hello/
     0 Thu Oct 25 11:12:26 CEST 2018 WEB-INF/lib/
   431 Thu Oct 25 11:08:56 CEST 2018 WEB-INF/web.xml
1047863 Thu Oct 25 11:11:42 CEST 2018 WEB-INF/lib/jaxb-impl-2.2.11.jar
  1222 Thu Oct 25 11:11:44 CEST 2018 WEB-INF/classes/io/openliberty/guides/hello/HelloServlet.class
   575 Thu Oct 25 11:08:56 CEST 2018 index.html
  6330 Thu Oct 25 11:08:56 CEST 2018 META-INF/maven/io.openliberty.guides/ServletSample/pom.xml
   107 Thu Oct 25 11:12:26 CEST 2018 META-INF/maven/io.openliberty.guides/ServletSample/pom.properties
102244 Thu Oct 25 11:11:42 CEST 2018 WEB-INF/lib/jaxb-api-2.2.11.jar
 69409 Thu Oct 25 11:11:42 CEST 2018 WEB-INF/lib/activation-1.1.1.jar
252336 Thu Oct 25 11:11:42 CEST 2018 WEB-INF/lib/jaxb-core-2.2.11.jar


Maven build log

mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ServletSample 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ServletSample ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /git/openliberty-maven-intro/finish/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ ServletSample ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ServletSample ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /git/openliberty-maven-intro/finish/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ ServletSample ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ ServletSample ---
[INFO]
[INFO] --- liberty-maven-plugin:2.6.1:install-server (create-server) @ ServletSample ---
[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-runtime:null:RELEASE:zip.
[INFO] CWWKM2102I: Using installDirectory : /git/openliberty-maven-intro/finish/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : ServletSampleServer.
[INFO] CWWKM2102I: Using serverDirectory : /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer.
[INFO] CWWKM2185I: The liberty-maven-plugin configuration parameter "appsDirectory" value defaults to "apps".
[INFO] CWWKM2112I: Re-using previously installed assembly.
[INFO]
[INFO] --- liberty-maven-plugin:2.6.1:create-server (create-server) @ ServletSample ---
[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-runtime:null:RELEASE:zip.
[INFO] CWWKM2102I: Using installDirectory : /git/openliberty-maven-intro/finish/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : ServletSampleServer.
[INFO] CWWKM2102I: Using serverDirectory : /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer.
[INFO] CWWKM2185I: The liberty-maven-plugin configuration parameter "appsDirectory" value defaults to "apps".
[INFO] CWWKM2112I: Re-using previously installed assembly.
[INFO] Copying 1 file to /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer
[INFO] CWWKM2144I: Update server configuration file server.xml from /git/openliberty-maven-intro/finish/src/main/liberty/config/server.xml.
[INFO] CWWKM2144I: Update server configuration file bootstrap.properties from inlined configuration.
[INFO]
[INFO] --- maven-war-plugin:3.2.2:war (default-war) @ ServletSample ---
[INFO] Packaging webapp
[INFO] Assembling webapp [ServletSample] in [/git/openliberty-maven-intro/finish/target/ServletSample-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/git/openliberty-maven-intro/finish/src/main/webapp]
[INFO] Webapp assembled in [47 msecs]
[INFO] Building war: /git/openliberty-maven-intro/finish/target/ServletSample-1.0-SNAPSHOT.war
[INFO]
[INFO] --- liberty-maven-plugin:2.6.1:install-apps (install-apps) @ ServletSample ---
[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-runtime:null:RELEASE:zip.
[INFO] CWWKM2102I: Using installDirectory : /git/openliberty-maven-intro/finish/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : ServletSampleServer.
[INFO] CWWKM2102I: Using serverDirectory : /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer.
[INFO] Copying 1 file to /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer
[INFO] CWWKM2144I: Update server configuration file server.xml from /git/openliberty-maven-intro/finish/src/main/liberty/config/server.xml.
[INFO] CWWKM2144I: Update server configuration file bootstrap.properties from inlined configuration.
[INFO] CWWKM2185I: The liberty-maven-plugin configuration parameter "appsDirectory" value defaults to "apps".
[INFO] CWWKM2160I: Installing application ServletSample.war.xml.
[INFO]
[INFO] --- liberty-maven-plugin:2.6.1:package-server (package-server) @ ServletSample ---
[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-runtime:null:RELEASE:zip.
[INFO] CWWKM2102I: Using installDirectory : /git/openliberty-maven-intro/finish/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : ServletSampleServer.
[INFO] CWWKM2102I: Using serverDirectory : /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer.
[INFO] CWWKM2112I: Re-using previously installed assembly.
[INFO] CWWKM2134I: Packaging server ServletSampleServer.
[INFO] Copying 1 file to /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer
[INFO] CWWKM2144I: Update server configuration file server.xml from /git/openliberty-maven-intro/finish/src/main/liberty/config/server.xml.
[INFO] CWWKM2144I: Update server configuration file bootstrap.properties from inlined configuration.
[INFO] CWWKM2136I: Package file location is /git/openliberty-maven-intro/finish/target/ServletSample.zip.
[INFO] CWWKM2001I: server.config.dir is /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer.
[INFO] CWWKM2001I: server.output.dir is /git/openliberty-maven-intro/finish/target/wlp-package/ServletSampleServer.
[INFO] CWWKM2001I: Invoke command is [/git/openliberty-maven-intro/finish/target/liberty/wlp/bin/server, package, ServletSampleServer, --archive=/git/openliberty-maven-intro/finish/target/ServletSample.zip, --include=usr].
[INFO] Packaging server ServletSampleServer.
[INFO] Server ServletSampleServer package complete in /git/openliberty-maven-intro/finish/target/ServletSample.zip.
[INFO]
[INFO] --- liberty-maven-plugin:2.6.1:test-start-server (test-start-server) @ ServletSample ---
[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-runtime:null:RELEASE:zip.
[INFO] CWWKM2102I: Using installDirectory : /git/openliberty-maven-intro/finish/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : ServletSampleServer.
[INFO] CWWKM2102I: Using serverDirectory : /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer.
[INFO] CWWKM2112I: Re-using previously installed assembly.
[INFO] Copying 1 file to /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer
[INFO] CWWKM2144I: Update server configuration file server.xml from /git/openliberty-maven-intro/finish/src/main/liberty/config/server.xml.
[INFO] CWWKM2144I: Update server configuration file bootstrap.properties from inlined configuration.
[INFO] CWWKM2001I: server.config.dir is /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer.
[INFO] CWWKM2001I: server.output.dir is /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer.
[INFO] CWWKM2001I: Invoke command is [/git/openliberty-maven-intro/finish/target/liberty/wlp/bin/server, start, ServletSampleServer].
[INFO] Server ServletSampleServer is already running with process ID 28763.
[INFO] Waiting up to 30 seconds for server confirmation:  CWWKF0011I to be found in /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer/logs/messages.log
[INFO] CWWKM2010I: Searching for CWWKF0011I in /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer/logs/messages.log. This search will timeout after 30 seconds.
[INFO] CWWKM2015I: Match number: 1 is [10/25/18 11:13:40:556 CEST] 00000019 com.ibm.ws.kernel.feature.internal.FeatureManager            A CWWKF0011I: The server ServletSampleServer is ready to run a smarter planet..
[INFO]
[INFO] --- maven-failsafe-plugin:2.19.1:integration-test (default) @ ServletSample ---


Tests 

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running io.openliberty.guides.hello.it.EndpointIT
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.373 sec - in io.openliberty.guides.hello.it.EndpointIT

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- liberty-maven-plugin:2.6.1:test-stop-server (test-stop-server) @ ServletSample ---
[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-runtime:null:RELEASE:zip.
[INFO] CWWKM2102I: Using installDirectory : /git/openliberty-maven-intro/finish/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : ServletSampleServer.
[INFO] CWWKM2102I: Using serverDirectory : /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer.
[INFO] CWWKM2152I: Stopping server ServletSampleServer.
[INFO] CWWKM2001I: server.config.dir is /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer.
[INFO] CWWKM2001I: server.output.dir is /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer.
[INFO] CWWKM2001I: Invoke command is [/git/openliberty-maven-intro/finish/target/liberty/wlp/bin/server, stop, ServletSampleServer].
[INFO] Stopping server ServletSampleServer.
[INFO] Server ServletSampleServer stopped.
[INFO]
[INFO] --- maven-failsafe-plugin:2.19.1:verify (default) @ ServletSample ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ ServletSample ---
[INFO] Installing /git/openliberty-maven-intro/finish/target/ServletSample-1.0-SNAPSHOT.war to /home/centos/.m2/io/openliberty/guides/ServletSample/1.0-SNAPSHOT/ServletSample-1.0-SNAPSHOT.war
[INFO] Installing /git/openliberty-maven-intro/finish/pom.xml to /home/centos/.m2/io/openliberty/guides/ServletSample/1.0-SNAPSHOT/ServletSample-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS


Run server

mvn liberty:start-server

Server log

tail -500f ./target/liberty/wlp/usr/servers/ServletSampleServer/logs/messages.log
********************************************************************************
product = Open Liberty 18.0.0.3 (wlp-1.0.22.cl180320180905-2337)
wlp.install.dir = /git/openliberty-maven-intro/finish/target/liberty/wlp/
java.home = /usr/java/jdk1.8.0_144/jre
java.version = 1.8.0_144
java.runtime = Java(TM) SE Runtime Environment (1.8.0_144-b01)
os = Linux (3.10.0-693.21.1.el7.x86_64; amd64) (en_US)
process = 28763@ip-10-112-45-153.eu-central-1.compute.internal
********************************************************************************
[10/25/18 11:13:37:833 CEST] 00000001 com.ibm.ws.kernel.launch.internal.FrameworkManager           A CWWKE0001I: The server ServletSampleServer has been launched.
[10/25/18 11:13:38:923 CEST] 00000001 com.ibm.ws.kernel.launch.internal.FrameworkManager           I CWWKE0002I: The kernel started after 1.322 seconds
[10/25/18 11:13:38:962 CEST] 00000019 com.ibm.ws.kernel.feature.internal.FeatureManager            I CWWKF0007I: Feature update started.
[10/25/18 11:13:39:643 CEST] 00000011 com.ibm.ws.app.manager.internal.monitor.DropinMonitor        A CWWKZ0058I: Monitoring dropins for applications.
[10/25/18 11:13:39:652 CEST] 0000001c com.ibm.ws.tcpchannel.internal.TCPChannel                    I CWWKO0219I: TCP Channel defaultHttpEndpoint has been started and is now listening for requests on host *  (IPv6) port 9080.
[10/25/18 11:13:39:853 CEST] 00000021 com.ibm.ws.app.manager.AppMessageHelper                      I CWWKZ0018I: Starting application ServletSample.
[10/25/18 11:13:39:932 CEST] 00000021 m.ibm.ws.container.service.app.deploy.ManifestClassPathUtils W SRVE9967W: The manifest class path jaxb-api.jar can not be found in jar file file:/home/centos/.m2/com/sun/xml/bind/jaxb-core/2.2.11/jaxb-core-2.2.11.jar or its parent.
[10/25/18 11:13:39:944 CEST] 00000021 m.ibm.ws.container.service.app.deploy.ManifestClassPathUtils W SRVE9967W: The manifest class path jaxb-core.jar can not be found in jar file file:/home/centos/.m2/com/sun/xml/bind/jaxb-impl/2.2.11/jaxb-impl-2.2.11.jar or its parent.
[10/25/18 11:13:40:106 CEST] 00000021 m.ibm.ws.container.service.app.deploy.ManifestClassPathUtils W SRVE9967W: The manifest class path jaxb-api.jar can not be found in jar file file:/home/centos/.m2/com/sun/xml/bind/jaxb-core/2.2.11/jaxb-core-2.2.11.jar or its parent.
[10/25/18 11:13:40:109 CEST] 00000021 m.ibm.ws.container.service.app.deploy.ManifestClassPathUtils W SRVE9967W: The manifest class path jaxb-core.jar can not be found in jar file file:/home/centos/.m2/com/sun/xml/bind/jaxb-impl/2.2.11/jaxb-impl-2.2.11.jar or its parent.
[10/25/18 11:13:40:484 CEST] 00000021 com.ibm.ws.session.WASSessionCore                            I SESN8501I: The session manager did not find a persistent storage location; HttpSession objects will be stored in the local application server's memory.
[10/25/18 11:13:40:506 CEST] 00000021 com.ibm.ws.webcontainer.osgi.webapp.WebGroup                 I SRVE0169I: Loading Web Module: Hello Servlet.
[10/25/18 11:13:40:508 CEST] 00000021 com.ibm.ws.webcontainer                                      I SRVE0250I: Web Module Hello Servlet has been bound to default_host.
[10/25/18 11:13:40:510 CEST] 00000021 com.ibm.ws.http.internal.VirtualHostImpl                     A CWWKT0016I: Web application available (default_host): http://rdfadm:9080/ServletSample/
[10/25/18 11:13:40:514 CEST] 00000021 com.ibm.ws.app.manager.AppMessageHelper                      A CWWKZ0001I: Application ServletSample started in 0.661 seconds.
[10/25/18 11:13:40:555 CEST] 00000019 com.ibm.ws.kernel.feature.internal.FeatureManager            A CWWKF0012I: The server installed the following features: [servlet-3.1].
[10/25/18 11:13:40:556 CEST] 00000019 com.ibm.ws.kernel.feature.internal.FeatureManager            I CWWKF0008I: Feature update completed in 1.633 seconds.
[10/25/18 11:13:40:556 CEST] 00000019 com.ibm.ws.kernel.feature.internal.FeatureManager            A CWWKF0011I: The server ServletSampleServer is ready to run a smarter planet.
[10/25/18 11:13:40:566 CEST] 00000025 com.ibm.ws.session.WASSessionCore                            I SESN0176I: A new session context will be created for application key default_host/ServletSample
[10/25/18 11:13:40:582 CEST] 00000025 com.ibm.ws.util                                              I SESN0172I: The session manager is using the Java default SecureRandom implementation for session ID generation.
[10/25/18 11:13:40:803 CEST] 00000021 com.ibm.ws.webcontainer.osgi.mbeans.PluginGenerator          I SRVE9103I: A configuration file for a web server plugin was automatically generated for this server at /git/openliberty-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer/logs/state/plugin-cfg.xml.

Using Docker containers to develop microservices

$
0
0


Adam Bien - Thin WARs, Java EE 7, Docker and Productivity
https://www.youtube.com/watch?v=5N4EUDhrkec

Adam Bien - samples
https://github.com/AdamBien/docklands


OpenLiberty MicroService Docker guide
https://openliberty.io/guides/docker.html

GitHub repo https://github.com/OpenLiberty/guide-docker

  mvn clean install


[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-runtime:null:RELEASE:zip.
[INFO] CWWKM2102I: Using installDirectory : /git/guide-docker/finish/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : defaultServer.
[INFO] CWWKM2102I: Using serverDirectory : /git/guide-docker/finish/target/liberty/wlp/usr/servers/defaultServer.
[INFO] CWWKM2185I: The liberty-maven-plugin configuration parameter "appsDirectory" value defaults to "dropins".
[INFO] Installing assembly...
[INFO] Expanding: /home/centos/.m2/io/openliberty/openliberty-runtime/18.0.0.3/openliberty-runtime-18.0.0.3.zip into /git/guide-docker/finish/target/liberty
[INFO]
[INFO] --- liberty-maven-plugin:2.6.1:create-server (create-server) @ rest ---
[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-runtime:null:RELEASE:zip.
[INFO] CWWKM2102I: Using installDirectory : /git/guide-docker/finish/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : defaultServer.
[INFO] CWWKM2102I: Using serverDirectory : /git/guide-docker/finish/target/liberty/wlp/usr/servers/defaultServer.
[INFO] CWWKM2185I: The liberty-maven-plugin configuration parameter "appsDirectory" value defaults to "dropins".
[INFO] CWWKM2112I: Re-using previously installed assembly.
[INFO] CWWKM2143I: Server defaultServer does not exist. Now creating...
[INFO] CWWKM2001I: server.config.dir is /git/guide-docker/finish/target/liberty/wlp/usr/servers/defaultServer.
[INFO] CWWKM2001I: server.output.dir is /git/guide-docker/finish/target/liberty/wlp/usr/servers/defaultServer.
[INFO] CWWKM2001I: Invoke command is [/git/guide-docker/finish/target/liberty/wlp/bin/server, create, defaultServer].
[INFO] Server defaultServer created.
[INFO] CWWKM2129I: Server defaultServer has been created at /git/guide-docker/finish/target/liberty/wlp/usr/servers/defaultServer.
[INFO] Copying 1 file to /git/guide-docker/finish/target/liberty/wlp/usr/servers/defaultServer
[INFO] CWWKM2144I: Update server configuration file server.xml from /git/guide-docker/finish/src/main/liberty/config/server.xml.
[INFO] CWWKM2144I: Update server configuration file bootstrap.properties from inlined configuration.
[INFO]
[INFO] --- maven-war-plugin:3.2.2:war (default-war) @ rest ---
[INFO] Packaging webapp
[INFO] Assembling webapp [rest] in [/git/guide-docker/finish/target/rest-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/git/guide-docker/finish/src/main/webapp]
[INFO] Webapp assembled in [47 msecs]
[INFO] Building war: /git/guide-docker/finish/target/rest-1.0-SNAPSHOT.war
[INFO]
[INFO] --- liberty-maven-plugin:2.6.1:install-apps (install-app) @ rest ---
[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-runtime:null:RELEASE:zip.
[INFO] CWWKM2102I: Using installDirectory : /git/guide-docker/finish/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : defaultServer.
[INFO] CWWKM2102I: Using serverDirectory : /git/guide-docker/finish/target/liberty/wlp/usr/servers/defaultServer.
[INFO] Copying 1 file to /git/guide-docker/finish/target/liberty/wlp/usr/servers/defaultServer
[INFO] CWWKM2144I: Update server configuration file server.xml from /git/guide-docker/finish/src/main/liberty/config/server.xml.
[INFO] CWWKM2144I: Update server configuration file bootstrap.properties from inlined configuration.
[INFO] CWWKM2160I: Installing application /git/guide-docker/finish/target/rest-1.0-SNAPSHOT.war.
[INFO] Copying 1 file to /git/guide-docker/finish/target/liberty/wlp/usr/servers/defaultServer/apps
[INFO]
[INFO] --- liberty-maven-plugin:2.6.1:test-start-server (start-server) @ rest ---
[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-runtime:null:RELEASE:zip.
[INFO] CWWKM2102I: Using installDirectory : /git/guide-docker/finish/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : defaultServer.
[INFO] CWWKM2102I: Using serverDirectory : /git/guide-docker/finish/target/liberty/wlp/usr/servers/defaultServer.
[INFO] CWWKM2112I: Re-using previously installed assembly.
[INFO] Copying 1 file to /git/guide-docker/finish/target/liberty/wlp/usr/servers/defaultServer
[INFO] CWWKM2144I: Update server configuration file server.xml from /git/guide-docker/finish/src/main/liberty/config/server.xml.
[INFO] CWWKM2144I: Update server configuration file bootstrap.properties from inlined configuration.
[INFO] CWWKM2001I: server.config.dir is /git/guide-docker/finish/target/liberty/wlp/usr/servers/defaultServer.
[INFO] CWWKM2001I: server.output.dir is /git/guide-docker/finish/target/liberty/wlp/usr/servers/defaultServer.
[INFO] CWWKM2001I: Invoke command is [/git/guide-docker/finish/target/liberty/wlp/bin/server, start, defaultServer].
[INFO] Starting server defaultServer.
[INFO] Server defaultServer started with process ID 20700.
[INFO] Waiting up to 30 seconds for server confirmation:  CWWKF0011I to be found in /git/guide-docker/finish/target/liberty/wlp/usr/servers/defaultServer/logs/messages.log
[INFO] CWWKM2010I: Searching for CWWKF0011I in /git/guide-docker/finish/target/liberty/wlp/usr/servers/defaultServer/logs/messages.log. This search will timeout after 30 seconds.
[INFO] CWWKM2015I: Match number: 1 is [10/26/18 13:21:13:991 CEST] 00000019 com.ibm.ws.kernel.feature.internal.FeatureManager            A CWWKF0011I: The server defaultServer is ready to run a smarter planet..



 yum install docker

sudo systemctl start docker
 
Configure Docker proxy 
 https://docs.docker.com/config/daemon/systemd/#httphttps-proxy

docker build -t ol-runtime .


docker build -t ol-runtime .
Sending build context to Docker daemon 150.5 MB
Step 1/4 : FROM open-liberty
Trying to pull repository docker.io/library/open-liberty ...
latest: Pulling from docker.io/library/open-liberty
18d680d61657: Pull complete
0addb6fece63: Pull complete
78e58219b215: Pull complete
eb6959a66df2: Pull complete
d28276d78514: Pull complete
f4b7f9cac3ff: Pull complete
cca6875781ba: Pull complete
19927b6c1502: Pull complete
e7b4b52f440a: Pull complete
b756387f6847: Pull complete
Digest: sha256:ed0252357b07d199c18fa67eac13a563cef9d052c856f7050727775bf2dc3e2b
Status: Downloaded newer image for docker.io/open-liberty:latest
 ---> 2408c7bfb52d
Step 2/4 : RUN ln -s /opt/ol/wlp/usr/servers /servers
 ---> Running in ee3238c49602

 ---> b99f07819d6b
Removing intermediate container ee3238c49602
Step 3/4 : ENTRYPOINT /opt/ol/wlp/bin/server run
 ---> Running in eb0103bfe0a0
 ---> 5be83f0c9bcd
Removing intermediate container eb0103bfe0a0
Step 4/4 : CMD defaultServer
 ---> Running in 79167390de6a
 ---> 026f9cdf87b7
Removing intermediate container 79167390de6a
Successfully built 026f9cdf87b7


Run container

$ docker run -d --name rest-app -p 9080:9080 -p 9443:9443 -v /git/guide-maven-intro/finish/target/liberty/wlp/usr/servers:/servers ol-runtime
6177bbf6b6626c4004878910f97bf2581d7f16cc4aca46550685e65b06a1771b



 docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                       PORTS               NAMES
6177bbf6b662        ol-runtime          "/opt/ol/wlp/bin/s..."   54 seconds ago      Exited (23) 52 seconds ago                       rest-app



JBoss Thorntail

$
0
0
https://thorntail.io/

https://thorntail.io/generator/


<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.clearstream</groupId>
  <artifactId>demo-thorntail</artifactId>
  <name>Thorntail Example</name>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>war</packaging>

  <properties>
    <version.thorntail>2.2.0.Final</version.thorntail>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <failOnMissingWebXml>false</failOnMissingWebXml>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.thorntail</groupId>
        <artifactId>bom-all</artifactId>
        <version>${version.thorntail}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <finalName>demo</finalName>
    <plugins>
      <plugin>
        <groupId>io.thorntail</groupId>
        <artifactId>thorntail-maven-plugin</artifactId>
        <version>${version.thorntail}</version>

        <executions>
          <execution>
            <goals>
              <goal>package</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>

    <dependency>
      <groupId>io.thorntail</groupId>
      <artifactId>jaxrs</artifactId>
    </dependency><dependency>
      <groupId>io.thorntail</groupId>
      <artifactId>jpa</artifactId>
    </dependency>
  </dependencies>
</project>


HelloWorldEndpoin.java

package com.clearstream.demothorntail.rest;


import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;


@Path("/hello")
public class HelloWorldEndpoint {

        @GET
        @Produces("text/plain")
        public Response doGet() {
                return Response.ok("Hello from Thorntail!").build();
        }
}



RestApplication

package com.clearstream.demothorntail.rest;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath("/")
public class RestApplication extends Application {

}




mvn install

mvn thorntail:run



[INFO] Starting .war
Fri Oct 26 16:40:36 CEST 2018 INFO [org.wildfly.swarm.bootstrap] (main) Dependencies not bundled; resolving from M2REPO.
2018-10-26 16:40:42,986 INFO  [org.wildfly.swarm] (main) THORN0013: Installed fraction:                   JAX-RS - STABLE          io.thorntail:jaxrs:2.2.0.Final
2018-10-26 16:40:42,997 INFO  [org.wildfly.swarm] (main) THORN0013: Installed fraction:                  Logging - STABLE          io.thorntail:logging:2.2.0.Final
2018-10-26 16:40:42,997 INFO  [org.wildfly.swarm] (main) THORN0013: Installed fraction:                 Undertow - STABLE          io.thorntail:undertow:2.2.0.Final
2018-10-26 16:40:42,999 INFO  [org.wildfly.swarm] (main) THORN0013: Installed fraction:                  Elytron - STABLE          io.thorntail:elytron:2.2.0.Final
2018-10-26 16:40:43,000 INFO  [org.wildfly.swarm] (main) THORN0013: Installed fraction:                      JPA - STABLE          io.thorntail:jpa:2.2.0.Final
2018-10-26 16:40:43,000 INFO  [org.wildfly.swarm] (main) THORN0013: Installed fraction:              Datasources - STABLE          io.thorntail:datasources:2.2.0.Final
2018-10-26 16:40:43,001 INFO  [org.wildfly.swarm] (main) THORN0013: Installed fraction:                      JCA - STABLE          io.thorntail:jca:2.2.0.Final
2018-10-26 16:40:43,001 INFO  [org.wildfly.swarm] (main) THORN0013: Installed fraction:             Transactions - STABLE          io.thorntail:transactions:2.2.0.Final
2018-10-26 16:40:46,101 WARN  [org.wildfly.swarm.datasources] (main) THORN1005: Not creating a default datasource due to lack of JDBC driver
2018-10-26 16:40:47,061 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.7.SP1
2018-10-26 16:40:47,304 INFO  [org.jboss.as] (MSC service thread 1-1) WFLYSRV0049: Thorntail 2.2.0.Final (WildFly Core 3.0.8.Final) starting
2018-10-26 16:40:47,554 INFO  [org.wildfly.swarm] (MSC service thread 1-1) THORN0019: Install MSC service for command line args: []
2018-10-26 16:40:50,300 INFO  [org.wildfly.security] (ServerService Thread Pool -- 12) ELY00001: WildFly Elytron version 1.1.6.Final
2018-10-26 16:40:50,374 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 16) WFLYTX0013: The node-identifier attribute on the /subsystem=transactions is set to the default value. This is a danger for environments running multiple servers. Please make sure the attribute value is unique.
2018-10-26 16:40:50,375 INFO  [org.jboss.as.jaxrs] (ServerService Thread Pool -- 15) WFLYRS0016: RESTEasy version 3.0.24.Final
2018-10-26 16:40:50,388 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 23) WFLYNAM0001: Activating Naming Subsystem
2018-10-26 16:40:50,454 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 20) WFLYSEC0002: Activating Security Subsystem
2018-10-26 16:40:50,459 INFO  [org.xnio] (ServerService Thread Pool -- 24) XNIO version 3.5.4.Final
2018-10-26 16:40:50,754 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0003: Undertow 1.4.18.Final starting
2018-10-26 16:40:50,792 INFO  [org.xnio.nio] (ServerService Thread Pool -- 24) XNIO NIO Implementation Version 3.5.4.Final
2018-10-26 16:40:50,804 INFO  [org.jboss.as.security] (MSC service thread 1-2) WFLYSEC0001: Current PicketBox version=5.0.2.Final
2018-10-26 16:40:50,988 INFO  [org.jboss.as.connector] (MSC service thread 1-3) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.4.6.Final)
2018-10-26 16:40:51,511 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 24) WFLYIO001: Worker 'default' has auto-configured to 4 core threads with 32 task threads based on your 2 available processors
2018-10-26 16:40:51,583 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0012: Started server default-server.
2018-10-26 16:40:51,610 INFO  [org.jboss.as.naming] (MSC service thread 1-4) WFLYNAM0003: Starting Naming Service
2018-10-26 16:40:51,691 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0006: Undertow HTTP listener default listening on [0:0:0:0:0:0:0:0]:8080
2018-10-26 16:40:52,282 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
2018-10-26 16:40:52,285 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: Thorntail 2.2.0.Final (WildFly Core 3.0.8.Final) started in 5331ms - Started 143 of 161 services (32 services are lazy, passive or on-demand)
2018-10-26 16:40:52,789 INFO  [org.wildfly.swarm.runtime.deployer] (main) deploying demo.war
2018-10-26 16:40:52,839 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0027: Starting deployment of "demo.war" (runtime-name: "demo.war")
2018-10-26 16:40:53,364 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-3) WFLYSRV0018: Deployment "deployment.demo.war" is using a private module ("org.jboss.jts") which may be changed or removed in future versions without notice.
2018-10-26 16:40:53,364 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-3) WFLYSRV0018: Deployment "deployment.demo.war" is using a private module ("org.jboss.ironjacamar.jdbcadapters") which may be changed or removed in future versions without notice.
2018-10-26 16:40:53,365 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-3) WFLYSRV0018: Deployment "deployment.demo.war" is using a private module ("org.jboss.jts") which may be changed or removed in future versions without notice.
2018-10-26 16:40:53,365 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-3) WFLYSRV0018: Deployment "deployment.demo.war" is using a private module ("org.jboss.ironjacamar.jdbcadapters") which may be changed or removed in future versions without notice.
2018-10-26 16:40:53,645 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0018: Host default-host starting
2018-10-26 16:40:54,005 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 12) RESTEASY002225: Deploying javax.ws.rs.core.Application: class com.clearstream.demothorntail.rest.RestApplication
2018-10-26 16:40:54,036 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 12) WFLYUT0021: Registered web context: '/' for server 'default-server'
2018-10-26 16:40:54,200 INFO  [org.jboss.as.server] (main) WFLYSRV0010: Deployed "demo.war" (runtime-name : "demo.war")
2018-10-26 16:40:54,216 INFO  [org.wildfly.swarm] (main) THORN99999: Thorntail is Ready




Check the project

http://localhost:8080/hello

Weblogic REST API

$
0
0
https://docs.oracle.com/middleware/1221/wls/WLRUR/overview.htm#WLRUR111

https://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/wls/12c/12_2_1/01-30-001-ManageWLSREST1221/Manage_WLS_REST1221.html#section1

https://www.oracle.com/technetwork/articles/soa/oliveira-wls-rest-javafx-1723982.html

https://www.middlewareinventory.com/blog/how-to-use-weblogic-rest-api-examples/

http://www.munzandmore.com/2015/ora/weblogic-12-2-1-rest-management-interface

https://localhost:7001/management/tenant-monitoring/servers/AdminServer

https://localhost:7001/management/weblogic/latest/domainRuntime/serverRuntimes

Using curl with https

curl -k  -v --noproxy "*"  -v --user   weblogic:weblogic123 -H X-Requested-By:MyClient -H Accept:application/json -X GET https://localhost:7001/management/weblogic/latest/domainRuntime/serverRuntimes/AdminServer/applicationRuntimes/myApp


----------------------------------------------------------------------
Monitor the servers
----------------------------------------------------------------------
 
curl -v \
--user monitor:monitor123 \
-H X-Requested-By:MyClient \
-H Accept:application/json \
-X GET http://localhost:7001/management/weblogic/latest/domainRuntime/serverRuntimes?links=none&fields=name,overallHealthState,healthState,state,openSocketsCurrentCount,activationTime
 

Python - configure development environment

After installation steps for Fedora 29

$
0
0

  Update all packages


dnf update

Enable RPM Fusion repo


 sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
 

Install VLC


  dnf install vlc

 Install Google Chrome


  dnf install fedora-workstation-repositories
  dnf config-manager --set-enabled google-chrome
  dnf install google-chrome-stable

Install Adobe Flash

  rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm
  rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
  dnf install flash-plugin alsa-plugins-pulseaudio libcurl
  

Golang - first test project

$
0
0
HOWTO structure Golang project

https://golang.org/doc/code.html

Settings GOPATH
https://github.com/golang/go/wiki/SettingGOPATH

Golang - complex project structure
https://github.com/golang-standards/project-layout

Directories You Shouldn't Have

/src

Some Go projects do have a src folder, but it usually happens when the devs came from the Java world where it's a common pattern. If you can help yourself try not to adopt this Java pattern. You really don't want your Go code or Go projects to look like Java :-)
Don't confuse the project level /src directory with the /src directory Go uses for its workspaces as described in How to Write Go Code. The $GOPATH environment variable points to your (current) workspace (by default it points to $HOME/go on non-windows systems). This workspace includes the top level /pkg, /bin and /src directories. Your actual project ends up being a sub-directory under /src, so if you have the /src directory in your project the project path will look like this: /some/path/to/workspace/src/your_project/src/your_code.go. Note that with Go 1.11 it's possible to have your project outside of your GOPATH, but it still doesn't mean it's a good idea to use this layout pattern.


Set environment
vi ~/.bash_profile

export GOPATH=$(go env GOPATH)
export PATH=$PATH:$(go env GOPATH)/bin

source ~/.bash_profile

Create first project
mkdir-p $GOPATH/src/github.com/dveselka/golang-hello


Install project

go install github.com/dveselka/golang-hello

[dave@localhost golang-hello]$ find  $GOPATH/src/github.com
/home/dave/go/src/github.com
/home/dave/go/src/github.com/dveselka
/home/dave/go/src/github.com/dveselka/golang-hello
/home/dave/go/src/github.com/dveselka/golang-hello/hello.go


Run project

[dave@localhost golang-hello]$ $GOPATH/bin/golang-hello 
Hello, world.

GitHub project https://github.com/dveselka/golang-hello

Postinstall tasks for Fedora using Ansible

$
0
0
Fedora Ansible tasks repo - various tasks

https://github.com/fabaff/fedora-ansible

Code for example below
https://github.com/dveselka/fedora-ansible-postinstall

Create Ansible playbook

[dave@dave fedora-ansible-postinstall]$ find
.
./post_install.yml
./tasks
./tasks/rpmfusion.yml



---
- hosts: localhost
  become: yes
  vars:
    fedora_current: 30
  tasks:
    - include: tasks/rpmfusion.yml

Enable RPMFusion repository

---
- name: install the rpmfusion repo packages
dnf:
name: ['http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-{{ fedora_current }}.noarch.rpm',
'http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-{{ fedora_current }}.noarch.rpm']
state: present

Run Ansible playbook

sudo ansible-playbook post_install.yml -vv
Added Google Chrome installation task
sudo ansible-playbook post_install.yml 
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'


PLAY [localhost] ********************************************************************************************************************************************************

TASK [Gathering Facts] **************************************************************************************************************************************************
ok: [localhost]

TASK [install the rpmfusion repo packages] ******************************************************************************************************************************
ok: [localhost]

TASK [install Fedora Workstation repositories] **************************************************************************************************************************
ok: [localhost]

TASK [install Google Chrome] ********************************************************************************************************************************************
ok: [localhost]

PLAY RECAP **************************************************************************************************************************************************************
localhost : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

Install Azure CLI on Centos

$
0
0
 Azure HOWTO
https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-yum?view=azure-cli-latest


Create repository

[centos@dbag-centos-xx630 ~]$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc^C

[centos@centos ~]$ sudo more /etc/yum.repos.d/azure-cli.repo
[azure-cli]
name=Azure CLI
baseurl=https://packages.microsoft.com/yumrepos/azure-cli
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc


sudo yum install azure-cli


$ az --version
azure-cli 2.0.73

command-modules-nspkg 2.0.3
core 2.0.73
nspkg 3.0.4
telemetry 1.0.3

Python location '/usr/bin/python'
Extensions directory '/home/centos/.azure/cliextensions'

Python (Linux) 2.7.5 (default, Aug 7 2019, 00:51:29)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

 

az login
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code 12345678 to authenticate.

Java EE 7 : JAX-RS 2.0 RST API sample

JAX-RS JAXB JSON - convert POJO to JSON

$
0
0

 Guide to JAXB

https://www.baeldung.com/jaxb

Sample code
 https://github.com/eugenp/tutorials/tree/master/jaxb

Microservice sample
https://www.baeldung.com/eclipse-microprofile

In previous versions before Java EE 7 to  serialize a POJO into JSON using JAXB you  had use a custom JAXB runtime like e.g. EclipseLink MOXy:
http://www.adam-bien.com/roller/abien/entry/jaxb_json_pojo_serialization_example

 Weblogic
http://blog.bdoughan.com/2013/07/oracle-weblogic-1212-now-with.html

 https://stackoverflow.com/questions/46813309/weblogic-12-2-1-3-from-moxy-to-jackson

Java EE 6
 https://docs.oracle.com/javaee/6/tutorial/doc/gkknj.html

Java EE 7
https://docs.oracle.com/javaee/7/tutorial/jaxrs-advanced007.htm

 

Using JSON with JAX-RS and JAXB

JAX-RS can automatically read and write XML using JAXB, but it can also work with JSON data. JSON is a simple text-based format for data exchange derived from JavaScript.

For this data
 
1
Mattress
Queen size mattress
500
 
The equivalent JSON representation is:
{
"id":"1",
"name":"Mattress",
"description":"Queen size mattress",
"price":500
}
 
You can add the format application/json to the @Produces annotation in resource methods to produce responses with JSON data:

@GET
@Path("/get")
@Produces({"application/xml","application/json"})
public Product getProduct() { ... }
 
In this example the default response is XML, but the response is a JSON object if the client makes a GET request that includes this header:

Accept: application/json
 
The resource methods can also accept JSON data for JAXB annotated classes:
 
@POST
@Path("/create")
@Consumes({"application/xml","application/json"})
public Response createProduct(Product prod) { ... }
 
The client should include the following header when submitting JSON data with a POST request:

Content-Type: application/json
 
 

Convert POJO to JSON

 

Use MessageBodyWriter - see here https://www.baeldung.com/eclipse-microprofile
 
https://github.com/eugenp/tutorials/blob/master/microprofile/src/main/java/com/baeldung/microprofile/providers/BookMessageBodyWriter.java 


@Provider
@Produces(MediaType.APPLICATION_JSON)
publicclassBookMessageBodyWriter
  implementsMessageBodyWriter {
 

Creating a RESTful web service using Java Microprofile

$
0
0
 Creating a RESTful web service using Java Microprofile - OpenLiberty guide

https://openliberty.io/guides/rest-intro.html?_ga=2.32933814.922244966.1570259159-606366657.1570259159


Install latest version of Maven  on Centos 7.6 ( sample failed with 3.0.5 default version)
https://www.tecmint.com/install-apache-maven-on-centos-7/

No implementation for org.codehaus.plexus.languages.java.jpms.LocationManager was bound.
  while locating org.apache.maven.plugin.surefire.SurefirePlugin

On Fedora 30 I get following error in Maven
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal net.wasdev.wlp.maven.plugins:liberty-maven-plugin:2.7:install-server (install-server) on project microprofile: Unable to resolve artifact: io.openliberty:openliberty-runtime:19.0.0.9: Could not transfer artifact io.openliberty:openliberty-runtime:zip:19.0.0.9 from/to central (https://repo.maven.apache.org/maven2): User-specified log class 'org.codehaus.mojo.pluginsupport.logging.DelegatingLog' cannot be found or is not useable. -> [Help 1]
Installing latest version of Maven removed error


Clone the tutorial  sample repo
https://github.com/eugenp/tutorials

Follow the tutorial article
https://www.baeldung.com/eclipse-microprofile

Change versions to latest in pom.xml - check versions at https://mvnrepository.com/artifact/io.openliberty/openliberty-runtime/

tail pom.xml 
    <properties>
        <app.name>library</app.name>
        <package.file>${project.build.directory}/${app.name}-service.jar</package.file>
        <packaging.type>runnable</packaging.type>
        <microprofile.version>1.2</microprofile.version>
        <liberty-maven-plugin.version>2.7</liberty-maven-plugin.version>
        <openliberty-runtime.version>19.0.0.9</openliberty-runtime.version>
    </properties>

Compile and start the service
mvn package
java -jar target/library-service.jar


microprofile]$ java -jar target/library-service.jar
Extracting files to /home/centos/wlpExtract/library-service_1453971251685/wlp
Successfully extracted all product files.
Launching defaultServer (Open Liberty 19.0.0.9/wlp-1.0.32.cl190920190905-0148) on OpenJDK 64-Bit Server VM, version 1.8.0_222-b10 (en_US)
[AUDIT   ] CWWKE0001I: The server defaultServer has been launched.
[AUDIT   ] CWWKZ0058I: Monitoring dropins for applications.
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://localhost:9080/
[AUDIT   ] CWWKZ0001I: Application microprofile-1.0-SNAPSHOT started in 1.746 seconds.
[AUDIT   ] CWWKF0012I: The server installed the following features: [cdi-1.2, jaxrs-2.0, jaxrsClient-2.0, jndi-1.0, json-1.0, jsonp-1.0, servlet-3.1].
[AUDIT   ] CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 5.136 seconds.


Test the service



curl http://localhost:9080/library/books
[{"id":"0001-201910","isbn":"1","name":"Building Microservice With Eclipse MicroProfile","author":"baeldung","pages":"420"}]

JAX-RS read JSON POST body parameters

$
0
0

 Set a Response Body in JAX-RS

https://www.baeldung.com/jax-rs-response

 

 Read JSON directly


    @POST
    @Path("listwrapper/")
    @Consumes({MediaType.APPLICATION_JSON})
    @Produces({MediaType.APPLICATION_JSON})
    public String getListViaWrapperHTTPRequest(List<String> list) {

        System.out.println("getListViaWrapperHTTPRequest");

        for(String param: list){
            System.out.println("
param=" + param);
        }
        return "SOME_RESPONSE";
    }




Read HTTP request body


    @POST
    @Path("listraw/")
    @Consumes({MediaType.APPLICATION_JSON})
    @Produces({MediaType.APPLICATION_JSON})
    public String getListViaRawHTTPRequest(@Context HttpServletRequest request, byte[] bodyBytes) {

        System.out.println("getListViaRawHTTPRequest");

        System.out.println("Content-Type: " + request.getContentType().toString());

        String body = new String(bodyBytes);

        System.out.println("body=" + body);

       return "SOME_RESPONSE";

    }

Configure development environment for Java Microproflle using OpenLiberty on Fedora

$
0
0
Follow the guide fron OpenLiberty
https://openliberty.io/guides/maven-intro.html

Install latest Maven


https://computingforgeeks.com/installing-latest-apache-maven-on-centos-fedora/

[dave@localhost ~]$ export VER="3.6.2"
[dave@localhost ~]$ curl -O http://www-eu.apache.org/dist/maven/maven-3/${VER}/binaries/apache-maven-${VER}-bin.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 8928k  100 8928k    0     0  9508k      0 --:--:-- --:--:-- --:--:-- 9497k
[dave@localhost ~]$ tar xvf apache-maven-${VER}-bin.tar.gz



[dave@localhost ~]$ sudo mv apache-maven-${VER} /opt/maven
[sudo] password for dave:
[dave@localhost ~]$ cat <<EOF | sudo tee /etc/profile.d/maven.sh
> export MAVEN_HOME=/opt/maven
> export PATH=\$PATH:\$MAVEN_HOME/bin
> EOF
export MAVEN_HOME=/opt/maven
export PATH=$PATH:$MAVEN_HOME/bin
[dave@localhost ~]$ source /etc/profile.d/maven.sh
[dave@localhost ~]$ echo $MAVEN_HOME
/opt/maven
[dave@localhost ~]$ echo $PATH
/home/dave/.local/bin:/home/dave/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/opt/maven/bin
[dave@localhost ~]$ mvn --version
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T17:06:16+02:00)
Maven home: /opt/maven
Java version: 1.8.0_232, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.fc30.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.3.6-200.fc30.x86_64", arch: "amd64", family: "unix"


Install Oracle JDK


You can also use OpenJDK but I want to run Weblogic on this host so I need Oracle JDK 


[dave@localhost finish]$ sudo dnf install ~/Downloads/jdk-8u231-linux-x64.rpm 
Error: 
 Problem: conflicting requests
  - nothing provides /bin/basename needed by jdk1.8-2000:1.8.0_231-fcs.x86_64
  - nothing provides /bin/cp needed by jdk1.8-2000:1.8.0_231-fcs.x86_64
  - nothing provides /bin/ls needed by jdk1.8-2000:1.8.0_231-fcs.x86_64
  - nothing provides /bin/mkdir needed by jdk1.8-2000:1.8.0_231-fcs.x86_64
  - nothing provides /bin/mv needed by jdk1.8-2000:1.8.0_231-fcs.x86_64
  - nothing provides /bin/pwd needed by jdk1.8-2000:1.8.0_231-fcs.x86_64
  - nothing provides /bin/sort needed by jdk1.8-2000:1.8.0_231-fcs.x86_64
(try to add '--skip-broken' to skip uninstallable packages)


Use direct rpm installation due to missing deps


[dave@localhost Downloads]$ sudo rpm -Uvh  ~/Downloads/jdk-8u231-linux-x64.rpm 
warning: /home/dave/Downloads/jdk-8u231-linux-x64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:jdk1.8-2000:1.8.0_231-fcs        ################################# [100%]
Unpacking JAR files...
    tools.jar...
    plugin.jar...
    javaws.jar...
    deploy.jar...
    rt.jar...
    jsse.jar...
    charsets.jar...
    localedata.jar...
[dave@localhost Downloads]$ rpm -qi jdk1.8
Name        : jdk1.8
Epoch       : 2000
Version     : 1.8.0_231
Release     : fcs
Architecture: x86_64
Install Date: Sat 26 Oct 2019 09:50:36 AM CEST
Group       : Development/Tools
Size        : 308047737
License     : https://java.com/bc_license
Signature   : RSA/SHA256, Sat 05 Oct 2019 12:32:51 PM CEST, Key ID 72f97b74ec551f03
Source RPM  : jdk1.8-1.8.0_231-fcs.src.rpm
Build Date  : Sat 05 Oct 2019 12:18:14 PM CEST
Build Host  : java.com
Relocations : /usr/java
Vendor      : Oracle Corporation
URL         : http://www.oracle.com/technetwork/java/javase/overview/index.html
Summary     : Java Platform Standard Edition Development Kit
Description :
The Java Platform Standard Edition Development Kit (JDK) includes both
the runtime environment (Java virtual machine, the Java platform classes
and supporting files) and development tools (compilers, debuggers,
tool libraries and other tools).

The JDK is a development environment for building applications, applets
and components that can be deployed with the Java Platform Standard
Edition Runtime Environment.


Set new Java home

[dave@localhost Downloads]$ sudo  /usr/sbin/alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.fc30.x86_64/jre/bin/java)
   2           /usr/java/jdk1.8.0_231-amd64/jre/bin/java

Enter to keep the current selection[+], or type selection number: 2
[dave@localhost Downloads]$ java -version
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)



Get the code for sample


git clone https://github.com/openliberty/guide-maven-intro.git
cd guide-maven-intro/finish
mvn install


Start server

[dave@localhost finish]$           mvn liberty:start-server
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for io.openliberty.guides:ServletSample:war:1.0-SNAPSHOT
[WARNING] 'parent.version' is either LATEST or RELEASE (both of them are being deprecated) @ line 8, column 18
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ----------------< io.openliberty.guides:ServletSample >-----------------
[INFO] Building ServletSample 1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- liberty-maven-plugin:3.0.M1:start-server (default-cli) @ ServletSample ---
[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-runtime:null:RELEASE:zip.
[INFO] CWWKM2102I: Using installDirectory : /git/guide-maven-intro/finish/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : ServletSampleServer.
[INFO] CWWKM2102I: Using serverDirectory : /git/guide-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer.
[INFO] CWWKM2112I: Re-using previously installed assembly.
[INFO] Copying 1 file to /git/guide-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer
[INFO] CWWKM2144I: Update server configuration file server.xml from /git/guide-maven-intro/finish/src/main/liberty/config/server.xml.
[INFO] CWWKM2144I: Update server configuration file bootstrap.properties from inlined configuration.
[INFO] CWWKM2001I: server.config.dir is /git/guide-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer.
[INFO] CWWKM2001I: server.output.dir is /git/guide-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer.
[INFO] CWWKM2001I: Invoke command is [/git/guide-maven-intro/finish/target/liberty/wlp/bin/server, start, ServletSampleServer].
[INFO]
[INFO] Starting server ServletSampleServer.
[INFO] Server ServletSampleServer started with process ID 18867.
[INFO] Waiting up to 30 seconds for server confirmation:  CWWKF0011I to be found in /git/guide-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer/logs/messages.log
[INFO] CWWKM2010I: Searching for CWWKF0011I in /git/guide-maven-intro/finish/target/liberty/wlp/usr/servers/ServletSampleServer/logs/messages.log. This search will timeout after 30 seconds.
[INFO] CWWKM2015I: Match number: 1 is [10/26/19 10:16:29:999 CEST] 00000020 com.ibm.ws.kernel.feature.internal.FeatureManager            A CWWKF0011I: The ServletSampleServer server is ready to run a smarter planet. The ServletSampleServer server started in 1.286 seconds..
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.408 s
[INFO] Finished at: 2019-10-26T10:16:30+02:00
[INFO] ------------------------------------------------------------------------


Test server

[dave@localhost finish]$ pgrep -a java
18867 /usr/java/jdk1.8.0_231-amd64/jre/bin/java -javaagent:/git/guide-maven-intro/finish/target/liberty/wlp/bin/tools/ws-javaagent.jar -Djava.awt.headless=true -Djdk.attach.allowAttachSelf=true -jar /git/guide-maven-intro/finish/target/liberty/wlp/bin/tools/ws-server.jar ServletSampleServer


[dave@localhost finish]$ wget -O - http://localhost:9080/ServletSample/servlet
--2019-10-26 10:19:27--  http://localhost:9080/ServletSample/servlet
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:9080... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified
Saving to: ‘STDOUT’

-                                          [<=>                                                                         ]       0  --.-KB/s               Hello! How are you today?
-                                          [ <=>                                                                        ]      26  --.-KB/s    in 0s     

2019-10-26 10:19:27 (2.10 MB/s) - written to stdout [26]

Create microservices multimodule OpenLiberty project using Maven

$
0
0
Multimodule project guide
https://openliberty.io/guides/maven-multimodules.html

Get the code

[dave@localhost git]$ git clone https://github.com/openliberty/guide-maven-multimodules.git
Cloning into 'guide-maven-multimodules'...

Project structure

[dave@localhost finish]$ find
.
./ear
./ear/pom.xml
./ear/src
./ear/src/main
./ear/src/main/liberty
./ear/src/main/liberty/config
./ear/src/main/liberty/config/server.xml
./ear/src/test
./ear/src/test/java
./ear/src/test/java/it
./ear/src/test/java/it/io
./ear/src/test/java/it/io/openliberty
./ear/src/test/java/it/io/openliberty/guides
./ear/src/test/java/it/io/openliberty/guides/multimodules
./ear/src/test/java/it/io/openliberty/guides/multimodules/Test.java
./war
./war/pom.xml
./war/src
./war/src/main
./war/src/main/java
./war/src/main/java/io
./war/src/main/java/io/openliberty
./war/src/main/java/io/openliberty/guides
./war/src/main/java/io/openliberty/guides/multimodules
./war/src/main/java/io/openliberty/guides/multimodules/web
./war/src/main/java/io/openliberty/guides/multimodules/web/HeightsBean.java
./war/src/main/webapp
./war/src/main/webapp/index.jsp
./war/src/main/webapp/WEB-INF
./war/src/main/webapp/WEB-INF/web.xml
./war/src/main/webapp/heights.jsp
./jar
./jar/pom.xml
./jar/src
./jar/src/main
./jar/src/main/java
./jar/src/main/java/io
./jar/src/main/java/io/openliberty
./jar/src/main/java/io/openliberty/guides
./jar/src/main/java/io/openliberty/guides/multimodules
./jar/src/main/java/io/openliberty/guides/multimodules/lib
./jar/src/main/java/io/openliberty/guides/multimodules/lib/Converter.java
./pom.xml


Build the project using mvn install


[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] io.openliberty.guides.multimodules.modules                         [pom]
[INFO] io.openliberty.guides.multimodules.jar                             [jar]
[INFO] io.openliberty.guides.multimodules.war                             [war]
[INFO] io.openliberty.guides.multimodules.ear                             [ear]
[INFO]
[INFO] --< io.openliberty.guides:io.openliberty.guides.multimodules.modules >--
[INFO] Building io.openliberty.guides.multimodules.modules 0.0.1-SNAPSHOT [1/4]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ io.openliberty.guides.multimodules.modules ---
[INFO] Installing /git/guide-maven-multimodules/finish/pom.xml to /home/dave/.m2/repository/io/openliberty/guides/io.openliberty.guides.multimodules.modules/0.0.1-SNAPSHOT/io.openliberty.guides.multimodules.modules-0.0.1-SNAPSHOT.pom


Start the server using mvn liberty:start-server

INFO] --- liberty-maven-plugin:3.0.M1:start-server (default-cli) @ io.openliberty.guides.multimodules.modules ---
[INFO] CWWKM2102I: Using installDirectory : /git/guide-maven-multimodules/finish/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : defaultServer.
[INFO] CWWKM2102I: Using serverDirectory : /git/guide-maven-multimodules/finish/target/liberty/wlp/usr/servers/defaultServer.
[INFO] Installing from Open Liberty repository...
[INFO] Getting: https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/release/info.json
[INFO] To: /home/dave/.m2/repository/wlp-cache/openliberty-versions.json
[INFO] Using runtime version: 2019-10-02_0300
[INFO] Getting: https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/release/2019-10-02_0300/info.json
[INFO] To: /home/dave/.m2/repository/wlp-cache/2019-10-02_0300.json
[INFO] Getting: https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/release/2019-10-02_0300/openliberty-19.0.0.10.zip
[INFO] To: /home/dave/.m2/repository/wlp-cache/2019-10-02_0300/openliberty-19.0.0.10.zip


[INFO] Copying 1 file to /git/guide-maven-multimodules/finish/ear/target/liberty/wlp/usr/servers/defaultServer
[INFO] CWWKM2144I: Update server configuration file server.xml from /git/guide-maven-multimodules/finish/ear/src/main/liberty/config/server.xml.
[INFO] CWWKM2144I: Update server configuration file bootstrap.properties from inlined configuration.
[INFO] CWWKM2001I: server.config.dir is /git/guide-maven-multimodules/finish/ear/target/liberty/wlp/usr/servers/defaultServer.
[INFO] CWWKM2001I: server.output.dir is /git/guide-maven-multimodules/finish/ear/target/liberty/wlp/usr/servers/defaultServer.
[INFO] CWWKM2001I: Invoke command is [/git/guide-maven-multimodules/finish/ear/target/liberty/wlp/bin/server, start, defaultServer].
[INFO]
[INFO] Starting server defaultServer.
[INFO] Server defaultServer started with process ID 21980.
[INFO] Waiting up to 30 seconds for server confirmation:  CWWKF0011I to be found in /git/guide-maven-multimodules/finish/ear/target/liberty/wlp/usr/servers/defaultServer/logs/messages.log
[INFO] CWWKM2010I: Searching for CWWKF0011I in /git/guide-maven-multimodules/finish/ear/target/liberty/wlp/usr/servers/defaultServer/logs/messages.log. This search will timeout after 30 seconds.
[INFO] CWWKM2015I: Match number: 1 is [10/26/19 12:10:53:843 CEST] 0000001f com.ibm.ws.kernel.feature.internal.FeatureManager            A CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 1.067 seconds..

[dave@localhost finish]$ tail -500f /git/guide-maven-multimodules/finish/ear/target/liberty/wlp/usr/servers/defaultServer/logs/messages.log
********************************************************************************
product = Open Liberty 19.0.0.10 (wlp-1.0.33.cl191020191002-0300)
wlp.install.dir = /git/guide-maven-multimodules/finish/ear/target/liberty/wlp/
java.home = /usr/java/jdk1.8.0_231-amd64/jre
java.version = 1.8.0_231
java.runtime = Java(TM) SE Runtime Environment (1.8.0_231-b11)
os = Linux (5.3.6-200.fc30.x86_64; amd64) (en_US)
process = 21980@localhost.localdomain
********************************************************************************
[10/26/19 12:10:52:876 CEST] 00000001 com.ibm.ws.kernel.launch.internal.FrameworkManager           A CWWKE0001I: The server defaultServer has been launched.
[10/26/19 12:10:53:275 CEST] 00000001 com.ibm.ws.kernel.launch.internal.FrameworkManager           I CWWKE0002I: The kernel started after 0.498 seconds
[10/26/19 12:10:53:296 CEST] 0000001f com.ibm.ws.kernel.feature.internal.FeatureManager            I CWWKF0007I: Feature update started.
[10/26/19 12:10:53:457 CEST] 00000015 com.ibm.ws.app.manager.internal.monitor.DropinMonitor        A CWWKZ0058I: Monitoring dropins for applications.
[10/26/19 12:10:53:527 CEST] 00000023 com.ibm.ws.tcpchannel.internal.TCPPort                       E CWWKO0221E: TCP Channel defaultHttpEndpoint initialization did not succeed.  The socket bind did not succeed for host * and port 9080.  The port might already be in use.  Exception Message: Address already in use
[10/26/19 12:10:53:625 CEST] 00000026 com.ibm.ws.app.manager.AppMessageHelper                      I CWWKZ0018I: Starting application io.openliberty.guides.multimodules.ear.
[10/26/19 12:10:53:626 CEST] 00000026 bm.ws.app.manager.ear.internal.EARDeployedAppInfoFactoryImpl I CWWKZ0134I: The io.openliberty.guides.multimodules.ear application is using the loose application definition at the /git/guide-maven-multimodules/finish/ear/target/liberty/wlp/usr/servers/defaultServer/apps/io.openliberty.guides.multimodules.ear-0.0.1-SNAPSHOT.ear.xml location.
[10/26/19 12:10:53:815 CEST] 00000026 com.ibm.ws.session.WASSessionCore                            I SESN8501I: The session manager did not find a persistent storage location; HttpSession objects will be stored in the local application server's memory.
[10/26/19 12:10:53:826 CEST] 00000026 com.ibm.ws.webcontainer.osgi.webapp.WebGroup                 I SRVE0169I: Loading Web Module: Archetype Created Web Application.
[10/26/19 12:10:53:827 CEST] 00000026 com.ibm.ws.webcontainer                                      I SRVE0250I: Web Module Archetype Created Web Application has been bound to default_host.
[10/26/19 12:10:53:830 CEST] 00000026 com.ibm.ws.app.manager.AppMessageHelper                      A CWWKZ0001I: Application io.openliberty.guides.multimodules.ear started in 0.205 seconds.
[10/26/19 12:10:53:842 CEST] 0000001f com.ibm.ws.kernel.feature.internal.FeatureManager            A CWWKF0012I: The server installed the following features: [el-3.0, jsp-2.3, servlet-3.1].
[10/26/19 12:10:53:843 CEST] 0000001f com.ibm.ws.kernel.feature.internal.FeatureManager            I CWWKF0008I: Feature update completed in 0.568 seconds.
[10/26/19 12:10:53:843 CEST] 0000001f com.ibm.ws.kernel.feature.internal.FeatureManager            A CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 1.067 seconds.
[10/26/19 12:10:53:847 CEST] 00000029 com.ibm.ws.session.WASSessionCore                            I SESN0176I: A new session context will be created for application key default_host/converter
[10/26/19 12:10:53:861 CEST] 00000029 com.ibm.ws.util                                              I SESN0172I: The session manager is using the Java default SecureRandom implementation for session ID generation.
[10/26/19 12:10:53:868 CEST] 0000002a com.ibm.ws.webcontainer.osgi.mbeans.PluginGenerator          I SRVE9103I: A configuration file for a web server plugin was automatically generated for this server at /git/guide-maven-multimodules/finish/ear/target/liberty/wlp/usr/servers/defaultServer/logs/state/plugin-cfg.xml.


Test the application

Deploy Java EE7 app into Weblogic Docker domain using Maven

$
0
0
Weblogic 12.2.1.4

General HOWTO

 Create Weblogic Docker image

See blogpost https://danielveselka.blogspot.com/2017/10/build-weblogic-docker-image.html

Create Weblogic generic Docker domain
See sample  from Oracle
https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain

Weblogic installers
https://www.oracle.com/middleware/technologies/weblogic-server-installers-downloads.html
12.2.1.4 now also has SLIM image  - interesting for Kubernetes deployment

 The WebLogic slim image is supported for development and production deployment of WebLogic configurations using Docker. In order to reduce image size, it contains a subset of the binaries included in the WebLogic generic image. The WebLogic console, WebLogic examples, WebLogic clients, Maven plug-ins and Java DB have been removed - all binaries that remain included are the same as those in the WebLogic generic image. The WebLogic slim image is primarily intended for WebLogic domains managed with the WebLogic Kubernetes Operator, when WLS console-based monitoring and configuration is not required, and a smaller image size than the generic image is preferred. If there are requirements to monitor the WebLogic configuration, they should be addressed using Prometheus and Grafana or other alternatives. All servers within a domain managed with the Operator will use the same WebLogic image. Support is also provided for environments where Kubernetes and/or the WebLogic Kubernetes Operator is not being used.

Get the sample code


Clone the modified code from https://github.com/dveselka/weblogic

 https://github.com/dveselka/weblogic/tree/master/docker-domain

Install generic Weblogic - required for Oracle Maven  repo configuration
[dave@localhost Downloads]$ java -jar fmw_12.2.1.4.0_wls.jar


Configure Oracle Maven  repository


https://blogs.oracle.com/weblogicserver/docker,-java-ee-7,-and-maven-with-weblogic-1213-v2

https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-server/12.2.1.4/wlprg/maven.html#GUID-C6FC7582-2D1C-4EA5-B000-71AE9A2F2B05
 cd ./oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.2.1

[dave@localhost 12.2.1]$ mvn install:install-file -DpomFile=oracle-maven-sync-12.2.1.pom -Dfile=oracle-maven-sync-12.2.1.jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing /app/weblogic/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.2.1/oracle-maven-sync-12.2.1.jar to /home/dave/.m2/repository/com/oracle/maven/oracle-maven-sync/12.2.1-4-0/oracle-maven-sync-12.2.1-4-0.jar
[INFO] Installing /app/weblogic/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.2.1/oracle-maven-sync-12.2.1.pom to /home/dave/.m2/repository/com/oracle/maven/oracle-maven-sync/12.2.1-4-0/oracle-maven-sync-12.2.1-4-0.pom

mvn com.oracle.maven:oracle-maven-sync:push -DoracleHome=/app/weblogic

[INFO] SUMMARY
[INFO] ------------------------------------------------------------------------
[INFO] PUSH SUMMARY - ARTIFACTS PROCESSED SUCCESSFULLY
[INFO] ------------------------------------------------------------------------
[INFO] Number of artifacts pushed: 1267
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] PUSH SUMMARY - ERRORS ENCOUNTERED
[INFO] ------------------------------------------------------------------------
[INFO] No issues encountered.
[INFO]
[INFO] IMPORTANT NOTE
[INFO] This operation may have added/updated archetypes in your repository.
[INFO] To update your archetype catalog, you should run:
[INFO] 'mvn archetype:crawl -Dcatalog=$HOME/.m2/archetype-catalog.xml'


[dave@localhost 12.2.1]$ find /home/dave/.m2/repository/com/oracle -name weblogic-maven-plugin
/home/dave/.m2/repository/com/oracle/weblogic/weblogic-maven-plugin

[dave@localhost 12.2.1]$ ls -l /home/dave/.m2/repository/com/oracle/weblogic/weblogic-maven-plugin
total 16
drwxrwxr-x. 2 dave dave 4096 Oct 27 12:40 12.2.1-0-0
drwxrwxr-x. 2 dave dave 4096 Oct 27 12:01 12.2.1-2-0
drwxrwxr-x. 2 dave dave 4096 Oct 27 12:38 12.2.1-4-0

Validate the installed Weblogic Maven plugin

mvn help:describe -DgroupId=com.oracle.weblogic -DartifactId=weblogic-maven-plugin -Dversion=12.2.1-4-0



Name: weblogic-maven-plugin
Description: The Oracle WebLogic Server 12.2.1 Maven plugin
Group Id: com.oracle.weblogic
Artifact Id: weblogic-maven-plugin
Version: 12.2.1-4-0
Goal Prefix: weblogic

This plugin has 23 goals:

weblogic:appc
  Description: This goal is a wrapper for the weblogic.appc compiler.

weblogic:create-domain
  Description: Create a domain for WebLogic Server using the default domain
    template. For more complex domain creation use the WLST goal. Note:
    Starting in WLS 12.2.1, there is a single unified version of WLST that
    automatically includes the WLST environment from all products in the
    ORACLE_HOME.

weblogic:deploy
  Description: Deploys an application to WebLogic Server (supports all
    formats WAR, JAR, RAR, EAR, etc.)

weblogic:distribute-app
  Description: Prepares deployment files for deployment by copying deployment
    files to target servers and validating them.

weblogic:install
  Description: Installs WebLogic Server

weblogic:list-apps
  Description: Lists the deployment names for applications and stand-alone
    modules deployed distributed, or installed to the domain

weblogic:purge-tasks
  Description: Flushes out retired deployment tasks

weblogic:redeploy
  Description: Redeploys a running application or part of a running
    application

weblogic:remove-domain
  Description: This class provides basic capabilities to remove a domain
    directory.

weblogic:start-app
  Description: Starts an application

weblogic:start-server
  Description: Starts WebLogic Server.

weblogic:stop-app
  Description: Stops an application

weblogic:stop-server
  Description: This goals run a stop script to stop WebLogic Server.

weblogic:undeploy
  Description: Stops the deployment unit and removes staged files from target
    servers

weblogic:uninstall
  Description: Uninstalls WebLogic Server

weblogic:update-app
  Description: Updates an application's deployment plan by redistributing the
    plan files and reconfiguring the application based on the new plan
    contents.

weblogic:wlst
  Description: This goal is a wrapper for the WLST scripting tool.
    Note: Starting in WLS 12.2.1, there is a single unified version of WLST
    that automatically includes the WLST environment from all products in the
    ORACLE_HOME.

weblogic:wlst-client
  Description: WLST wrapper for Maven that does not require a server install
    for WLST online commands.

weblogic:ws-clientgen
  Description: A Maven goal to generate client web service artifacts from a
    WSDL Note the differences between clientgen Ant task and Maven goal:
    clientgen goal only generates JAXWS web service artifacts, while Ant task
    has JAXRPC as the default. At the moment there is no way to direct
    clientgen goal to also compile and package generated artifacts.
  Deprecated. No reason given

weblogic:ws-jwsc
  Description: This goal builds a JAX-WS web service, generates source code,
    data binding artifacts, deployment descriptors, and so on into an output
    directory.
  Deprecated. No reason given

weblogic:ws-wsdlc
  Description: This goal generates, from an existing WSDL file, a set of
    artifacts that together provide a partial Java implementation of the Web
    Service described by the WSDL file.
  Deprecated. No reason given

weblogic:wsgen
  Description: Reads a JAX-WS service endpoint implementation class and
    generates all of the portable artifacts for a JAX-WS web service.

weblogic:wsimport
  Description: Parses wsdl and binding files and generates Java code needed
    to access it.

For more information, run 'mvn help:describe [...] -Ddetail'


Configure the properties for the Docker Weblogic domain


Set the weblogic Admin user/password in
./docker-domain/OracleWebLogic/samples/12214-domain-generic/properties/domain_security.properties


Create the domain using ./docker-domain/OracleWebLogic/samples/12214-domain-generic/build.sh

docker build -f Dockerfile -t 12214-weblogic-domain-generic .


This creates Docker image

[dave@localhost weblogic]$ docker images
REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
12214-weblogic-domain-generic   latest              0c7c40704362        43 minutes ago      1.26GB


Change the domain Docker image name in run_admin_server.sh script
./docker-domain/OracleWebLogic/samples/12214-domain-generic/run_admin_server.sh

[dave@localhost weblogic]$ grep 12214-weblogic-domain-generic ./docker-domain/OracleWebLogic/samples/12214-domain-generic/run_admin_server.sh
echo "docker run -d -p 9001:7001 -p 9002:9002 --name ${adminhost} --hostname ${adminhost} -v ${scriptDir}/properties:/u01/oracle/properties -v ${domainhostvol}:/u01/oracle/user_projects/domains ${ENV_ARG} 12214-weblogic-domain-generic"
docker run -d -p 9001:7001 -p 9002:9002 --name ${adminhost} --hostname ${adminhost} -v ${scriptDir}/properties:/u01/oracle/properties -v ${domainhostvol}:/u01/oracle/user_projects/domains ${ENV_ARG} 12214-weblogic-domain-generic



List of required images
[dave@localhost 12214-domain-generic]$ docker images
REPOSITORY                      TAG                 IMAGE ID            CREATED              SIZE
12214-weblogic-domain-generic   latest              93dc22395c42        14 seconds ago       1.26GB
oracle/weblogic                 12.2.1.4-generic    b67e91a22473        46 seconds ago       1.26GB
<none>                          <none>              ba227fc7cf16        About a minute ago   2.99GB
oracle/serverjre                8                   639ea570f133        4 hours ago          356MB
oraclelinux                     7-slim              874477adb545        2 months ago         118MB


Create directory on localhost where the Docker domain volume will be mapped - in our test /app/domains/

Run the domain


[dave@localhost 12213-domain]$ ./run_admin_server.sh 
Context for docker build is /git/docker-images/OracleWebLogic/samples/12213-domain
Export environment variables from the /git/docker-images/OracleWebLogic/samples/12213-domain/properties/domain.properties properties file
 env_arg: CUSTOM_DOMAIN_NAME=daveDomain
 env_arg: CUSTOM_ADMIN_NAME=admin
 env_arg: CUSTOM_ADMIN_PORT=7001
 env_arg: CUSTOM_ADMIN_HOST=AdminContainer
 env_arg: CUSTOM_MANAGED_SERVER_PORT=8001
 env_arg: CUSTOM_MANAGED_SERVER_NAME_BASE=MS
 env_arg: CUSTOM_CONFIGURED_MANAGED_SERVER_COUNT=2
 env_arg: CUSTOM_CLUSTER_NAME=clusterdave
 env_arg: CUSTOM_CLUSTER_TYPE=DYNAMIC
 env_arg: CUSTOM_PRODUCTION_MODE_ENABLED=true
 env_arg: CUSTOM_DOMAIN_HOST_VOLUME=/app/domains/
The domain configuration will get persisted in the host volume: /app/domains/
docker run -d -p 9001:7001 -p 9002:9002 --name AdminContainer --hostname AdminContainer -v /git/docker-images/OracleWebLogic/samples/12213-domain/properties:/u01/oracle/properties -v /app/domains/:/u01/oracle/user_projects/domains  -e CUSTOM_DOMAIN_NAME=daveDomain -e CUSTOM_ADMIN_NAME=admin -e CUSTOM_ADMIN_PORT=7001 -e CUSTOM_ADMIN_HOST=AdminContainer -e CUSTOM_ADMIN_HOST=AdminContainer -e CUSTOM_MANAGED_SERVER_PORT=8001 -e CUSTOM_MANAGED_SERVER_NAME_BASE=MS -e CUSTOM_CONFIGURED_MANAGED_SERVER_COUNT=2 -e CUSTOM_CLUSTER_NAME=clusterdave -e CUSTOM_CLUSTER_TYPE=DYNAMIC -e CUSTOM_PRODUCTION_MODE_ENABLED=true 12214-weblogic-domain-slim
42999c43bffe7bd381031c07567d4aa9893a23247190cbdb18659cae9c228b33
[dave@localhost 12213-domain]$ docker ps
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS              PORTS                                            NAMES
42999c43bffe        12214-weblogic-domain-slim   "/u01/oracle/contain…"   5 seconds ago       Up 3 seconds        0.0.0.0:9002->9002/tcp, 0.0.0.0:9001->7001/tcp   AdminContainer
[dave@localhost 12213-domain]$ pgrep -a java
7367 /usr/java/jdk-8/bin/java -server -Djava.security.egd=file:/dev/./urandom -cp /u01/oracle/wlserver/server/lib/weblogic-launcher.jar -Dlaunch.use.env.classpath=true -Dweblogic.Name=admin -Djava.security.policy=/u01/oracle/wlserver/server/lib/weblogic.policy -Doracle.jdbc.fanEnabled=false -Dweblogic.StdoutDebugEnabled=false -Djava.system.class.loader=com.oracle.classloader.weblogic.LaunchClassLoader -javaagent:/u01/oracle/wlserver/server/lib/debugpatch-agent.jar -da -Dwls.home=/u01/oracle/wlserver/server -Dweblogic.home=/u01/oracle/wlserver/server weblogic.Server
[dave@localhost 12213-domain]$ ls /app/domains/
daveDomain


Deploy the application code using Maven


Set the latest version of weblogic-maven-plugin

<plugin>
        <groupId>com.oracle.weblogic</groupId>
        <artifactId>weblogic-maven-plugin</artifactId>
        <version>12.2.1-4-0</version>


Maven plugin goals

 https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-server/12.2.1.4/wlprg/maven.html#GUID-CE12CFF4-EB0C-4E92-A13A-676AAD854663

SSH into container to check upload
docker exec -it  2f1af983d72d /bin/bash


Configure upload in Maven weblogic plugin

WAR is uploaded into Docker domain
[oracle@AdminContainer /]$ find . -name "rs-api.war" 2>/dev/null
./u01/oracle/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/rs-api/m49v6j/META-INF/.WL_internal/cache/rs-api.war
./u01/oracle/user_projects/domains/daveDomain/servers/admin/upload/rs-api/app/rs-api.war
./u01/oracle/user_projects/domains/daveDomain/servers/admin/tmp/.appmergegen_1572188440153_rs-api.war/META-INF/.WL_internal/cache/rs-api.war
./u01/oracle/user_projects/domains/daveDomain/servers/admin/tmp/.appmergegen_1572188440153/rs-api.war
./u01/oracle/user_projects/domains/daveDomain/servers/admin/tmp/_WL_user/rs-api/w7yf0e/META-INF/.WL_internal/cache/rs-api.war



Without upload you get following error
ERROR] Failed to execute goal com.oracle.weblogic:weblogic-maven-plugin:12.2.1-4-0:deploy (default) on project rs-api: weblogic.management.ManagementException: [Deployer:149003]Unable to access application source information in "/app/domains/apps/rs-api.war" for application "rs-api". The specific error is: No application files exist.
[ERROR]     at weblogic.deploy.internal.adminserver.operations.OperationHelper.validateSource(OperationHelper.java:358)
[ERROR]     at weblogic.deploy.internal.adminserver.operations.OperationHelper.getArchiveVersionIdFromSource(OperationHelper.java:168)
[ERROR]     at weblogic.deploy.internal.adminserver.operations.OperationHelper.getAndValidateVersionIdWithSrc(OperationHelper.java:206)


in case of unreachable admin you can try to add JAVA Option with the flag “-Dweblogic.rjvm.enableprotocolswitch=true
See also https://github.com/oracle/docker-images/issues/575


<plugin>
        <groupId>com.oracle.weblogic</groupId>
        <artifactId>weblogic-maven-plugin</artifactId>
        <version>12.2.1-4-0</version>
        <!--
        You can find and redefine the following variables in the parent pom file arccording to your environment.
 
        oracleMiddlewareHome
        oracleServerUrl
        oracleUsername
        oraclePassword
        oracleServerName
        -->
        <configuration>
          <middlewareHome>${oracleMiddlewareHome}</middlewareHome>
        </configuration>
        <executions>
          <!--Deploy the application to the server-->
          <execution>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
            <configuration>
              <!--The admin URL where the app is deployed. Here use the plugin's default value t3://localhost:7001-->
              <adminurl>${oracleServerUrl}</adminurl>
              <user>${oracleUsername}</user>
              <password>${oraclePassword}</password>
              <!--The location of the file or directory to be deployed-->
              <source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>
              <!--The target servers where the application is deployed. Here use the plugin's default value AdminServer-->
              <!--targets>${oracleServerName}</targets-->
              <verbose>true</verbose>
              <!--The deployment name of the application-->
              <name>${project.build.finalName}</name>
              <upload>true</upload>
            </configuration>
          </execution>
        </executions>
      </plugin>


 

Deploy the app into Docker Weblogic domain

Sample application code is here https://github.com/dveselka/weblogic/tree/master/rs-api

dave@localhost rs-api]$ mvn clean package pre-integration-test
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.dave:rs-api >---------------------------
[INFO] Building rs-api 1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ rs-api ---
[INFO] Deleting /git/weblogic/rs-api/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ rs-api ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /git/weblogic/rs-api/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ rs-api ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 4 source files to /git/weblogic/rs-api/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ rs-api ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /git/weblogic/rs-api/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ rs-api ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ rs-api ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ rs-api ---
[INFO] Packaging webapp
[INFO] Assembling webapp [rs-api] in [/git/weblogic/rs-api/target/rs-api]
[INFO] Processing war project
[INFO] Copying webapp resources [/git/weblogic/rs-api/src/main/webapp]
[INFO] Webapp assembled in [15 msecs]
[INFO] Building war: /git/weblogic/rs-api/target/rs-api.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ rs-api ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /git/weblogic/rs-api/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ rs-api ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 4 source files to /git/weblogic/rs-api/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ rs-api ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /git/weblogic/rs-api/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ rs-api ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ rs-api ---
[INFO] No tests to run.
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ rs-api ---
[INFO] Packaging webapp
[INFO] Assembling webapp [rs-api] in [/git/weblogic/rs-api/target/rs-api]
[INFO] Processing war project
[INFO] Copying webapp resources [/git/weblogic/rs-api/src/main/webapp]
[INFO] Webapp assembled in [2 msecs]
[INFO] Building war: /git/weblogic/rs-api/target/rs-api.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] --- weblogic-maven-plugin:12.2.1-4-0:deploy (default) @ rs-api ---
[INFO] Command flags are: -noexit -deploy -username myusername -password ******* -name rs-api -source /git/weblogic/rs-api/target/rs-api.war -upload -verbose -adminurl t3://localhost:9001
weblogic.Deployer invoked with options:  -noexit -deploy -username myusername -name rs-api -source /git/weblogic/rs-api/target/rs-api.war -upload -verbose -adminurl t3://localhost:9001
<Oct 27, 2019 2:12:33 PM CET> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, rs-api [archive: /git/weblogic/rs-api/target/rs-api.war], to configured targets.>
Task 5 initiated: [Deployer:149026]deploy application rs-api on admin.
Task 5 completed: [Deployer:149026]deploy application rs-api on admin.
Target state: deploy completed on Server admin

Target Assignments:
+ rs-api  admin
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.768 s
[INFO] Finished at: 2019-10-27T14:12:34+01:00
[INFO] ------------------------------------------------------------------------

Check the running domain

[dave@localhost rs-api]$ docker ps
CONTAINER ID        IMAGE                           COMMAND                  CREATED             STATUS              PORTS                                            NAMES
2f1af983d72d        12214-weblogic-domain-generic   "/u01/oracle/contain…"   22 minutes ago      Up 22 minutes       0.0.0.0:9002->9002/tcp, 0.0.0.0:9001->7001/tcp   AdminContainer
[dave@localhost rs-api]$ pgrep -a java
25383 /usr/java/jdk-8/bin/java -Djava.security.manager -Djava.security.policy=/u01/oracle/wlserver/common/derby/derbyServer.policy -Dderby.system.home=/u01/oracle/user_projects/domains/daveDomain/common/db -classpath /u01/oracle/wlserver/common/derby/lib/derby.jar:/u01/oracle/wlserver/common/derby/lib/derbynet.jar:/u01/oracle/wlserver/common/derby/lib/derbytools.jar:/u01/oracle/wlserver/common/derby/lib/derbyoptionaltools.jar:/u01/oracle/wlserver/common/derby/lib/derbyclient.jar org.apache.derby.drda.NetworkServerControl start
25384 /usr/java/jdk-8/bin/java -server -Djava.security.egd=file:/dev/./urandom -cp /u01/oracle/wlserver/server/lib/weblogic-launcher.jar -Dlaunch.use.env.classpath=true -Dweblogic.Name=admin -Djava.security.policy=/u01/oracle/wlserver/server/lib/weblogic.policy -Doracle.jdbc.fanEnabled=false -Dweblogic.StdoutDebugEnabled=false -Dweblogic.rjvm.enableprotocolswitch=true -Djava.system.class.loader=com.oracle.classloader.weblogic.LaunchClassLoader -javaagent:/u01/oracle/wlserver/server/lib/debugpatch-agent.jar -da -Dwls.home=/u01/oracle/wlserver/server -Dweblogic.home=/u01/oracle/wlserver/server weblogic.Server

Test the app


[dave@localhost rs-api]$ curl http://localhost:9001/rs-api/resources/persons
[{"age":50,"name":"dave"},{"age":30,"name":"abc"}



Viewing all 181 articles
Browse latest View live