2013/3/5 Edson Richter <edsonrich...@hotmail.com>:
> At ServletContextListener I've created, I do register a
> PropertyEditorManager that is able to convert string into java.util.Date.
> The registration code is:
>
>   @Override
>   public void contextInitialized(ServletContextEvent sce) {
>     System.err.println("Property editors: inicializando");
>     PropertyEditorManager.registerEditor(Date.class, DateEditor.class);
>     System.err.println("Property editors: registrados");
>   }
>
>   @Override
>   public void contextDestroyed(ServletContextEvent sce) {
>     System.err.println("Property editors: iniciando remoção");
>     PropertyEditorManager.registerEditor(Date.class, null);
>     System.err.println("Property editors: desregistrados");
>   }
>
> When I run the above code using Java 6 (more precisely, JRockit 6),
> everything works fine.
> When I run using JDK 7, I get the following exception (as if not
> registered):
>
> "type Exception report
> message org.apache.jasper.JasperException: Unable to convert string "" to
> class "java.util.Date" for attribute "value": Property Editor not registered
> with the PropertyEditorManager
>
> description The server encountered an internal error that prevented it from
> fulfilling this request.
> exception
> javax.servlet.ServletException: org.apache.jasper.JasperException: Unable to
> convert string "" to class "java.util.Date" for attribute "value": Property
> Editor not registered with the PropertyEditorManager
> br.net.studi.servlet.SecurityFilter.doFilter(SecurityFilter.java:98)"
>
>
> Has anyone experienced such error? Can you please help me?
>

Is it supposed to be a JVM-wide registration?

If so, you should not be doing it in a webapp. (It will break other
applications, cause PermGen memory leaks, etc.) Your editor
deregistration call will remove editor for any webapp there (e.g. for
the second copy of your own webapp if it is running at the same time).

E.g. Spring Framework uses its own registry, see
http://static.springsource.org/spring/docs/3.2.x/javadoc-api/org/springframework/beans/PropertyEditorRegistrySupport.html

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to