jueves, 26 de septiembre de 2013

c:out not parsing value

c:out not parsing value

When you use an expression like
<c:out value="${value}"/>

and the value is showed as a literal and does not replace the contained value, use

<%@ page isELIgnored="false"%>

At least one JAR was scanned for TLDs yet contained no TLDs

Where are my TLDs?!

The most common scenario for a simple application is using the jstl.jar library that contains useful tag libs such as "http://java.sun.com/jsp/jstl/core" and others.
After adding the library and making a simple
<c:out value="${value}"/>
the browser shows "value" and in the logs we see a warning saying

At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

Understanding Tomcat file skipping

For an improvement in loading times, tomcat has inside catalina.properties the list of files that will be skipped.
Find the line that says tomcat.util.scan.DefaultJarScanner.jarsToSkip = and search for the file that contains the TLDs.
In my case is jstl.jar, and remove it from the list.

domingo, 16 de junio de 2013

Wsdl2Java Maven Goal

<properties>
  <cxf.version.boolean>2.6.0</cxf.version.boolean> 
  <cxf.version>2.5.1</cxf.version>
</properties>

<build>
  <plugins>
    <!-- CXF Code generation -->
    <plugin>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-codegen-plugin</artifactId>
      <version>${cxf.version}</version>
      <executions>
        <execution>
          <phase>generate-sources</phase>          
          <goals>
            <goal>wsdl2java</goal>
          </goals>
          <configuration>
            <wsdlOptions>
              <wsdlOption>
                <wsdl>${basedir}/src/main/resources/wsdl/WebAPI.wsdl</wsdl>
                <autoNameResolution>true</autoNameResolution>
                <extraargs>
                  <!-- Package Destination -->
                  <extraarg>-p</extraarg>
                  <extraarg>org.gustavoalberola</extraarg>
                  <extraarg>-xjc-Xbg</extraarg>
                  <extraarg>-xjc-Xcollection-setter-injector</extraarg>
                  <!-- Binding directory -->
                  <extraarg>-b</extraarg>
                  <extraarg>${basedir}/src/main/resources/wsdl/binding.xml</extraarg> 
                </extraargs>
              </wsdlOption>
            </wsdlOptions>
          </configuration>
        </execution>
      </executions>
      <dependencies>
        <!-- Boolean getters -->
        <dependency>
          <groupId>org.apache.cxf.xjcplugins</groupId>
          <artifactId>cxf-xjc-boolean</artifactId>
          <version>${cxf.version.boolean}</version>
        </dependency>
        <!-- Collection Setters -->
        <dependency>
          <groupId>net.java.dev.vcc.thirdparty</groupId>
          <artifactId>collection-setter-injector</artifactId>
          <version>0.5.0-1</version>
        </dependency>
      </dependencies>
    </plugin>
  </plugins>
</build>

Cookbook

Spring

Maven

Specify JDK Version in Maven

<properties>
 <jdk.version>1.6</jdk.version>
</properties>

<build>
 <plugins>
  <plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-compiler-plugin</artifactId>
   <version>2.3.1</version>
   <configuration>
    <source>${jdk.version}</source>
    <target>${jdk.version}</target>
   </configuration>
  </plugin>
 </plugins>
</build>

ClassNotFoundException when running web-app inside Eclipse IDE

If we have a Maven project and we try to run/debug the project inside the Eclipse IDE to our web server, we need to be sure that all the dependencies are added to the "Deployment Assembly". Check this with Right button in your project hierachy "Properties -> Deployment Assembly". If you don't see the libraries in there, run again mvn eclipse:eclipse -Dwtpversion=2.0 and recheck

Spring configuration XML Schemas

All the spring schemas can be found in here

Example of use:
<?xml version="1.0" encoding="UTF-8"?>
 xmlns:context="http://www.springframework.org/schema/context"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.2.xsd">

 <context:component-scan base-package="com.blogspot.gustavoalberola" />
</beans>