Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8944195CA for ; Wed, 6 Mar 2013 21:00:32 +0000 (UTC) Received: (qmail 71680 invoked by uid 500); 6 Mar 2013 21:00:28 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 71575 invoked by uid 500); 6 Mar 2013 21:00:28 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 71564 invoked by uid 99); 6 Mar 2013 21:00:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Mar 2013 21:00:28 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of edsonrichter@hotmail.com designates 65.55.111.92 as permitted sender) Received: from [65.55.111.92] (HELO blu0-omc2-s17.blu0.hotmail.com) (65.55.111.92) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Mar 2013 21:00:21 +0000 Received: from BLU0-SMTP400 ([65.55.111.72]) by blu0-omc2-s17.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 6 Mar 2013 13:00:00 -0800 X-EIP: [CjrgEVFuJgWaU0nKWFm4GwGC8vcrGGqX] X-Originating-Email: [edsonrichter@hotmail.com] Message-ID: Received: from [192.168.0.14] ([189.6.163.210]) by BLU0-SMTP400.phx.gbl over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 6 Mar 2013 12:59:57 -0800 Date: Wed, 6 Mar 2013 17:59:30 -0300 From: Edson Richter Organization: Simkorp =?ISO-8859-1?Q?Inform=E1tica_Ltda?= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 MIME-Version: 1.0 To: users@tomcat.apache.org Subject: Re: Tomcat 7.0.34 not respecting PropertyEditorManager (may be offtopic)? References: In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 06 Mar 2013 20:59:58.0261 (UTC) FILETIME=[8FAF2E50:01CE1AAD] X-Virus-Checked: Checked by ClamAV on apache.org Em 05/03/2013 19:45=2C Konstantin Kolinko escreveu: > 2013/3/5 Edson Richter : >> At ServletContextListener I've created=2C 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")=3B >> PropertyEditorManager.registerEditor(Date.class=2C DateEditor.class= )=3B >> System.err.println("Property editors: registrados")=3B >> } >> >> @Override >> public void contextDestroyed(ServletContextEvent sce) { >> System.err.println("Property editors: iniciando remo=E7=E3o")=3B >> PropertyEditorManager.registerEditor(Date.class=2C null)=3B >> System.err.println("Property editors: desregistrados")=3B >> } >> >> When I run the above code using Java 6 (more precisely=2C JRockit 6)=2C >> everything works fine. >> When I run using JDK 7=2C I get the following exception (as if not >> registered): >> >> "type Exception report >> message org.apache.jasper.JasperException: Unable to convert string "" t= o >> class "java.util.Date" for attribute "value": Property Editor not regist= ered >> with the PropertyEditorManager >> >> description The server encountered an internal error that prevented it f= rom >> fulfilling this request. >> exception >> javax.servlet.ServletException: org.apache.jasper.JasperException: Unabl= e to >> convert string "" to class "java.util.Date" for attribute "value": Prope= rty >> 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=20 under AppContext)=2C but not in JDK 7 (ThreadGroupContext). My (limited)=20 understanding of the issue is that the context listener is running under=20 different ThreadGroup than JSP pages. Can anyone please point how to register a PropertyEditorManager to be=20 able to work correctly with JSP in Tomcat under JDK 7 (once EOL of JDK 6=20 I'll be forced in near future to upgrade our servers - internal policy). > > If so=2C you should not be doing it in a webapp. (It will break other > applications=2C cause PermGen memory leaks=2C 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=2C see > http://static.springsource.org/spring/docs/3.2.x/javadoc-api/org/springfr= amework/beans/PropertyEditorRegistrySupport.html I don't think it would be feasible to implement my own=20 PropertyEditorRegistrySupport because I don't know Tomcat internals=20 enough to deal with how JSP pages look after PropertyEditors... Regards=2C Edson > > Best regards=2C > Konstantin Kolinko > > --------------------------------------------------------------------- > To unsubscribe=2C e-mail: users-unsubscribe@tomcat.apache.org > For additional commands=2C 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