I've tried to update Selenium webdriver version and now i cant run my tests because of following exception:
Error: Could not find or load main class
org.testng.remote.RemoteTestNG
Environment on which it was working fine:
Selenium 2.53 jar
Webdriver 2.53.1
Java 7
Environment that rises an Error:
Selenium 3.5 jar
Webdriver 3.5
Java 8
I need to run it from eclipse, not commnd line
Some points to check:
Check your build path and make sure all required packages are present there.
Make sure your build path does not contain any redundant packages
Check for packages compatibility
Eventually move out from the manual packages managing and let Maven do it for you.
Always Try to use the latest version of TestNG:
From Properties>TestNG>
You can uncheck the box called "Use project TestNG jar"
Date-19-June-2019
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
I have selenium-java 3.0.1 in my Maven project. I have read that this version does not come packaged with HTMLUnitDriver. So, I have separately included selenium-htmlunit-driver 2.52.0 in my pom (the latest version available). However, when I do this, I get the following exception on test run:
org.openqa.selenium.WebDriverException: java.lang.IllegalArgumentException: Cannot locate declared field class org.apache.http.impl.client.HttpClientBuilder.sslcontext
According to this link, including the selenium-java and selenium-htmlunit-driver dependencies should be sufficient. In some scenarios, the standalone server may need to be included as well, which is not the case for my project. I tried it anyway, and that didn't work either.
selenium-htmlunit-driver 2.52.0 is internally dependent on org.apache.httpcomponents 4.5.1.
selenium-java 2.47.0 uses htmlunit-driver 2.47.0 which uses org.apache.httpcomponents 4.4.1. When I use these versions, everything works correctly.
So my question is, can HTMLUnitDriver not be used with Selenium 3.0.x at all? Or is my understanding completely wrong here?
Selenium has changed artifact id. Use htmlunit-driver instead.
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.23.2</version>
</dependency>
See also:
https://github.com/SeleniumHQ/htmlunit-driver
I am following an online tutorial, and am stuck trying to get Spring libraries to run things with. The instructions are either a little out of date or assume I know how to do things in a Maven world that I do not.
They give web addresses on the Spring site from which they say I can "download the jars". But you can't download jars from any of them; evidently what you can do is find pom.xml fragments and use them to download jars. If you know how.
For example: the tutorial says:
Finally, following is the list of Spring and other libraries to be
included in your web application. You simply drag these files and drop
them in WebContent/WEB-INF/lib folder.
commons-logging-x.y.z.jar
org.springframework.asm-x.y.z.jar
org.springframework.beans-x.y.z.jar
org.springframework.context-x.y.z.jar
org.springframework.core-x.y.z.jar
org.springframework.expression-x.y.z.jar
org.springframework.web.servlet-x.y.z.jar
org.springframework.web-x.y.z.jar
spring-web.jar
I love the "simply" here.
I have many but not all of these (version 3.2.4). I have googled the library names and used jarfinder for the ones I don't have, but haven't found them all. It seems to me I'm flailing around a bit, just trying this and that until something works. I hate that.
I'm hoping someone can give me a set of steps I should follow when faced with this sort of thing, since we're faced with it all the time. Do I need to stop my current study of programming and learn Maven inside and out so that I can configure the bloody system so I can program again?
Is it a maven project you have?
If so in the pom.xml you just need to place the “pom fragments” in the xml.
i.e. between the dependencies tags. For example,
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
</dependencies>
Once you have done that run maven install. Under Eclipse it is: run as > maven install.
That will download all the dependences i.e. jars you have listed into the you local maven repository.
I think the default is C:\Users\yourName\.m2\repository
Found most of the needed jar files here:
http://www.java2s.com/Code/Jar/CatalogJar.htm
while I downloaded commons-logging here:
http://mvnrepository.com/artifact/commons-logging/commons-logging/1.2
My advice is, stop study you program language, Java I guess and learn how to integrate maven dependencies of Spring in your Maven project.
http://spring.io/blog/2009/12/02/obtaining-spring-3-artifacts-with-maven/
You cannot start the house from the roof
I've been doing a P.O.C with Spring Boot.
So far it's been going really good and promising, but there's one major drawback: I'm using an embedded server (i.e., packaging the web app in a .jar), so when developing I have to rebuild the jar and restart the server every time I change the CSS, HTML or JS files. There's not hot-swap. This really slows down the UI development.
I can think of several quick fixes, such as loading static resources off a different domain and serving it from a local nginx, and some more variations like this, but isn't there a built-in option of some sort when working with IntelliJ/Eclipse?
There are several options. Running in an IDE (especially with debugging on) is a good way to do development (all modern IDEs allow reloading of static resources and usually also hotswapping of Java class changes). Spring Boot devtools is a cheap way to get quite a big boost (just add it to your classpath). It works by restarting your application in a hot JVM when changes are detected. It also switches off things like thymeleaf caches while it is running, so you don't have to remember to do that yourself. You can use it with an external css/js compiler process if you are writing that code with higher level tools.
Spring Loaded is no longer recommended, but probably still in use. More sophisticated agent-based tools work much better if you need hot swapping with zero delay (e.g. JRebel).
See the docs for some up to date content
but isn't there a built-in option of some sort when working with IntelliJ/Eclipse?
What helped me in IntelliJ 15.0, windows 10, was the following sequence:
STEP 1: Added the following dependency in pom (This is mentioned everywhere but this alone dint solve it), as mentioned by #jonashackt
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
STEP 2: Then from File->Settings-> Build-Execution-Deployment -> Compiler (make sure main compiler option is selected and not any of its sub-options)
enable Make Project Automatically. Click ok and close the dialog
Note : In latest version it will be Build project automatically
STEP 3: Hold Shift+Ctrl+A (on windows) you will see a search dialog with title "Enter Action or option name", type registry. Double click the first option that says "Registry..." it will open another window. Look for the following option:
compiler.automake.allow.when.app.running
and enable it, click close
STEP 4: Restart IDE
Elaborated from this source
You can get hot swapping:
for java code: using spring-loaded
for Thymeleaf templates: disabling the cache
Check this post to see more details: http://blog.netgloo.com/2014/05/21/hot-swapping-in-spring-boot-with-eclipse-sts/
I do not know how far this kind of support goes, but in case you use Eclipse IDE (or anyone reading this): starting up your Spring-Boot application via m2e in debug-mode (press the "Debug"-dropdown button and pick your maven run configuration item).
It works for me like a charm.
My maven run configuration item is configured as follows:
goal is set to "spring-boot:run"
base directory is the project directory
I am not using any further libraries (not even spring-boot-devtools).
That's it.
You can also use JRebel - it will reload all changes (better hotswap) including spring beans. It is easily integratred with both Intellij and Eclipse.
Assuming you are using gradle; use the following config in your build.gradle
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'application'
applicationDefaultJvmArgs = ["-agentlib:jdwp=transport=dt_socket,address=localhost:7000,server=y,suspend=n"]
mainClassName = "package.ApplicationRunner"
Run the application from the IDE or command line using the command gradle build run
Now the IDE can connect to the remote JVM (on port 7000) where the spring boot application runs. It also supports hot deployment of static files.
or even you can run the main class from intelliJ if the dependencies are properly managed in the IDE. The main class is the class that contains the main method which will call SpringApplication.run("classpath:/applicationContext.xml", args);
In Intellij, I can get this behavior. When the program is running in debug mode, select Run > Reload Changed Classes
Note: After Intellij completes the action, it might say Loaded classes are up to date. Nothing to reload. This is misleading, because it actually DID reload your classpath resources.
My environment/setup includes:
Intellij 13
Embedded Tomcat
Run/Debug configuration of type 'Application' (which just uses a main class)
Serving static html, css and js (no jsp)
try using this spring-boot-devtools tag in pom.xml
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
http://mytechnologythought.blogspot.com/2017/07/how-to-run-server-of-spring-boot-auto.html
From 1.3.0. (now in Milestone 2) on, you can use the spring-boot-devtools for that as a lightweigt approach - see the docs or this blogpost.
Simply upgrade to >= 1.3.0. and add the following to your pom.xml:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
</dependencies>
Than start your SpringBootApplication with Run As... and you´re fine.
I recommend Thymeleaf (template engine), jRebel for personal developer.
Thymeleaf template files are just HTML resources. So, they`re changed immediately after you edit template files.
If you're using maven, the spring-boot-maven-plugin in your pom.xml needs to be like this to get the hot swap:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.0.RELEASE</version>
</dependency>
</dependencies>
</plugin>
and if you're using thymeleaf, add this to your application properties:
spring.thymeleaf.cache=false
But remember something: Don't use this in your production environment..
How to perform Hot Swap in Springboot Application
When using gradle include following in the dependency:
compile group: 'org.springframework.boot', name: 'spring-boot-devtools', version: '2.0.1.RELEASE' & providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
In application.properties add the property spring.devtools.restart.additional-paths=.
Build Gradle and then run application as bootRun
The application is ready to perform hot swap on modification of classes
I'm trying to add an embedded database to my application, but I have no clue where to begin. So far I've found that I should download the sqlite-jdbc driver and add the .jar to my project. From there I'm kind of lost, are there any good tutorials to get me started or some helpful tips?
Also, I'm using Eclipse for my IDE, so if there's anything within there that will simplify the process, feel free to add that as well!
You want dependency management here? Read up on Maven (very easy), write a Maven pom.xml file and load it into Eclipse that way. Eclipse and NetBeans understand Maven very well now. No need to learn an Eclipse-specific way to do this since Maven will work as well in NetBeans as Eclipse and is simple to run on the command line too.
Based on what search.maven.org says, your dependency in Maven would be this added to a standard pom file to get the latest:
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.7.15-M1</version>
</dependency>