Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-1446

Isolated Classloader cant resolve JVM class w/o null constructor

    XMLWordPrintableJSON

Details

    • Test
    • Status: Closed
    • Blocker
    • Resolution: Invalid
    • 2.20.1
    • None
    • Maven Surefire Plugin
    • None
    • mvn -version
      maven=3.3.3
      JAVA_HOME=JDK_1.8

    Description

      I need to load com.sun.xml.internal.ws.api.SOAPVersion which doesnt have null constructor
      surefire-plugin reflection methods cannot resolve the class e.g.

      //LOAD in com.sun.xml.internal.ws.api.SOAPVersion into maven-surefire-plugin @Test
      java.lang.Class<?>	 soapVersionClazz=null;
      ClassLoader soapVersionClassloader = com.sun.xml.internal.ws.api.SOAPVersion.class.getClassLoader();
      //always the case
      if(soapVersionClassloader==null) {
        soapVersionClassloader=Thread.currentThread().getContextClassLoader();
      }
      String soapVersionString="com.sun.xml.internal.ws.api.SOAPVersion";
      System.out.println("RuntimeExceptionsAsyncMepTest::getPort LNE 566 soapVersionClassloader="+soapVersionClassloader);
      try {
        soapVersionClazz=soapVersionClassloader.loadClass(soapVersionString);
      }
      catch(ClassNotFoundException cnfe) { 
        System.out.println("RuntimeExceptionsAsyncMepTest::getPort LINE 561 throws ClassNotFoundException message="+cnfe.getMessage()); 
      }
      System.out.println("RuntimeExceptionsAsyncMepTest::getPort LINE 564 soapVersionClazz="+soapVersionClazz);
      com.sun.xml.internal.ws.api.SOAPVersion soapVersion =null;
      try {
        soapVersion=(com.sun.xml.internal.ws.api.SOAPVersion)soapVersionClazz.newInstance();
      }
      catch(InstantiationException iae) {
       System.out.println("RuntimeExceptionsAsyncMepTest::getPort LINE 572 throws InstantiationException message="+iae.getMessage()); 
      }
      catch(IllegalAccessException illegal) { 
        System.out.println("RuntimeExceptionsAsyncMepTest::getPort LINE 573 throws IllegalAccessException message="+illegal.getMessage()); 
      }
      
      System.out.println("RuntimeExceptionsAsyncMepTest::getPort LINE 574 soapVersion="+soapVersion);
      

      Attachments

        Activity

          People

            tibordigana Tibor Digana
            mgainty@hotmail.com Martin Gainty
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 336h
                336h
                Remaining:
                Remaining Estimate - 336h
                336h
                Logged:
                Time Spent - Not Specified
                Not Specified