11 May 2018

ag Cheat Sheet

A hidden gem, replace of grep:

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

 Find files whose contents match a regular expression:
ag '^ba(r|z)$'

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

ag hola$


http://conqueringthecommandline.com/book/ack_ag

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


03 May 2018

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


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

Inspectit client:
/Applications/inspectIT/inspectit/run.sh
(some modification 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





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)

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
-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

08 March 2018

Changing weblogic.xml at deployment time


Executing: java weblogic.PlanGenerator -all -plan plan.xml ear/war(file)

Java Plan we can get a sample of Plan.xml. From here we can edit it to do modifications at deployment time:

<?xml version='1.0' encoding='UTF-8'?>
<deployment-plan xmlns="http://xmlns.oracle.com/weblogic/deployment-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/deployment-plan http://xmlns.oracle.com/weblogic/deployment-plan/1.0/deployment-plan.xsd" global-variables="false">
  <application-name>presentacion-0.0.1-SNAPSHOT.war</application-name>
  <variable-definition>
     <variable>  
        <name>nameValue</name> 
        <value>webapp/presentacion-0.0.1-SNAPSHOT</value> 
     </variable>    
  </variable-definition>
  <module-override>
    <module-name>presentacion-0.0.1-SNAPSHOT.war</module-name>
    <module-type>war</module-type>
    <module-descriptor external="true">
      <root-element>weblogic-web-app</root-element>
      <uri>WEB-INF/weblogic.xml</uri>
      <variable-assignment>
        <name>nameValue</name>
        <xpath>/weblogic-web-app/context-root</xpath>
        <operation>replace</operation>  
      </variable-assignment> 
    </module-descriptor>
  </module-override>
  <config-root>.</config-root>
</deployment-plan>

Maven example:

        <plugin>
                <groupId>com.oracle.weblogic</groupId>
                <artifactId>weblogic-maven-plugin</artifactId>
                <version>12.1.3-0-0</version>
                <configuration>
                    <adminurl>t3://127.0.0.1:7001</adminurl>
                    <plan>refactoring.xml</plan>
                    <user>weblogic</user>
                    <password>welcome1</password>
                    <upload>true</upload>
                    <action>deploy</action>
                    <remote>true</remote>
                    <verbose>true</verbose>
                    <source>target/${project.artifactId}-${project.version}.${project.packaging}</source>
                    <name>${project.artifactId}</name>
                    <targets>AdminServer</targets>
                </configuration>
            </plugin>

22 February 2018

CNFE Quartz Job

A common problem is to a CNFE when a different job try to execute a job that is not is its classpath. This happens when different jobs are using the same quartz schema. This issue can be fixed by using different tables for Quartz persistence:

org.quartz.jobStore.tablePrefix = QRTZ_


Or to use different schedule name:

 <property name="schedulerName" value="quartzScheduler"/>

This can be checked in the column: SCHED_NAME of QRTZ_JOB_DETAILS.

####<Feb 1, 2018 11:54:52 PM CLT> <Notice> <Stdout> <server> <WLSServer01> <QuartzScheduler_quartzScheduler-1517345673963_MisfireHandler> <<WLS Kernel>> <> <> <1517540092414> <BEA-000000> <23:54:52.413 [QuartzScheduler_quartzScheduler-1517345673963_MisfireHandler] ERROR org.springframework.scheduling.quartz.LocalDataSourceJobStore - MisfireHandler: Error handling misfires: Couldn't store trigger 'DEFAULT.cronTriggerNotificaSolicitud' for 'DEFAULT.complexJobDetailNotificaSolicitud' job:cl.devweb.aviso.cron.ExecuteNotificaSolicitud
org.quartz.JobPersistenceException: Couldn't store trigger 'DEFAULT.cronTriggerNotificaSolicitud' for 'DEFAULT.complexJobDetailNotificaSolicitud' job:cl.devweb.aviso.cron.ExecuteNotificaSolicitud
  at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeTrigger(JobStoreSupport.java:1223) ~[quartz-2.2.1.jar:?]
  at org.quartz.impl.jdbcjobstore.JobStoreSupport.doUpdateOfMisfiredTrigger(JobStoreSupport.java:1037) ~[quartz-2.2.1.jar:?]
  at org.quartz.impl.jdbcjobstore.JobStoreSupport.recoverMisfiredJobs(JobStoreSupport.java:986) ~[quartz-2.2.1.jar:?]
  at org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreSupport.java:3187) ~[quartz-2.2.1.jar:?]
  at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.manage(JobStoreSupport.java:3935) [quartz-2.2.1.jar:?]
  at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.run(JobStoreSupport.java:3956) [quartz-2.2.1.jar:?]
Caused by: java.lang.ClassNotFoundException: cl.devweb.aviso.cron.ExecuteNotificaSolicitud
  at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:357) ~[weblogic.server.merged.jar:12.1.3.0.0]
  at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:318) ~[weblogic.server.merged.jar:12.1.3.0.0]
  at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:80) ~[weblogic.server.merged.jar:12.1.3.0.0]
  at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[?:1.7.0_91]
  at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[?:1.7.0_91]
  at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:186) ~[weblogic.server.merged.jar:12.1.3.0.0]
  at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:50) ~[weblogic.server.merged.jar:12.1.3.0.0]
  at org.springframework.scheduling.quartz.ResourceLoaderClassLoadHelper.loadClass(ResourceLoaderClassLoadHelper.java:78) ~[spring-context-support-4.2.1.RELEASE.jar:4.2.1.RELEASE]
  at org.springframework.scheduling.quartz.ResourceLoaderClassLoadHelper.loadClass(ResourceLoaderClassLoadHelper.java:83) ~[spring-context-support-4.2.1.RELEASE.jar:4.2.1.RELEASE]
  at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectJobDetail(StdJDBCDelegate.java:852) ~[quartz-2.2.1.jar:?]
  at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeTrigger(JobStoreSupport.java:1205) ~[quartz-2.2.1.jar:?]
  ... 5 more>

My Blog List

Blog Archive

There was an error in this gadget

Disclaimer

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