My java application creates Google Cloud Functions. It works when the pom.xml is:
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>6.12.2</version>
</dependency>
However after upgrading the version in the pom.xml to:
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>9.1.0</version>
<scope>runtime</scope>
</dependency>
These import statements no longer work.
import com.google.firebase.FirebaseApp;
import com.google.firebase.database.*;
How do I use the latest version and import these dependencies?
Here are the dependencies in the pom:
<dependencyManagement>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.google.cloud/libraries-bom -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.1.4</version>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud.functions</groupId>
<artifactId>functions-framework-api</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10</version>
</dependency>
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>9.1.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>2.14.0</version>
</dependency>
</dependencies>
I also tried removing the version number of the dependency hoping the BOM would take over the version numbers, but that didn't work.
What is strange is that I have looked at the code in github ( https://github.com/firebase/firebase-admin-java ) and can see the class exists in the code ( https://github.com/firebase/firebase-admin-java/blob/master/src/main/java/com/google/firebase/database/FirebaseDatabase.java )
If I look at the maven dependency com.google.firebase:firebase-admin:9.1.0 I can also see the class as shown here:
Thanks in advance for the help.
~Randy
I have a Tomcat application that writes out spreadsheets and it was using the following JAR files:
poi-3.16.jar
poi-ooxml-3.16.jar
poi-ooxml-schemas-3.16.jar
I saw there was a version 4.0.1 of poi, and in looking at https://poi.apache.org/components/ I think I have the prerequisites set up, but I get an Exception when running:
25-Mar-2019 22:33:37.117 SEVERE [http-nio-8181-exec-10] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [xxx.ApplicationConfig] in context with path [/DataLoaderREST] threw exception [org.glassfish.jersey.server.ContainerException: java.lang.ExceptionInInitializerError] with root cause
java.lang.RuntimeException: Uncompilable source code - cannot find symbol
symbol: class POIXMLDocument
location: package org.apache.poi
Update:
Apparently when I built my .WAR file that gave the above error, it looks like NetBeans found the old 3.16 jar files and compiled my code, but I didn't have the 3.16 jar files on the server. Now that I've done a clean in NetBeans, I cannot compile in NetBeans.
Error:
--- maven-compiler-plugin:2.3.2:compile (default-compile) # DataModules ---
Compiling 44 source files to C:\xxx\xxx\10 Software\Java\LoaderFramework\DataModules\target\classes
-------------------------------------------------------------
COMPILATION ERROR :
-------------------------------------------------------------
com/xxx/billing/loader/parser/ExcelParser.java:[36,21] error: cannot find symbol
And ExcelParser.jara line 36 is:
import org.apache.poi.POIXMLDocument;
Here is my pom.xml, referencing the 4.0.1 jars:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xx.billing</groupId>
<artifactId>DataModules</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
</dependency>
<!-- POI artifacts See https://poi.apache.org/components/ -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.11</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<!-- type>bundle</type -->
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>4.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.0.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.xx.billing</groupId>
<artifactId>DataLoderShared</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>3.5.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.univocity</groupId>
<artifactId>univocity-parsers</artifactId>
<version>1.5.6</version>
<scope>compile</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>55.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
I have checked my NetBeans .m2 repository, and I have both 3.16 and 4.0.1 directories inC:\Users\mstewart\.m2\repository\org\apache\poi\poi\ and poi\ooxml and poi\ooxml-schemas
I stared at the compiler error
import org.apache.poi.POIXMLDocument;
for days, and just noticed it was missing the ooxml part of the package; changed it to
import org.apache.poi.ooxml.POIXMLDocument;
And all is well. Thanks Axel for the links; that helped me eventually find the issue.
I developed one utility in maven.That maven utility i want to use in gradle and maven custom plugins with maven custom plugin this utility is working fine but in case of gradle plugin it is throwing following issue.
Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':hiveUnitTask'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
Caused by: java.lang.NoSuchMethodError: org.apache.hive.service.cli.operation.LogDivertAppender.setWriter(Ljava/io/Writer;)V
at org.apache.hive.service.cli.operation.LogDivertAppender.<init>(LogDivertAppender.java:166)
at org.apache.hive.service.cli.operation.OperationManager.initOperationLogCapture(OperationManager.java:85)
at org.apache.hive.service.cli.operation.OperationManager.init(OperationManager.java:63)
Gradle plugin is developed in java.
Pom file of my utility is as follows:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.datametica.hiveunit</groupId>
<artifactId>hive_unit</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>HiveUnit</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hadoop.version>2.2.0</hadoop.version>
<hive.version>1.2.1</hive.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-minicluster</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-service</artifactId>
<version>${hive.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-jdbc</artifactId>
<version>${hive.version}</version>
<exclusions>
<exclusion>
<artifactId>hive-service</artifactId>
<groupId>org.apache.hive</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Remove log4j-over-slf4j from your class path.
I copied class from the package of hive service jar's source code in which this error is coming and placed it in my plugin project by making same package structure as it was in hive service jar,this solved my issue I know its know perfect solution but its workaround that solved my purpose
I want to use spring boot to start my application ,but after i add some relative jar at pom.xml,it return this error:and i thank may be it caused by some conflict jars?
Application.java
package com.mm.application;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
#ComponentScan("com.mm.controller")
#Configuration
#EnableAutoConfiguration
public class Application {
public static void main(String[] args) {
//spring properties xml
ApplicationContext context = new ClassPathXmlApplicationContext(
"Spring-Module.xml");
SpringApplication.run(Application.class, args);
}
#Bean
public InternalResourceViewResolver setupViewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/jsp/");
resolver.setSuffix(".jsp");
return resolver;
}
}
Error:
Error starting ApplicationContext. To display the auto-configuration report enabled debug logging (start with --debug)
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
atorg.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:648)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:909)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:898)
at com.mm.application.Application.main(Application.java:20)
Main Problem:
Caused by: java.lang.ArrayStoreException:sun.reflect.annotation.TypeNotPresentExceptionProxy
atsun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:673)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:480)
atsun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:306)
atsun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:241)
atsun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88)
atsun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3178)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3185)
at java.lang.Class.getDeclaredAnnotations(Class.java:3166)
atorg.springframework.core.annotation.AnnotationUtils.isAnnotationDeclaredLocally(AnnotationUtils.java:395)
atorg.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:281)
atorg.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:265)
atorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.isHandler(RequestMappingHandlerMapping.java:173)
atorg.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:123)
atorg.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:103)
atorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:126)
atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
... 15 more
pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.0.1.RELEASE</version>
</parent>
<properties>
<start-class>com.kdubb.springboot.Application</start-class>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.4</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-dao</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
</dependencies>
LoginController
package com.mm.controller;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
#Controller
#Component
public class LoginController {
#RequestMapping(value = "/CreditRating", method = RequestMethod.GET)
public String index(Model model) {
model.addAttribute("wisdom", "Goodbye XML");
// renders /WEB-INF/jsp/Login.jsp
return "Login";
}
#RequestMapping(value = "/CreditRating/GoLogin")
public String login(Model model) {
model.addAttribute("wisdom", "Goodbye XML");
// renders /WEB-INF/jsp/index.jsp
return "index";
}
}
The solution can vary based on actual incompatibility root cause. The best way how to investigate such the issue is to follow this line:
Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
and put breakpoint into constructor of class 'TypeNotPresentExceptionProxy' (there is only one).
After execution in debug mode you should see what exactly is wrong and based on your findings you can decide what to do (add dependency, exclude autoconfig, ...)
In my specific case the breakpoint revealed this:
java.lang.ClassNotFoundException: org.springframework.integration.config.IntegrationManagementConfigurer
As the solution I decided to exclude 'IntegrationAutoConfiguration' like this:
#SpringBootApplication(exclude = IntegrationAutoConfiguration.class)
As explained by Andy Wilkinson in this GitHub issue or in this thread, these obscure exceptions occur when some annotation is referencing a class that isn't on the classpath.
Most issues of this kind have been fixed in recent Spring Boot versions, but you can also trigger one from your code, for example when using #AutoConfigureAfter(X.class) where class X is missing on the classpath.
I had the same issue with spring-boot-starter-parent 2.0.0.M6.
The solution
was to remove
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
<version>3.1.11</version>
</dependency>
and include
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
instead.
I had the same issue with :
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
As per the previous posts the solution was only to add :
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
I had the very same exception but my spring-boot-starter-parent was version 1.3.3, as below
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
</parent>
The exception showd up as I was upgrading to 1.4.1
The solution for me was
I had to lose the bad dependency:
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.1.4.RELEASE</version>
</dependency>
And replace it with the dependency below as per the Release notes of Spring Boot 1.4.0
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
The problem for me was simply that I hadn't cleaned my project before running verify, after having made some significant changes.
I had a same problem with this error :
Error creating bean with name 'org.apache.cxf.spring.boot.autoconfigure.CxfAutoConfiguration': Initialization of bean failed; nested exception is java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
I used below dependency in my POM.xml and the problem was solved :
<!-- https://mvnrepository.com/artifact/org.apache.cxf/cxf-spring-boot-autoconfigure -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-autoconfigure</artifactId>
<version>3.2.1</version>
</dependency>
The solution approach of adding
spring-boot-starter-web-services
dependency, proposed in the above answers, is good, working, but excessive in cases where you don't need web context to be raised up. I mean, if your application doesn't wish to be a web application. In such a case, at least for me, the adding of the following thinner dependency also resolved the issue:
org.springframework:spring-webmvc
implementation 'org.springframework:spring-webmvc:5.2.1.RELEASE'
If you are using spring JPA then make sure you have added the following dependency to pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
We ran into this issue when we were using an older version of Spring (1.x) and Websphere Liberty 22.0.0.3 with Java 8.
The issue is no longer there with the latest WLP - 22.0.0.13.
I want to use Arquillian's Drone extension to configure WebDriver for some functional tests, using the Capabilities interface as described here. I have added the artifacts arquillian-bom (version 1.0.2.Final), arquillian-drone-bom (version 1.1.0.CR2), arquillian-drone-webdriver-depchain and arquillian-drone-webdriver as dependencies in my pom.xml, as shown below, and declared the capabilities as shown, but when I run my tests, the following exception is thrown:
java.lang.NullPointerException
at org.openqa.selenium.remote.DesiredCapabilities.<init>(DesiredCapabilities.java:51)
at org.jboss.arquillian.drone.webdriver.configuration.TypedWebDriverConfiguration$5.invoke(TypedWebDriverConfiguration.java:268)
at org.jboss.arquillian.drone.webdriver.configuration.TypedWebDriverConfiguration$5.invoke(TypedWebDriverConfiguration.java:259)
at org.jboss.arquillian.drone.webdriver.configuration.TypedWebDriverConfiguration$CallInterceptor.intercept(TypedWebDriverConfiguration.java:65)
at org.jboss.arquillian.drone.webdriver.configuration.TypedWebDriverConfiguration.getCapabilities(TypedWebDriverConfiguration.java:274)
at org.jboss.arquillian.drone.webdriver.factory.FirefoxDriverFactory.createInstance(FirefoxDriverFactory.java:79)
at org.jboss.arquillian.drone.webdriver.factory.FirefoxDriverFactory.createInstance(FirefoxDriverFactory.java:42)
at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:129)
at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:43)
at org.jboss.arquillian.drone.impl.DroneCreator.createWebTestBrowser(DroneCreator.java:71)
etc.
Looking at the code, I can see this NPE is caused by a class variable, capabilityMap, in TypedWebDriverConfiguration that is not being initialised.
What do I need to fix in the configuration to make this work?
pom.xml extract:
<project>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${arquillian.version}</version>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-drone-bom</artifactId>
<version>${drone.version}</version>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-drone-webdriver</artifactId>
<version>${drone.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-drone-webdriver-depchain</artifactId>
<version>${drone.version}</version>
<type>pom</type>
<scope>test</scope>
</dependency>
</dependencies>
</project>
arquillian.xml:
<arquillian xmlns="http://jboss.org/schema/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<extension qualifier="webdriver">
<property name="browserCapabilities">firefox</property>
<property name="capabilityWebdriverFirefoxBin">/usr/bin/firefox</property>
</extension>
</arquillian>
WebDriver declaration in code:
#RunWith(Arquillian.class)
public class WebDriverTest {
#Deployment
public static WebArchive createDeployment() {
...
}
#Drone
WebDriver driver;
}
This is a versioning problem caused by the dependency declarations in the Maven pom.xml. The Arquillian BOM artifacts need to be declared under dependencyManagement, with import scope. The pom.xml dependency declarations should look like this:
<project>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-drone-webdriver-depchain</artifactId>
<version>${drone.version}</version>
<type>pom</type>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${arquillian.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-drone-bom</artifactId>
<version>${drone.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Note that the arquillian-drone-webdriver dependency is no longer needed.