Martin Gainty created SUREFIRE-1446:
---------------------------------------

             Summary: Isolated Classloader cant resolve JVM class w/o null 
constructor
                 Key: SUREFIRE-1446
                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1446
             Project: Maven Surefire
          Issue Type: Test
          Components: Maven Surefire Plugin
    Affects Versions: 2.20.1
         Environment: mvn -version
maven=3.3.3
JAVA_HOME=JDK_1.8
            Reporter: Martin Gainty
            Priority: Blocker
         Attachments: RuntimeExceptionsAsyncMepTest.java

//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);




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to