glassfish
  1. glassfish
  2. GLASSFISH-12084

Unable to lookup using SerialInitContextFactory and ClassNotFound thrown

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: v3.0.1
    • Fix Version/s: 3.1
    • Component/s: naming
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      12,084

      Description

      Problem:
      =======
      Unable to set java.naming.factory.initial to
      com.sun.enterprise.naming.SerialInitContextFactory
      and getting ClassNotFound inside a webapp
      to perform remote EJB lookup

      Config:
      ========
      GFv301-b20/GFv31-b01/b02

      RootCause
      =========
      1. The GFv3 renamed the implementation class to
      com.sun.enterprise.naming.impl.SerialInitContextFactory
      and then it's OSGI export only
      com.sun.enterprise.naming.impl.* and not
      the compatibility/old package
      com.sun.enterprise.naming.SerialInitContextFactory

      Testcase
      ========
      <%@ page session="false" %>
      <%@ page import="javax.naming.,java.util." %>
      <%
      Properties props = new Properties();
      props.setProperty("java.naming.factory.initial",
      "com.sun.enterprise.naming.SerialInitContextFactory");
      try

      { InitialContext ctx = new InitialContext(props); }

      catch (Exception ex)

      { ex.printStackTrace(new java.io.PrintWriter(out,true)); }

      =========
      Exception
      ========

      Caused by: java.lang.ClassNotFoundException:
      com.sun.enterprise.naming.SerialInitContextFactory
      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:247)
      at
      com.sun.enterprise.naming.GlassFishNamingBuilder.loadClass(GlassFishNamingBuilder.java:130)
      at
      com.sun.enterprise.naming.GlassFishNamingBuilder.createInitialContextFactory(GlassFishNamingBuilder.java:96)
      ... 35 more

      FIX
      ===
      1) Edit glassfish-naming to export the legacy compatibility naming
      2) Or document issue

      IMPACT:
      ========
      -> document porting issues (from all previous GFv2/AS9/8
      -> All current GFv3 docs and wiki information incomplete
      due to this (ie: unable to get things working)

        Activity

        Hide
        Cheng Fang added a comment -

        The value of java.naming.factory.initial is not meant to be published as a
        public interface. Users typically use the no-arg constructor (new
        InitialContext()).

        Show
        Cheng Fang added a comment - The value of java.naming.factory.initial is not meant to be published as a public interface. Users typically use the no-arg constructor (new InitialContext()).
        Hide
        Cheng Fang added a comment -

        fix checked in (to export the old class
        com.sun.enterprise.naming.SerialInitContextFactory)

        Show
        Cheng Fang added a comment - fix checked in (to export the old class com.sun.enterprise.naming.SerialInitContextFactory)

          People

          • Assignee:
            Cheng Fang
            Reporter:
            gfuser9999
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: