Wednesday, April 6, 3014

Welcome

The intent of the this blog is to provide a online resource for odd ends and notes I have related to application administration.

Tuesday, October 21, 2014

Show lightweight threads


sort parta.lwt -k 5 |awk '{printf "HEX %x \n", "CPU" $5}'

sort parta.lwt -k 5 |awk '{printf "TOP LWT in HEX %x \n", $4}'


sort parta.lwt -k 5 |awk '{printf "TOP LWT in HEX %x\t", $4;printf "CPU_TIME %d\n", $5 }'



ps -eLf |grep 7291 |sort -k 5 |awk '{printf "TOP LWT in HEX %x\t", $4;printf "CPU_TIME %d\n", $5 }'

Thursday, August 28, 2014

Liferay SQL

SELECT * FROM "LRAY"."LAYOUT" WHERE FRIENDLYURL = '/bla'
SELECT * FROM "LRAY"."JOURNALARTICLE" where TITLE = 'bla'

Find dups:

SELECT FRIENDLYURL, count(*)
FROM "LRAY"."LAYOUT"
GROUP BY
FRIENDLYURL
having
count(*) > 1


Find bad article

SELECT * FROM "LRAY"."JOURNALARTICLE" where URLTITLE IS NULL;



Count

select count(*) cnt
from user_constraints
where table_name='JOURNALARTICLE'
and constraint_type='U';




Let's say:

17:30:33,297 ERROR [JDBCExceptionReporter:234] ORA-00001: unique constraint (LRAY.IX_E2815081) violated

17:30:33,298 ERROR [JDBCExceptionReporter:234] ORA-00001: unique constraint (LRAY.IX_E2815081) violated

17:30:33,299 ERROR [PortletImporter:669] com.liferay.portal.kernel.lar.PortletDataException: com.liferay.portal.kernel.exception.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
com.liferay.portal.kernel.lar.PortletDataException: com.liferay.portal.kernel.exception.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at com.liferay.portal.kernel.lar.BasePortletDataHandler.importData(BasePortletDataHandler.java:78)
at com.liferay.portal.lar.PortletImporter.importPortletData(PortletImporter.java:665)
at com.liferay.portal.lar.PortletImporter.importPortletData(PortletImporter.java:546)
at com.liferay.portal.lar.LayoutImporter.importLayouts(LayoutImporter.java:417)
at com.liferay.portal.service.impl.LayoutLocalServiceImpl.importLayouts(LayoutLocalServiceImpl.java:685)
at com.liferay.portal.service.impl.LayoutLocalServiceImpl.importLayouts(LayoutLocalServiceImpl.java:709)
at com.liferay.portal.service.impl.LayoutLocalServiceImpl.importLayouts(LayoutLocalServiceImpl.java:672)
at sun.reflect.GeneratedMethodAccessor4493.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:86)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy34.importLayouts(Unknown Source)



select table_name from all_indexes where index_name='IX_E2815081';

shows DLFILEVERSION


Monday, August 25, 2014

SSL notes

1. Log into the web server to be updated.





4. cd conf/extra directory



Example: SSLCertificateFile "/u01/app/appadmin/product/servers/pactiprd/ssl/rsact01.crt"



Example: SSLCertificateKeyFile "/u01/app/appadmin/product/servers/pactiprd/ssl/rsact01.key"

8. Copy the server crt and key file to the location defined within the httpd-ssl.conf file.



step 2: Download the cert from the server.
openssl s_client -connect 10.4.10.1:7336 | tee cert

Step 5: Verify whether the cert got added to the keystore and check its information.
keytool -list -v -keystore keystore



Step x: If you want to print the cert
keytool -printcert -file file.cer

You can use openssl to test certificate store if running in a container such as java.

openssl s_client -connect bla:PORT -state -debug
If it errors out this will verify that there is a problem with the keystore.
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;

public class MulticastNode {

InetAddress group = null;
MulticastSocket s = null;

public static void main(String[] args) {

if (args.length > 0) {

System.out.println("Sending message: " + args[0]);

MulticastNode node = new MulticastNode();

node.send(args[0]);

node.receive();


} else {

System.out.println("Need an argument string to send.");
System.exit(1);

}

}

public MulticastNode() {

try {

group = InetAddress.getByName("228.0.0.4");
s = new MulticastSocket(45564);
s.joinGroup(group);

} catch (Exception e) {

e.printStackTrace();

}

}

public void send (String msg) {

try {

DatagramPacket hi = new DatagramPacket(
msg.getBytes(), msg.length(),group,45564);
s.send(hi);

} catch (Exception e) {

e.printStackTrace();

}
}

public void receive() {

byte[] buf;

while (true) {


try {

buf = new byte[1000];
DatagramPacket recv = new DatagramPacket(buf, buf.length);
s.receive(recv);
System.out.println("Received: " + new String(buf));

} catch (Exception e) {

e.printStackTrace();

}

}

}

}



to test.
Copy to a test directory on each machine you want to test.
Then run "$JAVA_HOME/bin/java MulticastNode NodeOne" on the first node.
On the second node ""$JAVA_HOME/bin/java MulticastNode NodeTwo"
You will first see:
>java MulticastNode NodeOne
Sending message: NodeOne
Received: NodeOne
on the first node, then when starting on second:

This is from pages 374-378 of "Tomcat the definitive guide" from O'Reilly.

Friday, April 11, 2014

KOFAX installation notes

Some quick notes for KOFAX


- Make sure anti virus is setup with exceptions for KOFAX folders as described in KB.

- For higher volume batch processing, use a client server along with central site. Enable KCNS on both sites, the IIS web services will only be active on one server. However, the secondary site will work on inserting data into SQL Server. If no secondary service is used, the Kofax Server Service will crash under high loads over time.

- Run multiple PDF, Release (export), recognition services on client and central site server for high throughput.

- Some queues like Advanced Reports can only run one service.

- KTM schedule service only runs one service, however this is fine since multiple mailroom processes run.

- If using KCNS from remote site server to central site server, you can run multiple instances of RSA service, this really has high improvement on throughput. If only one RSA service is running, if a batch has an error, it will hang up processing of upload/download. It's recommended to make sure at least two KCNS services are running to support this.

- Make sure to run KTM at the remote site server if possible. Increase the memory to 80% and performance really improves. KOFAX documentation stated this is the default but found this not to be the case when installed.

Sunday, April 6, 2014

Testing Active Directory SSL in LINUX with OpenLDAP

When setting up MicroStrategy LDAP Authentication over SSL (port 636), found that testing in the shell was very helpful.

If you have the latest OpenLDAP package installed in Linux, you can run "ldapsearch" command.

This is an example:

ldapsearch -x -s base -H ldaps://.domain.com -b "" "(objectclass=*)"

ldap_bind: Can't contact LDAP server (-1)
additional info: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

This is if you have not set a CA or updated the default location, for default location check /etc/openldap/ldap.conf

Add the root CA for the Active Directory host to some location, either the default location or say /u01/MSTR/certs

If using a new location:

export LDAPTLS_CACERT=/u01/MSTR/certs/cert.pem

ldapsearch -x -s base -H ldaps://.domain.com -b "" "(objectclass=*)" |grep result

# search result
result: 0 Success

This indicates that connection works and you are getting a result. If you don't grep out the results you will get a large output.

References used:

http://www.openldap.org/lists/openldap-technical/201103/msg00317.html
http://www.commandlinefu.com/commands/view/2402/ldap-search-to-query-an-activedirectory-server
http://technet.microsoft.com/library/bb463158
http://techies.ncsu.edu/wiki/How_to_get_OpenSSL_to_recognise_an_Active_Directory_CA