Bug 1395543 - [GSS](6.4.z) Custom NameService by sun.net.spi.nameservice.provider.n doesn't work on EAP
Summary: [GSS](6.4.z) Custom NameService by sun.net.spi.nameservice.provider.n doesn't...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Class Loading
Version: 6.3.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: CR1
: EAP 6.4.13
Assignee: Petr Jurak
QA Contact: Peter Mackay
URL:
Whiteboard:
Depends On:
Blocks: eap6413-payload
TreeView+ depends on / blocked
 
Reported: 2016-11-16 07:19 UTC by Osamu Nagano
Modified: 2019-12-16 07:23 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-02-03 16:45:59 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
modules.zip (918.61 KB, application/zip)
2016-11-16 07:33 UTC, Osamu Nagano
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker JBEAP-7369 0 Major Verified [GSS](7.1.0) Custom NameService by sun.net.spi.nameservice.provider.n doesn't work on WildFly 2017-06-26 08:54:54 UTC
Red Hat Issue Tracker JBEAP-7370 0 Major Verified [GSS](7.0.z) Custom NameService by sun.net.spi.nameservice.provider.n doesn't work on WildFly 2017-06-26 08:54:54 UTC
Red Hat Issue Tracker WFCORE-1998 0 Major Resolved Custom NameService by sun.net.spi.nameservice.provider.n doesn't work on WildFly 2017-06-26 08:54:54 UTC
Red Hat Knowledge Base (Solution) 2775031 0 None None None 2016-11-22 04:43:44 UTC

Description Osamu Nagano 2016-11-16 07:19:39 UTC
As described in WFCORE-1998, custom implementation of sun.net.spi.nameservice.NameService doesn't work on EAP. Dependency to "sun.jdk:main" should be added into "org.jboss.as.server:main" because it is the TCCL when java.net.InetAddress is initialized.

Though this way of NameService customization will be removed in Java 9.

Comment 1 Osamu Nagano 2016-11-16 07:33:28 UTC
Created attachment 1221052 [details]
modules.zip

How to reproduce:

On EAP 6.4.11, prepend the attached module by editing standalone.conf like this.

  JBOSS_HOME=/path/to/eap6411
  JBOSS_MODULEPATH="/path/to/the/modules:$JBOSS_HOME/modules"
  ...
  JAVA_OPTS="$JAVA_OPTS -Dsun.net.spi.nameservice.provider.1=dns,MyNameService"

The custom name service provider impl, modules/sun/jdk/main/classes/com/example/MyNameService.java, will print a message to stdout if it is called.

    @Override
    public InetAddress[] lookupAllHostAddr(String string) throws UnknownHostException {
        System.out.println("*** MyNameService.lookupAllHostAddr called");
        return javaNativeNameService.lookupAllHostAddr(string);
    }

Deploy a test.jsp like below to call the method. The message won't appear unless you add the "sun.jdk:main" dependency to "org.jboss.as.server:main".

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
    <head>
        <title>Test Page</title>
    </head>
    <body>
        <%
            String name = request.getParameter("name");
            if (name == null) name = "www.redhat.com";
            java.net.InetAddress addr = java.net.InetAddress.getByName(name);
        %>
        
        <%=name%> maps to <%=addr.toString()%>.
        
    </body>
</html>

Comment 2 Petr Jurak 2016-11-21 10:09:36 UTC
PR: https://github.com/jbossas/jboss-eap/pull/2884

Comment 3 Jiří Bílek 2017-01-13 08:29:56 UTC
Verified with EAP 6.4.13.CP.CR2

Comment 4 Petr Penicka 2017-02-03 16:45:59 UTC
Released with EAP 6.4.13 on Feb 02 2017.


Note You need to log in before you can comment on or make changes to this bug.