Forum Discussion

albertzhou's avatar
albertzhou
New Contributor
10 years ago

Why - Failed to create a WsdlProjectPro object

I am trying to create a JUnit v3 test case in Eclipse to call a test case in SoapUI Pro v5.1.2.  The required libraries - junit.jar & soapui-pro-5.1.2.jar have been imported successfully.



However, I still ERROR in Eclipse as follow:



java.lang.NoClassDefFoundError: com/eviware/soapui/impl/wsdl/WsdlProject

    at java.lang.ClassLoader.defineClass1(Native Method)

    at java.lang.ClassLoader.defineClassCond(Unknown Source)

    at java.lang.ClassLoader.defineClass(Unknown Source)

    at java.security.SecureClassLoader.defineClass(Unknown Source)

    at java.net.URLClassLoader.defineClass(Unknown Source)

    at java.net.URLClassLoader.access$000(Unknown Source)

    at java.net.URLClassLoader$1.run(Unknown Source)

    at java.security.AccessController.doPrivileged(Native Method)

    at java.net.URLClassLoader.findClass(Unknown Source)

    at java.lang.ClassLoader.loadClass(Unknown Source)

    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

    at java.lang.ClassLoader.loadClass(Unknown Source)

    at com.test.soapuitest.HotelReservationSoapUITest.testSoapUIHotelReservation(HotelReservationSoapUITest.java:16)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at junit.framework.TestCase.runTest(TestCase.java:176)

    at junit.framework.TestCase.runBare(TestCase.java:141)

    at junit.framework.TestResult$1.protect(TestResult.java:122)

    at junit.framework.TestResult.runProtected(TestResult.java:142)

    at junit.framework.TestResult.run(TestResult.java:125)

    at junit.framework.TestCase.run(TestCase.java:129)

    at junit.framework.TestSuite.runTest(TestSuite.java:255)

    at junit.framework.TestSuite.run(TestSuite.java:250)

    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:131)

    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)

    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)

    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)

    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Caused by: java.lang.ClassNotFoundException: com.eviware.soapui.impl.wsdl.WsdlProject

    at java.net.URLClassLoader$1.run(Unknown Source)

    at java.security.AccessController.doPrivileged(Native Method)

    at java.net.URLClassLoader.findClass(Unknown Source)

    at java.lang.ClassLoader.loadClass(Unknown Source)

    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

    at java.lang.ClassLoader.loadClass(Unknown Source)

    ... 31 more





Here are my codes(just create a WsdlProjectPro object, simple enough!):

package com.test.soapuitest;



import junit.framework.TestCase;



import com.eviware.soapui.impl.wsdl.*;



public class HotelReservationSoapUITest extends TestCase {

    

    public HotelReservationSoapUITest(){

        

    }

    

    public void testSoapUIHotelReservation() {

        

        @SuppressWarnings("unused")

        WsdlProjectPro myProject=new WsdlProjectPro("C:\\Users\\Albert\\Documents\\GuestManagementServices-soapui-project.xml");

        System.out.print("==========");

        

    }



}

  • albertzhou's avatar
    albertzhou
    New Contributor
    Problem solved!



    Solution: All .jar files under lib directory of soapUI Pro installatioin need to be included.