Skip to content

Instantly share code, notes, and snippets.

@chongma
chongma / KeycloakToken.java
Created September 14, 2018 21:47
Keycloak token
private HomeConveyToken tokenProduction() {
String realmPath = "https://secure.thing.com/auth/realms/thing-production/protocol/openid-connect/token";
WebClient wc = WebClient.create(realmPath);
Form form = new Form();
form.param("grant_type", "password");
form.param("client_id", "clientname");
form.param("client_secret", "xxxxxxxxxxx etc");
form.param("username", username);
form.param("password", password);
return wc.post(form, KeycloakToken.class);
12-Dec-2018 16:41:06.349 WARNING [main] sun.reflect.NativeMethodAccessorImpl.invoke Problem with directory [/home/matthew/git/case-management/deployment/target/apache-tomee/lib/keycloak], exists: [false], isDirectory: [false], canRead: [false]
12-Dec-2018 16:41:06.747 WARNING [main] sun.reflect.NativeMethodAccessorImpl.invoke [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:nbmclient' did not find a matching property.
12-Dec-2018 16:41:06.754 WARNING [main] sun.reflect.NativeMethodAccessorImpl.invoke [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:admin' did not find a matching property.
12-Dec-2018 16:41:06.755 WARNING [main] sun.reflect.NativeMethodAccessorImpl.invoke [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:bill' did not find a matching property.
12-Dec-2018 16:41:06.755 WARNING [main] sun.reflect.NativeMetho
package com.test;
import java.io.InputStream;
import javax.ws.rs.Consumes;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
import org.apache.johnzon.mapper.Mapper;
import org.apache.johnzon.mapper.MapperBuilder;
// at line 12 scaleFee.getScaleFeeItems() is in the right order but end of transaction does not reflect this
// @OneToMany(mappedBy = "scaleFee", cascade = CascadeType.ALL, orphanRemoval = true)
// @OrderColumn
// private List<ScaleFeeItem> scaleFeeItems;
@Transactional
public boolean createScaleFeeScaleFeeItem(Long id) {
ScaleFee scaleFee = scaleFeeDb.selectScaleFee(id);
if (scaleFee != null) {
ScaleFeeItem scaleFeeItem = new ScaleFeeItem(scaleFee, BigDecimal.ZERO, BigDecimal.ZERO, false);
scaleFee.getScaleFeeItems().add(scaleFeeItem);
package uk.me.kissy.database.entities.jpa.sales;
import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
25-Apr-2020 17:26:46.871 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Server version name: Apache Tomcat (TomEE)/9.0.22 (8.0.0)
25-Apr-2020 17:26:46.871 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Server built: Jul 4 2019 14:20:06 UTC
25-Apr-2020 17:26:46.871 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Server version number: 9.0.22.0
25-Apr-2020 17:26:46.871 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke OS Name: Linux
25-Apr-2020 17:26:46.871 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke OS Version: 5.5.15-200.fc31.x86_64
25-Apr-2020 17:26:46.872 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Architecture: amd64
25-Apr-2020 17:26:46.872 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Java Home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.fc31.x86_64/jre
25-Apr-2020 17:26:46.872 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke JVM Version: 1.8.0_242-b08
25-Apr-20
25-Apr-2020 17:26:46.871 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Server version name: Apache Tomcat (TomEE)/9.0.22 (8.0.0)
25-Apr-2020 17:26:46.871 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Server built: Jul 4 2019 14:20:06 UTC
25-Apr-2020 17:26:46.871 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Server version number: 9.0.22.0
25-Apr-2020 17:26:46.871 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke OS Name: Linux
25-Apr-2020 17:26:46.871 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke OS Version: 5.5.15-200.fc31.x86_64
25-Apr-2020 17:26:46.872 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Architecture: amd64
25-Apr-2020 17:26:46.872 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Java Home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.fc31.x86_64/jre
25-Apr-2020 17:26:46.872 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke JVM Version: 1.8.0_242-b08
25-Apr-20
<?xml version="1.0" encoding="UTF-8"?>
<!-- <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> -->
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="conveyancing">
<jta-data-source>conveyancing</jta-data-source>
package com.test.api.events;
import java.io.IOException;
import java.time.Duration;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import javax.ejb.Lock;
import javax.ejb.LockType;
@chongma
chongma / AppDescriptor.java
Created July 9, 2021 09:37
Resource adapter loads but deployments not found
package org.superbiz;
import java.io.PrintWriter;
import java.net.URL;
import java.util.Set;
import javax.annotation.Resource;
import javax.naming.NamingException;
import javax.naming.Reference;
import javax.resource.ResourceException;