Uploaded image for project: 'JBoss Modules'
  1. JBoss Modules
  2. MODULES-374

RedirectedUtils loadProvider WARN / debug if exception is thrown

    Details

      Description

      If a module contains a JAXP implementation jar, with a META-INF/services/... , it will try to load the implementation class in this method below, if the module contains JAXP API classes, then it will throw a ClassCastException which is silently ignored and then the default JAXP implementation will be used. A warning and possible a debug logging of the exception would be useful to diagnose issues.

          static <T> Class<? extends T> loadProvider(Class<T> intf, ClassLoader classLoader, String name) {
              List<String> names = findProviderClassNames(intf, classLoader, name);
      
              if (names.isEmpty()) {
                  getModuleLogger().providerUnloadable("Not found", classLoader);
                  return null;
              }   
      
              String clazzName = names.get(0);
              try {
                  return classLoader.loadClass(clazzName).asSubclass(intf);
              } catch (Exception ignore) {
                  getModuleLogger().providerUnloadable(clazzName, classLoader);
                  return null;
              }   
          }   
      
      java.lang.ClassCastException: class com.bea.xml.stream.XMLOutputFactoryBase
       	at java.lang.Class.asSubclass(Class.java:3404)
       	at __redirected.__RedirectedUtils.loadProvider(__RedirectedUtils.java:114)
       	at __redirected.__RedirectedUtils.loadProvider(__RedirectedUtils.java:98)
       	at __redirected.__XMLOutputFactory.<init>(__XMLOutputFactory.java:108)
       	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
       	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
       	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
       	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
       	at java.lang.Class.newInstance(Class.java:442)
       	at javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:193)
       	at javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:152)
       	at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:265)
       	at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:227)
       	at javax.xml.stream.XMLOutputFactory.newInstance(XMLOutputFactory.java:130)
       	at com.jboss.examples.servlet.Servlet.init(Servlet.java:46)
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  dmlloyd David Lloyd
                  Reporter:
                  bmaxwell Brad Maxwell
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: