Validation JSR-303 benchmarking

http://carinae.net/2010/06/benchmarking-hibernate-validator-and-apache-beanvalidation-the-two-jsr-303-implementations/ Apache BeanValidation Formerly Agimatec Validation, since March 2010 it has migrated to Apache where it is currently under incubation. One of its most useful extra features is the ability to perform method validation using the same kind of JSR-303 annotations. The benchmarked version is: 0.1-incubating. Hibernate Validator The reference implementation of the standard, coming […]

Read more

Purging connections from JDBC connection pool

http://docs.oracle.com/cd/E24329_01/web.1211/e24376/phys_conr.htm#JDBCP1037 http://docs.tpu.ru/docs/oracle/en/fmw/11.1.1.6.0/apirefs.1111/e13941/toc.htm   There are special tasks when we need to explicitly close physical connection to the database: clean errors on the connection for example. General standard solution does not exist but for WebLogic data source we can do the following: 1. Ensure that “Remove Infected Connections Enabled” option is set to true; true is […]

Read more

Configuring SSL for WebLogic managed server

General considerations: https://timtaubert.de/blog/2014/10/deploying-tls-the-hard-way/ To check current SSL/TLS version and cipher suite used for SSL connections: $ openssl s_client -connect hostname:8888 example output: New, TLSv1/SSLv3, Cipher is AES128-SHA Server public key is 2048 bit Secure Renegotiation IS supported Compression: NONE Expansion: NONE SSL-Session: Protocol  : TLSv1 Cipher    : AES128-SHA Session-ID: 5523B18F98C687FD8E76527F827E86EA47C603C8D105DF1D5428468A83ACA7D5 Session-ID-ctx: Master-Key: 7C2824A28A3722A8072082D6CB69ED3C2D6DA669B7D46E4FC994AFB71150B324A0D55E59569377FF9C93A8DF0DE80BE1 Key-Arg   : […]

Read more

Configuring Java-based Node Manager

Create script for managing Node Manager script: /etc/init.d/nodemgr. Register it as a service start/stop script: #  chkconfig –add nodemgr Now we may start and stop the service as: # service nodemgr start # service nodemgr stop   ———————————————————————————————————————————- #!/bin/sh # # nodemgr Oracle Weblogic NodeManager service # ### BEGIN INIT INFO # Provides: nodemgr # […]

Read more

Configuring Script-based Node Manager

Further it is supposed that WebLogic server is already installed on the machine and domains are configured. Let us take “base_domain” as the domain name in the following example commands. 1. Create OS user > useradd -g bea -m ndmgr > passwd ndmgr add WL_HOME/common/bin to the PATH variable. It is recommended that node manager […]

Read more

JSF: button and commandButton difference

http://stackoverflow.com/questions/13070537/difference-between-hbutton-and-hcommandbutton The <h:button> generates a HTML <input type=”button”> which uses JavaScript to navigate to URL as represented by the given navigation case outcome by a HTTP GET request. E.g. <h:button value=”GET button” outcome=”otherpage” /> will generate <input type=”button” onclick=”window.location.href=’/contextpath/otherpage.xhtml’; return false;” value=”GET button” /> Even though this ends up in a (bookmarkable) URL change in […]

Read more

Configuring datasource on Tomcat

Add Resource tag into Context, for example^ <Resource name=”jdbc/PostgreDS” auth=”Container” type=”javax.sql.DataSource” driverClassName=”org.postgresql.Driver” url=”jdbc:postgresql://127.0.0.1:5432/schema” username=”schema” password=”1234″ maxActive=”50″ maxIdle=”10″ maxWait=”-1″/> <Resource name=”jdbc/MysqlDS” auth=”Container” type=”javax.sql.DataSource” driverClassName=”com.mysql.jdbc.Driver” url=”jdbc:mysql://localhost:3306/schema” username=”user” password=”1234″ maxActive=”50″ maxIdle=”10″ maxWait=”-1″/>  

Read more

IO Streams

http://tutorials.jenkov.com/java-io/overview.html   Byte Based Character Based Input Output Input Output Basic InputStream OutputStream Reader InputStreamReader Writer OutputStreamWriter Arrays ByteArrayInputStream ByteArrayOutputStream CharArrayReader CharArrayWriter Files FileInputStream RandomAccessFile FileOutputStream RandomAccessFile FileReader FileWriter Pipes PipedInputStream PipedOutputStream PipedReader PipedWriter Buffering BufferedInputStream BufferedOutputStream BufferedReader BufferedWriter Filtering FilterInputStream FilterOutputStream FilterReader FilterWriter Parsing PushbackInputStream StreamTokenizer PushbackReader LineNumberReader Strings StringReader StringWriter Data DataInputStream DataOutputStream […]

Read more

How to run jsf 2.0 on Weblogic 10

1. Minimal Weblogic version number should be 10.3.6. This release contains jsf 2.0 implementation as a jar file that should be installed separately. We deploy $WEBLOGIC_HOME/modules/javax.jsf_1.1.0.0_1-2.jar as a library onto Weblogic server. 2. Our application should contain: in web.xml: <context-param> <param-name>com.sun.faces.expressionFactory</param-name> <param-value>com.sun.el.ExpressionFactoryImpl</param-value> </context-param> in weblogic.xml: <library-ref> <library-name>jsf</library-name> <specification-version>2.0</specification-version> <implementation-version>1.0.0.0_2-0-2</implementation-version> <exact-match>true</exact-match> </library-ref> <container-descriptor> <prefer-application-packages> <package-name>com.sun.el.*</package-name> <package-name>javax.el.*</package-name> […]

Read more

GlassFish: how to reset admin password

How to Recover Glassfish admin password Replace the file “admin-keyfile” under “/installation-folder/glassfish/domains/domain1/config/” with same of any of working domains file. So that password will be same used in domains used earlier and you may change the password once after the login. For glassfish 4, the content of admin-keyfile for password “changit” is: admin;{SSHA256}dvCEGFNHGtSyXIhJvwR5FnviH+u8fCadrUIqp6uJc1tP9Bv10CGT7A==;asadmin The content […]

Read more

Adding pem private key and a certificate into jks for use as an identity

0.1 If do not have a certificate, could create a self-signed certificate: (the following command requires password) openssl genrsa -des3 -out server.key 2048 openssl req -new -key server.key -out server.csr (you may add -sha256 to get SHA256 signarure) openssl x509 -req -days 730 -in server.csr -signkey server.key -out server.crt or even better, one-liner without password: […]

Read more

How to use JVM as a daemon process

http://shrubbery.mynetgear.net/c/display/W/Java+Daemon+Startup+Script See also: http://www.source-code.biz/snippets/java/7.htm JBoss Daemon Startup Script Waiting for a process to stop Here is the CentOS/RedHat/Ubuntu version of the SUSE script: #!/bin/bash # # chkconfig: 345 99 05 # description: Java deamon script # # A non-SUSE Linux start/stop script for Java daemons. # # Derived from – # Home page: http://www.source-code.biz # […]

Read more

WebLogic и IPv6

How to enable IPV6 addresses If you have upgraded to configured network channel with IPV6 listen address on Weblogic managed servers. Then, you need to do below steps to make sure Weblogic automatically differentiate the IPV4 and IPV6 traffic with the default and IPV6 network channels only. Add below two JVM arguments to the startup […]

Read more

WebLogic и JMX

Чтобы управлять экземпляром сервера WebLogic 10.3 нужны библиотеки: wljmxclient.jar wlclient.jar которые лежат в директории: $ORACLE_MIDDLEWARE_HOME/wlserver_10.3/server/lib обзор Managed Beans через jconsole: jconsole -J-Djava.class.path=$JAVA_HOME\lib\jconsole.jar;wljmxclient.jar;wlclient.jar -J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote -J-Dcom.sun.tools.jconsole.mbeans.keyPropertyList=type,Type,j2eeType,name,Name -debug затем для подключения: service:jmx:t3://hostname.ru:8080/jndi/weblogic.management.mbeanservers.domainruntime либо service:jmx:t3://hostname.ru:8080/jndi/weblogic.management.mbeanservers.edit В качестве имени-пароля можно использовать административную учетную запись. Нужно иметь в виду, что могут возникнуть проблемы, если библиотеки будут от более младшей версии WebLogic, […]

Read more

Примеры использования JSch

http://wiki.jsch.org Here’s a minimalistic example of Public Key Authentcation. It is adapted from JSCH examples, but I have stripped out the GUI etc. import com.jcraft.jsch.*; public class UserAuthPubKey{ public static void main(String[] arg){ String pubkeyfile=”/home/cr/users/anand/.ssh/id_dsa”; String passphrase=””; String host=”gs00″, user=”root”; try{ JSch jsch=new JSch(); jsch.addIdentity(pubkeyfile); // jsch.addIdentity(pubkeyfile, passphrase); jsch.setKnownHosts(“/home/cr/users/anand/.ssh/known_hosts”); Session session=jsch.getSession(user, host, 22); session.connect(); Channel […]

Read more