I'm getting the below error when I run my test classes. Please advise how to fix this issue?
Cannot find class in classpath: za.co.woolworths.core.droplet.DeliverySlotTableDropletTest
at org.testng.xml.XmlClass.loadClass(XmlClass.java:76)
at org.testng.xml.XmlClass.init(XmlClass.java:68)
at org.testng.xml.XmlClass.<init>(XmlClass.java:54)
at org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.java:523)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:17)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:10)
at org.testng.xml.Parser.parse(Parser.java:170)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:305)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
Did you try the -testjar flag while running the test cases? Or -testclass flag in case you dont have a jar file?
Try bundling your test cases in a jar and then use the -testjar flag.
Related
I have a Swing based Java application that uses Java 8 u161.
The jre that the application uses is stored in one of its directories (it doesn't use an installed jre).
One of the screens in the application approaches a Webshere that is installed on a distant server via HTTPS. The public key is installed on cacert in the client's jre\lib\security folder.
When the application runs as a standalone application, all is well: the handshake is completed successfully, the message is sent to the server and the returned code is 200 (OK).
But when the application runs in collaboration with another application (a dotnet application that injects code to the Java application. I'm not even sure what exactly), a "javax.net.ssl.SSLKeyException: RSA premaster secret error" is thrown
Most similar problems on the internet were solved by uninstalling and reinstalling all the Java versions. But my Java is not installed, so I can't do that.
I tripled checked that my Java application uses the correct jre- it does.
I can't understand what causes this exception and I don't know what else to check.
Here is how I open the connection:
URL servletUrl = new URL(urlStr); //throws java.net.MalformedURLException
HttpsURLConnection.setDefaultHostnameVerifier(new ChequesServletHostnameVerifier());
servletConnection = (HttpsURLConnection) servletUrl.openConnection(); //throws java.io.IOException
servletConnection.setDoOutput(true);
servletConnection.setUseCaches(false);
OutputStream os = servletConnection.getOutputStream(); //throws java.io.IOException
And here is the complete stacktrace:
javax.net.ssl.SSLKeyException: RSA premaster secret error
at sun.security.ssl.RSAClientKeyExchange.<init>(Unknown Source)
at sun.security.ssl.ClientHandshaker.serverHelloDone(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at sun.security.ssl.Handshaker.process_record(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
at qs.localtransactions.servlet.SrvltTxn.connect2Servlet(SrvltTxn.java:114)
at qs.localtransactions.AmgImgBase.retrieveImagesFromServlet(AmgImgBase.java:562)
at qs.localtransactions.AMGIMG91.sendAndReceive(AMGIMG91.java:27)
at qs.localtransactions.AMGIMG.sendAndReceive(AMGIMG.java:32)
at idb.messenger.sender.LocalBackendDispatcher.send(LocalBackendDispatcher.java:26)
at qc.distribution.protocol.idb.QtMessengerIDB.sendAndReceive(QtMessengerIDB.java:127)
at qc.distribution.QtTransaction.sendRemote(QtTransaction.java:3338)
at qc.distribution.QtTransaction.send(QtTransaction.java:2528)
at qc.distribution.QtTransaction.send(QtTransaction.java:1930)
at qt.presentacion.QtLogic.send(QtLogic.java:800)
at qt.presentacion.QtLogic.performObserverCommand(QtLogic.java:584)
at qt.presentacion.logic.QtAction.evaluateSensitive(QtAction.java:536)
at qt.presentacion.logic.QtAction.evaluate(QtAction.java:258)
at qt.presentacion.logic.QtLogicEvaluator.evaluateActions(QtLogicEvaluator.java:472)
at qt.presentacion.logic.QtLogicEvaluator.evaluate(QtLogicEvaluator.java:397)
at qt.presentacion.logic.QtLogicRoutines.evaluateNotificationStack(QtLogicRoutines.java:582)
at qt.presentacion.logic.QtLogicRoutines.evaluate(QtLogicRoutines.java:555)
at qt.presentacion.logic.QtLogicEvaluator.update(QtLogicEvaluator.java:1431)
at qt.presentacion.logic.QtLogicStackController.processNotification(QtLogicStackController.java:108)
at qc.controls.observer.QtNotificator.notify(QtNotificator.java:65)
at qt.presentacion.QtRadioButtonModel.setValid(QtRadioButtonModel.java:110)
at qt.presentacion.QtRadioButton.radiobutton_ItemStateChanged(QtRadioButton.java:1111)
at qt.presentacion.QtRadioButton.connEtoC2(QtRadioButton.java:150)
at qt.presentacion.QtRadioButton.itemStateChanged(QtRadioButton.java:882)
at javax.swing.AbstractButton.fireItemStateChanged(Unknown Source)
at javax.swing.AbstractButton$Handler.itemStateChanged(Unknown Source)
at javax.swing.DefaultButtonModel.fireItemStateChanged(Unknown Source)
at qt.presentacion.QtRadioButtonModel.setSelected(QtRadioButtonModel.java:95)
at javax.swing.ButtonGroup.setSelected(Unknown Source)
at qt.presentacion.QtRadioButtonModel.setSelected(QtRadioButtonModel.java:89)
at javax.swing.AbstractButton.setSelected(Unknown Source)
at qt.presentacion.QtRadioButton.select(QtRadioButton.java:1181)
at qt.presentacion.QtRadioButton.performObserverCommand(QtRadioButton.java:1045)
at qt.presentacion.logic.QtAction.evaluateSensitive(QtAction.java:536)
at qt.presentacion.logic.QtAction.evaluate(QtAction.java:258)
at qt.presentacion.logic.QtLogicEvaluator.evaluateActions(QtLogicEvaluator.java:472)
at qt.presentacion.logic.QtLogicEvaluator.evaluate(QtLogicEvaluator.java:397)
at qt.presentacion.logic.QtLogicEvaluator.register(QtLogicEvaluator.java:1312)
at qt.presentacion.QtLogic.registerEvaluators(QtLogic.java:741)
at qt.presentacion.QtLogic.initState(QtLogic.java:510)
at qt.presentacion.QtLogic.paint(QtLogic.java:529)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at qt.presentacion.QtPanel.paint(QtPanel.java:1995)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager$4.run(Unknown Source)
at javax.swing.RepaintManager$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.access$1200(Unknown Source)
at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.security.NoSuchAlgorithmException: SunTlsRsaPremasterSecret KeyGenerator not available
at javax.crypto.KeyGenerator.<init>(KeyGenerator.java:169)
at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:223)
at sun.security.ssl.JsseJce.getKeyGenerator(Unknown Source)
... 105 more
Any information with be appreciated.
Like many people mentioned in older posts regarding exception
javax.net.ssl.SSLKeyException: RSA premaster secret error
it means that two different java versions are mixed. Therefore, reinstalling Java helps.
In my case, apparently, the dotnet application set the java extension folder to an older java version. When the extension configuration was set to the correct Java version, the problem was solved.
Okay, this is weird. I have a regular java console application. It uses spring and hibernate and works as expected when is do Run As... from inside eclipse. When I package a runnable JAR with all the dependencies and export that, it fails while initializing the spring context with the below exception.
I strongly suspect that the difference is that because I work for the government, our security folks must have an exception that allows eclipse to go to the internet and get the xsd, while the jvm outside eclipse does not. I confirmed this using curl...it cannot get the xsd, being rejected by the firewall.
There's no chance I'm going to get a firewall exception as it's very bureaucratic and they are inclined to say 'no' unless you have a really compelling reason. I found an article talking about putting the xsd's local in meta-inf, but that seems aimed as web projects. Mine is a console app. I'm not sure how to do something similar in the console project.
I tried just creating a meta-inf directory off the root and adding it to the classpath, but that didn't work. So how can i get spring to consume local copies of the xsd files in a console application?
WARNING: Ignored XML validation warning
org.xml.sax.SAXParseException; lineNumber: 22; columnNumber: 115; schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-3.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaWarning(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument1(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:77)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:428)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:223)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:194)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:258)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:128)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:133)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:621)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:522)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)
at gov.usdoj.afms.umc.cli.DoUmc.initializeSpring(DoUmc.java:191)
at gov.usdoj.afms.umc.cli.DoUmc.<init>(DoUmc.java:102)
at gov.usdoj.afms.umc.cli.DoUmc.main(DoUmc.java:77)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOMParser.parse(Unknown Source)
... 37 more
I tried to run testng code (XML file) and I have following things on the classpath. I have cleaned my project multiple times but still, I m facing the same. Any workarounds?
Cannot find class in classpath: com.cs.selenium.test.AddAnalystTest
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:575)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.testng.xml.XMLParser.parse(XMLParser.java:39)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:16)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:9)
at org.testng.xml.Parser.parse(Parser.java:170)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:298)
at org.testng.TestNG.initializeEverything(TestNG.java:1107)
at org.testng.remote.support.RemoteTestNG6_12.initialize(RemoteTestNG6_12.java:22)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:97)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
so here's the case... I try to create a class object (to use the method getDeclaredConstructors on it) out of a java file, I load the file with the help of the library net.openhft.compiler and the line looks like : Class<?> clazz = CompilerUtils.CACHED_COMPILER.loadFromJava(fileName, IOUtils.toString(new FileReader(file)));. When I run the app in Intellij it works completely fine but when i make a jar out of the app and try to do the same I get the Error Message:
Exception in thread "JavaFX Application Thread" java.lang.NoClassDefFoundError: net/openhft/compiler/CompilerUtils
at com.company.Modules.ChangeVariableNameModule.storeConstructors(ChangeVariableNameModule.java:530)
at com.company.Modules.ChangeVariableNameModule.changeVariableNames(ChangeVariableNameModule.java:85)
at com.company.Obfuscator.obfuscate(Obfuscator.java:53)
at com.company.View$7.handle(View.java:242)
at com.company.View$7.handle(View.java:210)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown
Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown
Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown
Source)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown
Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown
Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown
Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown
Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown
Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown
Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown
Source)
at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at javafx.event.Event.fireEvent(Unknown Source)
at javafx.scene.Node.fireEvent(Unknown Source)
at javafx.scene.control.Button.fire(Unknown Source)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(Unknown
Source)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown
Source)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown
Source)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown
Source)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown
Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown
Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown
Source)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown
Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown
Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown
Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown
Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown
Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown
Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown
Source)
at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at javafx.event.Event.fireEvent(Unknown Source)
at javafx.scene.Scene$MouseHandler.process(Unknown Source)
at javafx.scene.Scene$MouseHandler.access$1500(Unknown Source)
at javafx.scene.Scene.impl_processMouseEvent(Unknown Source)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown
Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown
Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(Unknown
Source)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown
Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown
Source)
at com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
at com.sun.glass.ui.View.notifyMouse(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(Unknown Source)
at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: net.openhft.compiler.CompilerUtils
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)
... 52 more
I read some stuff about this Exception, do I have to set the classpath to the location where my app is? And if yes, is it possible to do this also in java? - Maybe something with Runtime.exec()?
Or is there a better way to do that? I tried already many ways but I just don't get how to solve this problem.
Thanks for your help!
Forgive me, but I'm very new to this. I have a JNLP file on my work computer, and have access to work at home. I set up my VPN, and copy/pasted the JNLP file to my home computer. However, when I launch it (I upgraded to Java 7 using Windows 7 Home Premium), I get the Unable to Launch Application issue.
It shows Unable to Load Resources and then
com.sun.deploy.net.FailedDownloadException: Unable to load resource: http: //pbs-sj1/pbs/jnlp/tnp/msgr/alt.jnlp
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.downloadResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.javaws.Launcher.updateFinalLaunchDesc(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main.access$000(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
This is under the wrapped section
java.net.UnknownHostException: pbs-sj1
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.sun.deploy.net.HttpUtils.followRedirects(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doGetRequest(Unknown Source)
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.downloadResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.javaws.Launcher.updateFinalLaunchDesc(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main.access$000(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I've researched online quite a bit but to be honest, most of it seems to be on a developer level. I'm just trying to get the JNLP file to launch.
Any ideas?
The error message is telling you that it can't figure out what host you are trying to reach:
java.net.UnknownHostException: pbs-sj1
Probably the easiest thing to do is to edit your hosts file on the box you have this .jnlp file and add:
127.0.0.1 pbs-sj1
Then make sure your actual .jnlp file location lines up with the rest of the path you specified (/pbs/jnlp/tnp/msgr/alt.jnlp). Here's a howto on editing your hosts file on Win7.
-OR-
Rather than mess with the Hosts file, just make use of a file URL to specify where to find the .JNLP file on Windows--e.g.,
file:///C:/Documents%20and%20Settings/your_login/alt.jnlp
(I'm assuming you know to paste/type either of these addresses into your Java-enabled browser's address bar)