Sunday, 26 February 2012

Configure H2 JNDI DataSource in Weblogic






H2 good database for packaging app with embedded DB or for local database setup.




Add driver, JNDI URL and user details

Attach JDBC data source to the app server









Thursday, 16 February 2012

OpenSAML with Spring on Weblogic and Java Core JSTL issue


There is a good example to start with here by Jim Cox http://sourceforge.net/projects/spring-saml/, so kudos to him.

I could strightaway get started with Spring + OpenSAML on Mavan & Tomcat.

However when it comes to getting making my own web app work on WLS 9.2+ server had various issues but mostly due to JAXP and JSTL (indirectly xml-apis-xxx) JARs conflicts on Weblogic.

If you are not using Mavan then you mainly need to add following to your WEB-INF/lib (apart from other standar jars & as per your requirement);

opensaml-2.4.1.jar
openws-1.4.1.jar
xmltooling-1.3.1.jar
resolver-2.8.0.jar
xercesImpl-2.8.0.jar
xml-apis-2.8.0.jar
And slf4j-xxx + log4j

Since I run other apps, I had to set <prefer-web-inf-classes>true</prefer-web-inf-classes> in weblogic.xml to make sure that my app web-inf/lib gets the preference.

Still I faced issue as web app JSPs use tlds core tlds like http://java.sun.com/jsp/jstl/core and I got conflicts with Weblogic JAR, suspect due to xml-apis;

<17-Feb-2012 00:39:17 o'clock GMT> <Error> <HTTP> <BEA-101017> <[weblogic.servlet.internal.WebAppServletContext@12a4caf - appName: 'samlsp', name: 'samlsp', context-path: '/samlsp'] Root cause of ServletException.weblogic.servlet.jsp.CompilationException: Failed to compile JSP /home.jsp
home.jsp:1:1: The validator class: "org.apache.taglibs.standard.tlv.JstlCoreTLV" has failed with the following exception:"java.lang.ClassCastException: weblogic.xml.jaxp.RegistrySAXParserFactory".

Same web app works like a charm in Tomcat, no problem at all.

To fix this I had to pre-compile JSPs by setting following in weblogic.xml & that cures the odd Javelin9 JSP compiler error;

      <jsp-param>
        <param-name>precompile</param-name>
        <param-value>true</param-value>
      </jsp-param>
      <jsp-param>
        <param-name>precompile-continue</param-name>
        <param-value>true</param-value>
      </jsp-param>

This works as at startup Weblogic would trigger JSP compilation first which would use Weblogic jaxp parser, later for web app class loader is set to web-inf/lib. So, technically this is a workaround.

Still, I hope Weblogic (now Oracle) gets better with package conflicts.

Microservices architecture with Kubernets

Kubernetes is an  open-source platform for automating deployment, scaling, and operations of application containers  across clusters of hos...