Wednesday, August 24, 2011

The content of element type must match

Problem :

I have the following error :
The content of element type "filter" must match  "(icon?,filter-name,display-name?,description?,filter-class,init-param*)".

Here is an extract of my web.xml :
    <display-name>RichFaces Filter</display-name>

Solution :

In fact, the solution is in the message.The message said that there is an order in the tags filter-mappings.
You have to put first filter-name then url-pattern or servlet name.
So you have to correct like that :

    <display-name>RichFaces Filter</display-name>  

An important note, this error appear because I put the following dtd in my web.xml :

 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "" >

Or it's not the last dtd.Now it has change and it seems that the good manner is the following :

<?xml version="1.0"?>
<web-app version="2.5" 

Friday, August 19, 2011

GWT and Eclipse : Unable to find a module

Problème :

When I launch my application in Eclipse, I have the following error :

Loading modules
      [ERROR] Unable to find 'de/toolforge/googlechartwrapper/googlechartwrapper.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] shell failed in doStartup method

I check all of my line of code and there is no references to this module.

Solution :

In Eclipse :

Run -> Run Configurations
Go in  Arguments tab.

Then you have to delete the bad module.For me :

Thursday, August 18, 2011

GWT : compilation error with Map

Problème :

         In your code, you declare Map&lt;Integer, Integer&gt; map = new HashMap&lt;Integer, Integer&gt;
and you have the following error  :

         [ERROR] Line 23: No source code is available for type;K,V&gt;; did you forget to inherit a required module?

Solution :

Map collections works with Object.However Object isn't serializable.So to work, you have to pass the following arguments in comments :@gwt.typeArgs &lt;java.lang.Integer,java.lang.Integer&gt;
to define the contents of your map :

public class ChartData implements IsSerializable {

   * This field is a Map that must always contain Strings as its keys and
   * values.
   * @gwt.typeArgs &lt;java.lang.Integer,java.lang.Integer&gt;
  public Map data;
  public ChartData() {

Then you can use your Map like that :

CharData charData = new CharData();,13);

Ref :

Tuesday, August 16, 2011

[WARN] Candidate class for JDOQL single-string query (User) could not be resolved User

Problème :

[WARN] Candidate class for JDOQL single-string query (User) could not be resolved User

Solution :

I have not instantiate my User class because I call it with a static method :

And in my Method, I make the following request :
PersistenceManager pm = PMF.get().getPersistenceManager();
Query query = pm.newQuery(User.class);

To resolve the problem, I do the following :

User myUser = new User();
myUser.myMethod(); // myMethod n'est plus statique

Friday, August 12, 2011

How to log with GWT

In your test.gwt.xml file, you have to add the following :

 &lt;inherits name=""/&gt;
  &lt;set-property name="gwt.logging.logLevel" value="INFO"/&gt;          # To change the default logLevel
  &lt;set-property name="gwt.logging.enabled" value="TRUE"/&gt; 

In your java file :

  • Import the logger :

import java.util.logging.Logger;

  • Declare logger variable :

private static final Logger logger = Logger.getLogger(WeightManager.class.getName());

  • Call logger methods :"========&gt;TEST !!!!");

Note : Logging works only in client side (so in client package).In server side it doesn't work for me so if I found something, I will publish a post.

Sunday, August 7, 2011

JBoss 7 and JEE6 a good way to update your knowledge

You want practice JEE6 with CDI and other stuff ...
A good way to do taht it's to download the new JBoss application server (JBOSS 7) and to download examples.
Tutoriels show simple examples (Hello world application, login application ...) which uses JEE6 features with Maven 3.In my mind it's a esay and good way to test theses technos and there is a good documentation.
Moreover, JBOSS 7 appears to be very fast !

Friday, August 5, 2011

Java7 available for the maven compiler plugin.

Hi ! This morning I tried to compile my project with Maven and the JDK7 and it works.
Here is my settings.xml extract :

Wednesday, August 3, 2011

Bug on JAVA 7

Now, the community talk a lot about a bug on JAVA 7.I found on the web a good summary of the situation :

- yes java 7 has a bug
- Yes It's a problem for Lucene and certainly other project
- No you don't have to avoid Java 7
- Yes you have to wait before going into production
- Yes you can uncheck theses optimisations and have a  JAVA 7 with no bug.