Friday, May 29, 2015

jasper font problem in Ubuntu

I was getting "Font 'Arial' is not available to the JVM. See the Javadoc for more" this error in Ubuntu.
To fix it I install ttf-mscorefonts-installer package using apt-get
Then cp /usr/share/fonts/truetype/msttcorefonts/*.ttf  JAVA_HOME/jre/lib/fonts/

Sunday, May 24, 2015

Spring-Hibernate-JPA session open in JSP

Just a small mistake kills 4-5 hrs while I was configuring a open Spring-Hibernate-JPA session for JSP. (I know it's not the best practice but as a quick fix I did it) web.xml <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value> </context-param> <servlet> <servlet-name>appServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value></param-value> </init-param> <!-- Here was the error <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value> </init-param> --> <load-on-startup>1</load-on-startup> </servlet> <filter> <filter-name>openEntityManagerFilter</filter-name> <filter-class> org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter </filter-class> <init-param> <param-name>entityManagerFactoryBeanName</param-name> <param-value>entityManagerFactory</param-value> </init-param> </filter> <filter-mapping> <filter-name>openEntityManagerFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> The openEntityManagerFilter filter do the magic here :) It takes entityManagerFactory from the application servlet and does the tricks.