Getting test file resource with maven - maven

I'm trying to get a json file resource in order to use it to build a java object. When I try to run my code in the Intellij I don't have any problem, but when I run with mvn test I get the follow error.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project cadastur-backend-business: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed: There was an error in the forked process
[ERROR] java.lang.RuntimeException: Unable to create test class 'guiaVOTemplate.json'
[ERROR] at org.apache.maven.surefire.util.DefaultScanResult.loadClass(DefaultScanResult.java:135)
[ERROR] at org.apache.maven.surefire.util.DefaultScanResult.applyFilter(DefaultScanResult.java:95)
[ERROR] at org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:222)
[ERROR] at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:107)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
[ERROR] Caused by: java.lang.ClassNotFoundException: guiaVOTemplate.json
[ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[ERROR] at org.apache.maven.surefire.util.DefaultScanResult.loadClass(DefaultScanResult.java:131)
[ERROR] ... 6 more
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :cadastur-backend-business
The project has the follow structure:
Project Structure Image
And above has the code where I'm trying to read the file and convert the json to java object.
package br.gov.mtur.cadastur.builder;
import br.gov.mtur.cadastur.vo.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
public class GuiaVOBuilder {
private GuiaVO guia;
public GuiaVOBuilder() {
this.guia = new GuiaVO();
}
public GuiaVOBuilder comId(Integer id) {
guia.setId(id);
return this;
}
public GuiaVOBuilder comPessoaFisica(PessoaFisicaVO pessoaFisica) {
guia.setPessoaFisica(pessoaFisica);
return this;
}
... //Builder methods
public GuiaVO build(){
return guia;
}
public GuiaVO buildGuiaCompleto() throws IOException {
return new ObjectMapper().readValue(GuiaVOBuilder.class.getResource("/guiaVOTemplate.json"), GuiaVO.class);
}
}

I find my mistake, in the main pom.xml, the maven-surefire-plugin was including all files, so because this I was getting Unable to create test class 'guiaVOTemplate.json'. So I could resolve this putting files with extension .json in the exclude list, as bellow. And my guiaVOTemplate.json remains in src/test/resources.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>**/*.json</exclude>
</excludes>
</configuration>
</plugin>

Copy the guiaVOTemplate.json file to src\main\resources and it should work.

Related

"Dependency problems found" when `mvn clean install` a che plugin project

I downloaded the che plugin project example che-ide-server-extension. It works when mvn clean install. But when I add a dependency in
che-ide-server-extension/plugins/plugin-serverservice/plugin-serverservice-ide/pom.xml
, it fails to install.
The dependency I added is
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-ide-ui</artifactId>
</dependency>
And the error message of mvn clean install -e -X is:
...
[WARNING] Unused declared dependencies found:
[WARNING] org.eclipse.che.core:che-core-ide-ui:jar:6.16.0:compile
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Plugin ServerService :: Parent pom ................. SUCCESS [ 2.174 s]
[INFO] Plugin ServerService :: Plugins :: Parent ......... SUCCESS [ 0.064 s]
[INFO] Plugin ServerService :: Plugin :: Parent ........... SUCCESS [ 1.382 s]
[INFO] Plugin ServerService :: Plugin :: Server ........... SUCCESS [ 3.827 s]
[INFO] Plugin ServerService :: Plugin :: IDE .............. FAILURE [ 4.870 s]
[INFO] Plugin ServerService :: Che Assembly :: Assembly Parent SKIPPED
[INFO] Plugin ServerService :: Che Assembly :: Workspace Agent Assembly SKIPPED
[INFO] Plugin ServerService :: Che Assembly :: Workspace Agent Tomcat Assembly SKIPPED
[INFO] Plugin ServerService :: Che Assembly :: IDE Assembly SKIPPED
[INFO] Plugin ServerService :: Che Assembly :: Assemblies Tomcat SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.925 s
[INFO] Finished at: 2019-07-10T10:48:43+08:00
[INFO] Final Memory: 75M/1321M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.0.1:analyze-only (analyze) on project plugin-serverservice-ide: Dependency problems found -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.0.1:analyze-only (analyze) on project plugin-serverservice-ide: Dependency problems found
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Dependency problems found
at org.apache.maven.plugins.dependency.analyze.AbstractAnalyzeMojo.execute(AbstractAnalyzeMojo.java:261)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :plugin-serverservice-ide
I don't think I added a wrong dependency. Because when I
import org.eclipse.che.ide.ui.dialogs.DialogFactory;
in my java code, che says
The import org.eclipse.che.ide.ui.dialogs cannot be resolved.
But after I added the dependency, che can recognize it.
I don't know why this happens... The error message says Dependency problems found, but it didn't point out the real problem...
I've just checked and I didn't face any issues you mentioned above.
This my changes for the project:
diff --git a/plugins/plugin-serverservice/plugin-serverservice-ide/pom.xml b/plugins/plugin-serverservice/plugin-serverservice-ide/pom.xml
index 1237c6e..a5eed89 100644
--- a/plugins/plugin-serverservice/plugin-serverservice-ide/pom.xml
+++ b/plugins/plugin-serverservice/plugin-serverservice-ide/pom.xml
## -28,6 +28,10 ##
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
+<dependency>
+ <groupId>org.eclipse.che.core</groupId>
+ <artifactId>che-core-ide-ui</artifactId>
+</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-commons-gwt</artifactId>
diff --git a/plugins/plugin-serverservice/plugin-serverservice-ide/src/main/java/org/eclipse/che/sample/ide/MyServiceClient.java b/plugins/plugin-serverservice/plugin-serverservice-ide/src/main/java/org/eclipse/che/sample/ide/MyServiceClient.java
index cb1cf58..0def9c2 100644
--- a/plugins/plugin-serverservice/plugin-serverservice-ide/src/main/java/org/eclipse/che/sample/ide/MyServiceClient.java
+++ b/plugins/plugin-serverservice/plugin-serverservice-ide/src/main/java/org/eclipse/che/sample/ide/MyServiceClient.java
## -8,13 +8,15 ##
*/
package org.eclipse.che.sample.ide;
-import javax.inject.Inject;
import org.eclipse.che.api.promises.client.Promise;
import org.eclipse.che.ide.api.app.AppContext;
import org.eclipse.che.ide.rest.AsyncRequestFactory;
import org.eclipse.che.ide.rest.StringUnmarshaller;
+import org.eclipse.che.ide.ui.dialogs.DialogFactory;
import org.eclipse.che.ide.ui.loaders.request.LoaderFactory;
+import javax.inject.Inject;
+
/**
* Client for consuming the sample server service.
*
## -25,6 +27,7 ## public class MyServiceClient {
private AppContext appContext;
private AsyncRequestFactory asyncRequestFactory;
private LoaderFactory loaderFactory;
+ private DialogFactory dialogFactory;
/**
* Constructor.
## -38,8 +41,10 ## public class MyServiceClient {
public MyServiceClient(
final AppContext appContext,
final AsyncRequestFactory asyncRequestFactory,
- final LoaderFactory loaderFactory) {
+ final LoaderFactory loaderFactory,
+ final DialogFactory dialogFactory) {
+ this.dialogFactory = dialogFactory;
this.appContext = appContext;
this.asyncRequestFactory = asyncRequestFactory;
this.loaderFactory = loaderFactory;
## -52,6 +57,7 ## public class MyServiceClient {
* #return a Promise containing the server response
*/
public Promise<String> getHello(String name) {
+ this.dialogFactory.createChoiceDialog("1", "2", "", "", null, null);
return asyncRequestFactory
.createGetRequest(appContext.getWsAgentServerApiEndpoint() + "/hello/" + name)
.loader(loaderFactory.newLoader("Waiting for hello..."))

ClassNotFoundException running Flyway Migrate task with java callback

I am trying to implement a FlyWay java callback. However, flyway doesn't seem to find my class.
[ERROR] Failed to execute goal org.flywaydb:flyway-maven-plugin:6.0.0-beta:migrate (default-cli) on project odin_build: org.flywaydb.core.api.FlywayException: Unable to instantiate class ch.x.dp.test1 : ch.x.dp.test1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.flywaydb:flyway-maven-plugin:6.0.0-beta:migrate (default-cli) on project odin_build: org.flywaydb.core.api.FlywayException: Unable to instantiate class ch.x.dp.test1 : ch.x.dp.test1
/snip.../
Caused by: java.lang.ClassNotFoundException: ch.x.dp.test1
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass (SelfFirstStrategy.java:50)
It seems that Flyway cannot find the class.
Here my java class:
package ch.x.dp;
import org.flywaydb.core.api.callback.Callback;
import org.flywaydb.core.api.callback.Context;
import org.flywaydb.core.api.callback.Event;
public class test1 implements Callback {
public test1() {
System.out.println("sldhksjhdkghd");
}
public boolean supports(Event event, Context context) {
return false;
}
public boolean canHandleInTransaction(Event event, Context context) {
return false;
}
public void handle(Event event, Context context) {
}
}
My pom contains the following:
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>6.0.0-beta2</version>
</dependency>
and
<plugins>
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>${flyway.version}</version>
<configuration>
<locations>classpath:ch.x.dp,filesystem:src/main/resources/db/migration</locations>
<callbacks>
<callback>ch.x.dp.test1</callback>
</callbacks>
<snip/>
</plugin>
I have verified that my mvn package calls create a jar in /target that contains my test1 class.
What else could be missing? How can I tell that FlyWay is actually using that jar?

Having issue building TestG maven project in Jenkins

I have an issue with building TestNG based Maven project via Jenkins. The issue is that if I have less number of test to run (up to 30) everything runs fine, but as soon as I increase the number, the build fails consistently. The problem I see is that, tests doesn't start until all the browser instance are open (eg, browser opens 30 windows first then start execution for suite of 30 tests) and when the test gets complete(not entire test suite), the browser window doesn't close (even after adding driver.quit() method) and it remains open till the TestSuite run is complete.
Below is snippet of my code.
Main Java class:
public class AccountManagement {
public WebDriver driver = new FirefoxDriver();
public WebDriverWait wait = new WebDriverWait(driver, 20);
public void login(String uid, String pass) throws Throwable {
driver.manage().window().maximize();
driver.get(URL);
driver.findElement(By.id("Email")).sendKeys(uid);
driver.findElement(By.id("Password")).sendKeys(pass);
driver.findElement(By.id("btnLogin")).click();
<!-- REST OF THE CODE-->
}
}
Sample test class:
public class TC_AC408 extends AccountManagement {
#Test(retryAnalyzer=Retry.class)
public void accountActionLinks() {
login("auto.admin#test.com", "test#123");
<!-- REST OF THE CODE-->
}
#AfterTest
public void end() {
driver.quit();
}
}
Here is my testng.xml:
<suite name="Smoke Test" preserve-order="true" thread-count="1" verbose="1" parallel="false">
<test name="Accounts">
<classes>
<class name="SmokeTests.TC_AC408"></class>
<class name="SmokeTests.TC_AC409"></class>
<class name="SmokeTests.TC_AC410"></class>
<class name="SmokeTests.TC_AC411"></class>
<class name="SmokeTests.TC_AC412"></class>
<class name="SmokeTests.TC_AC413"></class>
<class name="SmokeTests.TC_AC414"></class>
<class name="SmokeTests.TC_AC416"></class>
</classes>
</test>
<test name="Organization">
<classes>
<class name="SmokeTests.TC_AC470"></class>
<class name="SmokeTests.TC_AC474"></class>
<class name="SmokeTests.TC_AC475"></class>
<class name="SmokeTests.TC_AC477"></class>
<class name="SmokeTests.TC_AC478"></class>
</classes>
</test>
<test name="Project Management">
<classes>
<class name="SmokeTests.TC_AC186"></class>
<class name="SmokeTests.TC_AC191"></class>
<class name="SmokeTests.TC_AC193"></class>
<class name="SmokeTests.TC_AC194"></class>
<class name="SmokeTests.TC_AC195"></class>
<class name="SmokeTests.TC_AC196"></class>
<class name="SmokeTests.TC_AC200"></class>
<class name="SmokeTests.TC_AC785"></class>
<class name="SmokeTests.TC_AC786"></class>
<class name="SmokeTests.TC_AC788"></class>
<class name="SmokeTests.TC_AC790"></class>
</classes>
</test>
<test name="Registration">
<classes>
<class name="SmokeTests.TC_AC381"></class>
<class name="SmokeTests.TC_AC385"></class>
<class name="SmokeTests.TC_AC387"></class>
<class name="SmokeTests.TC_AC398"></class>
<class name="SmokeTests.TC_AC386"></class>
<class name="SmokeTests.TC_AC388"></class>
</classes>
</test>
<test name="Product">
<classes>
<class name="SmokeTests.TC_AC482"></class>
<class name="SmokeTests.TC_AC483"></class>
<class name="SmokeTests.TC_AC486"></class>
<class name="SmokeTests.TC_AC487"></class>
<class name="SmokeTests.TC_AC489"></class>
<class name="SmokeTests.TC_AC491"></class>
<class name="SmokeTests.TC_AC492"></class>
<class name="SmokeTests.TC_AC1777"></class>
<class name="SmokeTests.TC_AC1823"></class>
<class name="SmokeTests.TC_AC1949"></class>
</classes>
</test>
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter"/>
<listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
<listener class-name="SmokeTests.RetryListener"/>
</listeners>
</suite>
Here is my pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!--suppress ALL -->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 h
ttp://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>project_selenium_mvn</groupId>
<artifactId>project_selenium_mvn</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<suiteXmlFile>testng.xml</suiteXmlFile>
</properties>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.1.1</version>
</dependency>
<!-- Adding Selenium dependency -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.48.2</version>
</dependency>
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.40</version>
</dependency>
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<compilerVersion>1.8</compilerVersion>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
And below is the error I am getting:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19:test (default-test) on project acutiy_selenium_mvn: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19:test failed: There was an error in the forked process
[ERROR] org.testng.TestNGException:
[ERROR]
[ERROR] Cannot instantiate class SmokeTests.TC_AC193
[ERROR] at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:37)
[ERROR] at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:372)
[ERROR] at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:284)
[ERROR] at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:109)
[ERROR] at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:181)
[ERROR] at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:120)
[JENKINS] Archiving C:\AutomatedTest\project_selenium_mvn\pom.xml to project_selenium_mvn/project_selenium_mvn/1.0-SNAPSHOT/project_selenium_mvn-1.0-SNAPSHOT.pom
[ERROR] at org.testng.TestRunner.initMethods(TestRunner.java:402)
[ERROR] at org.testng.TestRunner.init(TestRunner.java:228)
[ERROR] at org.testng.TestRunner.init(TestRunner.java:198)
[ERROR] at org.testng.TestRunner.<init>(TestRunner.java:147)
[ERROR] at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:525)
[ERROR] at org.testng.SuiteRunner.init(SuiteRunner.java:156)
[ERROR] at org.testng.SuiteRunner.<init>(SuiteRunner.java:110)
[ERROR] at org.testng.TestNG.createSuiteRunner(TestNG.java:1235)
[ERROR] at org.testng.TestNG.createSuiteRunners(TestNG.java:1222)
[ERROR] at org.testng.TestNG.runSuitesLocally(TestNG.java:1074)
[ERROR] at org.testng.TestNG.run(TestNG.java:999)
[ERROR] at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:282)
[ERROR] at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:83)
[ERROR] at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:114)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:286)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:240)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
[ERROR] Caused by: java.lang.reflect.InvocationTargetException
[ERROR] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[ERROR] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
[ERROR] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[ERROR] at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
[ERROR] at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:28)
[ERROR] ... 22 more
[ERROR] Caused by: org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7079; process output follows:
[ERROR]
[ERROR] Build info: version: '2.48.2', revision: '41bccdd10cf2c0560f637404c2d96164b67d9d67', time: '2015-10-09 13:08:06'
[ERROR] System info: host: 'WIN-O8VQ2P3P2GD', ip: '172.31.62.242', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_79'
[ERROR] Driver info: driver.version: FirefoxDriver
[ERROR] at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:135)
[ERROR] at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
[ERROR] at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:117)
[ERROR] at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:216)
[ERROR] at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
[ERROR] at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
[ERROR] at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
[ERROR] at Automation.ProjectManagementPage.<init>(ProjectManagementPage.java:17)
[ERROR] at SmokeTests.TC_AC193.<init>(TC_AC193.java:15)
[ERROR] ... 27 more
[ERROR] Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7079 after 45000 ms. Firefox console output:
[ERROR]
[ERROR] at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:123)
[ERROR] ... 35 more
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
You are creating driver instance whenever for every class inside a test and quitting driver only once per test.Instead of instantiating WebDriver directly in class do it in #BeforeTest. It will ensure only one driver is created per test.
Your class whould look like below after upation.
public class AccountManagement {
public WebDriver driver;
public WebDriverWait wait;
#BeforeTest
public void beforeTest(){
driver = new FirefoxDriver();
wait = new WebDriverWait(driver, 20);
}
public void login(String uid, String pass) throws Throwable {
driver.manage().window().maximize();
driver.get(URL);
driver.findElement(By.id("Email")).sendKeys(uid);
driver.findElement(By.id("Password")).sendKeys(pass);
driver.findElement(By.id("btnLogin")).click();
<!-- REST OF THE CODE-->
}
}

Trouble building apache mesos with jdk 1.8.0

I am new to apache mesos, while installing with JDK 1.8.0 receive the following error
“[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:21 min
[INFO] Finished at: 2014-07-22T21:27:56+05:30
[INFO] Final Memory: 23M/78M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.8.1:jar (build-and-attach-javadocs) on project mesos: MavenReportException: Error while creating archive:
[ERROR] Exit code: 1 - /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Executor.java:41: error: reference not found
[ERROR] * data to it's executors through the {#link ExecutorInfo#data}
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Executor.java:73: error: reference not found
[ERROR] * via {#link Scheduler#launchTasks}. Note that this task can be
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Executor.java:81: warning - Tag #link: can't find launchTasks in org.apache.mesos.Scheduler
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Executor.java:50: warning - Tag #link: can't find data in org.apache.mesos.Protos.ExecutorInfo
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:251: warning: no #param for identity
[ERROR] public Position position(byte[] identity) {
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:251: warning: no #return
[ERROR] public Position position(byte[] identity) {
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:65: warning: no #return
[ERROR] public byte[] identity() {
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:149: warning: no #param for from
[ERROR] public native List<Entry> read(Position from,
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:149: warning: no #param for to
[ERROR] public native List<Entry> read(Position from,
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:149: warning: no #param for timeout
[ERROR] public native List<Entry> read(Position from,
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:149: warning: no #param for unit
[ERROR] public native List<Entry> read(Position from,
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:149: warning: no #return
[ERROR] public native List<Entry> read(Position from,
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:149: warning: no #throws for java.util.concurrent.TimeoutException
[ERROR] public native List<Entry> read(Position from,
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:149: warning: no #throws for org.apache.mesos.Log.OperationFailedException
[ERROR] public native List<Entry> read(Position from,
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:159: warning: no #return
[ERROR] public native Position beginning();
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:165: warning: no #return
[ERROR] public native Position ending();
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:191: warning: no #param for data
[ERROR] public native Position append(byte[] data, long timeout, TimeUnit unit)
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:191: warning: no #param for timeout
[ERROR] public native Position append(byte[] data, long timeout, TimeUnit unit)
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:191: warning: no #param for unit
[ERROR] public native Position append(byte[] data, long timeout, TimeUnit unit)
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:191: warning: no #return
[ERROR] public native Position append(byte[] data, long timeout, TimeUnit unit)
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:191: warning: no #throws for java.util.concurrent.TimeoutException
[ERROR] public native Position append(byte[] data, long timeout, TimeUnit unit)
[ERROR] ^
[ERROR] /vol1/mesos-0.19.0/build/../src/java/src/org/apache/mesos/Log.java:191: warning: no #throws for org.apache.mesos.Log.WriterFailedException
While running it with JDK 1.7 it works fine
Is there anything I am missing to make it work with 1.8 or this is not currently supported ?
Any advice please.
There're missing javadoc annotations in ./src/java/mesos.pom.in
Read more here

Error: The type byte[] cannot be used here. (In Proxy Class of Request Factory)

I have a maven + spring + gwt(2.4.0) project. When I am running mvn gwt:run i get the following error :
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project star: Compilation failure: Compilation failure:
[ERROR] C:\Users\radu_chilom\Eclipse Workspaces\Spring3\star\src\main\java\com\base\star\shared\proxies\customer\CDocumentProxy.java:[19,8] error: The type byte[] cannot be used here
[ERROR] C:\Users\radu_chilom\Eclipse Workspaces\Spring3\star\src\main\java\com\base\star\shared\proxies\customer\CDocumentProxy.java:[21,25] error: The type byte[] cannot be used here
[ERROR] C:\Users\radu_chilom\Eclipse Workspaces\Spring3\star\src\main\java\com\base\star\shared\proxies\dealer\DealerTargetAgreementProxy.java:[35,36] error: The type byte[] cannot be used here
[ERROR] C:\Users\radu_chilom\Eclipse Workspaces\Spring3\star\src\main\java\com\base\star\shared\proxies\dealer\DealerTargetAgreementProxy.java:[40,15] error: The type byte[] cannot be used here
[ERROR] C:\Users\radu_chilom\Eclipse Workspaces\Spring3\star\src\main\java\com\base\star\shared\services\dealer\TreeNodeTargetAgreementRequest.java:[29,33] error: Could not find domain method similar to java.util.List<com.base.star.server.dto.dealer.FileTextDTO> getTreeNodeTargetAgreementsList(java.lang.Long)
My CDocumpentProxy.java looks like :
#ProxyFor(value = com.base.star.server.domain.CDocument.class, locator=
com.base.star.server.locators.customer.CDocumentLocator.class)
public interface CDocumentProxy extends EntityProxy {
byte[] getDocument(); //line 19
void setDocument(byte[] document); //line 21
If i build the project with STS 2.9.2 the project builds up. So i think the problem is bad configuration to maven-compiler-plugin.
In my .pom file i have configure maven-compiler-plugin like :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
Can't i use byte[] as a return type for a method in a request factory proxy ? I just can't understand the error..
You cannot use arrays in Request Factory: https://developers.google.com/web-toolkit/doc/latest/DevGuideRequestFactory#transportable
That being said, for a byte[] equivalent, I'd rather use a String than a List<Byte>, and GWT emulates String#getBytes for the UTF-8 and ISO-8859-1 charsets.

Resources