Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TestNG Exception on Mac : Cannot find class in classpath...!

Tags:

java

testng

When I am trying to run the test suite, am getting this exception on Mac, we are using maven projects here, today morning eclipse was hung and i done force quit and then restarted the same and later am not able to run the tests. I done refreshing, cleaning, reinstalling testNG, reconfigured eclipse with the new eclipse instance and imported the maven projects but then also am getting the same exception..The same maven projects ll run on the other Mac, Pls suggest any ways tat am missing here.

also referred the solutions present in the following links : SO link 1 SO link 2

Error console :

org.testng.TestNGException: 
Cannot find class in classpath: com.adobe.store.polarBear.polarBearSuite.tests.ReaderAIHTest
    at org.testng.xml.XmlClass.loadClass(XmlClass.java:81)
    at org.testng.xml.XmlClass.init(XmlClass.java:73)
    at org.testng.xml.XmlClass.<init>(XmlClass.java:59)
    at org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.java:539)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:788)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2756)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
    at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:17)
    at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:1)
    at org.testng.xml.Parser.parse(Parser.java:172)
    at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:311)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
like image 416
harish raja Avatar asked Nov 28 '12 09:11

harish raja


2 Answers

Go to Project --> Clean

It works for me

like image 104
bugCracker Avatar answered Nov 15 '22 04:11

bugCracker


Couple of suggestions : 1. Go to your target folder and check whether the .class for ReaderAIHTest is available? 2. Go to Run As - > Maven Build -> Enter goal as clean test-compile (I am assuming your cases are lying in src/test/java. )

like image 38
niharika_neo Avatar answered Nov 15 '22 02:11

niharika_neo