Recent Notes

Displaying keyword search results 1 - 10
Created by zhidao on April 06, 2012 13:03:20    Last update: April 06, 2012 13:03:20
1. pom.xml <plugin> <groupId>org.jvnet.jax-ws-commons<... 2. To ignore SSL cert errors: <configuration> <args> <arg>... 3. To resolve class name conflict ("Use a class customization to resolve this conflict" error): <configuration> <args> <arg>-B-Xaut...
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 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 January 10, 2010 00:19:30    Last update: January 31, 2012 16:28:42
Maven is a powerful yet complex tool. When I started learning Maven, the first obstacle was, of course, its complexity. The second, was the lack of documentation that can get me off the ground quickly. This tutorial is an attempt to create a pragmatic guide that aims to get you familiar with Maven in the quickest way possible. The main theme is to get you on some hands on experience to start out and lead you through the creation of a simple Java EE project as quickly as possible. Instead of trying to give you a good read, I try to get you on the journey right away. The topics are roughly ordered by the logical sequence but you can jump around in any way...
Created by zhidao on January 23, 2012 15:00:19    Last update: January 23, 2012 15:00:19
The domain object is annotated @Entity , but Java runtime complains that it's not an entity class. Cause: : class not listed in persistence.xml , or persistence.xml misplaced, or multiple persistence.xml files existed.
Created by nogeek on November 03, 2010 20:52:49    Last update: November 23, 2011 08:54:44
My problem is simple: in my XML data, a timestamp is provided as a long integer (number of milliseconds since the "the epoch"). When I do XSLT, I want to display it as a readable string, such as "Mon Nov 01 18:08:48 CDT 2010". After hours of struggle, I found: It's not so easy to get the job done with JDK 1.6 There are tons of garbage on the web in this space (suggestions, code snippets that simply don't work) Simple Xalan extension functions was the only resource that's somewhat informative. Even there some of the examples don't work. Below is a list of what worked and what didn't. This works: <xsl:stylesheet version="1.0" xmlns:xsl="h... This does not (providing long value to Date constructor): <xsl:stylesheet version="1.0" xmlns:xsl="h......
Created by Fang on November 10, 2011 20:33:46    Last update: November 10, 2011 20:33:46
The stack trace is like this: java.lang.IllegalArgumentException: Component prop... You get this error because you are using the class attribute with a JSF UI component, for which the class attribute cannot be altered. Of course you meant CSS class, not Java class! You can use the styleClass attribute instead of the class attribute. The styleClass attribute becomes the class attribute when the component is rendered. If you can add a tag handler to the UI component, you can alias class to styleClass , which will allow you to use the class attribute on the UI component: import javax.faces.view.facelets.*; pub...
Created by Fang on November 08, 2011 14:40:57    Last update: November 08, 2011 14:40:57
This error happened when I loaded a JSF page, using Apache MyFaces. From the stack trace it looked like the XML parser failed, but in reality the runtime was not able to load the class specified in the handler-class element - a typo in the class name! That's the price you pay for wiring together components with XML! This was the stack trace: Caused by: org.xml.sax.SAXException: Error Handlin...
Created by Fang on October 22, 2011 19:51:05    Last update: October 22, 2011 20:31:48
I built a very basic JSF application and deployed to Tomcat 7.0.22, but it failed with this error: Caused by: java.lang.ClassFormatError: Absent Code... That looks weird and I wasn't able to find a sensible explanation! So I copied the jsf-api-2.1.jar , which was downloaded from the java.net Maven repository by Maven, into a temp folder. And tested it with this simple program: public class ClassFormatErrorTest { public ... I also copied servlet-api.jar from Tomcat's lib folder to the temp folder. Sure enough it failed with the same error: C:\tmp>java -cp .;jsf-api-2.1.jar;servlet-api.jar ... But when I replaced the javax.faces.webapp.FacesServlet class with one I compiled from source, the error disappears! Conclusions: The jar file jsf-api-2.1.jar from java.net Maven repository is good for compilation only (cannot be used...
Created by freyo on September 07, 2011 16:46:14    Last update: September 07, 2011 19:23:00
The Android unit test framework is based on JUnit 3 , not JUnit 4. Test cases have to extend junit.framework.TestCase or a subclass (such as android.test.InstrumentationTestCase ). Tests are identified by public methods whose name starts with test , not methods annotated with @Test (as in JUnit 4). An Android test suite is packaged as an APK, just like the application being tested. To create a test package, first you need to identify the application package it is testing. Google suggests to put the test package source in a directory named tests/ alongside the src/ directory of the main application. At runtime, Android instrumentation loads both the test package and the application under test into the same process. Therefore, the tests can invoke methods on...
Previous  1 2 3 4 Next