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 C0F2B1047A for ; Tue, 18 Nov 2014 19:42:43 +0000 (UTC) Received: (qmail 20362 invoked by uid 500); 18 Nov 2014 19:42:38 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 20296 invoked by uid 500); 18 Nov 2014 19:42:38 -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 20285 invoked by uid 99); 18 Nov 2014 19:42:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Nov 2014 19:42:38 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of knst.kolinko@gmail.com designates 209.85.192.52 as permitted sender) Received: from [209.85.192.52] (HELO mail-qg0-f52.google.com) (209.85.192.52) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Nov 2014 19:42:13 +0000 Received: by mail-qg0-f52.google.com with SMTP id a108so6125523qge.11 for ; Tue, 18 Nov 2014 11:40:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=yWZPqnHVF3tolf1W1nksE6LOmMsnU/nMNdYZadF2dAc=; b=gKCPrC4lrSgSMnIVnC4NPd/2V6T29SyzdeLwvxZah9d4cvpuvH+9McaXAsyL3ANifD VF7S+TbDjfezth96AGtmVc6zg//Lsk5S7byhrmoeWi2oz77boUwQXUuIa1DMjE9nj4sf 5xXOJuuII8r2WK0cBzNSv8U1rvYnub+nVlKmpvWay+EyrUZ2FYR3g9ndP61lsDKcJ5C9 OB29y0ivYPK6nMmCoToBg7bzrmaZtlGiDNG/jQgRUVUbm3GtucKZ4oBfjVftnENFymC5 lBjmjsxhHfaRE4mHCKFUxC9WJrqJG/tPSTKY3TlRojSm/gIES8qYbqW/wbORDwha89gl SYpg== MIME-Version: 1.0 X-Received: by 10.140.34.21 with SMTP id k21mr44836336qgk.21.1416339642274; Tue, 18 Nov 2014 11:40:42 -0800 (PST) Received: by 10.140.106.227 with HTTP; Tue, 18 Nov 2014 11:40:42 -0800 (PST) In-Reply-To: References: <546B0373.4040809@apache.org> Date: Tue, 18 Nov 2014 22:40:42 +0300 Message-ID: Subject: Re: java.protocol.handler.pkgs does not work with Tomcat 7 From: Konstantin Kolinko To: Tomcat Users List Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org 2014-11-18 22:35 GMT+03:00 Konstantin Kolinko : > 2014-11-18 11:29 GMT+03:00 Mark Thomas : >> On 17/11/2014 22:47, Ignacio Ocampo wrote: >>> Hi all, >>> >>> I'm using a third part library for NTLM authentication, one of their >>> requeriments is to set: System.setProperty("java.protocol.handler.pkgs", >>> "jespa"); >>> >>> But, it does not take any effect, I see Tomcat 7 source code here: >>> >>> https://github.com/apache/tomcat70/blob/051a1dfd4c2943a8e8001c6be88d208cac72faff/java/org/apache/catalina/loader/WebappLoader.java#L561 >>> >>> // Register a stream handler factory for the JNDI protocol >>> URLStreamHandlerFactory streamHandlerFactory = >>> DirContextURLStreamHandlerFactory.getInstance(); >>> if (first) { >>> first = false; >>> try { >>> * URL.setURLStreamHandlerFactory(streamHandlerFactory);* >>> } catch (Exception e) { >>> // Log and continue anyway, this is not critical >>> log.error("Error registering jndi stream handler", e); >>> } catch (Throwable t) { >>> ExceptionUtils.handleThrowable(t); >>> // This is likely a dual registration >>> log.info("Dual registration of jndi stream handler: " >>> + t.getMessage()); >>> } >>> } >>> >>> And I see *URL.setURLStreamHandlerFactory *documentation at: >>> https://docs.oracle.com/javase/7/docs/api/java/net/URL.html#setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory) >>> >>> public static void setURLStreamHandlerFactory(URLStreamHandlerFactory >>> >>> fac) >>> >>> Sets an application's URLStreamHandlerFactory. This method can be called at >>> most once in a given Java Virtual Machine. >>> >>> The URLStreamHandlerFactory instance is used to construct a stream protocol >>> handler from a protocol name. >>> I tried set -Djava.protocol.handler.pkgs=jespa in catalina.sh and put my >>> jars in jdk/lib, jdk/jre/lib, tomcat/lib, tomcat/webapps/ROOT/WEB-INF/lib, >>> but nothing. >>> >>> I hope your comments. >> >> Yes, this is a problem that isn't addressed in Tomcat 7. >> >> It is addressed in Tomcat 8 (and 9) where we add a Tomcat specific >> factory. This factory avoids the problem of only being able to call >> setURLStreamHandlerFactory() once by adding the Tomcat specific factory >> which allows additional handler factories to be added. > > > 1. It is possible to inject user's URL factories into > DirContextURLStreamHandlerFactory of Tomcat 7. See static method added > in > http://svn.apache.org/r1078601 > https://issues.apache.org/bugzilla/show_bug.cgi?id=26701 > > 2. java.protocol.handler.pkgs shall work, but it have been a long > time since I last experimented with that. > >> I tried set -Djava.protocol.handler.pkgs= jespa in catalina.sh > > 3. Exactly how you did it? > 4. Modifying catalina.sh is usually a bad thing. > Modifications shall go into a "$CATALINA_BASE/bin/setenv.sh" file. > >> and put my jars in jdk/lib, jdk/jre/lib, > > 5. Are those the Java version that you are using? Are they visible to > the class loader (e.g can you load the class in any test JSP page?) > >> tomcat/lib, tomcat/webapps/ROOT/WEB-INF/lib, > but nothing. > > Is your webapp the ROOT one? > > If it cannot be in $CATALINA_BASE/lib then put it elsewhere and add it > to CLASSPATH variable in setenv.sh. > > > 6. Is "jespa" the correct value for that property? It shall be a > correct Java package name. >From another thread *jespa.jar*:/root/apache-tomcat-7.0.57/lib/*jcifs.jar* That is JCIFS jar, not a Jespa jar. Maybe you meant different value, java.protocol.handler.pkgs=jcifs like on a FAQ page http://jcifs.samba.org/FAQ.html > Best regards, > Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org