Notes by Fang

Displaying keyword search results 1 - 10
Created by Fang on January 14, 2013 14:00:36    Last update: January 14, 2013 14:00:36
Cause: Hibernate reverse engineering generated a column mapping like this: @Version @Column(name="VERSION", nullable=false... Fix: change the mapping to: @Column(name="VERSION", length=20) public Strin...
Created by Fang on May 15, 2012 13:04:24    Last update: May 15, 2012 13:04:44
Set the warnLogCategory attribute to log uncaught exception stacktrace: <bean class="org.springframework.web.servl...
Created by Fang on March 15, 2012 10:24:35    Last update: March 15, 2012 10:24:35
Suppose that I have an email field annotated with: @NotEmpty(message="Please enter email address") ... Bean validation will trigger two errors when no email address is entered: the email field is empty an empty email field is not a valid email address Displaying both errors to the user with <form:errors> would be redundant and confusing: <%@ taglib uri="http://www.springframework.org/tag... This is how to display the first error only: <spring:bind path="emailAddress"> <c:if test="$...
Created by Fang on February 27, 2012 12:19:19    Last update: February 27, 2012 12:19:19
Mapping Java objects to Jackson JSON is pretty simple. But if you name a JSON field wrong, you'll get the "Unrecognized field ... (Class ...), not marked as ignorable" error. The rule for mapping a Java bean attribute name to a JSON field name is: lower all leading capital letters until the first lower case letter . For example, this Java class: package com.example; public class Person { ... maps to this JSON string: { "firstName": "Jane", "lastName": "... Test code: package com.example; import java.net.URL; ...
Created by Fang on February 21, 2012 20:33:58    Last update: February 21, 2012 20:33:58
You can customize Tomcat error page with error code: <error-page> <error-code>404</error-code> ... or Java exception type: <error-page> <exception-type>java.lang.Throwab... Either error-code or exception-type is required, but not both. There's no way to aggregate error codes, such as: <!-- This does not work! --> <error-page> ... Customizing error pages is about the only way to suppress the default stack trace in Tomcat in case of an unhandled exception.
Created by Fang on February 15, 2012 21:11:02    Last update: February 15, 2012 21:11:02
Error: java.lang.NoClassDefFoundError: org/slf4j/helpers/... Cause: had slf4j-nop as dependency, but did not have slf4j-api. Solution: add dependency for slf4j-api. <dependency> <groupId>org.slf4j</groupId> ...
Created by Fang on February 15, 2012 21:03:57    Last update: February 15, 2012 21:03:57
Error: java.lang.NoClassDefFoundError: org/slf4j/impl/Sta... Soluton: add Maven dependency for one of slf4j-nop , slf4j-simple , slf4j-log4j12 , slf4j-jdk14 . For example: <dependency> <groupId>org.slf4j</groupId> ... or <dependency> <groupId>org.slf4j</groupId> ...
Created by Fang on February 15, 2012 20:52:57    Last update: February 15, 2012 20:52:57
I got this error while using Hibernate 3.5.6: org.hibernate.MappingException: An AnnotationConfi... where I used annotations for mapping in the ExampleEntity class. Problem : I initialized the session factory with Configuration : sessionFactory = new Configuration() .co... Solution : should use AnnotationConfiguration instead: sessionFactory = new AnnotationConfiguration() ... Additional Note: Hibernate 4.1 didn't seem to mind ( Configuration worked fine).
Created by Fang on February 08, 2012 21:21:01    Last update: February 08, 2012 21:21:17
Just a reminder that I got this error when I set the Java system property javax.net.ssl.trustStore to a non-existing file (typo). The full error message when running Maven was: [ERROR] java.lang.RuntimeException: Unexpected e...
Created by Fang on February 08, 2012 21:15:00    Last update: February 08, 2012 21:15:00
This was the error message: [ERROR] sun.security.validator.ValidatorExceptio... The certificate was actually signed by Verisign, but somehow failed to pass Java cert validation. To resolve the problem: Download the cert from the server (with RetrieveSSLCert , for example) Import the certificate into the keystore: $ keytool -import -trustcacerts -alias myserver -f... Define MAVEN_OPTS : $ export MAVEN_OPTS='-Djavax.net.ssl.trustStore=/h... The quotes must exist for the value of MAVEN_OPTS , and the path must be absolute ( ~/etc/mavenKeyStore.jks does not work).
Previous  1 2 3 Next