Archive

Archive for December, 2009

JMX Port issue

December 30, 2009 Leave a comment

Use following commands to check open/established ports. This is giving snapshot. in between connections can be opened and closed.

>netstat -an
>netstat -an |find /i “listening”

Options to pass to JVM
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=1616
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-o-

Categories: Core Java Tags:

com.sun.xml.ws.client.sei.SEIStub cannot be cast to org.apache.cxf.frontend.ClientProxy

December 29, 2009 Leave a comment

Problem:
com.sun.xml.ws.client.sei.SEIStub cannot be cast to org.apache.cxf.frontend.ClientProxy

Solution:
Make sure that com.sun.xml.ws.client.sei.SEIStub is not in classpath.

http://issues.apache.org/jira/browse/CXF-2237

Categories: cxf

java.lang.IllegalArgumentException: SSL

December 28, 2009 Leave a comment

Problem:
INFO: Interceptor has thrown exception, unwinding now
java.lang.IllegalArgumentException: SSL
at com.sun.net.ssl.internal.ssl.ProtocolVersion.valueOf(ProtocolVersion.java:133)
at com.sun.net.ssl.internal.ssl.ProtocolList.(ProtocolList.java:38)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.setEnabledProtocols(SSLSocketImpl.java:2075)

Fix:

Before: parameters.setSecureSocketProtocol(“SSL”);

After: parameters.setSecureSocketProtocol(“SSLv3″);

InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

December 15, 2009 Leave a comment

Problem Statement: Getting exception while trying to connecting remote https system.

Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
	at java.security.cert.PKIXParameters.setTrustAnchors(PKIXParameters.java:183)
	at java.security.cert.PKIXParameters.<init>(PKIXParameters.java:103)
	at java.security.cert.PKIXBuilderParameters.<init>(PKIXBuilderParameters.java:87)
	at sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:57)
	... 28 common frames omitted

Solution: System is not getting keystore from relative path.
Provide absolutepath and keystore name. It should be resolved.

//System.setProperty("javax.net.ssl.trustStore", relativePath+key_name); //Not working

System.setProperty("javax.net.ssl.trustStore", absolutePath+key_name); //Working

-o-

Log4j Performance debate – isDebugEnabled()

December 15, 2009 Leave a comment

Problem statement: Do we need to use isDebugEnabled() ?

Short answer: It is better to use.

1. In log4j we need to use.
2. In SLF4J we need to use parametrized debug statements.

For more information read
http://www.slf4j.org/faq.html#logging_performance

-o-

Code coverage – pitfalls

December 15, 2009 Leave a comment

Problem Statement: Code coverage 100%. There are x number of bugs. What happened?

Code coverage 100% doesn’t mean that test coverage 100%.
Sample code

public int add(int a, int b)
{
   return a+b;
}

we can have simple unit test case and it can show 100% code coverage.
But it is not talking about business.
i.e It should support float, double and other data types.
Boundary checks..etc

We need to make sure that we have all unit test cases according to business requirements.
Code coverage 100%, doesn’t mean that code is bug free.
-o-

How to print classpath in Maven?

December 9, 2009 Leave a comment

Solution:

Use this plugin
http://mojo.os.xebia.com/cpprinter-maven-plugin/usage.html

>mvn cpprinter:print

-o-

Database Min Connection must be zero

December 9, 2009 Leave a comment

Statement: Database Min Connection must be zero

Why?

When there is firewall between oracle database and application, firewall is timing out the connections.
The opened connections become stale connections.
Oracle / Database connection pool on app side failed to recover them and destroy.
Due to this application is getting staled connection and causing exceptions.

Due to this, it is better to have min connections zero. We can minimize the risk.

Categories: Database, Oracle

xs:anyType issue – ElementNSImpl Vs Node

December 8, 2009 Leave a comment

XSD is having element like this

<xs:element name="companyname" type="xs:anyType" minOccurs="0"/>

JAXB Generated Class is having code like this

protected Object companyname;

To fetch the data we are using

final ElementNSImpl element = (ElementNSImpl)atGiven;

To resolve this element we can use either of this.

If we use this import, it is working in Eclipse. But failing in osgi.
import org.apache.xerces.dom.ElementNSImpl;
java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to org.apache.xerces.dom.ElementNSImpl

If we use this import, paxrunner with Equinox is failing to do boot delegation com.sun.*
import com.sun.org.apache.xerces.internal.dom.ElementNSImpl;

We have two solutions:

replace xs:anyType to xs:string if permits.
or

Make sure that boot delegation works.

Final Solution:
It is better not to use code specific to implementation.
It is better to use interface. Due to this used Node and resolved the issue.
import org.w3c.dom.Node;

-o-

Categories: JAXB Tags: , ,
Follow

Get every new post delivered to your Inbox.