Thursday, January 26, 2017

JBOSS5 DEBUG THRESHHOLD setting

add following for JBoss Lauch configuration -Djboss.server.log.threshold=DEBUG

Wednesday, January 25, 2017

force https post use TLS version 1.2

String protocol = "TLSv1.2"; try { SSLContext ctx5 = SSLContext.getInstance(protocol); ctx5.init(null, null, null); SSLContext.setDefault(ctx5); System.out.println("get default.."); } catch (Exception e) { System.out.println("could not set"); }

add soap authentication header in soap request

VinDecodingServiceServiceLocator locator = new VinDecodingServiceServiceLocator(); VinDecodingService_PortType service = locator.getVinDecodingService(new URL("https://host_ip/apis/services/VinDecodingService")); org.apache.axis.client.Stub stub = (org.apache.axis.client.Stub) service; SOAPHeaderElement header = new SOAPHeaderElement("urn:yournamespace", "AuthenticationHeader"); SOAPElement node = header.addChildElement("username"); node.addTextNode("joedone"); SOAPElement node1 = header.addChildElement("password"); node1.addTextNode("8b67e624r"); ((Stub) service).setHeader(header); stub.setHeader(header); VinDecodingResponse res = service.decode("US", 233706, "PRIOS", "2C4RC1BG1ER178205"); //test System.out.println(res.getStatus())

Friday, September 23, 2016

dump a java process threads

jstack -l JAVA_PID > jstack.out

remote monitor and dump the java process

remote monitor and dump the java process: 1) in the machine that java process is running. create following filw with content: file name:jstatd.all.policy content: grant codebase "file:${java.home}/../lib/tools.jar" { permission java.security.AllPermission; }; do not change the above content, event in windows, the path even looks not reflect right path. 2) start jstatd with following way with exactly copy jstatd -J-Djava.security.policy=jstatd.all.policy 3) in remnote monitoring machine, start jvisualVM add remote machine name or IP, the java process will be fecthed, you can monitor and profile now.

Thursday, August 18, 2016

build a jdk rt.jar with debug option

1)download the src.zip for your jdk 2)unzip src.zip into a tmp/src folder:unzip src.zip -d /src 3)get list of all java class into a file: find -name "*.java* > files.txt 4)compile all java files:javac -verbose -g -d ..\out -J-Xmx2048m -cp c:\jdk7u80\jre\lib\rt.jar;c:\jdk7u80\lib\tools.jar @files.txt 5)create jar file:cd tmp\out; jar cvf rt.jar * 6)copy the rt.jar into jdk\jre\lib\endorsed

Wednesday, August 17, 2016

Log4J appender format

here is the best log4J appender ConversionPattern value "%d{MM/dd/yyyy hh:mm:ss aa} [%-5p] [%c{1}] - %m%n", it approved working it print out the date time, log type and class name and message remember put it in the appender you expected, because we might have mutiple appender, one for file, one for console, etc.