TestNG setup issue- Cannot find class in classpath - selenium

I am pretty new to TestNG framework. I did download TestNG from the link http://beust.com/eclipse. Post this I created a new Java Project named as MyProject and a new TestNG class file "NewTest". I did write a small piece of Code with #Test annotation to launch Firefox browser and navigate to Google. I tried searching the web for possible solutions to sort this issue but I am not able to find the low level steps on how this can be corrected. Please help.
Output
org.testng.TestNGException: Cannot find class in classpath: NewTest
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:582)
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:305)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:109)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)

Move Package1 inside src directory and run the code.
Note: Eclipse run .java files from src directory, and create .class files in bin directory.

It seems that I did not update my Eclipse for few months. I did navigate to Eclipse->Help->Check for updates->Completed installing all updates. Post this the test did run fine.

Related

A JNI error has occurred, please check your installation and try again Exception in thread "main"

I am facing a issue while trying to run my executable JAR file for my cucumber project (A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.SecurityException: no manifiest section for
signature file entry org/bouncycastle/mail/smime/SMIMEEnvelopedGenerator$Envelo
pedGenerator.class)
Few Important Points : 1.) I am using Idea IntelliJ and created executable JAR
2.) I am using Gradle as a build tool
3.) I am using cucumber framework and want to run only specific test mentioned in my cucumber options using executable JAR
Please find below the complete Error Stack Trace
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.SecurityException: no manifiest section for
signature file entry org/bouncycastle/mail/smime/SMIMEEnvelopedGenerator$Envelo
pedGenerator.class
at sun.security.util.SignatureFileVerifier.verifySection(Unknown Source)
at sun.security.util.SignatureFileVerifier.processImpl(Unknown Source)
at sun.security.util.SignatureFileVerifier.process(Unknown Source)
at java.util.jar.JarVerifier.processEntry(Unknown Source)
at java.util.jar.JarVerifier.update(Unknown Source)
at java.util.jar.JarFile.initializeVerifier(Unknown Source)
at java.util.jar.JarFile.getInputStream(Unknown Source)
at sun.misc.URLClassPath$JarLoader$2.getInputStream(Unknown Source)
at sun.misc.Resource.cachedInputStream(Unknown Source)
at sun.misc.Resource.getByteBuffer(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(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 sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Please let me know for any more information required.Read many articles but could'nt able to find any solution.Thanks in advance

Error opening transformations in Pentaho DI in Mac

I have installed Pentaho DI and it works for me but not always.
Pentaho DI lets me open only 3 transformations and when I try to open one more (in the menu) the window does not appear.
Also when I push a button who opens a dialog box it appears me an error like this:
java.lang.NullPointerException
at org.eclipse.swt.widgets.FileDialog.panel_shouldShowFilename(Unknown Source)
at org.eclipse.swt.widgets.Display.dialogProc(Unknown Source)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSSavePanel.setAccessoryView(Unknown Source)
at org.eclipse.swt.widgets.FileDialog.open(Unknown Source)
at org.pentaho.di.ui.job.entries.shell.JobEntryShellDialog$12.widgetSelected(JobEntryShellDialog.java:690)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.notifyListeners(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at org.pentaho.di.ui.job.entries.shell.JobEntryShellDialog.open(JobEntryShellDialog.java:714)
at org.pentaho.di.ui.spoon.delegates.SpoonJobDelegate.editJobEntry(SpoonJobDelegate.java:259)
at org.pentaho.di.ui.spoon.Spoon.editJobEntry(Spoon.java:8564)
at org.pentaho.di.ui.spoon.job.JobGraph.editEntry(JobGraph.java:2836)
at org.pentaho.di.ui.spoon.job.JobGraph.mouseDoubleClick(JobGraph.java:633)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.notifyListeners(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at org.pentaho.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:1339)
at org.pentaho.di.ui.spoon.Spoon.waitForDispose(Spoon.java:7939)
at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:9214)
at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:653)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.pentaho.commons.launcher.Launcher.main(Launcher.java:92)
I don't know what can be. Java version maybe?
What version? Pentaho 6.0.0 didnt work on the mac. 6.0.1 fixes it
From the stack-trace I see that it is happens when you double-click on JobEntry step in your transformation:
at org.pentaho.di.ui.spoon.Spoon.editJobEntry(Spoon.java:8564)
at org.pentaho.di.ui.spoon.job.JobGraph.editEntry(JobGraph.java:2836)
at org.pentaho.di.ui.spoon.job.JobGraph.mouseDoubleClick(JobGraph.java:633)
It is attempts to open file dialog in response to this action:
at org.eclipse.swt.widgets.FileDialog.open(Unknown Source)
at org.pentaho.di.ui.job.entries.shell.JobEntryShellDialog$12.widgetSelected(JobEntryShellDialog.java:690
And then NPE is thrown. So it is not a java version. Very likely you are not use repository to store transformation/jobs, or use it but some of items in repository may still have links to filesystem, or any other.
That is might be a case when different transformation is reference same file, or one transformation opened from repository, other from filesystem, having same name but trying to reference one job entry.
Nobody knows better than you with you unique environment. If you can reproduce this NPE with job/transformation example I would suggest to open bug in jira.pentaho.org for 'Data Integration' project.

"macro not found: _after_build" Ant error building hybris with IntelliJ IDEA

I'm trying to get the internal ant tool working with the hybris ecommerce suite.
When I'm invoking ant from the console, it works fine.
Using the Ant tool supplied by IntelliJ, I get the following error message when invoking the "all" target:
F:\pathtohybrisinstall\bin\platform\resources\ant\util.xml:130: macro not found: _after_build
at de.hybris.ant.taskdefs.CallMacro.execute(CallMacro.java:58)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at sun.reflect.GeneratedMethodAccessor80.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at net.sf.antcontrib.logic.TryCatchTask.execute(TryCatchTask.java:207)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.Main.start(Main.java:198)
at org.apache.tools.ant.Main.main(Main.java:286)
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 com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:30)
Based on your subsequent comment I imagine that the extname param is not being set correctly.
Are you simply calling ant build from your IDE? I would take a look at codegen.xml which is used for the Eclipse integration. There are a few settings imported prior to calling gensource. One of these is importing the contrib library that contains the trycatch target that prevents errors like the one you see there. Perhaps that is related but I am not sure.
Basically, we support Eclipse by default.
Due to description from IntelliJ IDEA Help center, Ant integration is shipped with IntelliJ IDEA, that means, that the Ant you run via console is not the same, that the one used by IDE.
So the exception could be caused by versions incompatibility. You can change the Ant distibution, used by IDE, in your build file properties on execution tab. Just provide there aa Ant distribution you use in your console.
intellij IDEA did not support ant-contrib try/catch block which is used in hybris build. There are multiple fixes to ant in intellij 2017.2.
When you import your hybris project using Hybris Integration plugin it'll set up all ant related settings for you.
You can install it to your IDE directly from the repository by clicking on the "Browse Repositories" button in Settings/Plugins dialog.

Getting Exception: java.lang.SecurityException: attempted to open sandboxed jar as Trusted-Only

We need to sign all 5 .class java files. That we have done by creating a .jar file and signed it too. But while executing my web application it is showing below error message in Java Console
java.lang.SecurityException: attempted to open sandboxed jar https://xxxxxxxxxxx.com/xxxx/JavaApplet.jar as Trusted-Only
at com.sun.deploy.security.CPCallbackHandler$ParentElement.checkResource(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.checkResource(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.SecurityException: attempted to open sandboxed jar https://xxxxxxxxxxx.com/xxxx/JavaApplet.jar as Trusted-Only*
I am not sure about this error. I have signed Jar 3-4 times after getting this error but I am getting same error again again.
Please can anybody help me if I am doing something wrong?
Check your Manifest.mf file of jar. This should contain the Trusted-Library: true if you are using MixedCode(Applet called from the javascript) and your files are self signed. oracle has released latest security updates in Java 7 update 21. According to the release notes you must sign your code with CA certificates only, else JRE will treat your code as malicious. oracle is totally deprecating the Mixedcode. Please check the release notes of latest updates. But before adding the attribute Trusted-Library: true in manifest.mf make sure you are aware of the effects of the attribute.

install4j java.lang.NullPointerException when clicking "Browse" button in installation location screen

I made a install package with install4j version 5.1.2.
In the process of installing the package, on installation location screen first I clear the text field of "Destination directory", then I click the browse button and want to select a whole new installation location, NO response from this mouse event, at the same time there is a error.log file created.
The content of the error.log is like below:
java.lang.NullPointerException
at com.install4j.runtime.installer.frontend.components.DirectorySelector.doBrowse(Unknown Source)
at com.install4j.runtime.installer.frontend.components.DirectorySelector.access$000(Unknown Source)
at com.install4j.runtime.installer.frontend.components.DirectorySelector$1.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
Is there any possible that something is wrong with install4j? Or any other reasons?
This is a bug in install4j that was fixed in 5.1.3.