30 May 2018

Jax-ws timeout

 There are several properties to set timeout to WLS (or most web/app containers),

1.
Details for programming approach: https://docs.oracle.com/middleware/1213/wls/WSGET/jax-ws-jws.htm#WSGET168

Using: BindingProviderProperties.REQUEST_TIMEOUT

ie:

  requestContext.put(BindingProviderProperties.CONNECT_TIMEOUT, 3000);
  requestContext.put(BindingProviderProperties.REQUEST_TIMEOUT, 3000);


2.
Another approach is setting these values (this time in a Spring context):

    <!-- timeout -->
    <util:map id="jaxwsCustomProperties">
        <beans:entry key="com.sun.xml.ws.request.timeout">
            <beans:value type="java.lang.Integer">11000</beans:value>
        </beans:entry>
        <beans:entry key="com.sun.xml.ws.connect.timeout">
            <beans:value type="java.lang.Integer">11000</beans:value>
        </beans:entry>
    </util:map>



3.
Spring HTTP client:
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.html

httpRequestFactory.setConnectionRequestTimeout(5000);        httpRequestFactory.setConnectTimeout(10000);       
httpRequestFactory.setReadTimeout(120000);

4.
These java properties probably are the most direct way (but as we know they'll impact the complete server):

-Dweblogic.https.client.defaultConnectTimeout=30000
-Dweblogic.http.client.defaultConnectTimeout=30000


OR

-Dweblogic.webservice.UseWebLogicURLStreamHandler=false
-DUseSunHttpHandler=true
-Dsun.net.client.defaultConnectTimeout=30000 

-Dsun.net.client.defaultReadTimeout=30000

All this happens by the default values:

sun.net.client.defaultConnectTimeout (default: -1 (forever))
sun.net.client.defaultReadTimeout (default: -1 (forever))

OQL queries

From https://github.com/devwebcl/wls_contraption/blob/master/oql/oql-queries.md

How many classes loaded in my app?
(retrieving from a heapdump and queried thru eclipse-mat or visualvm)

select count(heap.classes())

select count(heap.objects('sun.reflect.DelegatingClassLoader'))

select x from cl.ejemplo.foo.bar.Qux x


We use the classes method of heap object and used count built-in to count the result of the same. The output was: 1950

http://blogs.oracle.com/sundararajan/permanent-generation-analysis-with-oql

11 May 2018

ag Cheat Sheet

A hidden gem, replace of grep:

Find exact string (not regexp)
ag -Q "forEach(i -> map.put(i,"

Find files containing "foo", and print the line matches in context:
ag foo

 Find files containing "foo", but only list the filenames:
ag -l foo

 Find files containing "FOO" case-insensitively, and print only the match, rather than the whole line:
ag -i -o FOO

 Find "foo" in files with a name matching "bar":
ag foo -G bar
ag "perfil-usuario" -G java

Find files whose contents match a regular expression:
(double quotes are better, in particular when there is a double or single quote inside of regexp)
ag "^ba(r|z)$"

Find files with a name matching "foo":
ag -g foo

ag hola$

-z --search-zip: Search contents of compressed files. Currently, gz and xz are supported. This option requires that ag is built with lzma and zlib.


http://conqueringthecommandline.com/book/ack_ag

https://www.mankier.com/1/ag


03 May 2018

Service Mesh Blonde Ale

Fancy a pint (beer) of 'Service mesh'? Yes… Well, head over to the party next week as has selected as their winner of the competition.


13 April 2018

inspectIT

Interesting Open Source APM: https://github.com/inspectIT

To run it on Mac is necessary:

WLS:
startWebLogic.sh

-javaagent:/Applications/inspectIT/agent/inspectit-agent.jar -Dinspectit.repository=localhost:9070 -Dinspectit.agent.name=test1


inspectIT Server: (nothing, just run it)
/Applications/inspectIT/CMR/startup.sh

InspectIT Client:
(eclipse)
/Applications/inspectIT/inspectit/run.sh
(some modifications are necessary)

$ cat /Applications/inspectIT/inspectit/run.sh
xattr -r -d com.apple.quarantine inspectIT.app
./inspectIT.app/Contents/MacOS/inspectIT -vm /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin -data /Users/German/tmp/workspace-inspectit -debug

Issue:

I hit a bug when using a JDK newer than 1.8.0_131 (on Mac)

https://inspectit-performance.atlassian.net/browse/INSPECTIT-2560?focusedCommentId=33865&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-33865



TODO:

- https://blog.novatec-gmbh.de/can-opentracing-scene-benefit-new-tracer-implementations/


12 April 2018

Rightmost duplicated Xmx

Just like it's explained at Stackoverflow question, most JVM take rightmost duplicated java properties values, in particular memory settings:

java -server -Xms256m -Xmx512m -XX:MaxPermSize=256m -Dweblogic.Name=servidor01 -Djava.security.policy=/u04/Middleware/P_WLS12c/product/wlserver/server/lib/weblogic.policy -Dweblogic.ProductionModeEnabled=true -Dweblogic.system.BootIdentityFile=/u04/Admin/domains/dominio/servers/servidor01/data/nodemanager/boot.properties -Dweblogic.nodemanager.ServiceEnabled=true -Dweblogic.nmservice.RotationEnabled=true -Dweblogic.security.SSL.ignoreHostnameVerification=false -Dweblogic.ReverseDNSAllowed=false -Djava.awt.headless=true -Xms2g -Xmx2g -XX:MaxPermSize=2g -Djava.security.egd=file:/dev/./urandom -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC 

public class TotalMemory
{
 public static void main(String[] args)
 {
 System.out.println("Total Memory: "+Runtime.getRuntime().totalMemory());
 System.out.println("Free Memory: "+Runtime.getRuntime().freeMemory());
 }
}
> java -version; java -Xmx1G -XX:+PrintFlagsFinal -Xmx2G 2>/dev/null | grep MaxHeapSize

The way is parsed: 
for( int i=0; i<argc; i++ ) {
  process_argument(argv[i]);
}
  
(2G of Heap !)

05 April 2018

Smallest Alphabest

I was able to find the smallest heterogram scrabble puzzle.

http://www.gamepuzzles.com/alphabest.htm

Thanks to grep & sowpods :

$ grep -P '^\w{14}$' sowpods.txt | grep -v -i -P '(.).*\1'
AMBIDEXTROUSLY
DERMATOGLYPHIC
HYDROMAGNETICS
HYDROPNEUMATIC
TROUBLEMAKINGS
UNDISCOVERABLY

03 April 2018

No more data to read from socket

This is a very low level exception, which is ORA-17410.
It may happens by several reasons:
  1. A temporary problem on networking.
  2. Wrong JDBC driver version.
  3. Some issues with special data structure (on database side).
  4. Database bug.
In my case, it was a bug we hit on the database, which needs to be patched.



]] Root cause of ServletException.
cl.devweb.plataformabase.error.BaseException: CallableStatementCallback; SQL [{call
STORED_PROCEDURE_EJEMPLO(?, ?, ?, ?, ?)}]; No more data to read from socket; nested exception is java.sql.SQLRecoverableException: No more data to read from socket
  at cl.devweb.ejemplo.aggregator.dao.AggregatorDaoImpl.listaCorreos(AggregatorDaoImpl.java:430)
  at cl.devweb.ejemplo.aggregator.service.AggregatorServiceImpl.listaCorreos(AggregatorServiceImpl.java:96)
  at cl.devweb.ejemplo.aggregator.controller.AggregatorController.listaCorreos(AggregatorController.java:343)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
  at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:111)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:806)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:729)
  at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
  at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:751)
  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
  at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
  at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
  at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
  at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346)
  at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
  at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  at cl.devweb.plataformabase.security.config.StatelessAuthenticationFilter.doFilter(StatelessAuthenticationFilter.java:38)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
  at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
  at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
  at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
  at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3436)
  at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3402)
  at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
  at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
  at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
  at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2285)
  at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2201)
  at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
  at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1572)
  at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255)
  at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
  at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Caused By: cl.devweb.plataformabase.error.ServiceException: CallableStatementCallback; SQL [{call
STORED_PROCEDURE_EJEMPLO(?, ?, ?, ?, ?)}]; No more data to read from socket; nested exception is java.sql.SQLRecoverableException: No more data to read from socket
  at cl.devweb.sample.persistence.repository.SpBpmRetornaTareasGrupoDAOImpl.execute(SpBpmRetornaTareasGrupoDAOImpl.java:61)
  at cl.devweb.ejemplo.aggregator.dao.AggregatorDaoImpl.listaCorreos(AggregatorDaoImpl.java:399)
  at cl.devweb.ejemplo.aggregator.service.AggregatorServiceImpl.listaCorreos(AggregatorServiceImpl.java:96)
  at cl.devweb.ejemplo.aggregator.controller.AggregatorController.listaCorreos(AggregatorController.java:343)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
  at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:111)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:806)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:729)
  at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
  at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:751)
  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
  at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
  at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
  at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
  at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346)
  at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
  at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  at cl.devweb.plataformabase.security.config.StatelessAuthenticationFilter.doFilter(StatelessAuthenticationFilter.java:38)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
  at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
  at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
  at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
  at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3436)
  at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3402)
  at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
  at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
  at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
  at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2285)
  at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2201)
  at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
  at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1572)
  at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255)
  at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
  at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Caused By: org.springframework.dao.RecoverableDataAccessException: CallableStatementCallback; SQL [{call STORED_PROCEDURE_EJEMPLO(?, ?, ?, ?, ?)}]; No more data to read from socket; nested exception is java.sql.SQLRecoverableException: No more data to read from socket
  at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:98)
  at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
  at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
  at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1094)
  at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1130)
  at org.springframework.jdbc.object.StoredProcedure.execute(StoredProcedure.java:142)
  at cl.devweb.sample.persistence.repository.sp.SpBpmRetornaTareasGrupoSP.execute(SpBpmRetornaTareasGrupoSP.java:42)
  at cl.devweb.sample.persistence.repository.SpBpmRetornaTareasGrupoDAOImpl.execute(SpBpmRetornaTareasGrupoDAOImpl.java:59)
  at cl.devweb.ejemplo.aggregator.dao.AggregatorDaoImpl.listaCorreos(AggregatorDaoImpl.java:399)
  at cl.devweb.ejemplo.aggregator.service.AggregatorServiceImpl.listaCorreos(AggregatorServiceImpl.java:96)
  at cl.devweb.ejemplo.aggregator.controller.AggregatorController.listaCorreos(AggregatorController.java:343)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
  at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:111)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:806)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:729)
  at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
  at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:751)
  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
  at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
  at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
  at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
  at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346)
  at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
  at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  at cl.devweb.plataformabase.security.config.StatelessAuthenticationFilter.doFilter(StatelessAuthenticationFilter.java:38)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
  at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
  at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
  at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
  at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3436)
  at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3402)
  at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
  at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
  at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
  at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2285)
  at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2201)
  at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
  at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1572)
  at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255)
  at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
  at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Caused By: java.sql.SQLRecoverableException: No more data to read from socket
  at oracle.jdbc.driver.T4CMAREngineStream.unmarshalUB1(T4CMAREngineStream.java:456)
  at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:397)
  at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257)
  at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:587)
  at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:220)
  at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:48)
  at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:938)
  at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1150)
  at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:4798)
  at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:4901)
  at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:5631)
  at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1385)
  at weblogic.jdbc.wrapper.PreparedStatement.execute(PreparedStatement.java:105)
  at org.springframework.jdbc.core.JdbcTemplate$6.doInCallableStatement(JdbcTemplate.java:1133)
  at org.springframework.jdbc.core.JdbcTemplate$6.doInCallableStatement(JdbcTemplate.java:1130)
  at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1078)
  at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1130)
  at org.springframework.jdbc.object.StoredProcedure.execute(StoredProcedure.java:142)
  at cl.devweb.sample.persistence.repository.sp.SpBpmRetornaTareasGrupoSP.execute(SpBpmRetornaTareasGrupoSP.java:42)
  at cl.devweb.sample.persistence.repository.SpBpmRetornaTareasGrupoDAOImpl.execute(SpBpmRetornaTareasGrupoDAOImpl.java:59)
  at cl.devweb.ejemplo.aggregator.dao.AggregatorDaoImpl.listaCorreos(AggregatorDaoImpl.java:399)
  at cl.devweb.ejemplo.aggregator.service.AggregatorServiceImpl.listaCorreos(AggregatorServiceImpl.java:96)
  at cl.devweb.ejemplo.aggregator.controller.AggregatorController.listaCorreos(AggregatorController.java:343)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
  at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:111)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:806)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:729)
  at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
  at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:751)
  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
  at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
  at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
  at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
  at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346)
  at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
  at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  at cl.devweb.plataformabase.security.config.StatelessAuthenticationFilter.doFilter(StatelessAuthenticationFilter.java:38)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
  at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
  at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
  at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
  at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3436)
  at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3402)
  at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
  at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
  at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
  at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2285)
  at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2201)
  at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
  at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1572)
  at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255)
  at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
  at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)

29 March 2018

Certificates Keystore SSL "Cheat Sheet"

How To Create a Java Keystore via Keytool in FMW 11g/12c (Doc ID 1230333.1)

Configuring Oracle WebLogic Server (10.3.x - 12.1.x) to use SSL in Fusion Middleware 11g/12c (Doc ID 1235653.1)

https://docs.oracle.com/cd/E11035_01/wls100/secmanage/identity_trust.html#wp1196290

https://blogs.oracle.com/blogbypuneeth/steps-to-create-a-self-signed-certificate-and-configure-custom-identity-and-custom-trust-with-weblogic-server-using-keytool

http://kingsfleet.blogspot.cl/2008/11/using-demoidentity-and-demotrust.html
(passwords)

http://one-size-doesnt-fit-all.blogspot.cl/2009/09/weblogic-server-identity-vs-trust.html

https://www.digitalocean.com/community/tutorials/java-keytool-essentials-working-with-java-keystores

https://www.sslshopper.com/article-most-common-java-keytool-keystore-commands.html

https://blogs.oracle.com/blogbypuneeth/steps-to-create-a-self-signed-certificate-and-configure-custom-identity-and-custom-trust-with-weblogic-server-using-keytool

https://support.ssl.com/Knowledgebase/Article/View/19/0/der-vs-crt-vs-cer-vs-pem-certificates-and-how-to-convert-them

X509 File Extensions

The first thing we have to understand is what each type of file extension is.   There is a lot of confusion about what DER, PEM, CRT, and CER are and many have incorrectly said that they are all interchangeable.  While in certain cases some can be interchanged the best practice is to identify how your certificate is encoded and then label it correctly.  Correctly labeled certificates will be much easier to manipulat

Encodings (also used as extensions)

  • .DER = The DER extension is used for binary DER encoded certificates. These files may also bear the CER or the CRT extension.   Proper English usage would be “I have a DER encoded certificate” not “I have a DER certificate”.
  • .PEM = The PEM extension is used for different types of X.509v3 files which contain ASCII (Base64) armored data prefixed with a “—– BEGIN …” line.

Common Extensions

  • .CRT = The CRT extension is used for certificates. The certificates may be encoded as binary DER or as ASCII PEM. The CER and CRT extensions are nearly synonymous.  Most common among *nix systems
  • CER = alternate form of .crt (Microsoft Convention) You can use MS to convert .crt to .cer (.both DER encoded .cer, or base64[PEM] encoded .cer)  The .cer file extension is also recognized by IE as a command to run a MS cryptoAPI command (specifically rundll32.exe cryptext.dll,CryptExtOpenCER) which displays a dialogue for importing and/or viewing certificate contents.
  • .KEY = The KEY extension is used both for public and private PKCS#8 keys. The keys may be encoded as binary DER or as ASCII PEM.
The only time CRT and CER can safely be interchanged is when the encoding type can be identical.  (ie  PEM encoded CRT = PEM encoded CER)

-------------------------------------------------------------------------------------------

openssl x509 -in ca.cer -inform der -text -noout

https://support.ssl.com/Knowledgebase/Article/View/19/0/der-vs-crt-vs-cer-vs-pem-certificates-and-how-to-convert-them

openssl x509 -in ca.pem -text -noout


Conversion of DER (.crt .cer or .der) to PEM:

openssl x509 -inform der -in certificate.cer -out certificate.pem
openssl x509 -inform der -in intermediate.cer -out certificate.pem



View a PEM-encoded certificate:

openssl x509 -noout -text -in certificate.pem

------------

openssl req -in ca.cer -text

To show the content of a certificate use

openssl x509 -in ca.cer -text

---

openssl x509 -in ca.pem -noout -issuer_hash

15 March 2018

certpath.SunCertPathBuilderException: unable to find valid certification path


A continuación el ejemplo que hice :



[German@KDU ssl]$ java -cp . SSLPoke 
Utility to debug Java connections to SSL servers
Usage: 
  java SSLPoke
or for more debugging:
  java -Djavax.net.debug=ssl SSLPoke

Eg. to test the SSL certificate at https://localhost, use
  java SSLPoke localhost 443
[German@KDU ssl]$ java -cp . SSLPoke 127.0.0.1 7002

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:385)
at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:290)
at java.base/sun.security.validator.Validator.validate(Validator.java:264)
at java.base/sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:343)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:226)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:133)
at java.base/sun.security.ssl.ClientHandshaker.checkServerCerts(ClientHandshaker.java:1947)
at java.base/sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1777)
at java.base/sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:264)
at java.base/sun.security.ssl.Handshaker.processLoop(Handshaker.java:1092)
at java.base/sun.security.ssl.Handshaker.processRecord(Handshaker.java:1026)
at java.base/sun.security.ssl.SSLSocketImpl.processInputRecord(SSLSocketImpl.java:1137)
at java.base/sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1074)
at java.base/sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
at java.base/sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1402)
at java.base/sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:733)
at java.base/sun.security.ssl.AppOutputStream.write(AppOutputStream.java:67)
at java.base/sun.security.ssl.AppOutputStream.write(AppOutputStream.java:81)
at SSLPoke.main(SSLPoke.java:31)

Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380)
... 18 more
[German@KDU ssl]$ 
[German@KDU ssl]$ java -cp . -Djavax.net.ssl.trustStore=/Users/German/Oracle/Middleware/Oracle_Home/wlserver/server/lib/DemoTrust.jks SSLPoke 127.0.0.1 7002 
Successfully connected
[German@KDU ssl]$ 


como era de esperar uno de los problemas clasicos es setear el trust store en el java system properties, ademas algunos otros properties de ayuda para debug ssl :

-Djavax.net.debug=ssl:handshake:verbose

-Djavax.net.debug=ssl
-Djavax.net.ssl.keyStoreType=pkcs12
-Djavax.net.ssl.keyStore=client.p12
-Djavax.net.ssl.keyStorePassword=whatever
-Djavax.net.ssl.trustStoreType=jks
-Djavax.net.ssl.trustStore=client-truststore.jks
-Djavax.net.ssl.trustStorePassword=whatever

Blog Archive

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.