You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Edson Richter <ed...@hotmail.com> on 2013/03/05 15:27:57 UTC
Tomcat 7.0.34 not respecting PropertyEditorManager (may be offtopic)?
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?
Thanks,
Edson Richter
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 7.0.34 not respecting PropertyEditorManager (may be offtopic)?
Posted by Edson Richter <ed...@hotmail.com>.
Em 05/03/2013 19:45, Konstantin Kolinko escreveu:
> 2013/3/5 Edson Richter <ed...@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?
It is a App wide registration. It works as expected in JDK 6 (registered
under AppContext), but not in JDK 7 (ThreadGroupContext). My (limited)
understanding of the issue is that the context listener is running under
different ThreadGroup than JSP pages.
Can anyone please point how to register a PropertyEditorManager to be
able to work correctly with JSP in Tomcat under JDK 7 (once EOL of JDK 6
I'll be forced in near future to upgrade our servers - internal policy).
>
> 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
I don't think it would be feasible to implement my own
PropertyEditorRegistrySupport because I don't know Tomcat internals
enough to deal with how JSP pages look after PropertyEditors...
Regards,
Edson
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 7.0.34 not respecting PropertyEditorManager (may be offtopic)?
Posted by Konstantin Kolinko <kn...@gmail.com>.
2013/3/5 Edson Richter <ed...@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 7.0.34 not respecting PropertyEditorManager (may be offtopic)?
Posted by Edson Richter <ed...@hotmail.com>.
Seems that Java 6 used AppContext, and Java 7 uses ThreadGroupContext...
Anyone has experienced this:
http://stackoverflow.com/questions/13424690/java7-propertyeditors-registered-via-threadgroupcontext
?
Thanks,
Edson
Em 05/03/2013 11:27, Edson Richter escreveu:
> 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?
>
> Thanks,
>
> Edson Richter
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org